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 OutputProcessor_hh_INCLUDED
49 : #define OutputProcessor_hh_INCLUDED
50 :
51 : // C++ Headers
52 : #include <iosfwd>
53 : #include <map>
54 : #include <unordered_map>
55 :
56 : // ObjexxFCL Headers
57 : #include <ObjexxFCL/Array1D.hh>
58 : #include <ObjexxFCL/Array2D.hh>
59 : #include <ObjexxFCL/Optional.hh>
60 : #include <ObjexxFCL/Reference.hh>
61 :
62 : // EnergyPlus Headers
63 : #include <EnergyPlus/Data/BaseData.hh>
64 : #include <EnergyPlus/DataGlobals.hh>
65 : #include <EnergyPlus/DisplayRoutines.hh>
66 : #include <EnergyPlus/EPVector.hh>
67 : #include <EnergyPlus/EnergyPlus.hh>
68 :
69 : // Third party Headers
70 : #include "re2/re2.h"
71 :
72 : namespace EnergyPlus {
73 :
74 : // Forward declarations
75 : class InputOutputFile;
76 : struct EnergyPlusData;
77 :
78 : namespace OutputProcessor {
79 :
80 : // enumerations for SetupOutputVariable calls -- for now these are direct mappings from the original strings, no change in functionality
81 : enum class SOVTimeStepType
82 : {
83 : Invalid = -1,
84 : System,
85 : HVAC,
86 : Zone,
87 : Plant,
88 : Num
89 : };
90 : static constexpr std::array<std::string_view, (int)SOVTimeStepType::Num> sovTimeStepTypeStrings = {"System", "HVAC", "Zone", "Plant"};
91 : enum class SOVStoreType
92 : {
93 : Invalid = -1,
94 : State,
95 : NonState,
96 : Summed,
97 : Average,
98 : Num
99 : };
100 : static constexpr std::array<std::string_view, (int)SOVStoreType::Num> sovStoreTypeStrings = {"State", "NonState", "Summed", "Average"};
101 :
102 : enum class ReportVDD
103 : {
104 : Invalid = -1,
105 : No, // Don't report the variable dictionaries in any form
106 : Yes, // Report the variable dictionaries in "report format"
107 : IDF, // Report the variable dictionaries in "IDF format"
108 : Num
109 : };
110 :
111 : constexpr Real64 MinSetValue(99999999999999.0);
112 : constexpr Real64 MaxSetValue(-99999999999999.0);
113 : constexpr int IMinSetValue(999999);
114 : constexpr int IMaxSetValue(-999999);
115 :
116 : enum class VariableType
117 : {
118 : Invalid = -1,
119 : NotFound, // ref: GetVariableKeyCountandType, 0 = not found
120 : Integer, // ref: GetVariableKeyCountandType, 1 = integer
121 : Real, // ref: GetVariableKeyCountandType, 2 = real
122 : Meter, // ref: GetVariableKeyCountandType, 3 = meter
123 : Schedule, // ref: GetVariableKeyCountandType, 4 = schedule
124 : Num
125 : };
126 :
127 : enum class MtrType
128 : {
129 : Invalid = -1,
130 : Normal, // Type value for normal meters
131 : Custom, // Type value for custom meters
132 : CustomDec, // Type value for custom meters that decrement another meter
133 : CustomDiff, // Type value for custom meters that difference another meter
134 : Num
135 : };
136 :
137 : constexpr int N_WriteTimeStampFormatData(100);
138 :
139 : static constexpr std::array<std::string_view, 14> endUseCategoryNames = {"HEATING",
140 : "COOLING",
141 : "INTERIORLIGHTS",
142 : "EXTERIORLIGHTS",
143 : "INTERIOREQUIPMENT",
144 : "EXTERIOREQUIPMENT",
145 : "FANS",
146 : "PUMPS",
147 : "HEATREJECTION",
148 : "HUMIDIFIER",
149 : "HEATRECOVERY",
150 : "WATERSYSTEMS",
151 : "REFRIGERATION",
152 : "COGENERATION"};
153 :
154 : constexpr int RVarAllocInc(1000);
155 : constexpr int LVarAllocInc(1000);
156 : constexpr int IVarAllocInc(10);
157 :
158 : // For IP Units (tabular reports) certain resources will be put in sub-tables
159 : enum class RT_IPUnits
160 : {
161 : Invalid = -1,
162 : OtherJ,
163 : Electricity,
164 : Gas,
165 : Cooling,
166 : Water,
167 : OtherKG,
168 : OtherM3,
169 : OtherL,
170 : Num
171 : };
172 :
173 : enum class Unit
174 : {
175 : Invalid = -1,
176 : kg_s,
177 : C,
178 : kgWater_kgDryAir,
179 : ppm,
180 : Pa,
181 : m3_s,
182 : None,
183 : min,
184 : W,
185 : J,
186 : m3,
187 : kg,
188 : ach,
189 : W_W,
190 : lux,
191 : lum_W,
192 : hr,
193 : cd_m2,
194 : J_kgWater,
195 : m_s,
196 : W_m2,
197 : m,
198 : Ah,
199 : A,
200 : V,
201 : deltaC,
202 : kmol_s,
203 : rev_min,
204 : Btu_h_W,
205 : W_m2K,
206 : J_kg,
207 : kg_kg,
208 : Perc,
209 : deg,
210 : s,
211 : kg_m3,
212 : kg_m2s,
213 : J_kgK,
214 : L,
215 : K_m,
216 : m2,
217 : W_m2C,
218 : rad,
219 : J_m2,
220 : clo,
221 : W_mK,
222 : W_K,
223 : K_W,
224 : kgWater_s,
225 : unknown,
226 : customEMS,
227 : Num
228 : };
229 :
230 : enum class ReportingFrequency
231 : {
232 : EachCall = -1, // Write out each time UpdatedataandReport is called
233 : TimeStep, // Write out at 'EndTimeStepFlag'
234 : Hourly, // Write out at 'EndHourFlag'
235 : Daily, // Write out at 'EndDayFlag'
236 : Monthly, // Write out at end of month (must be determined)
237 : Simulation, // Write out once per environment 'EndEnvrnFlag'
238 : Yearly, // Write out at 'EndYearFlag'
239 : Num
240 : };
241 :
242 : enum class StoreType
243 : {
244 : Invalid = -1,
245 : Averaged = 1, // Type value for "averaged" variables
246 : Summed, // Type value for "summed" variables
247 : Num
248 : };
249 :
250 : enum class TimeStepType
251 : {
252 : Invalid = -1,
253 : Zone = 1, // Type value for "zone" timestep variables
254 : System = 2, // Type value for "system" timestep variables
255 : Num
256 : };
257 :
258 : struct TimeSteps
259 : {
260 : Real64 *TimeStep = nullptr; // fortran POINTER Pointer to the Actual Time Step Variable (Zone or HVAC)
261 : Real64 CurMinute = 0.0; // Current minute (decoded from real Time Step Value)
262 : };
263 :
264 1988830 : struct RealVariables
265 : {
266 : Real64 *Which; // The POINTER to the actual variable holding the value
267 : Real64 Value; // Current Value of the variable (to resolution of Zone Time Step)
268 : Real64 TSValue; // Value of this variable at the Zone Time Step
269 : Real64 EITSValue; // Value of this variable at the Zone Time Step for external interface
270 : Real64 StoreValue; // At end of Zone Time Step, value is placed here for later reporting
271 : Real64 NumStored; // Number of hours stored
272 : StoreType storeType; // Variable Type (Summed/Non-Static or Average/Static)
273 : bool Stored; // True when value is stored
274 : bool Report; // User has requested reporting of this variable in the IDF
275 : bool tsStored; // if stored for this zone timestep
276 : bool thisTSStored; // if stored for this zone timestep
277 : int thisTSCount;
278 : ReportingFrequency frequency; // How often to report this variable
279 : Real64 MaxValue; // Maximum reporting (only for Averaged variables, and those greater than Time Step)
280 : int maxValueDate; // Date stamp of maximum
281 : Real64 MinValue; // Minimum reporting (only for Averaged variables, and those greater than Time Step)
282 : int minValueDate; // Date stamp of minimum
283 : int ReportID; // Report variable ID number
284 : std::string ReportIDChr; // Report variable ID number (character -- for printing)
285 : int SchedPtr; // If scheduled, this points to the schedule
286 : int MeterArrayPtr; // If metered, this points to an array of applicable meters
287 : int ZoneMult; // If metered, Zone Multiplier is applied
288 : int ZoneListMult; // If metered, Zone List Multiplier is applied
289 :
290 : // Default Constructor
291 830 : RealVariables()
292 830 : : Value(0.0), TSValue(0.0), EITSValue(0.0), StoreValue(0.0), NumStored(0.0), storeType(StoreType::Averaged), Stored(false), Report(false),
293 : tsStored(false), thisTSStored(false), thisTSCount(0), frequency(ReportingFrequency::Hourly), MaxValue(-9999.0), maxValueDate(0),
294 830 : MinValue(9999.0), minValueDate(0), ReportID(0), SchedPtr(0), MeterArrayPtr(0), ZoneMult(1), ZoneListMult(1)
295 : {
296 830 : }
297 : };
298 :
299 79573 : struct IntegerVariables
300 : {
301 : // Members
302 : int *Which; // The POINTER to the actual variable holding the value
303 : Real64 Value; // Current Value of the variable (to resolution of Zone Time Step)
304 : Real64 TSValue; // Value of this variable at the Zone Time Step
305 : Real64 EITSValue; // Value of this variable at the Zone Time Step for external interface
306 : Real64 StoreValue; // At end of Zone Time Step, value is placed here for later reporting
307 : Real64 NumStored; // Number of hours stored
308 : StoreType storeType; // Variable Type (Summed/Non-Static or Average/Static)
309 : bool Stored; // True when value is stored
310 : bool Report; // User has requested reporting of this variable in the IDF
311 : bool tsStored; // if stored for this zone timestep
312 : bool thisTSStored; // if stored for this zone timestep
313 : int thisTSCount;
314 : ReportingFrequency frequency; // How often to report this variable
315 : int MaxValue; // Maximum reporting (only for Averaged variables, and those greater than Time Step)
316 : int maxValueDate; // Date stamp of maximum
317 : int MinValue; // Minimum reporting (only for Averaged variables, and those greater than Time Step)
318 : int minValueDate; // Date stamp of minimum
319 : int ReportID; // Report variable ID number
320 : std::string ReportIDChr; // Report variable ID number (character -- for printing)
321 : int SchedPtr; // If scheduled, this points to the schedule
322 :
323 : // Default Constructor
324 1073 : IntegerVariables()
325 1073 : : Value(0.0), TSValue(0.0), EITSValue(0.0), StoreValue(0.0), NumStored(0.0), storeType(StoreType::Averaged), Stored(false), Report(false),
326 : tsStored(false), thisTSStored(false), thisTSCount(0), frequency(ReportingFrequency::Hourly), MaxValue(-9999), maxValueDate(0),
327 1073 : MinValue(9999), minValueDate(0), ReportID(0), SchedPtr(0)
328 : {
329 1073 : }
330 : };
331 :
332 1546772 : struct VariableTypeForDDOutput
333 : {
334 : // Members
335 : TimeStepType timeStepType; // Type whether Zone or HVAC
336 : StoreType storeType; // Variable Type (Summed/Non-Static or Average/Static)
337 : VariableType variableType; // Integer, Real.
338 : int Next; // Next variable of same name (different units)
339 : bool ReportedOnDDFile; // true after written to .rdd/.mdd file
340 : std::string VarNameOnly; // Name of Variable
341 : OutputProcessor::Unit units; // Units for Variable
342 : std::string unitNameCustomEMS; // name of units when customEMS is used for EMS variables that are unusual
343 :
344 : // Default Constructor
345 772 : VariableTypeForDDOutput()
346 772 : : timeStepType(TimeStepType::Zone), storeType(StoreType::Averaged), variableType(VariableType::NotFound), Next(0),
347 772 : ReportedOnDDFile(false), units(OutputProcessor::Unit::None)
348 : {
349 772 : }
350 : };
351 :
352 1988830 : struct RealVariableType
353 : {
354 : // Members
355 : TimeStepType timeStepType; // Type whether Zone or HVAC
356 : StoreType storeType; // Variable Type (Summed/Non-Static or Average/Static)
357 : int ReportID; // Report variable ID number
358 : std::string VarName; // Name of Variable key:variable
359 : std::string VarNameUC; // Name of Variable (Uppercase)
360 : std::string VarNameOnly; // Name of Variable
361 : std::string VarNameOnlyUC; // Name of Variable with out key in uppercase
362 : std::string KeyNameOnlyUC; // Name of key only witht out variable in uppercase
363 : OutputProcessor::Unit units; // Units for Variable
364 : std::string unitNameCustomEMS; // name of units when customEMS is used for EMS variables that are unusual
365 : RealVariables VarPtr; // Pointer used to real Variables structure
366 :
367 : // Default Constructor
368 830 : RealVariableType() : timeStepType(TimeStepType::Zone), storeType(StoreType::Averaged), ReportID(0), units(OutputProcessor::Unit::None)
369 : {
370 830 : }
371 : };
372 :
373 79573 : struct IntegerVariableType
374 : {
375 : // Members
376 : TimeStepType timeStepType; // Type whether Zone or HVAC
377 : StoreType storeType; // Variable Type (Summed/Non-Static or Average/Static)
378 : int ReportID; // Report variable ID number
379 : std::string VarName; // Name of Variable
380 : std::string VarNameUC; // Name of Variable
381 : std::string VarNameOnly; // Name of Variable
382 : std::string VarNameOnlyUC; // Name of Variable with out key in uppercase
383 : std::string KeyNameOnlyUC; // Name of key only witht out variable in uppercase
384 : OutputProcessor::Unit units; // Units for Variable
385 : IntegerVariables VarPtr; // Pointer used to integer Variables structure
386 :
387 : // Default Constructor
388 1073 : IntegerVariableType() : timeStepType(TimeStepType::Zone), storeType(StoreType::Averaged), ReportID(0), units(OutputProcessor::Unit::None)
389 : {
390 1073 : }
391 : };
392 :
393 41485 : struct ReqReportVariables // Structure for requested Report Variables
394 : {
395 : // Members
396 : std::string Key; // Could be blank or "*"
397 : std::string VarName; // Name of Variable
398 : ReportingFrequency frequency; // Reporting Frequency
399 : int SchedPtr; // Index of the Schedule
400 : std::string SchedName; // Schedule Name
401 : bool Used; // True when this combination (key, varname, frequency) has been set
402 :
403 : bool is_simple_string; // Whether the Key potentially includes a Regular Expression pattern
404 : std::shared_ptr<RE2> case_insensitive_pattern;
405 :
406 : // Default Constructor
407 771 : ReqReportVariables()
408 771 : : frequency(ReportingFrequency::Hourly), SchedPtr(0), Used(false), is_simple_string(true), case_insensitive_pattern(nullptr)
409 : {
410 771 : }
411 : };
412 :
413 18446085 : struct MeterArrayType
414 : {
415 : // Members
416 : int NumOnMeters; // Number of OnMeter Entries for variable
417 : int RepVariable; // Backwards pointer to real Variable
418 : Array1D_int OnMeters; // Forward pointer to Meter Numbers
419 : int NumOnCustomMeters; // Number of OnCustomMeter Entries for variable
420 : Array1D_int OnCustomMeters; // Forward pointer to Custom Meter Numbers
421 :
422 : // Default Constructor
423 56223 : MeterArrayType() : NumOnMeters(0), RepVariable(0), OnMeters(10, 0), NumOnCustomMeters(0)
424 : {
425 56223 : }
426 : };
427 :
428 25498289 : struct MeterType
429 : {
430 : // Members
431 : std::string Name; // Name of the meter
432 : std::string ResourceType; // Resource Type of the meter
433 : std::string EndUse; // End Use of the meter
434 : std::string EndUseSub; // End Use subcategory of the meter
435 : std::string Group; // Group of the meter
436 : OutputProcessor::Unit Units; // Units for the Meter
437 : OutputProcessor::RT_IPUnits RT_forIPUnits; // Resource type number for IP Units (tabular) reporting
438 : MtrType TypeOfMeter; // type of meter
439 : int SourceMeter; // for custom decrement meters, this is the meter number for the subtraction
440 :
441 : Real64 TSValue; // TimeStep Value
442 : Real64 CurTSValue; // Current TimeStep Value (internal access)
443 : bool RptTS; // Report at End of TimeStep (Zone)
444 : bool RptTSFO; // Report at End of TimeStep (Zone) -- meter file only
445 : int TSRptNum; // Report Number for TS Values
446 : std::string TSRptNumChr; // Report Number for TS Values (character -- for printing)
447 :
448 : Real64 HRValue; // Hourly Value
449 : bool RptHR; // Report at End of Hour
450 : bool RptHRFO; // Report at End of Hour -- meter file only
451 : int HRRptNum; // Report Number for HR Values
452 : std::string HRRptNumChr; // Report Number for HR Values (character -- for printing)
453 :
454 : Real64 DYValue; // Daily Value
455 : bool RptDY; // Report at End of Day
456 : bool RptDYFO; // Report at End of Day -- meter file only
457 : Real64 DYMaxVal; // Maximum Value (Day)
458 : int DYMaxValDate; // Date stamp of maximum
459 : Real64 DYMinVal; // Minimum Value (Day)
460 : int DYMinValDate; // Date stamp of minimum
461 : int DYRptNum; // Report Number for DY Values
462 : std::string DYRptNumChr; // Report Number for DY Values (character -- for printing)
463 :
464 : Real64 MNValue; // Monthly Value
465 : bool RptMN; // Report at End of Month
466 : bool RptMNFO; // Report at End of Month -- meter file only
467 : Real64 MNMaxVal; // Maximum Value (Month)
468 : int MNMaxValDate; // Date stamp of maximum
469 : Real64 MNMinVal; // Minimum Value (Month)
470 : int MNMinValDate; // Date stamp of minimum
471 : int MNRptNum; // Report Number for MN Values
472 : std::string MNRptNumChr; // Report Number for MN Values (character -- for printing)
473 :
474 : Real64 YRValue; // Yearly Value
475 : bool RptYR; // Report at End of Year
476 : bool RptYRFO; // Report at End of Year
477 : Real64 YRMaxVal; // Maximum Value (Yearly)
478 : int YRMaxValDate; // Date stamp of maximum
479 : Real64 YRMinVal; // Minimum Value (Yearly)
480 : int YRMinValDate; // Date stamp of minimum
481 : int YRRptNum; // Report Number for YR Values
482 : std::string YRRptNumChr; // Report Number for YR Values (character -- for printing)
483 :
484 : Real64 SMValue; // Simulation Value
485 : bool RptSM; // Report at End of Environment/Simulation
486 : bool RptSMFO; // Report at End of Environment/Simulation -- meter file only
487 : Real64 SMMaxVal; // Maximum Value (Sim)
488 : int SMMaxValDate; // Date stamp of maximum
489 : Real64 SMMinVal; // Minimum Value (Sim)
490 : int SMMinValDate; // Date stamp of minimum
491 : int SMRptNum; // Report Number for SM Values
492 : std::string SMRptNumChr; // Report Number for SM Values (character -- for printing)
493 :
494 : Real64 LastSMValue; // Simulation Value
495 : Real64 LastSMMaxVal; // Maximum Value (Sim)
496 : int LastSMMaxValDate; // Date stamp of maximum
497 : Real64 LastSMMinVal; // Minimum Value (Sim)
498 : int LastSMMinValDate; // Date stamp of minimum
499 : Real64 FinYrSMValue; // Final Year Simulation Value
500 : Real64 FinYrSMMaxVal; // Maximum Value (Sim)
501 : int FinYrSMMaxValDate; // Date stamp of maximum
502 : Real64 FinYrSMMinVal; // Minimum Value (Sim)
503 : int FinYrSMMinValDate; // Date stamp of minimum
504 : bool RptAccTS; // Report Cumulative Meter at Time Step
505 : bool RptAccTSFO; // Report Cumulative Meter at Time Step -- meter file only
506 : bool RptAccHR; // Report Cumulative Meter at Hour
507 : bool RptAccHRFO; // Report Cumulative Meter at Hour -- meter file only
508 : bool RptAccDY; // Report Cumulative Meter at Day
509 : bool RptAccDYFO; // Report Cumulative Meter at Day -- meter file only
510 : bool RptAccMN; // Report Cumulative Meter at Month
511 : bool RptAccMNFO; // Report Cumulative Meter at Month -- meter file only
512 : bool RptAccYR; // Report Cumulative Meter at Year
513 : bool RptAccYRFO; // Report Cumulative Meter at Year -- meter file only
514 : bool RptAccSM; // Report Cumulative Meter at Run Period
515 : bool RptAccSMFO; // Report Cumulative Meter at Run Period -- meter file only
516 : int TSAccRptNum; // Report Number for Acc Values
517 : int HRAccRptNum; // Report Number for Acc Values
518 : int DYAccRptNum; // Report Number for Acc Values
519 : int MNAccRptNum; // Report Number for Acc Values
520 : int YRAccRptNum; // Report Number for Acc Values
521 : int SMAccRptNum; // Report Number for Acc Values
522 : int InstMeterCacheStart; // index of the beginning of the instant meter cache
523 : int InstMeterCacheEnd; // index of the end of the instant meter cache
524 :
525 : // Default Constructor
526 93065 : MeterType()
527 93065 : : Units(OutputProcessor::Unit::None), RT_forIPUnits(OutputProcessor::RT_IPUnits::Invalid), TypeOfMeter(MtrType::Normal), SourceMeter(0),
528 : TSValue(0.0), CurTSValue(0.0), RptTS(false), RptTSFO(false), TSRptNum(0), HRValue(0.0), RptHR(false), RptHRFO(false), HRRptNum(0),
529 : DYValue(0.0), RptDY(false), RptDYFO(false), DYMaxVal(-99999.0), DYMaxValDate(0), DYMinVal(99999.0), DYMinValDate(0), DYRptNum(0),
530 : MNValue(0.0), RptMN(false), RptMNFO(false), MNMaxVal(-99999.0), MNMaxValDate(0), MNMinVal(99999.0), MNMinValDate(0), MNRptNum(0),
531 : YRValue(0.0), RptYR(false), RptYRFO(false), YRMaxVal(-99999.0), YRMaxValDate(0), YRMinVal(99999.0), YRMinValDate(0), YRRptNum(0),
532 : SMValue(0.0), RptSM(false), RptSMFO(false), SMMaxVal(-99999.0), SMMaxValDate(0), SMMinVal(99999.0), SMMinValDate(0), SMRptNum(0),
533 : LastSMValue(0.0), LastSMMaxVal(-99999.0), LastSMMaxValDate(0), LastSMMinVal(99999.0), LastSMMinValDate(0), FinYrSMValue(0.0),
534 : FinYrSMMaxVal(-99999.0), FinYrSMMaxValDate(0), FinYrSMMinVal(99999.0), FinYrSMMinValDate(0), RptAccTS(false), RptAccTSFO(false),
535 : RptAccHR(false), RptAccHRFO(false), RptAccDY(false), RptAccDYFO(false), RptAccMN(false), RptAccMNFO(false), RptAccYR(false),
536 : RptAccYRFO(false), RptAccSM(false), RptAccSMFO(false), TSAccRptNum(0), HRAccRptNum(0), DYAccRptNum(0), MNAccRptNum(0), YRAccRptNum(0),
537 93065 : SMAccRptNum(0), InstMeterCacheStart(0), InstMeterCacheEnd(0)
538 : {
539 93065 : }
540 : };
541 :
542 33153 : struct EndUseCategoryType
543 : {
544 : // Members
545 : std::string Name; // End use category name
546 : std::string DisplayName; // Display name for output table
547 : int NumSubcategories = 0;
548 : Array1D_string SubcategoryName; // Array of subcategory names
549 : int numSpaceTypes = 0;
550 : Array1D_string spaceTypeName; // Array of space type names
551 : };
552 :
553 : void InitializeOutput(EnergyPlusData &state);
554 :
555 : void SetupTimePointers(EnergyPlusData &state,
556 : OutputProcessor::SOVTimeStepType IndexKey, // Which timestep is being set up, 'Zone'=1, 'HVAC'=2
557 : Real64 &TimeStep // The timestep variable. Used to get the address
558 : );
559 :
560 : void CheckReportVariable(EnergyPlusData &state,
561 : std::string_view const KeyedValue, // Associated Key for this variable
562 : std::string_view const VarName // String Name of variable (without units)
563 : );
564 :
565 : void GetReportVariableInput(EnergyPlusData &state);
566 :
567 : ReportingFrequency determineFrequency(EnergyPlusData &state, std::string const &FreqString);
568 :
569 : std::string reportingFrequency(ReportingFrequency reportingInterval);
570 :
571 : void ProduceMinMaxString(std::string &String, // Current value
572 : int DateValue, // Date of min/max
573 : ReportingFrequency ReportFreq // Reporting Frequency
574 : );
575 :
576 : // TODO: GET RID OF THESE REDIMENSIONS
577 : inline void ReallocateIntegerArray(Array1D_int &Array,
578 : int &ArrayMax, // Current and resultant dimension for Array
579 : int const ArrayInc // increment for redimension
580 : )
581 : {
582 : Array.redimension(ArrayMax += ArrayInc, 0);
583 : }
584 :
585 : inline void ReallocateRVar(EnergyPlusData &state);
586 :
587 : inline void ReallocateIVar(EnergyPlusData &state);
588 :
589 : TimeStepType ValidateTimeStepType(EnergyPlusData &state,
590 : OutputProcessor::SOVTimeStepType TimeStepTypeKey // Index type (Zone, HVAC) for variables
591 : );
592 :
593 : std::string StandardTimeStepTypeKey(TimeStepType timeStepType);
594 :
595 : StoreType validateVariableType(EnergyPlusData &state, OutputProcessor::SOVStoreType VariableTypeKey);
596 :
597 : std::string standardVariableTypeKey(StoreType VariableType);
598 :
599 : // *****************************************************************************
600 : // The following routines implement Energy Meters in EnergyPlus.
601 : // *****************************************************************************
602 :
603 : void InitializeMeters(EnergyPlusData &state);
604 :
605 : void GetCustomMeterInput(EnergyPlusData &state, bool &ErrorsFound);
606 :
607 : void
608 : GetStandardMeterResourceType(EnergyPlusData &state, std::string &OutResourceType, std::string const &UserInputResourceType, bool &ErrorsFound);
609 :
610 : void AddMeter(EnergyPlusData &state,
611 : std::string const &Name, // Name for the meter
612 : OutputProcessor::Unit MtrUnits, // Units for the meter
613 : std::string const &ResourceType, // ResourceType for the meter
614 : std::string const &EndUse, // EndUse for the meter
615 : std::string const &EndUseSub, // EndUse subcategory for the meter
616 : std::string const &Group // Group for the meter
617 : );
618 :
619 : void AttachMeters(EnergyPlusData &state,
620 : EnergyPlus::OutputProcessor::Unit MtrUnits, // Units for this meter
621 : std::string &ResourceType, // Electricity, Gas, etc.
622 : std::string &EndUse, // End-use category (Lights, Heating, etc.)
623 : std::string &EndUseSub, // End-use subcategory (user-defined, e.g., General Lights, Task Lights, etc.)
624 : std::string &Group, // Group key (Facility, Zone, Building, etc.)
625 : std::string const &ZoneName, // Zone key only applicable for Building group
626 : std::string const &SpaceTypeName, // Space Type key only applicable for Building group
627 : int RepVarNum, // Number of this report variable
628 : int &MeterArrayPtr, // Output set of Pointers to Meters
629 : bool &ErrorsFound // True if errors in this call
630 : );
631 :
632 : void AttachCustomMeters(EnergyPlusData &state,
633 : int RepVarNum, // Number of this report variable
634 : int &MeterArrayPtr, // Input/Output set of Pointers to Meters
635 : int MeterIndex // Which meter this is
636 : );
637 :
638 : void ValidateNStandardizeMeterTitles(EnergyPlusData &state,
639 : OutputProcessor::Unit MtrUnits, // Units for the meter
640 : std::string &ResourceType, // Electricity, Gas, etc.
641 : std::string &EndUse, // End Use Type (Lights, Heating, etc.)
642 : std::string &EndUseSub, // End Use Sub Type (General Lights, Task Lights, etc.)
643 : std::string &Group, // Group key (Facility, Zone, Building, etc.)
644 : bool &ErrorsFound, // True if errors in this call
645 : const std::string &ZoneName, // Zone Name when Group=Building
646 : const std::string &SpaceType // Space Type when Group=Building
647 : );
648 :
649 : void DetermineMeterIPUnits(EnergyPlusData &state,
650 : OutputProcessor::RT_IPUnits &CodeForIPUnits, // Output Code for IP Units
651 : std::string const &ResourceType, // Resource Type
652 : OutputProcessor::Unit MtrUnits, // Meter units
653 : bool &ErrorsFound // true if errors found during subroutine
654 : );
655 :
656 : void UpdateMeters(EnergyPlusData &state, int TimeStamp); // Current TimeStamp (for max/min)
657 :
658 : void ResetAccumulationWhenWarmupComplete(EnergyPlusData &state);
659 :
660 : void ReportTSMeters(EnergyPlusData &state,
661 : Real64 StartMinute, // Start Minute for TimeStep
662 : Real64 EndMinute, // End Minute for TimeStep
663 : bool &PrintESOTimeStamp, // True if the ESO Time Stamp also needs to be printed
664 : bool PrintTimeStampToSQL // Print Time Stamp to SQL file
665 : );
666 :
667 : void ReportHRMeters(EnergyPlusData &state, bool PrintTimeStampToSQL // Print Time Stamp to SQL file
668 : );
669 :
670 : void ReportDYMeters(EnergyPlusData &state, bool PrintTimeStampToSQL // Print Time Stamp to SQL file
671 : );
672 :
673 : void ReportMNMeters(EnergyPlusData &state, bool PrintTimeStampToSQL // Print Time Stamp to SQL file
674 : );
675 :
676 : void ReportSMMeters(EnergyPlusData &state, bool PrintTimeStampToSQL // Print Time Stamp to SQL file
677 : );
678 :
679 : void ReportYRMeters(EnergyPlusData &state, bool PrintTimeStampToSQL);
680 :
681 : void ReportForTabularReports(EnergyPlusData &state);
682 :
683 : std::string DateToStringWithMonth(int codedDate); // word containing encoded month, day, hour, minute
684 :
685 : void ReportMeterDetails(EnergyPlusData &state);
686 :
687 : // *****************************************************************************
688 : // End of routines for Energy Meters implementation in EnergyPlus.
689 : // *****************************************************************************
690 :
691 : void addEndUseSubcategory(EnergyPlusData &state, std::string const &EndUseName, std::string const &EndUseSubName);
692 :
693 : void addEndUseSpaceType(EnergyPlusData &state, std::string const &EndUseName, std::string const &EndUseSpTypeName);
694 :
695 : void WriteTimeStampFormatData(EnergyPlusData &state,
696 : InputOutputFile &outputFile,
697 : ReportingFrequency reportingInterval, // Reporting frequency.
698 : int reportID, // The ID of the time stamp
699 : std::string const &reportIDString, // The ID of the time stamp
700 : std::string const &DayOfSimChr, // the number of days simulated so far
701 : bool writeToSQL, // write to SQLite
702 : Optional_int_const Month = _, // the month of the reporting interval
703 : Optional_int_const DayOfMonth = _, // The day of the reporting interval
704 : Optional_int_const Hour = _, // The hour of the reporting interval
705 : Optional<Real64 const> EndMinute = _, // The last minute in the reporting interval
706 : Optional<Real64 const> StartMinute = _, // The starting minute of the reporting interval
707 : Optional_int_const DST = _, // A flag indicating whether daylight savings time is observed
708 : Optional_string_const DayType = _ // The day tied for the data (e.g., Monday)
709 : );
710 :
711 : void WriteYearlyTimeStamp(EnergyPlusData &state,
712 : InputOutputFile &outputFile,
713 : std::string const &reportIDString, // The ID of the time stamp
714 : std::string const &yearOfSimChr, // the year of the simulation
715 : bool writeToSQL);
716 :
717 : void WriteReportVariableDictionaryItem(EnergyPlusData &state,
718 : ReportingFrequency reportingInterval, // The reporting interval (e.g., hourly, daily)
719 : StoreType storeType,
720 : int reportID, // The reporting ID for the data
721 : int indexGroupKey, // The reporting group (e.g., Zone, Plant Loop, etc.)
722 : std::string const &indexGroup, // The reporting group (e.g., Zone, Plant Loop, etc.)
723 : std::string const &reportIDChr, // The reporting ID for the data
724 : std::string_view const keyedValue, // The key name for the data
725 : std::string_view const variableName, // The variable's actual name
726 : TimeStepType timeStepType,
727 : OutputProcessor::Unit unitsForVar, // The variables units
728 : Optional_string_const customUnitName = _,
729 : std::string_view const ScheduleName = {});
730 :
731 : void WriteMeterDictionaryItem(EnergyPlusData &state,
732 : ReportingFrequency reportingInterval, // The reporting interval (e.g., hourly, daily)
733 : StoreType storeType,
734 : int reportID, // The reporting ID in for the variable
735 : int indexGroupKey, // The reporting group for the variable
736 : std::string const &indexGroup, // The reporting group for the variable
737 : std::string const &reportIDChr, // The reporting ID in for the variable
738 : std::string const &meterName, // The variable's meter name
739 : OutputProcessor::Unit unit, // The variables units
740 : bool cumulativeMeterFlag, // A flag indicating cumulative data
741 : bool meterFileOnlyFlag // A flag indicating whether the data is to be written to standard output
742 : );
743 :
744 : void WriteRealVariableOutput(EnergyPlusData &state,
745 : RealVariables &realVar, // Real variable to write out
746 : ReportingFrequency reportType // The report type or interval (e.g., hourly)
747 : );
748 :
749 : void WriteReportRealData(EnergyPlusData &state,
750 : int reportID,
751 : std::string const &creportID,
752 : Real64 repValue,
753 : StoreType storeType,
754 : Real64 numOfItemsStored,
755 : ReportingFrequency reportingInterval,
756 : Real64 minValue,
757 : int minValueDate,
758 : Real64 MaxValue,
759 : int maxValueDate);
760 :
761 : void WriteCumulativeReportMeterData(EnergyPlusData &state,
762 : int reportID, // The variable's report ID
763 : std::string const &creportID, // variable ID in characters
764 : Real64 repValue, // The variable's value
765 : bool meterOnlyFlag // A flag that indicates if the data should be written to standard output
766 : );
767 :
768 : void WriteReportMeterData(EnergyPlusData &state,
769 : int reportID, // The variable's report ID
770 : std::string const &creportID, // variable ID in characters
771 : Real64 repValue, // The variable's value
772 : ReportingFrequency reportingInterval, // The variable's reporting interval (e.g., hourly)
773 : Real64 minValue, // The variable's minimum value during the reporting interval
774 : int minValueDate, // The date the minimum value occurred
775 : Real64 MaxValue, // The variable's maximum value during the reporting interval
776 : int maxValueDate, // The date of the maximum value
777 : bool meterOnlyFlag // Indicates whether the data is for the meter file only
778 : );
779 :
780 : void WriteNumericData(EnergyPlusData &state,
781 : int reportID, // The variable's reporting ID
782 : std::string const &creportID, // variable ID in characters
783 : Real64 repValue // The variable's value
784 : );
785 :
786 : void WriteNumericData(EnergyPlusData &state,
787 : int reportID, // The variable's reporting ID
788 : std::string const &creportID, // variable ID in characters
789 : int32_t repValue // The variable's value
790 : );
791 :
792 : void WriteIntegerVariableOutput(EnergyPlusData &state,
793 : IntegerVariables &intVar, // Integer variable to write out
794 : ReportingFrequency reportType // The report type (i.e., the reporting interval)
795 : );
796 :
797 : void WriteReportIntegerData(EnergyPlusData &state,
798 : int reportID, // The variable's reporting ID
799 : std::string const &reportIDString, // The variable's reporting ID (character)
800 : Real64 repValue, // The variable's value
801 : StoreType storeType, // Type of item (averaged or summed)
802 : Real64 numOfItemsStored, // The number of items (hours or timesteps) of data stored
803 : ReportingFrequency reportingInterval, // The reporting interval (e.g., monthly)
804 : int minValue, // The variable's minimum value during the reporting interval
805 : int minValueDate, // The date the minimum value occurred
806 : int MaxValue, // The variable's maximum value during the reporting interval
807 : int maxValueDate // The date the maximum value occurred
808 : );
809 :
810 : int DetermineIndexGroupKeyFromMeterName(EnergyPlusData &state, std::string const &meterName); // the meter name
811 :
812 : std::string DetermineIndexGroupFromMeterGroup(MeterType const &meter); // the meter
813 :
814 : void SetInternalVariableValue(EnergyPlusData &state,
815 : OutputProcessor::VariableType varType, // 1=integer, 2=real, 3=meter
816 : int keyVarIndex, // Array index
817 : Real64 SetRealVal, // real value to set, if type is real or meter
818 : int SetIntVal // integer value to set if type is integer
819 : );
820 :
821 : std::string unitEnumToStringBrackets(EnergyPlus::OutputProcessor::Unit unitIn);
822 :
823 : std::string unitEnumToString(OutputProcessor::Unit unitIn);
824 :
825 : OutputProcessor::Unit unitStringToEnum(std::string const &unitIn);
826 :
827 : std::string unitStringFromDDitem(EnergyPlusData &state, int ddItemPtr // index provided for DDVariableTypes
828 : );
829 :
830 0 : struct APIOutputVariableRequest
831 : {
832 : std::string varName;
833 : std::string varKey;
834 : };
835 :
836 : } // namespace OutputProcessor
837 :
838 : //==============================================================================================
839 : // *****************************************************************************
840 : // These routines are available outside the OutputProcessor Module (i.e. calling
841 : // routines do not have to "USE OutputProcessor". But each of these routines
842 : // will use the OutputProcessor and take advantage that everything is PUBLIC
843 : // within the OutputProcessor.
844 : // *****************************************************************************
845 :
846 : void SetupOutputVariable(EnergyPlusData &state,
847 : std::string_view const VariableName, // String Name of variable (with units)
848 : OutputProcessor::Unit VariableUnit, // Actual units corresponding to the actual variable
849 : Real64 &ActualVariable, // Actual Variable, used to set up pointer
850 : OutputProcessor::SOVTimeStepType TimeStepTypeKey, // Zone, HeatBalance=1, HVAC, System, Plant=2
851 : OutputProcessor::SOVStoreType VariableTypeKey, // State, Average=1, NonState, Sum=2
852 : std::string_view const KeyedValue, // Associated Key for this variable
853 : Optional_string_const ReportFreq = _, // Internal use -- causes reporting at this freqency
854 : Optional_string_const ResourceTypeKey = _, // Meter Resource Type (Electricity, Gas, etc)
855 : Optional_string_const EndUseKey = _, // Meter End Use Key (Lights, Heating, Cooling, etc)
856 : Optional_string_const EndUseSubKey = _, // Meter End Use Sub Key (General Lights, Task Lights, etc)
857 : Optional_string_const GroupKey = _, // Meter Super Group Key (Building, System, Plant)
858 : Optional_string_const ZoneKey = _, // Meter Zone Key (zone name)
859 : Optional_int_const ZoneMult = _, // Zone Multiplier, defaults to 1
860 : Optional_int_const ZoneListMult = _, // Zone List Multiplier, defaults to 1
861 : Optional_int_const indexGroupKey = _, // Group identifier for SQL output
862 : Optional_string_const customUnitName = _, // the custom name for the units from EMS definition of units
863 : Optional_string_const SpaceType = _ // Space type (applicable for Building group only)
864 : );
865 :
866 : void SetupOutputVariable(EnergyPlusData &state,
867 : std::string_view const VariableName, // String Name of variable
868 : OutputProcessor::Unit VariableUnit, // Actual units corresponding to the actual variable
869 : int &ActualVariable, // Actual Variable, used to set up pointer
870 : OutputProcessor::SOVTimeStepType TimeStepTypeKey, // Zone, HeatBalance=1, HVAC, System, Plant=2
871 : OutputProcessor::SOVStoreType VariableTypeKey, // State, Average=1, NonState, Sum=2
872 : std::string_view const KeyedValue, // Associated Key for this variable
873 : Optional_string_const ReportFreq = _, // Internal use -- causes reporting at this freqency
874 : Optional_int_const indexGroupKey = _ // Group identifier for SQL output
875 : );
876 :
877 : void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType TimeStepTypeKey); // What kind of data to update (Zone, HVAC)
878 :
879 : void AssignReportNumber(EnergyPlusData &state, int &ReportNumber);
880 :
881 : void GenOutputVariablesAuditReport(EnergyPlusData &state);
882 :
883 : void UpdateMeterReporting(EnergyPlusData &state);
884 :
885 : void SetInitialMeterReportingAndOutputNames(EnergyPlusData &state,
886 : int WhichMeter, // Which meter number
887 : bool MeterFileOnlyIndicator, // true if this is a meter file only reporting
888 : OutputProcessor::ReportingFrequency FrequencyIndicator, // at what frequency is the meter reported
889 : bool CumulativeIndicator // true if this is a Cumulative meter reporting
890 : );
891 :
892 : int GetMeterIndex(EnergyPlusData &state, std::string const &MeterName);
893 :
894 : std::string GetMeterResourceType(EnergyPlusData &state, int MeterNumber); // Which Meter Number (from GetMeterIndex)
895 :
896 : Real64 GetCurrentMeterValue(EnergyPlusData &state, int MeterNumber); // Which Meter Number (from GetMeterIndex)
897 :
898 : Real64 GetInstantMeterValue(EnergyPlusData &state,
899 : int MeterNumber, // Which Meter Number (from GetMeterIndex)
900 : OutputProcessor::TimeStepType TimeStepType // Whether this is zone of HVAC
901 : );
902 :
903 : void IncrementInstMeterCache(EnergyPlusData &state);
904 :
905 : Real64 GetInternalVariableValue(EnergyPlusData &state,
906 : OutputProcessor::VariableType varType, // 1=integer, 2=real, 3=meter
907 : int keyVarIndex // Array index
908 : );
909 :
910 : Real64 GetInternalVariableValueExternalInterface(EnergyPlusData &state,
911 : OutputProcessor::VariableType varType, // 1=integer, 2=REAL(r64), 3=meter
912 : int keyVarIndex // Array index
913 : );
914 :
915 : int GetNumMeteredVariables(EnergyPlusData &state,
916 : std::string const &ComponentType, // Given Component Type
917 : std::string const &ComponentName // Given Component Name (user defined)
918 : );
919 :
920 : void GetMeteredVariables(EnergyPlusData &state,
921 : std::string const &ComponentType, // Given Component Type
922 : std::string const &ComponentName, // Given Component Name (user defined)
923 : Array1D_int &VarIndexes, // Variable Numbers
924 : Array1D<OutputProcessor::VariableType> &VarTypes, // Variable Types (1=integer, 2=real, 3=meter)
925 : Array1D<OutputProcessor::TimeStepType> &TimeStepTypes, // Variable Index Types (1=Zone,2=HVAC),
926 : Array1D<OutputProcessor::Unit> &unitsForVar, // units from enum for each variable
927 : std::map<int, DataGlobalConstants::ResourceType> &ResourceTypes, // ResourceTypes for each variable
928 : Array1D_string &EndUses, // EndUses for each variable
929 : Array1D_string &Groups, // Groups for each variable
930 : Array1D_string &Names, // Variable Names for each variable
931 : int &NumFound // Number Found
932 : );
933 :
934 : void GetMeteredVariables(EnergyPlusData &state,
935 : std::string const &ComponentType, // Given Component Type
936 : std::string const &ComponentName, // Given Component Name (user defined)
937 : Array1D_int &VarIndexes, // Variable Numbers
938 : Array1D<OutputProcessor::VariableType> &VarTypes, // Variable Types (1=integer, 2=real, 3=meter)
939 : Array1D<OutputProcessor::TimeStepType> &TimeStepTypes, // Variable Index Types (1=Zone,2=HVAC),
940 : Array1D<OutputProcessor::Unit> &unitsForVar, // units from enum for each variable
941 : std::map<int, DataGlobalConstants::ResourceType> &ResourceTypes, // ResourceTypes for each variable
942 : Array1D_string &EndUses, // EndUses for each variable
943 : Array1D_string &Groups, // Groups for each variable
944 : Array1D_string &Names, // Variable Names for each variable
945 : Array1D_int &VarIDs // Variable Report Numbers
946 : );
947 :
948 : void GetVariableKeyCountandType(EnergyPlusData &state,
949 : std::string const &varName, // Standard variable name
950 : int &numKeys, // Number of keys found
951 : OutputProcessor::VariableType &varType,
952 : OutputProcessor::StoreType &varAvgSum, // Variable is Averaged=1 or Summed=2
953 : OutputProcessor::TimeStepType &varStepType, // Variable time step is Zone=1 or HVAC=2
954 : OutputProcessor::Unit &varUnits // Units enumeration
955 : );
956 :
957 : void GetVariableKeys(EnergyPlusData &state,
958 : std::string const &varName, // Standard variable name
959 : OutputProcessor::VariableType varType,
960 : Array1D_string &keyNames, // Specific key name
961 : Array1D_int &keyVarIndexes // Array index for
962 : );
963 :
964 : bool ReportingThisVariable(EnergyPlusData &state, std::string const &RepVarName);
965 :
966 : void InitPollutionMeterReporting(EnergyPlusData &state, std::string const &ReportFreqName);
967 :
968 : void ProduceRDDMDD(EnergyPlusData &state);
969 :
970 : void AddToOutputVariableList(EnergyPlusData &state,
971 : std::string_view const VarName, // Variable Name
972 : OutputProcessor::TimeStepType TimeStepType,
973 : OutputProcessor::StoreType StateType,
974 : OutputProcessor::VariableType VariableType,
975 : OutputProcessor::Unit unitsForVar,
976 : Optional_string_const customUnitName = _ // the custom name for the units from EMS definition of units
977 : );
978 :
979 : int initErrorFile(EnergyPlusData &state);
980 :
981 1542 : struct OutputProcessorData : BaseGlobalStruct
982 : {
983 :
984 : int InstMeterCacheSize = 1000; // the maximum size of the instant meter cache used in GetInstantMeterValue
985 : int InstMeterCacheSizeInc = 1000; // the increment for the instant meter cache used in GetInstantMeterValue
986 : Array1D_int InstMeterCache; // contains a list of RVariableTypes that make up a specific meter
987 : int InstMeterCacheLastUsed = 0; // the last item in the instant meter cache used
988 : int CurrentReportNumber = 0;
989 : int NumVariablesForOutput = 0;
990 : int MaxVariablesForOutput = 0;
991 : int NumOfRVariable_Setup = 0;
992 : int NumTotalRVariable = 0;
993 : int NumOfRVariable_Sum = 0;
994 : int NumOfRVariable_Meter = 0;
995 : int NumOfRVariable = 0;
996 : int MaxRVariable = 0;
997 : int NumOfIVariable_Setup = 0;
998 : int NumTotalIVariable = 0;
999 : int NumOfIVariable_Sum = 0;
1000 : int NumOfIVariable = 0;
1001 : int MaxIVariable = 0;
1002 : bool OutputInitialized = false;
1003 : OutputProcessor::ReportVDD ProduceReportVDD = OutputProcessor::ReportVDD::No;
1004 : int NumHoursInMonth = 0;
1005 : int NumHoursInSim = 0;
1006 : Array1D_int ReportList;
1007 : int NumReportList = 0;
1008 : int NumExtraVars = 0;
1009 : int NumOfReqVariables = 0; // Current number of Requested Report Variables
1010 : int NumVarMeterArrays = 0; // Current number of Arrays pointing to meters
1011 : int NumEnergyMeters = 0; // Current number of Energy Meters
1012 : Array1D<Real64> MeterValue; // This holds the current timestep value for each meter.
1013 : int TimeStepStampReportNbr = 0; // TimeStep and Hourly Report number
1014 : std::string TimeStepStampReportChr; // TimeStep and Hourly Report number (character -- for printing)
1015 : bool TrackingHourlyVariables = false; // Requested Hourly Report Variables
1016 : int DailyStampReportNbr = 0; // Daily Report number
1017 : std::string DailyStampReportChr; // Daily Report number (character -- for printing)
1018 : bool TrackingDailyVariables = false; // Requested Daily Report Variables
1019 : int MonthlyStampReportNbr = 0; // Monthly Report number
1020 : std::string MonthlyStampReportChr; // Monthly Report number (character -- for printing)
1021 : bool TrackingMonthlyVariables = false; // Requested Monthly Report Variables
1022 : int YearlyStampReportNbr = 0; // Yearly Report number
1023 : std::string YearlyStampReportChr; // Yearly Report number (character -- for printing)
1024 : bool TrackingYearlyVariables = false; // Requested Yearly Report Variables
1025 : int RunPeriodStampReportNbr; // RunPeriod Report number
1026 : std::string RunPeriodStampReportChr; // RunPeriod Report number (character -- for printing)
1027 : bool TrackingRunPeriodVariables = false; // Requested RunPeriod Report Variables
1028 : Real64 TimeStepZoneSec = 0; // Seconds from NumTimeStepInHour
1029 : bool ErrorsLogged = false;
1030 : int MaxNumSubcategories = 1;
1031 : int maxNumEndUseSpaceTypes = 1;
1032 : bool isFinalYear = false;
1033 : bool GetOutputInputFlag = true;
1034 : OutputProcessor::ReportingFrequency minimumReportFrequency = OutputProcessor::ReportingFrequency::EachCall;
1035 : std::vector<OutputProcessor::APIOutputVariableRequest> apiVarRequests;
1036 : int ReportNumberCounter = 0; // The report number is used in output reports as a key.
1037 : int LHourP = -1; // Helps set hours for timestamp output
1038 : Real64 LStartMin = -1.0; // Helps set minutes for timestamp output
1039 : Real64 LEndMin = -1.0; // Helps set minutes for timestamp output
1040 : bool GetMeterIndexFirstCall = true; // trigger setup in GetMeterIndex
1041 : bool InitFlag = true;
1042 : Array1D_int keyVarIndexes; // Array index for specific key name
1043 : int curKeyVarIndexLimit = 0; // current limit for keyVarIndexes
1044 : Array1D_string varNames; // stored variable names
1045 : Array1D_int ivarNames; // pointers for sorted information
1046 : int numVarNames = 0; // number of variable names
1047 : std::map<OutputProcessor::TimeStepType, OutputProcessor::TimeSteps> TimeValue; // Pointers to the actual TimeStep variables
1048 : Array1D<OutputProcessor::RealVariableType> RVariableTypes; // Variable Types structure (use NumOfRVariables to traverse)
1049 : Array1D<OutputProcessor::IntegerVariableType> IVariableTypes; // Variable Types structure (use NumOfIVariables to traverse)
1050 : Array1D<OutputProcessor::VariableTypeForDDOutput> DDVariableTypes; // Variable Types structure (use NumVariablesForOutput to traverse)
1051 : Array1D<OutputProcessor::ReqReportVariables> ReqRepVars;
1052 : Array1D<OutputProcessor::MeterArrayType> VarMeterArrays;
1053 : Array1D<OutputProcessor::MeterType> EnergyMeters;
1054 : EPVector<OutputProcessor::EndUseCategoryType> EndUseCategory;
1055 : std::unordered_map<std::string, std::string> UniqueMeterNames;
1056 : char stamp[OutputProcessor::N_WriteTimeStampFormatData];
1057 : char s_WriteReportRealData[129];
1058 : char s_WriteCumulativeReportMeterData[129];
1059 : char s_WriteReportMeterData[129];
1060 : char s_WriteNumericData[129];
1061 : bool Rept = false;
1062 : bool OpaqSurfWarned = false;
1063 : Array1D_string ValidMeterNames;
1064 : Array1D_int iValidMeterNames;
1065 : int NumValidMeters = 0;
1066 :
1067 : // statics
1068 :
1069 : Real64 rDummy1TS = 0.0;
1070 : Real64 rDummy2TS = 0.0;
1071 : int iDummy1TS = 0;
1072 : int iDummy2TS = 0;
1073 : Real64 rDummy1 = 0.0;
1074 : Real64 rDummy2 = 0.0;
1075 : int iDummy1 = 0;
1076 : int iDummy2 = 0;
1077 : int indexGroupKey = -1;
1078 :
1079 0 : void clear_state() override
1080 : {
1081 0 : this->InstMeterCacheSize = 1000;
1082 0 : this->InstMeterCacheSizeInc = 1000;
1083 0 : this->InstMeterCache.deallocate();
1084 0 : this->InstMeterCacheLastUsed = 0;
1085 0 : this->CurrentReportNumber = 0;
1086 0 : this->NumVariablesForOutput = 0;
1087 0 : this->MaxVariablesForOutput = 0;
1088 0 : this->NumOfRVariable_Setup = 0;
1089 0 : this->NumTotalRVariable = 0;
1090 0 : this->NumOfRVariable_Sum = 0;
1091 0 : this->NumOfRVariable_Meter = 0;
1092 0 : this->NumOfRVariable = 0;
1093 0 : this->MaxRVariable = 0;
1094 0 : this->NumOfIVariable_Setup = 0;
1095 0 : this->NumTotalIVariable = 0;
1096 0 : this->NumOfIVariable_Sum = 0;
1097 0 : this->NumOfIVariable = 0;
1098 0 : this->MaxIVariable = 0;
1099 0 : this->OutputInitialized = false;
1100 0 : this->ProduceReportVDD = OutputProcessor::ReportVDD::No;
1101 0 : this->NumHoursInMonth = 0;
1102 0 : this->NumHoursInSim = 0;
1103 0 : this->ReportList.deallocate();
1104 0 : this->NumReportList = 0;
1105 0 : this->NumExtraVars = 0;
1106 0 : this->NumOfReqVariables = 0;
1107 0 : this->NumVarMeterArrays = 0;
1108 0 : this->NumEnergyMeters = 0;
1109 0 : this->MeterValue.deallocate();
1110 0 : this->TimeStepStampReportNbr = 0;
1111 0 : this->TimeStepStampReportChr.clear();
1112 0 : this->TrackingHourlyVariables = false;
1113 0 : this->DailyStampReportNbr = 0;
1114 0 : this->DailyStampReportChr.clear();
1115 0 : this->TrackingDailyVariables = false;
1116 0 : this->MonthlyStampReportNbr = 0;
1117 0 : this->MonthlyStampReportChr.clear();
1118 0 : this->TrackingMonthlyVariables = false;
1119 0 : this->YearlyStampReportNbr = 0;
1120 0 : this->YearlyStampReportChr.clear();
1121 0 : this->TrackingYearlyVariables = false;
1122 0 : this->RunPeriodStampReportNbr = 0;
1123 0 : this->RunPeriodStampReportChr.clear();
1124 0 : this->TrackingRunPeriodVariables = false;
1125 0 : this->TimeStepZoneSec = 0;
1126 0 : this->ErrorsLogged = false;
1127 0 : this->MaxNumSubcategories = 1;
1128 0 : this->maxNumEndUseSpaceTypes = 1;
1129 0 : this->isFinalYear = false;
1130 0 : this->GetOutputInputFlag = true;
1131 0 : this->minimumReportFrequency = OutputProcessor::ReportingFrequency::EachCall;
1132 0 : this->apiVarRequests.clear();
1133 0 : this->ReportNumberCounter = 0;
1134 0 : this->LHourP = -1;
1135 0 : this->LStartMin = -1.0;
1136 0 : this->LEndMin = -1.0;
1137 0 : this->GetMeterIndexFirstCall = true;
1138 0 : this->InitFlag = true;
1139 0 : this->keyVarIndexes.deallocate();
1140 0 : this->curKeyVarIndexLimit = 0;
1141 0 : this->varNames.deallocate();
1142 0 : this->ivarNames.deallocate();
1143 0 : this->numVarNames = 0;
1144 0 : this->TimeValue.clear();
1145 0 : this->RVariableTypes.deallocate();
1146 0 : this->IVariableTypes.deallocate();
1147 0 : this->DDVariableTypes.deallocate();
1148 0 : this->ReqRepVars.deallocate();
1149 0 : this->VarMeterArrays.deallocate();
1150 0 : this->EnergyMeters.deallocate();
1151 0 : this->EndUseCategory.deallocate();
1152 0 : this->UniqueMeterNames.clear();
1153 :
1154 0 : this->rDummy1TS = 0.0;
1155 0 : this->rDummy2TS = 0.0;
1156 0 : this->iDummy1TS = 0;
1157 0 : this->iDummy2TS = 0;
1158 0 : this->rDummy1 = 0.0;
1159 0 : this->rDummy2 = 0.0;
1160 0 : this->iDummy1 = 0;
1161 0 : this->iDummy2 = 0;
1162 0 : this->indexGroupKey = -1;
1163 0 : this->Rept = false;
1164 0 : this->OpaqSurfWarned = false;
1165 0 : this->ValidMeterNames.clear();
1166 0 : this->iValidMeterNames.clear();
1167 0 : this->NumValidMeters = 0;
1168 0 : }
1169 : };
1170 :
1171 : } // namespace EnergyPlus
1172 :
1173 : #endif
|