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 FaultsManager_hh_INCLUDED
49 : #define FaultsManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/Plant/DataPlant.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace FaultsManager {
66 :
67 : // Using/Aliasing
68 :
69 : // Data
70 : // MODULE PARAMETER DEFINITIONS
71 :
72 : // DERIVED TYPE DEFINITIONS:
73 :
74 : // MODULE VARIABLE TYPE DECLARATIONS:
75 :
76 : // ControllerTypeEnum
77 : int constexpr iController_AirEconomizer = 1001;
78 :
79 : // Input methods for fouling coils
80 : enum class FouledCoil
81 : {
82 : Invalid = -1,
83 : UARated,
84 : FoulingFactor,
85 : Num
86 : };
87 :
88 : // FaultTypeEnum
89 : enum class Fault
90 : {
91 : Invalid = -1,
92 : TemperatureSensorOffset_OutdoorAir,
93 : HumiditySensorOffset_OutdoorAir,
94 : EnthalpySensorOffset_OutdoorAir,
95 : TemperatureSensorOffset_ReturnAir,
96 : EnthalpySensorOffset_ReturnAir,
97 : Fouling_Coil,
98 : ThermostatOffset,
99 : HumidistatOffset,
100 : Fouling_AirFilter,
101 : TemperatureSensorOffset_ChillerSupplyWater,
102 : TemperatureSensorOffset_CondenserSupplyWater,
103 : Fouling_Tower,
104 : TemperatureSensorOffset_CoilSupplyAir,
105 : Fouling_Boiler,
106 : Fouling_Chiller,
107 : Fouling_EvapCooler,
108 : Num
109 : };
110 :
111 : // Types of faults under Group Operational Faults in IDD
112 : // 1. Temperature sensor offset (FY14)
113 : // 2. Humidity sensor offset (FY14)
114 : // 3. Enthalpy sensor offset (FY14)
115 : // 4. Fouling coils (FY14)
116 : // 5. Thermostat offset (FY15)
117 : // 6. Humidistat offset (FY15)
118 : // 7. Fouling air filter (FY15)
119 : // 8. Chiller Supply Water Temperature Sensor Offset (FY16)
120 : // 9. Condenser Supply Water Temperature Sensor Offset (FY16)
121 : // 10. Cooling Tower Scaling (FY16)
122 : // 11. Coil Supply Air Temperature Sensor Offset (FY16)
123 : // coming ...
124 : // Fouling: chillers, boilers, cooling towers
125 : // Damper leakage: return air, outdoor air
126 : // Blockage: pipe
127 : // Meter: air flow, water flow
128 : // CO2 sensor
129 : // Pressure sensor offset
130 : // more
131 :
132 : // 'FaultModel:PressureSensorOffset:OutdoorAir ', &
133 : // 'FaultModel:TemperatureSensorOffset:SupplyAir ', &
134 : // 'FaultModel:TemperatureSensorOffset:ZoneAir ', &
135 : // 'FaultModel:Blockage:Branch ', &
136 : // 'FaultModel:Dirty:AirFilter ', &
137 : // 'FaultModel:Fouling:Chiller ', &
138 : // 'FaultModel:Fouling:Boiler ', &
139 : // 'FaultModel:Fouling:CoolingTower ', &
140 : // 'FaultModel:DamperLeakage:ReturnAir ', &
141 : // 'FaultModel:DamperLeakage:OutdoorAir ' /)
142 :
143 : // SUBROUTINE SPECIFICATIONS:
144 :
145 : // Types
146 :
147 35 : struct FaultProperties // Base Class for operational faults
148 : {
149 : // Members
150 : std::string Name;
151 : std::string FaultType; // Fault type
152 : std::string AvaiSchedule; // Availability schedule
153 : std::string SeveritySchedule; // Severity schedule, multipliers to the Offset
154 : Fault FaultTypeEnum;
155 : int AvaiSchedPtr;
156 : int SeveritySchedPtr;
157 : Real64 Offset; // offset, + means sensor reading is higher than actual value
158 : bool Status; // for future use
159 :
160 : // Default Constructor
161 14 : FaultProperties()
162 14 : : Name(""), FaultType(""), AvaiSchedule(""), SeveritySchedule(""), FaultTypeEnum(Fault::Invalid), AvaiSchedPtr(0), SeveritySchedPtr(0),
163 14 : Offset(0.0), Status(false)
164 : {
165 14 : }
166 :
167 : // Virtual Destructor
168 49 : virtual ~FaultProperties() = default;
169 :
170 : public:
171 : Real64 CalFaultOffsetAct(EnergyPlusData &state);
172 : };
173 :
174 5 : struct FaultPropertiesEconomizer : public FaultProperties // Class for fault models related with economizer
175 : {
176 : // Members
177 : int ControllerTypeEnum;
178 : int ControllerID; // Point to a controller associated with the fault
179 : std::string ControllerType; // Controller type
180 : std::string ControllerName; // Controller name
181 :
182 : // Default Constructor
183 1 : FaultPropertiesEconomizer() : ControllerTypeEnum(0), ControllerID(0), ControllerType(""), ControllerName("")
184 : {
185 1 : }
186 :
187 : // Destructor
188 6 : virtual ~FaultPropertiesEconomizer() = default;
189 : };
190 :
191 16 : struct FaultPropertiesThermostat : public FaultProperties // Class for FaultModel:ThermostatOffset
192 : {
193 : // Members
194 : std::string FaultyThermostatName; // The faulty thermostat name
195 :
196 : // Default Constructor
197 2 : FaultPropertiesThermostat() : FaultyThermostatName("")
198 : {
199 2 : }
200 :
201 : // Destructor
202 18 : virtual ~FaultPropertiesThermostat() = default;
203 : };
204 :
205 2 : struct FaultPropertiesHumidistat : public FaultProperties // Class for FaultModel:HumidistatOffset
206 : {
207 : // Members
208 : std::string FaultyThermostatName; // The faulty thermostat name
209 : std::string FaultyHumidistatName; // The faulty humidistat name
210 : std::string FaultyHumidistatType; // The faulty humidistat type
211 :
212 : // Default Constructor
213 2 : FaultPropertiesHumidistat() : FaultyThermostatName(""), FaultyHumidistatName(""), FaultyHumidistatType("")
214 : {
215 2 : }
216 :
217 : // Destructor
218 4 : virtual ~FaultPropertiesHumidistat() = default;
219 : };
220 :
221 2 : struct FaultPropertiesFoulingCoil : public FaultProperties // Class for FaultModel:Fouling:Coil
222 : {
223 : // Members
224 : std::string FouledCoilName; // The fouled coil name
225 : DataPlant::PlantEquipmentType FouledCoilType; // Type of coil that's fouled
226 : int FouledCoilNum; // The "FouledUARated" implies having to use the Coil's UA, which could be autosized, so have to use this index
227 : FouledCoil FoulingInputMethod; // Coil fouling input method
228 : Real64 UAFouled; // Fouling coil UA under rating conditions
229 : Real64 Rfw; // Water side fouling factor
230 : Real64 Rfa; // Air side fouling factor
231 : Real64 Aout; // Coil outside surface area
232 : Real64 Aratio; // Inside to outside surface area ratio
233 :
234 : // Default Constructor
235 1 : FaultPropertiesFoulingCoil()
236 1 : : FouledCoilName(""), FouledCoilType(DataPlant::PlantEquipmentType::Invalid), FouledCoilNum(0), FoulingInputMethod(FouledCoil::Invalid),
237 1 : UAFouled(0.0), Rfw(0.0), Rfa(0.0), Aout(0.0), Aratio(0.0)
238 : {
239 1 : }
240 :
241 : // Destructor
242 3 : virtual ~FaultPropertiesFoulingCoil() = default;
243 :
244 : public:
245 : // Calculate the fouling thermal insulance factor (the reciprocal of a heat transfer coefficient) due to fouling in a coil
246 : // Real64 CalFaultyCoilFoulingFactor();
247 :
248 : // Calculate the Fault Fraction based on Availability and Severity Schedules
249 : Real64 FaultFraction(EnergyPlusData &state);
250 : };
251 :
252 1 : struct FaultPropertiesAirFilter : public FaultProperties // Class for FaultModel:Fouling:AirFilter, derived from FaultProperties
253 : {
254 : // Members
255 : std::string FaultyAirFilterFanName; // The name of the fan corresponding to the fouled air filter
256 : std::string FaultyAirFilterFanType; // The type of the fan corresponding to the fouled air filter
257 : std::string FaultyAirFilterFanCurve; // The name of the fan curve
258 : std::string FaultyAirFilterPressFracSche; // Schedule describing variations of the fan pressure rise
259 : int FaultyAirFilterFanCurvePtr; // The index to the curve
260 : int FaultyAirFilterPressFracSchePtr; // The pointer to the schedule
261 : Real64 FaultyAirFilterFanPressInc; // The increase of the fan pressure due to fouled air filter
262 : Real64 FaultyAirFilterFanFlowDec; // The decrease of the fan airflow rate due to fouled air filter
263 :
264 : // Default Constructor
265 1 : FaultPropertiesAirFilter()
266 1 : : FaultyAirFilterFanName(""), FaultyAirFilterFanType(""), FaultyAirFilterFanCurve(""), FaultyAirFilterPressFracSche(""),
267 1 : FaultyAirFilterFanCurvePtr(0), FaultyAirFilterPressFracSchePtr(0), FaultyAirFilterFanPressInc(0.0), FaultyAirFilterFanFlowDec(0.0)
268 : {
269 1 : }
270 :
271 : // Destructor
272 2 : virtual ~FaultPropertiesAirFilter() = default;
273 :
274 : public:
275 : bool CheckFaultyAirFilterFanCurve(EnergyPlusData &state);
276 : };
277 :
278 3 : struct FaultPropertiesCoilSAT : public FaultProperties // Class for FaultModel:TemperatureSensorOffset:CoilSupplyAir
279 : {
280 : // Members
281 : std::string CoilType; // Coil type
282 : std::string CoilName; // Coil name
283 : std::string WaterCoilControllerName; // Water coil controller name
284 :
285 : // Default Constructor
286 1 : FaultPropertiesCoilSAT() : CoilType(""), CoilName(""), WaterCoilControllerName("")
287 : {
288 1 : }
289 : };
290 :
291 1 : struct FaultPropertiesChillerSWT : public FaultProperties // Class for FaultModel:TemperatureSensorOffset:ChillerSupplyWater
292 : {
293 : // Members
294 : std::string ChillerType; // Chiller type
295 : std::string ChillerName; // Chiller name
296 :
297 : // Default Constructor
298 1 : FaultPropertiesChillerSWT() : ChillerType(""), ChillerName("")
299 : {
300 1 : }
301 :
302 : // Destructor
303 2 : virtual ~FaultPropertiesChillerSWT() = default;
304 :
305 : public:
306 : void CalFaultChillerSWT(bool FlagConstantFlowChiller, // True if chiller is constant flow and false if it is variable flow
307 : Real64 FaultyChillerSWTOffset, // Faulty chiller SWT sensor offset
308 : Real64 Cp, // Local fluid specific heat
309 : Real64 EvapInletTemp, // Chiller evaporator inlet water temperature
310 : Real64 &EvapOutletTemp, // Chiller evaporator outlet water temperature
311 : Real64 &EvapMassFlowRate, // Chiller mass flow rate
312 : Real64 &QEvaporator // Chiller evaporator heat transfer rate
313 : );
314 : };
315 :
316 3 : struct FaultPropertiesCondenserSWT : public FaultProperties // Class for FaultModel:TemperatureSensorOffset:CondenserSupplyWater
317 : {
318 : // Members
319 : std::string TowerType; // Tower type
320 : std::string TowerName; // Tower name
321 :
322 : // Default Constructor
323 1 : FaultPropertiesCondenserSWT() : TowerType(""), TowerName("")
324 : {
325 1 : }
326 : };
327 :
328 3 : struct FaultPropertiesTowerFouling : public FaultProperties // Class for FaultModel:Fouling:CoolingTower
329 : {
330 : // Members
331 : std::string TowerType; // Tower type
332 : std::string TowerName; // Tower name
333 : Real64 UAReductionFactor; // UA Reduction Factor
334 :
335 : // Default Constructor
336 1 : FaultPropertiesTowerFouling() : TowerType(""), TowerName(""), UAReductionFactor(1.0)
337 : {
338 1 : }
339 :
340 : public:
341 : Real64 CalFaultyTowerFoulingFactor(EnergyPlusData &state);
342 : };
343 :
344 13 : struct FaultPropertiesFouling : public FaultProperties // Class for FaultModel:Fouling
345 : {
346 : // Members
347 : Real64 FoulingFactor; // Fouling Factor
348 :
349 : // Default Constructor
350 3 : FaultPropertiesFouling() : FoulingFactor(1.0)
351 : {
352 3 : }
353 :
354 : public:
355 : Real64 CalFoulingFactor(EnergyPlusData &state); // To calculate the dynamic fouling factor
356 : };
357 :
358 3 : struct FaultPropertiesBoilerFouling : public FaultPropertiesFouling // Class for FaultModel:Fouling:Boiler
359 : {
360 : // Members
361 : std::string BoilerType; // Boiler type
362 : std::string BoilerName; // Boiler name
363 :
364 : // Default Constructor
365 1 : FaultPropertiesBoilerFouling() : BoilerType(""), BoilerName("")
366 : {
367 1 : }
368 : };
369 :
370 5 : struct FaultPropertiesChillerFouling : public FaultPropertiesFouling // Class for FaultModel:Fouling:Chiller
371 : {
372 : // Members
373 : std::string ChillerType; // Chiller type
374 : std::string ChillerName; // Chiller name
375 :
376 : // Default Constructor
377 1 : FaultPropertiesChillerFouling() : ChillerType(""), ChillerName("")
378 : {
379 1 : }
380 : };
381 :
382 5 : struct FaultPropertiesEvapCoolerFouling : public FaultPropertiesFouling // Class for FaultModel:Fouling:EvaporativeCooler
383 : {
384 : // Members
385 : std::string EvapCoolerType; // Evaporative Cooler type
386 : std::string EvapCoolerName; // Evaporative Cooler name
387 :
388 : // Default Constructor
389 1 : FaultPropertiesEvapCoolerFouling() : EvapCoolerType(""), EvapCoolerName("")
390 : {
391 1 : }
392 : };
393 :
394 : // Functions
395 :
396 : void CheckAndReadFaults(EnergyPlusData &state);
397 :
398 : void SetFaultyCoilSATSensor(
399 : EnergyPlusData &state, std::string const &CompType, std::string_view CompName, bool &FaultyCoilSATFlag, int &FaultyCoilSATIndex);
400 :
401 : } // namespace FaultsManager
402 :
403 1542 : struct FaultsManagerData : BaseGlobalStruct
404 : {
405 :
406 : bool RunFaultMgrOnceFlag = false; // True if CheckAndReadFaults is already done
407 : bool ErrorsFound = false; // True if errors detected in input
408 :
409 : bool AnyFaultsInModel = false; // True if there are operational faults in the model
410 : int NumFaults = 0; // Number of faults (include multiple faults of same type) in the model
411 : int NumFaultyEconomizer = 0; // Total number of faults related with the economizer
412 : int NumFouledCoil = 0; // Total number of fouled coils
413 : int NumFaultyThermostat = 0; // Total number of faulty thermostat with offset
414 : int NumFaultyHumidistat = 0; // Total number of faulty humidistat with offset
415 : int NumFaultyAirFilter = 0; // Total number of fouled air filters
416 : int NumFaultyChillerSWTSensor = 0; // Total number of faulty Chillers Supply Water Temperature Sensor
417 : int NumFaultyCondenserSWTSensor = 0; // Total number of faulty Condenser Supply Water Temperature Sensor
418 : int NumFaultyTowerFouling = 0; // Total number of faulty Towers with Scaling
419 : int NumFaultyCoilSATSensor = 0; // Total number of faulty Coil Supply Air Temperature Sensor
420 : int NumFaultyBoilerFouling = 0; // Total number of faulty Boilers with Fouling
421 : int NumFaultyChillerFouling = 0; // Total number of faulty Chillers with Fouling
422 : int NumFaultyEvapCoolerFouling = 0; // Total number of faulty Evaporative Coolers with Fouling
423 :
424 : // Object Data
425 : Array1D<FaultsManager::FaultPropertiesEconomizer> FaultsEconomizer;
426 : Array1D<FaultsManager::FaultPropertiesFoulingCoil> FouledCoils;
427 : Array1D<FaultsManager::FaultPropertiesThermostat> FaultsThermostatOffset;
428 : Array1D<FaultsManager::FaultPropertiesHumidistat> FaultsHumidistatOffset;
429 : Array1D<FaultsManager::FaultPropertiesAirFilter> FaultsFouledAirFilters;
430 : Array1D<FaultsManager::FaultPropertiesChillerSWT> FaultsChillerSWTSensor;
431 : Array1D<FaultsManager::FaultPropertiesCondenserSWT> FaultsCondenserSWTSensor;
432 : Array1D<FaultsManager::FaultPropertiesTowerFouling> FaultsTowerFouling;
433 : Array1D<FaultsManager::FaultPropertiesCoilSAT> FaultsCoilSATSensor;
434 : Array1D<FaultsManager::FaultPropertiesBoilerFouling> FaultsBoilerFouling;
435 : Array1D<FaultsManager::FaultPropertiesChillerFouling> FaultsChillerFouling;
436 : Array1D<FaultsManager::FaultPropertiesEvapCoolerFouling> FaultsEvapCoolerFouling;
437 :
438 0 : void clear_state() override
439 : {
440 0 : RunFaultMgrOnceFlag = false;
441 0 : ErrorsFound = false;
442 0 : AnyFaultsInModel = false;
443 0 : NumFaults = 0;
444 0 : NumFaultyEconomizer = 0;
445 0 : NumFouledCoil = 0;
446 0 : NumFaultyThermostat = 0;
447 0 : NumFaultyHumidistat = 0;
448 0 : NumFaultyAirFilter = 0;
449 0 : NumFaultyChillerSWTSensor = 0;
450 0 : NumFaultyCondenserSWTSensor = 0;
451 0 : NumFaultyTowerFouling = 0;
452 0 : NumFaultyCoilSATSensor = 0;
453 :
454 0 : FaultsEconomizer.deallocate();
455 0 : FouledCoils.deallocate();
456 0 : FaultsThermostatOffset.deallocate();
457 0 : FaultsHumidistatOffset.deallocate();
458 0 : FaultsFouledAirFilters.deallocate();
459 0 : FaultsChillerSWTSensor.deallocate();
460 0 : FaultsCondenserSWTSensor.deallocate();
461 0 : FaultsTowerFouling.deallocate();
462 0 : FaultsCoilSATSensor.deallocate();
463 0 : }
464 : };
465 :
466 : } // namespace EnergyPlus
467 :
468 : #endif
|