LCOV - code coverage report
Current view: top level - EnergyPlus - FaultsManager.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 476 984 48.4 %
Date: 2023-01-17 19:17:23 Functions: 10 10 100.0 %

          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/Boilers.hh>
      50             : #include <EnergyPlus/ChillerAbsorption.hh>
      51             : #include <EnergyPlus/ChillerElectricEIR.hh>
      52             : #include <EnergyPlus/ChillerIndirectAbsorption.hh>
      53             : #include <EnergyPlus/ChillerReformulatedEIR.hh>
      54             : #include <EnergyPlus/CondenserLoopTowers.hh>
      55             : #include <EnergyPlus/CurveManager.hh>
      56             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      57             : #include <EnergyPlus/DataIPShortCuts.hh>
      58             : #include <EnergyPlus/EvaporativeCoolers.hh>
      59             : #include <EnergyPlus/Fans.hh>
      60             : #include <EnergyPlus/FaultsManager.hh>
      61             : #include <EnergyPlus/HVACControllers.hh>
      62             : #include <EnergyPlus/HVACDXHeatPumpSystem.hh>
      63             : #include <EnergyPlus/HeatingCoils.hh>
      64             : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      65             : #include <EnergyPlus/PlantChillers.hh>
      66             : #include <EnergyPlus/ScheduleManager.hh>
      67             : #include <EnergyPlus/SteamCoils.hh>
      68             : #include <EnergyPlus/UtilityRoutines.hh>
      69             : #include <EnergyPlus/WaterCoils.hh>
      70             : 
      71             : namespace EnergyPlus {
      72             : 
      73             : namespace FaultsManager {
      74             : 
      75             :     // MODULE INFORMATION:
      76             :     //       AUTHOR         Tianzhen Hong, LBNL
      77             :     //       DATE WRITTEN   August 2013
      78             :     //       MODIFIED       Sep. 2013, Xiufeng Pang (XP), LBNL. Added Fouling Coil fault
      79             :     //                      Feb. 2015, Rongpeng Zhang, LBNL. Added Thermostat/Humidistat Offset faults
      80             :     //                      Apr. 2015, Rongpeng Zhang, LBNL. Added Fouling Air Filter fault
      81             :     //                      May. 2016, Rongpeng Zhang, LBNL. Added Chiller/Condenser Supply Water Temperature Sensor fault
      82             :     //                      Jun. 2016, Rongpeng Zhang, LBNL. Added Tower Scaling fault
      83             :     //                      Jul. 2016, Rongpeng Zhang, LBNL. Added Coil Supply Air Temperature Sensor fault
      84             :     //                      Oct. 2016, Rongpeng Zhang, LBNL. Added Fouling Boiler fault
      85             :     //                      Nov. 2016, Rongpeng Zhang, LBNL. Added Fouling Chiller fault
      86             :     //                      Jan. 2017, Rongpeng Zhang, LBNL. Added Fouling Evaporative Cooler fault
      87             :     //       RE-ENGINEERED
      88             : 
      89             :     // PURPOSE OF THIS MODULE:
      90             :     // This module manages operational faults of buildings and systems.
      91             : 
      92             :     // METHODOLOGY EMPLOYED:
      93             :     //  Various methods are employed depending types of faults
      94             : 
      95             :     // USE STATEMENTS:
      96             : 
      97             :     // Using/Aliasing
      98             :     // Data
      99             :     // MODULE PARAMETER DEFINITIONS
     100             : 
     101             :     // DERIVED TYPE DEFINITIONS:
     102             : 
     103             :     // MODULE VARIABLE TYPE DECLARATIONS:
     104             : 
     105             :     namespace {
     106             :         // These were static variables within different functions. They were pulled out into the namespace
     107             :         // to facilitate easier unit testing of those functions.
     108             :         // These are purposefully not in the header file as an extern variable. No one outside of this module should
     109             :         // use these. They are cleared by clear_state() for use by unit tests, but normal simulations should be unaffected.
     110             :         // This is purposefully in an anonymous namespace so nothing outside this implementation file can use it.
     111             : 
     112             :     } // namespace
     113             : 
     114             :     // FaultTypeEnum
     115             : 
     116             :     // Types of faults under Group Operational Faults in IDD
     117             :     //  1. Temperature sensor offset (FY14)
     118             :     //  2. Humidity sensor offset (FY14)
     119             :     //  3. Enthalpy sensor offset (FY14)
     120             :     //  4. Fouling coils (FY14)
     121             :     //  5. Thermostat offset (FY15)
     122             :     //  6. Humidistat offset (FY15)
     123             :     //  7. Fouling air filter (FY15)
     124             :     //  8. Chiller Supply Water Temperature Sensor Offset (FY16)
     125             :     //  9. Condenser Supply Water Temperature Sensor Offset (FY16)
     126             :     //  10. Cooling Tower Scaling (FY16)
     127             :     //  11. Coil Supply Air Temperature Sensor Offset (FY16)
     128             :     // coming ...
     129             :     //  Fouling: chillers, boilers, cooling towers
     130             :     //  Damper leakage: return air, outdoor air
     131             :     //  Blockage: pipe
     132             :     //  Meter: air flow, water flow
     133             :     //  CO2 sensor
     134             :     //  Pressure sensor offset
     135             :     //  more
     136             : 
     137         771 :     Array1D_string const cFaults({0, 15},
     138             :                                  {"FaultModel:TemperatureSensorOffset:OutdoorAir",
     139             :                                   "FaultModel:HumiditySensorOffset:OutdoorAir",
     140             :                                   "FaultModel:EnthalpySensorOffset:OutdoorAir",
     141             :                                   "FaultModel:TemperatureSensorOffset:ReturnAir",
     142             :                                   "FaultModel:EnthalpySensorOffset:ReturnAir",
     143             :                                   "FaultModel:Fouling:Coil",
     144             :                                   "FaultModel:ThermostatOffset",
     145             :                                   "FaultModel:HumidistatOffset",
     146             :                                   "FaultModel:Fouling:AirFilter",
     147             :                                   "FaultModel:TemperatureSensorOffset:ChillerSupplyWater",
     148             :                                   "FaultModel:TemperatureSensorOffset:CondenserSupplyWater",
     149             :                                   "FaultModel:Fouling:CoolingTower",
     150             :                                   "FaultModel:TemperatureSensorOffset:CoilSupplyAir",
     151             :                                   "FaultModel:Fouling:Boiler",
     152             :                                   "FaultModel:Fouling:Chiller",
     153         771 :                                   "FaultModel:Fouling:EvaporativeCooler"});
     154             :     //      'FaultModel:PressureSensorOffset:OutdoorAir   ', &
     155             :     //      'FaultModel:TemperatureSensorOffset:SupplyAir ', &
     156             :     //      'FaultModel:TemperatureSensorOffset:ZoneAir   ', &
     157             :     //      'FaultModel:Blockage:Branch                   ', &
     158             :     //      'FaultModel:Fouling:Chiller                   ', &
     159             :     //      'FaultModel:Fouling:Boiler                    ', &
     160             :     //      'FaultModel:DamperLeakage:ReturnAir           ', &
     161             :     //      'FaultModel:DamperLeakage:OutdoorAir          ' /)
     162             : 
     163             :     enum class ChillerType
     164             :     {
     165             :         Invalid = -1,
     166             :         ChillerElectric,
     167             :         ChillerElectricEIR,
     168             :         ChillerElectricReformulatedEIR,
     169             :         ChillerConstantCOP,
     170             :         ChillerEngineDriven,
     171             :         ChillerCombustionTurbine,
     172             :         ChillerAbsorption,
     173             :         ChillerAbsorptionIndirect,
     174             :         Num
     175             :     };
     176             : 
     177             :     enum class CoilType
     178             :     {
     179             :         Invalid = -1,
     180             :         CoilHeatingElectric,
     181             :         CoilHeatingFuel,
     182             :         CoilHeatingDesuperheater,
     183             :         CoilHeatingSteam,
     184             :         CoilHeatingWater,
     185             :         CoilCoolingWater,
     186             :         CoilCoolingWaterDetailedgeometry,
     187             :         CoilSystemCoolingDX,
     188             :         CoilSystemHeatingDX,
     189             :         AirLoopHVACUnitarySystem,
     190             :         Num
     191             :     };
     192             : 
     193             :     constexpr std::array<std::string_view, static_cast<int>(ChillerType::Num)> ChillerTypeNamesUC{"CHILLER:ELECTRIC",
     194             :                                                                                                   "CHILLER:ELECTRIC:EIR",
     195             :                                                                                                   "CHILLER:ELECTRIC:REFORMULATEDEIR",
     196             :                                                                                                   "CHILLER:CONSTANTCOP",
     197             :                                                                                                   "CHILLER:ENGINEDRIVEN",
     198             :                                                                                                   "CHILLER:COMBUSTIONTURBINE",
     199             :                                                                                                   "CHILLER:ABSORPTION",
     200             :                                                                                                   "CHILLER:ABSORPTION:INDIRECT"};
     201             : 
     202             :     constexpr std::array<std::string_view, static_cast<int>(CoilType::Num)> CoilTypeNamesUC{"COIL:HEATING:ELECTRIC",
     203             :                                                                                             "COIL:HEATING:FUEL",
     204             :                                                                                             "COIL:HEATING:DESUPERHEATER",
     205             :                                                                                             "COIL:HEATING:STEAM",
     206             :                                                                                             "COIL:HEATING:WATER",
     207             :                                                                                             "COIL:COOLING:WATER",
     208             :                                                                                             "COIL:COOLING:WATER:DETAILEDGEOMETRY",
     209             :                                                                                             "COILSYSTEM:COOLING:DX",
     210             :                                                                                             "COILSYSTEM:HEATING:DX",
     211             :                                                                                             "AIRLOOPHVAC:UNITARYSYSTEM"};
     212             : 
     213             :     constexpr std::array<std::string_view, static_cast<int>(FouledCoil::Num)> FouledCoilNamesUC{"FOULEDUARATED", "FOULINGFACTOR"};
     214             : 
     215        1162 :     void CheckAndReadFaults(EnergyPlusData &state)
     216             :     {
     217             : 
     218             :         // SUBROUTINE INFORMATION:
     219             :         //       AUTHOR         Tianzhen Hong, LBNL
     220             :         //       DATE WRITTEN   August 2013
     221             :         //       MODIFIED       Sep. 2013, Xiufeng Pang (XP), LBNL. Added Fouling Coil fault
     222             :         //                      Feb. 2015, Rongpeng Zhang, LBNL. Added Thermostat/Humidistat Offset faults
     223             :         //                      Apr. 2015, Rongpeng Zhang, LBNL. Added Fouling Air Filter fault
     224             :         //                      May. 2016, Rongpeng Zhang, LBNL. Added Chiller/Condenser Supply Water Temperature Sensor fault
     225             :         //                      Jun. 2016, Rongpeng Zhang, LBNL. Added Tower Scaling fault
     226             :         //                      Jul. 2016, Rongpeng Zhang, LBNL. Added Coil Supply Air Temperature Sensor fault
     227             :         //                      Oct. 2016, Rongpeng Zhang, LBNL. Added Fouling Boiler fault
     228             :         //                      Nov. 2016, Rongpeng Zhang, LBNL. Added Fouling Chiller fault
     229             :         //                      Jan. 2017, Rongpeng Zhang, LBNL. Added Fouling Evaporative Cooler fault
     230             :         //
     231             :         //       RE-ENGINEERED
     232             : 
     233             :         // PURPOSE OF THIS SUBROUTINE:
     234             :         //  1. Determine if any operational faults are present in a model and set flags
     235             :         //  2. Read faults input
     236             : 
     237             :         // METHODOLOGY EMPLOYED:
     238             :         // Get number of faults-related input objects and assign faults input to data structure
     239             : 
     240             :         // Using/Aliasing
     241             :         using Curve::GetCurveIndex;
     242             :         using ScheduleManager::GetScheduleIndex;
     243             : 
     244             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     245             :         int NumAlphas;  // Number of Alphas for each GetobjectItem call
     246             :         int NumNumbers; // Number of Numbers for each GetobjectItem call
     247             :         int IOStatus;
     248        1174 :         Array1D_string cAlphaArgs(10); // Alpha input items for object
     249        1174 :         Array1D_bool lAlphaFieldBlanks(10, false);
     250        1174 :         Array1D_bool lNumericFieldBlanks(10, false);
     251        1174 :         Array1D_string cAlphaFieldNames(10);
     252        1174 :         Array1D_string cNumericFieldNames(10);
     253        1174 :         Array1D<Real64> rNumericArgs(10); // Numeric input items for object
     254        1174 :         std::string cFaultCurrentObject;
     255             : 
     256        1162 :         if (state.dataFaultsMgr->RunFaultMgrOnceFlag) return;
     257             : 
     258             :         // check number of faults
     259         769 :         state.dataFaultsMgr->NumFaults = 0;
     260         769 :         state.dataFaultsMgr->NumFaultyEconomizer = 0;
     261       13073 :         for (int NumFaultsTemp = 0, i = 0; i <= 15; ++i) {
     262       12304 :             NumFaultsTemp = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cFaults(i));
     263       12304 :             state.dataFaultsMgr->NumFaults += NumFaultsTemp;
     264             : 
     265       12304 :             if (i <= 4) {
     266             :                 // 1st-5th fault: economizer sensor offset
     267        3845 :                 state.dataFaultsMgr->NumFaultyEconomizer += NumFaultsTemp;
     268        8459 :             } else if (i == 5) {
     269             :                 // 6th fault: Coil fouling
     270         769 :                 state.dataFaultsMgr->NumFouledCoil = NumFaultsTemp;
     271        7690 :             } else if (i == 6) {
     272             :                 // 7th fault: Faulty thermostat
     273         769 :                 state.dataFaultsMgr->NumFaultyThermostat = NumFaultsTemp;
     274        6921 :             } else if (i == 7) {
     275             :                 // 8th fault: Faulty humidistat
     276         769 :                 state.dataFaultsMgr->NumFaultyHumidistat = NumFaultsTemp;
     277        6152 :             } else if (i == 8) {
     278             :                 // 9th fault: Fouled air filter
     279         769 :                 state.dataFaultsMgr->NumFaultyAirFilter = NumFaultsTemp;
     280        5383 :             } else if (i == 9) {
     281             :                 // 10th fault: Faulty Chillers Supply Water Temperature Sensor
     282         769 :                 state.dataFaultsMgr->NumFaultyChillerSWTSensor = NumFaultsTemp;
     283        4614 :             } else if (i == 10) {
     284             :                 // 11th fault: Faulty Condenser Supply Water Temperature Sensor
     285         769 :                 state.dataFaultsMgr->NumFaultyCondenserSWTSensor = NumFaultsTemp;
     286        3845 :             } else if (i == 11) {
     287             :                 // 12th fault: Faulty Towers with Scaling
     288         769 :                 state.dataFaultsMgr->NumFaultyTowerFouling = NumFaultsTemp;
     289        3076 :             } else if (i == 12) {
     290             :                 // 13th fault: Faulty Coil Supply Air Temperature Sensor
     291         769 :                 state.dataFaultsMgr->NumFaultyCoilSATSensor = NumFaultsTemp;
     292        2307 :             } else if (i == 13) {
     293             :                 // 14th fault: Faulty Boiler with Fouling
     294         769 :                 state.dataFaultsMgr->NumFaultyBoilerFouling = NumFaultsTemp;
     295        1538 :             } else if (i == 14) {
     296             :                 // 15th fault: Faulty Chiller with Fouling
     297         769 :                 state.dataFaultsMgr->NumFaultyChillerFouling = NumFaultsTemp;
     298         769 :             } else if (i == 15) {
     299             :                 // 16th fault: Faulty Evaporative Cooler with Fouling
     300         769 :                 state.dataFaultsMgr->NumFaultyEvapCoolerFouling = NumFaultsTemp;
     301             :             }
     302             :         }
     303             : 
     304         769 :         if (state.dataFaultsMgr->NumFaults > 0) {
     305          12 :             state.dataFaultsMgr->AnyFaultsInModel = true;
     306             :         } else {
     307         757 :             state.dataFaultsMgr->AnyFaultsInModel = false;
     308             :         }
     309             : 
     310         769 :         if (!state.dataFaultsMgr->AnyFaultsInModel) {
     311         757 :             state.dataFaultsMgr->RunFaultMgrOnceFlag = true;
     312         757 :             return;
     313             :         }
     314             : 
     315             :         // allocate fault array
     316          12 :         if (state.dataFaultsMgr->NumFaultyEconomizer > 0) state.dataFaultsMgr->FaultsEconomizer.allocate(state.dataFaultsMgr->NumFaultyEconomizer);
     317          12 :         if (state.dataFaultsMgr->NumFouledCoil > 0) state.dataFaultsMgr->FouledCoils.allocate(state.dataFaultsMgr->NumFouledCoil);
     318          12 :         if (state.dataFaultsMgr->NumFaultyThermostat > 0)
     319           2 :             state.dataFaultsMgr->FaultsThermostatOffset.allocate(state.dataFaultsMgr->NumFaultyThermostat);
     320          12 :         if (state.dataFaultsMgr->NumFaultyHumidistat > 0)
     321           2 :             state.dataFaultsMgr->FaultsHumidistatOffset.allocate(state.dataFaultsMgr->NumFaultyHumidistat);
     322          12 :         if (state.dataFaultsMgr->NumFaultyAirFilter > 0)
     323           1 :             state.dataFaultsMgr->FaultsFouledAirFilters.allocate(state.dataFaultsMgr->NumFaultyAirFilter);
     324          12 :         if (state.dataFaultsMgr->NumFaultyChillerSWTSensor > 0)
     325           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor.allocate(state.dataFaultsMgr->NumFaultyChillerSWTSensor);
     326          12 :         if (state.dataFaultsMgr->NumFaultyCondenserSWTSensor > 0)
     327           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor.allocate(state.dataFaultsMgr->NumFaultyCondenserSWTSensor);
     328          12 :         if (state.dataFaultsMgr->NumFaultyTowerFouling > 0)
     329           1 :             state.dataFaultsMgr->FaultsTowerFouling.allocate(state.dataFaultsMgr->NumFaultyTowerFouling);
     330          12 :         if (state.dataFaultsMgr->NumFaultyCoilSATSensor > 0)
     331           1 :             state.dataFaultsMgr->FaultsCoilSATSensor.allocate(state.dataFaultsMgr->NumFaultyCoilSATSensor);
     332          12 :         if (state.dataFaultsMgr->NumFaultyBoilerFouling > 0)
     333           1 :             state.dataFaultsMgr->FaultsBoilerFouling.allocate(state.dataFaultsMgr->NumFaultyBoilerFouling);
     334          12 :         if (state.dataFaultsMgr->NumFaultyChillerFouling > 0)
     335           1 :             state.dataFaultsMgr->FaultsChillerFouling.allocate(state.dataFaultsMgr->NumFaultyChillerFouling);
     336          12 :         if (state.dataFaultsMgr->NumFaultyEvapCoolerFouling > 0)
     337           1 :             state.dataFaultsMgr->FaultsEvapCoolerFouling.allocate(state.dataFaultsMgr->NumFaultyEvapCoolerFouling);
     338             : 
     339             :         // read faults input of Evaporative Cooler Fouling
     340          14 :         for (int jFault_EvapCoolerFouling = 1; jFault_EvapCoolerFouling <= state.dataFaultsMgr->NumFaultyEvapCoolerFouling;
     341             :              ++jFault_EvapCoolerFouling) {
     342             : 
     343           2 :             cFaultCurrentObject = cFaults(15); // fault object string
     344           2 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     345             :                                                                      cFaultCurrentObject,
     346             :                                                                      jFault_EvapCoolerFouling,
     347             :                                                                      cAlphaArgs,
     348             :                                                                      NumAlphas,
     349             :                                                                      rNumericArgs,
     350             :                                                                      NumNumbers,
     351             :                                                                      IOStatus,
     352             :                                                                      lNumericFieldBlanks,
     353             :                                                                      lAlphaFieldBlanks,
     354             :                                                                      cAlphaFieldNames,
     355             :                                                                      cNumericFieldNames);
     356             : 
     357           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).FaultType = cFaultCurrentObject;
     358           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).FaultTypeEnum = Fault::Fouling_EvapCooler;
     359           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).Name = cAlphaArgs(1);
     360             : 
     361             :             // Fault availability schedule
     362           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).AvaiSchedule = cAlphaArgs(2);
     363           2 :             if (lAlphaFieldBlanks(2)) {
     364           2 :                 state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).AvaiSchedPtr = -1; // returns schedule value of 1
     365             :             } else {
     366           0 :                 state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
     367           0 :                 if (state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).AvaiSchedPtr == 0) {
     368           0 :                     ShowSevereError(state,
     369           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) +
     370             :                                         "\" not found.");
     371           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     372             :                 }
     373             :             }
     374             : 
     375             :             // Fault severity schedule
     376           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).SeveritySchedule = cAlphaArgs(3);
     377           2 :             if (lAlphaFieldBlanks(3)) {
     378           2 :                 state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).SeveritySchedPtr = -1; // returns schedule value of 1
     379             :             } else {
     380           0 :                 state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
     381           0 :                 if (state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).SeveritySchedPtr == 0) {
     382           0 :                     ShowSevereError(state,
     383           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
     384             :                                         "\" not found.");
     385           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     386             :                 }
     387             :             }
     388             : 
     389             :             // CapReductionFactor - degree of fault
     390           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).FoulingFactor = rNumericArgs(1);
     391             : 
     392             :             // Evaporative cooler type
     393           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).EvapCoolerType = cAlphaArgs(4);
     394           2 :             if (lAlphaFieldBlanks(4)) {
     395           0 :                 ShowSevereError(state,
     396           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
     397             :                                     "\" blank.");
     398           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     399             :             }
     400             : 
     401             :             // Evaporative cooler name
     402           2 :             state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).EvapCoolerName = cAlphaArgs(5);
     403           2 :             if (lAlphaFieldBlanks(5)) {
     404           0 :                 ShowSevereError(state,
     405           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     406             :                                     "\" blank.");
     407           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     408             :             }
     409             : 
     410             :             // Evaporative cooler check
     411             : 
     412             :             int EvapCoolerNum;
     413             : 
     414           2 :             if (UtilityRoutines::SameString(state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).EvapCoolerType,
     415           2 :                                             "EvaporativeCooler:Indirect:WetCoil")) {
     416             :                 // Read in evaporative cooler is not done yet
     417           2 :                 if (state.dataEvapCoolers->GetInputEvapComponentsFlag) {
     418           0 :                     EvaporativeCoolers::GetEvapInput(state);
     419           0 :                     state.dataEvapCoolers->GetInputEvapComponentsFlag = false;
     420             :                 }
     421             : 
     422             :                 // Check whether the evaporative cooler  name and type match each other;
     423           2 :                 EvapCoolerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsEvapCoolerFouling(jFault_EvapCoolerFouling).EvapCoolerName,
     424           2 :                                                                 state.dataEvapCoolers->EvapCond,
     425             :                                                                 &EvaporativeCoolers::EvapConditions::Name);
     426           2 :                 if (EvapCoolerNum <= 0) {
     427           0 :                     ShowSevereError(state,
     428           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     429             :                                         "\" not found.");
     430           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     431             :                 } else {
     432             :                     // Link the boiler with the fault model
     433           2 :                     state.dataEvapCoolers->EvapCond(EvapCoolerNum).FaultyEvapCoolerFoulingFlag = true;
     434           2 :                     state.dataEvapCoolers->EvapCond(EvapCoolerNum).FaultyEvapCoolerFoulingIndex = jFault_EvapCoolerFouling;
     435             :                 }
     436             :             }
     437             :         }
     438             : 
     439             :         // read faults input of Chiller Fouling
     440          14 :         for (int jFault_ChillerFouling = 1; jFault_ChillerFouling <= state.dataFaultsMgr->NumFaultyChillerFouling; ++jFault_ChillerFouling) {
     441             : 
     442           2 :             cFaultCurrentObject = cFaults(14); // fault object string
     443           2 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     444             :                                                                      cFaultCurrentObject,
     445             :                                                                      jFault_ChillerFouling,
     446             :                                                                      cAlphaArgs,
     447             :                                                                      NumAlphas,
     448             :                                                                      rNumericArgs,
     449             :                                                                      NumNumbers,
     450             :                                                                      IOStatus,
     451             :                                                                      lNumericFieldBlanks,
     452             :                                                                      lAlphaFieldBlanks,
     453             :                                                                      cAlphaFieldNames,
     454             :                                                                      cNumericFieldNames);
     455             : 
     456           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).FaultType = cFaultCurrentObject;
     457           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).FaultTypeEnum = Fault::Fouling_Chiller;
     458           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).Name = cAlphaArgs(1);
     459             : 
     460             :             // Fault availability schedule
     461           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).AvaiSchedule = cAlphaArgs(2);
     462           2 :             if (lAlphaFieldBlanks(2)) {
     463           2 :                 state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).AvaiSchedPtr = -1; // returns schedule value of 1
     464             :             } else {
     465           0 :                 state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
     466           0 :                 if (state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).AvaiSchedPtr == 0) {
     467           0 :                     ShowSevereError(state,
     468           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) +
     469             :                                         "\" not found.");
     470           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     471             :                 }
     472             :             }
     473             : 
     474             :             // Fault severity schedule
     475           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).SeveritySchedule = cAlphaArgs(3);
     476           2 :             if (lAlphaFieldBlanks(3)) {
     477           2 :                 state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).SeveritySchedPtr = -1; // returns schedule value of 1
     478             :             } else {
     479           0 :                 state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
     480           0 :                 if (state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).SeveritySchedPtr == 0) {
     481           0 :                     ShowSevereError(state,
     482           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
     483             :                                         "\" not found.");
     484           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     485             :                 }
     486             :             }
     487             : 
     488             :             // CapReductionFactor - degree of fault
     489           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).FoulingFactor = rNumericArgs(1);
     490             : 
     491             :             // Chiller type
     492           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerType = cAlphaArgs(4);
     493           2 :             if (lAlphaFieldBlanks(4)) {
     494           0 :                 ShowSevereError(state,
     495           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
     496             :                                     "\" blank.");
     497           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     498             :             }
     499             : 
     500             :             // Chiller name
     501           2 :             state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerName = cAlphaArgs(5);
     502           2 :             if (lAlphaFieldBlanks(5)) {
     503           0 :                 ShowSevereError(state,
     504           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     505             :                                     "\" blank.");
     506           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     507             :             }
     508             : 
     509             :             // Chiller check
     510             :             int ChillerNum;
     511           4 :             ChillerType ChillerTypeCheck = static_cast<ChillerType>(getEnumerationValue(
     512           6 :                 ChillerTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerType)));
     513           2 :             switch (ChillerTypeCheck) {
     514           0 :             case ChillerType::ChillerElectric: {
     515             :                 // Check whether the chiller name and chiller type match each other
     516           0 :                 ChillerNum = 0;
     517           0 :                 int thisChil = 0;
     518           0 :                 for (auto &ch : state.dataPlantChillers->ElectricChiller) {
     519           0 :                     thisChil++;
     520           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerName) {
     521           0 :                         ChillerNum = thisChil;
     522             :                     }
     523             :                 }
     524           0 :                 if (ChillerNum <= 0) {
     525           0 :                     ShowSevereError(state,
     526           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     527             :                                         "\" not found.");
     528           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     529             :                 } else {
     530             : 
     531           0 :                     if (state.dataPlantChillers->ElectricChiller(ChillerNum).CondenserType != DataPlant::CondenserType::WaterCooled) {
     532             :                         // The fault model is only applicable to the chillers with water based condensers
     533           0 :                         ShowWarningError(state,
     534           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     535           0 :                                              cAlphaArgs(5) +
     536             :                                              "\". The specified chiller is not water cooled. The chiller fouling fault model will not be applied.");
     537             : 
     538             :                     } else {
     539             :                         // Link the chiller with the fault model
     540           0 :                         state.dataPlantChillers->ElectricChiller(ChillerNum).FaultyChillerFoulingFlag = true;
     541           0 :                         state.dataPlantChillers->ElectricChiller(ChillerNum).FaultyChillerFoulingIndex = jFault_ChillerFouling;
     542             :                     }
     543             :                 }
     544           0 :             } break;
     545           0 :             case ChillerType::ChillerElectricEIR: {
     546             :                 // Read in chiller if not done yet
     547           0 :                 if (state.dataChillerElectricEIR->getInputFlag) {
     548           0 :                     ChillerElectricEIR::GetElectricEIRChillerInput(state);
     549           0 :                     state.dataChillerElectricEIR->getInputFlag = false;
     550             :                 }
     551             : 
     552             :                 // Check whether the chiller name and chiller type match each other
     553           0 :                 ChillerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerName,
     554           0 :                                                              state.dataChillerElectricEIR->ElectricEIRChiller);
     555           0 :                 if (ChillerNum <= 0) {
     556           0 :                     ShowSevereError(state,
     557           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     558             :                                         "\" not found.");
     559           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     560             :                 } else {
     561             : 
     562           0 :                     if (state.dataChillerElectricEIR->ElectricEIRChiller(ChillerNum).CondenserType != DataPlant::CondenserType::WaterCooled) {
     563             :                         // The fault model is only applicable to the chillers with water based condensers
     564           0 :                         ShowWarningError(state,
     565           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     566           0 :                                              cAlphaArgs(5) +
     567             :                                              "\". The specified chiller is not water cooled. The chiller fouling fault model will not be applied.");
     568             : 
     569             :                     } else {
     570             :                         // Link the chiller with the fault model
     571           0 :                         state.dataChillerElectricEIR->ElectricEIRChiller(ChillerNum).FaultyChillerFoulingFlag = true;
     572           0 :                         state.dataChillerElectricEIR->ElectricEIRChiller(ChillerNum).FaultyChillerFoulingIndex = jFault_ChillerFouling;
     573             :                     }
     574             :                 }
     575           0 :             } break;
     576           2 :             case ChillerType::ChillerElectricReformulatedEIR: {
     577             :                 // Read in chiller if not done yet
     578           2 :                 if (state.dataChillerReformulatedEIR->GetInputREIR) {
     579           0 :                     ChillerReformulatedEIR::GetElecReformEIRChillerInput(state);
     580           0 :                     state.dataChillerReformulatedEIR->GetInputREIR = false;
     581             :                 }
     582             : 
     583             :                 // Check whether the chiller name and chiller type match each other
     584           2 :                 ChillerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerName,
     585           2 :                                                              state.dataChillerReformulatedEIR->ElecReformEIRChiller);
     586           2 :                 if (ChillerNum <= 0) {
     587           0 :                     ShowSevereError(state,
     588           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     589             :                                         "\" not found.");
     590           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     591             :                 } else {
     592             : 
     593           2 :                     if (state.dataChillerReformulatedEIR->ElecReformEIRChiller(ChillerNum).CondenserType != DataPlant::CondenserType::WaterCooled) {
     594             :                         // The fault model is only applicable to the chillers with water based condensers
     595           0 :                         ShowWarningError(state,
     596           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     597           0 :                                              cAlphaArgs(5) +
     598             :                                              "\". The specified chiller is not water cooled. The chiller fouling fault model will not be applied.");
     599             : 
     600             :                     } else {
     601             :                         // Link the chiller with the fault model
     602           2 :                         state.dataChillerReformulatedEIR->ElecReformEIRChiller(ChillerNum).FaultyChillerFoulingFlag = true;
     603           2 :                         state.dataChillerReformulatedEIR->ElecReformEIRChiller(ChillerNum).FaultyChillerFoulingIndex = jFault_ChillerFouling;
     604             :                     }
     605             :                 }
     606           2 :             } break;
     607           0 :             case ChillerType::ChillerConstantCOP: {
     608             :                 // Check whether the chiller name and chiller type match each other
     609           0 :                 ChillerNum = 0;
     610           0 :                 int thisChil = 0;
     611           0 :                 for (auto &ch : state.dataPlantChillers->ConstCOPChiller) {
     612           0 :                     thisChil++;
     613           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerName) {
     614           0 :                         ChillerNum = thisChil;
     615             :                     }
     616             :                 }
     617           0 :                 if (ChillerNum <= 0) {
     618           0 :                     ShowSevereError(state,
     619           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     620             :                                         "\" not found.");
     621           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     622             :                 } else {
     623             : 
     624           0 :                     if (state.dataPlantChillers->ConstCOPChiller(ChillerNum).CondenserType != DataPlant::CondenserType::WaterCooled) {
     625             :                         // The fault model is only applicable to the chillers with water based condensers
     626           0 :                         ShowWarningError(state,
     627           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     628           0 :                                              cAlphaArgs(5) +
     629             :                                              "\". The specified chiller is not water cooled. The chiller fouling fault model will not be applied.");
     630             : 
     631             :                     } else {
     632             :                         // Link the chiller with the fault model
     633           0 :                         state.dataPlantChillers->ConstCOPChiller(ChillerNum).FaultyChillerFoulingFlag = true;
     634           0 :                         state.dataPlantChillers->ConstCOPChiller(ChillerNum).FaultyChillerFoulingIndex = jFault_ChillerFouling;
     635             :                     }
     636             :                 }
     637           0 :             } break;
     638           0 :             case ChillerType::ChillerEngineDriven: {
     639             :                 // Check whether the chiller name and chiller type match each other
     640           0 :                 ChillerNum = 0;
     641           0 :                 int thisChil = 0;
     642           0 :                 for (auto &ch : state.dataPlantChillers->EngineDrivenChiller) {
     643           0 :                     thisChil++;
     644           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerName) {
     645           0 :                         ChillerNum = thisChil;
     646             :                     }
     647             :                 }
     648           0 :                 if (ChillerNum <= 0) {
     649           0 :                     ShowSevereError(state,
     650           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     651             :                                         "\" not found.");
     652           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     653             :                 } else {
     654             : 
     655           0 :                     if (state.dataPlantChillers->EngineDrivenChiller(ChillerNum).CondenserType != DataPlant::CondenserType::WaterCooled) {
     656             :                         // The fault model is only applicable to the chillers with water based condensers
     657           0 :                         ShowWarningError(state,
     658           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     659           0 :                                              cAlphaArgs(5) +
     660             :                                              "\". The specified chiller is not water cooled. The chiller fouling fault model will not be applied.");
     661             : 
     662             :                     } else {
     663             :                         // Link the fault model with the water cooled chiller
     664           0 :                         state.dataPlantChillers->EngineDrivenChiller(ChillerNum).FaultyChillerFoulingFlag = true;
     665           0 :                         state.dataPlantChillers->EngineDrivenChiller(ChillerNum).FaultyChillerFoulingIndex = jFault_ChillerFouling;
     666             :                     }
     667             :                 }
     668           0 :             } break;
     669           0 :             case ChillerType::ChillerCombustionTurbine: {
     670             :                 // Check whether the chiller name and chiller type match each other
     671           0 :                 ChillerNum = 0;
     672           0 :                 int thisChil = 0;
     673           0 :                 for (auto &ch : state.dataPlantChillers->GTChiller) {
     674           0 :                     thisChil++;
     675           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerFouling(jFault_ChillerFouling).ChillerName) {
     676           0 :                         ChillerNum = thisChil;
     677             :                     }
     678             :                 }
     679           0 :                 if (ChillerNum <= 0) {
     680           0 :                     ShowSevereError(state,
     681           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     682             :                                         "\" not found.");
     683           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     684             :                 } else {
     685           0 :                     if (state.dataPlantChillers->GTChiller(ChillerNum).CondenserType != DataPlant::CondenserType::WaterCooled) {
     686             :                         // The fault model is only applicable to the chillers with water based condensers
     687           0 :                         ShowWarningError(state,
     688           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     689           0 :                                              cAlphaArgs(5) +
     690             :                                              "\". The specified chiller is not water cooled. The chiller fouling fault model will not be applied.");
     691             : 
     692             :                     } else {
     693             :                         // Link the fault model with the water cooled chiller
     694           0 :                         state.dataPlantChillers->GTChiller(ChillerNum).FaultyChillerFoulingFlag = true;
     695           0 :                         state.dataPlantChillers->GTChiller(ChillerNum).FaultyChillerFoulingIndex = jFault_ChillerFouling;
     696             :                     }
     697             :                 }
     698           0 :             } break;
     699           0 :             default:
     700           0 :                 break;
     701             :             }
     702             :         }
     703             : 
     704             :         // read faults input of Boiler Fouling
     705          13 :         for (int jFault_BoilerFouling = 1; jFault_BoilerFouling <= state.dataFaultsMgr->NumFaultyBoilerFouling; ++jFault_BoilerFouling) {
     706             : 
     707           1 :             cFaultCurrentObject = cFaults(13); // fault object string
     708           1 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     709             :                                                                      cFaultCurrentObject,
     710             :                                                                      jFault_BoilerFouling,
     711             :                                                                      cAlphaArgs,
     712             :                                                                      NumAlphas,
     713             :                                                                      rNumericArgs,
     714             :                                                                      NumNumbers,
     715             :                                                                      IOStatus,
     716             :                                                                      lNumericFieldBlanks,
     717             :                                                                      lAlphaFieldBlanks,
     718             :                                                                      cAlphaFieldNames,
     719             :                                                                      cNumericFieldNames);
     720             : 
     721           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).FaultType = cFaultCurrentObject;
     722           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).FaultTypeEnum = Fault::Fouling_Boiler;
     723           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).Name = cAlphaArgs(1);
     724             : 
     725             :             // Fault availability schedule
     726           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).AvaiSchedule = cAlphaArgs(2);
     727           1 :             if (lAlphaFieldBlanks(2)) {
     728           1 :                 state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).AvaiSchedPtr = -1; // returns schedule value of 1
     729             :             } else {
     730           0 :                 state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
     731           0 :                 if (state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).AvaiSchedPtr == 0) {
     732           0 :                     ShowSevereError(state,
     733           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) +
     734             :                                         "\" not found.");
     735           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     736             :                 }
     737             :             }
     738             : 
     739             :             // Fault severity schedule
     740           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).SeveritySchedule = cAlphaArgs(3);
     741           1 :             if (lAlphaFieldBlanks(3)) {
     742           1 :                 state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).SeveritySchedPtr = -1; // returns schedule value of 1
     743             :             } else {
     744           0 :                 state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
     745           0 :                 if (state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).SeveritySchedPtr == 0) {
     746           0 :                     ShowSevereError(state,
     747           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
     748             :                                         "\" not found.");
     749           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     750             :                 }
     751             :             }
     752             : 
     753             :             // CapReductionFactor - degree of fault
     754           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).FoulingFactor = rNumericArgs(1);
     755             : 
     756             :             // Boiler type
     757           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).BoilerType = cAlphaArgs(4);
     758           1 :             if (lAlphaFieldBlanks(4)) {
     759           0 :                 ShowSevereError(state,
     760           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
     761             :                                     "\" blank.");
     762           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     763             :             }
     764             : 
     765             :             // Boiler name
     766           1 :             state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).BoilerName = cAlphaArgs(5);
     767           1 :             if (lAlphaFieldBlanks(5)) {
     768           0 :                 ShowSevereError(state,
     769           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     770             :                                     "\" blank.");
     771           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     772             :             }
     773             : 
     774             :             // Boiler check and link
     775             :             {
     776           1 :                 if (state.dataBoilers->getBoilerInputFlag) {
     777           0 :                     Boilers::GetBoilerInput(state);
     778           0 :                     state.dataBoilers->getBoilerInputFlag = false;
     779             :                 }
     780             :                 // Check the boiler name and boiler type
     781           1 :                 int BoilerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsBoilerFouling(jFault_BoilerFouling).BoilerName,
     782           2 :                                                                 state.dataBoilers->Boiler);
     783           1 :                 if (BoilerNum <= 0) {
     784           0 :                     ShowSevereError(state,
     785           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     786             :                                         "\" not found.");
     787           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     788             :                 } else {
     789             :                     // Link the boiler with the fault model
     790           1 :                     state.dataBoilers->Boiler(BoilerNum).FaultyBoilerFoulingFlag = true;
     791           1 :                     state.dataBoilers->Boiler(BoilerNum).FaultyBoilerFoulingIndex = jFault_BoilerFouling;
     792             :                 }
     793             :             }
     794             :         }
     795             : 
     796             :         // read faults input of Coil SAT Sensor Offset
     797          13 :         for (int jFault_CoilSAT = 1; jFault_CoilSAT <= state.dataFaultsMgr->NumFaultyCoilSATSensor; ++jFault_CoilSAT) {
     798             : 
     799           1 :             cFaultCurrentObject = cFaults(12); // fault object string
     800           1 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     801             :                                                                      cFaultCurrentObject,
     802             :                                                                      jFault_CoilSAT,
     803             :                                                                      cAlphaArgs,
     804             :                                                                      NumAlphas,
     805             :                                                                      rNumericArgs,
     806             :                                                                      NumNumbers,
     807             :                                                                      IOStatus,
     808             :                                                                      lNumericFieldBlanks,
     809             :                                                                      lAlphaFieldBlanks,
     810             :                                                                      cAlphaFieldNames,
     811             :                                                                      cNumericFieldNames);
     812             : 
     813           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).FaultType = cFaultCurrentObject;
     814           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).FaultTypeEnum = Fault::TemperatureSensorOffset_CoilSupplyAir;
     815           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).Name = cAlphaArgs(1);
     816             : 
     817             :             // Fault availability schedule
     818           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).AvaiSchedule = cAlphaArgs(2);
     819           1 :             if (lAlphaFieldBlanks(2)) {
     820           1 :                 state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).AvaiSchedPtr = -1; // returns schedule value of 1
     821             :             } else {
     822           0 :                 state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
     823           0 :                 if (state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).AvaiSchedPtr == 0) {
     824           0 :                     ShowSevereError(state,
     825           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) +
     826             :                                         "\" not found.");
     827           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     828             :                 }
     829             :             }
     830             : 
     831             :             // Fault severity schedule
     832           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).SeveritySchedule = cAlphaArgs(3);
     833           1 :             if (lAlphaFieldBlanks(3)) {
     834           1 :                 state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).SeveritySchedPtr = -1; // returns schedule value of 1
     835             :             } else {
     836           0 :                 state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
     837           0 :                 if (state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).SeveritySchedPtr == 0) {
     838           0 :                     ShowSevereError(state,
     839           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
     840             :                                         "\" not found.");
     841           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     842             :                 }
     843             :             }
     844             : 
     845             :             // offset - degree of fault
     846           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).Offset = rNumericArgs(1);
     847             : 
     848             :             // Coil type
     849           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilType = cAlphaArgs(4);
     850           1 :             if (lAlphaFieldBlanks(4)) {
     851           0 :                 ShowSevereError(state,
     852           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
     853             :                                     "\" blank.");
     854           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     855             :             }
     856             : 
     857             :             // Coil name
     858           1 :             state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName = cAlphaArgs(5);
     859           1 :             if (lAlphaFieldBlanks(5)) {
     860           0 :                 ShowSevereError(state,
     861           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     862             :                                     "\" blank.");
     863           0 :                 state.dataFaultsMgr->ErrorsFound = true;
     864             :             }
     865             : 
     866             :             // Coil check and link
     867           2 :             CoilType CoilTypeCheck = static_cast<CoilType>(getEnumerationValue(
     868           3 :                 CoilTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilType)));
     869           1 :             switch (CoilTypeCheck) {
     870           0 :             case CoilType::CoilHeatingElectric:
     871             :             case CoilType::CoilHeatingFuel:
     872             :             case CoilType::CoilHeatingDesuperheater: {
     873             :                 // Read in coil input if not done yet
     874           0 :                 if (state.dataHeatingCoils->GetCoilsInputFlag) {
     875           0 :                     HeatingCoils::GetHeatingCoilInput(state);
     876           0 :                     state.dataHeatingCoils->GetCoilsInputFlag = false;
     877             :                 }
     878             :                 // Check the coil name and coil type
     879           0 :                 int CoilNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName,
     880           0 :                                                               state.dataHeatingCoils->HeatingCoil);
     881           0 :                 if (CoilNum <= 0) {
     882           0 :                     ShowSevereError(state,
     883           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     884             :                                         "\" not found.");
     885           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     886             :                 } else {
     887             :                     // Link the coil with the fault model
     888           0 :                     state.dataHeatingCoils->HeatingCoil(CoilNum).FaultyCoilSATFlag = true;
     889           0 :                     state.dataHeatingCoils->HeatingCoil(CoilNum).FaultyCoilSATIndex = jFault_CoilSAT;
     890             :                 }
     891           0 :             } break;
     892           0 :             case CoilType::CoilHeatingSteam: {
     893             :                 // Read in coil input if not done yet
     894           0 :                 if (state.dataSteamCoils->GetSteamCoilsInputFlag) {
     895           0 :                     SteamCoils::GetSteamCoilInput(state);
     896           0 :                     state.dataSteamCoils->GetSteamCoilsInputFlag = false;
     897             :                 }
     898             :                 // Check the coil name and coil type
     899           0 :                 int CoilNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName,
     900           0 :                                                               state.dataSteamCoils->SteamCoil);
     901           0 :                 if (CoilNum <= 0) {
     902           0 :                     ShowSevereError(state,
     903           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     904             :                                         "\" not found.");
     905           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     906             :                 } else {
     907             : 
     908           0 :                     if (state.dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil != SteamCoils::CoilControlType::TemperatureSetPoint) {
     909             :                         // The fault model is only applicable to the coils controlled on leaving air temperature
     910           0 :                         ShowWarningError(state,
     911           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     912           0 :                                              cAlphaArgs(5) +
     913             :                                              "\". The specified coil is not controlled on leaving air temperature. The coil SAT sensor fault model "
     914             :                                              "will not be applied.");
     915             :                     } else {
     916             :                         // Link the fault model with the coil that is controlled on leaving air temperature
     917           0 :                         state.dataSteamCoils->SteamCoil(CoilNum).FaultyCoilSATFlag = true;
     918           0 :                         state.dataSteamCoils->SteamCoil(CoilNum).FaultyCoilSATIndex = jFault_CoilSAT;
     919             :                     }
     920             :                 }
     921           0 :             } break;
     922           1 :             case CoilType::CoilHeatingWater:
     923             :             case CoilType::CoilCoolingWater:
     924             :             case CoilType::CoilCoolingWaterDetailedgeometry: {
     925             :                 // Read in coil input if not done yet
     926           1 :                 if (state.dataWaterCoils->GetWaterCoilsInputFlag) {
     927           0 :                     WaterCoils::GetWaterCoilInput(state);
     928           0 :                     state.dataWaterCoils->GetWaterCoilsInputFlag = false;
     929             :                 }
     930             :                 // Check the coil name and coil type
     931           1 :                 int CoilNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName,
     932           2 :                                                               state.dataWaterCoils->WaterCoil);
     933           1 :                 if (CoilNum <= 0) {
     934           0 :                     ShowSevereError(state,
     935           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
     936             :                                         "\" not found.");
     937           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     938             :                 }
     939             : 
     940             :                 // Read in Water Coil Controller Name
     941           1 :                 state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).WaterCoilControllerName = cAlphaArgs(6);
     942           1 :                 if (lAlphaFieldBlanks(6)) {
     943           0 :                     ShowSevereError(state,
     944           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(6) + " = \"" + cAlphaArgs(6) +
     945             :                                         "\" blank.");
     946           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     947             :                 }
     948             :                 // Read in controller input if not done yet
     949           1 :                 if (state.dataHVACControllers->GetControllerInputFlag) {
     950           0 :                     HVACControllers::GetControllerInput(state);
     951           0 :                     state.dataHVACControllers->GetControllerInputFlag = false;
     952             :                 }
     953             :                 // Check the controller name
     954           1 :                 int ControlNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).WaterCoilControllerName,
     955           1 :                                                                  state.dataHVACControllers->ControllerProps,
     956           1 :                                                                  &HVACControllers::ControllerPropsType::ControllerName);
     957           1 :                 if (ControlNum <= 0) {
     958           0 :                     ShowSevereError(state,
     959           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(6) + " = \"" + cAlphaArgs(6) +
     960             :                                         "\" not found.");
     961           0 :                     state.dataFaultsMgr->ErrorsFound = true;
     962             :                 } else {
     963             :                     // Link the controller with the fault model
     964           1 :                     state.dataHVACControllers->ControllerProps(ControlNum).FaultyCoilSATFlag = true;
     965           1 :                     state.dataHVACControllers->ControllerProps(ControlNum).FaultyCoilSATIndex = jFault_CoilSAT;
     966             : 
     967             :                     // Check whether the controller match the coil
     968           2 :                     if (state.dataHVACControllers->ControllerProps(ControlNum).SensedNode !=
     969           1 :                         state.dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum) {
     970           0 :                         ShowSevereError(state,
     971           0 :                                         cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(6) + " = \"" +
     972           0 :                                             cAlphaArgs(6) + "\" does not match " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5));
     973           0 :                         state.dataFaultsMgr->ErrorsFound = true;
     974             :                     }
     975             :                 }
     976           1 :             } break;
     977           0 :             case CoilType::CoilSystemCoolingDX: {
     978             :                 // see case CoilCheck::AirLoopHVACUnitarySystem: below
     979             :                 // UnitarySystem connects a different way. Make sure this works by testing a CoilSystem model.
     980             :                 // Read in DXCoolingSystem input if not done yet
     981             :                 // if (state.dataHVACDXSys->GetInputFlag) {
     982             :                 //    HVACDXSystem::GetDXCoolingSystemInput(state);
     983             :                 //    state.dataHVACDXSys->GetInputFlag = false;
     984             :                 //}
     985             : 
     986             :                 //// Check the coil name and coil type
     987             :                 // int CoilSysNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName,
     988             :                 //                                                 state.dataHVACDXSys->DXCoolingSystem);
     989             :                 // if (CoilSysNum <= 0) {
     990             :                 //    ShowSevereError(state,
     991             :                 //                    cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
     992             :                 //                        cAlphaArgs(5) + "\" not found.");
     993             :                 //    state.dataFaultsMgr->ErrorsFound = true;
     994             :                 //} else {
     995             :                 //    // Link the coil system with the fault model
     996             :                 //    state.dataHVACDXSys->DXCoolingSystem(CoilSysNum).FaultyCoilSATFlag = true;
     997             :                 //    state.dataHVACDXSys->DXCoolingSystem(CoilSysNum).FaultyCoilSATIndex = jFault_CoilSAT;
     998             :                 //}
     999           0 :             } break;
    1000           0 :             case CoilType::CoilSystemHeatingDX: {
    1001             :                 // Read in DXCoolingSystem input if not done yet
    1002           0 :                 if (state.dataHVACDXHeatPumpSys->GetInputFlag) {
    1003           0 :                     HVACDXHeatPumpSystem::GetDXHeatPumpSystemInput(state);
    1004           0 :                     state.dataHVACDXHeatPumpSys->GetInputFlag = false;
    1005             :                 }
    1006             : 
    1007             :                 // Check the coil name and coil type
    1008           0 :                 int CoilSysNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName,
    1009           0 :                                                                  state.dataHVACDXHeatPumpSys->DXHeatPumpSystem);
    1010           0 :                 if (CoilSysNum <= 0) {
    1011           0 :                     ShowSevereError(state,
    1012           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1013             :                                         "\" not found.");
    1014           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1015             :                 } else {
    1016             :                     // Link the coil system with the fault model
    1017           0 :                     state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(CoilSysNum).FaultyCoilSATFlag = true;
    1018           0 :                     state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(CoilSysNum).FaultyCoilSATIndex = jFault_CoilSAT;
    1019             :                 }
    1020           0 :             } break;
    1021           0 :             case CoilType::AirLoopHVACUnitarySystem: {
    1022             :                 // UnitarySystem model connects to FaultManager via function call to FaultsManager::SetFaultyCoilSATSensor
    1023           0 :             } break;
    1024           0 :             default:
    1025           0 :                 break;
    1026             :             }
    1027             :         } // End read faults input of Fault_type 113
    1028             : 
    1029             :         // read faults input of Cooling tower scaling
    1030          13 :         for (int jFault_TowerFouling = 1; jFault_TowerFouling <= state.dataFaultsMgr->NumFaultyTowerFouling; ++jFault_TowerFouling) {
    1031             : 
    1032           1 :             cFaultCurrentObject = cFaults(11); // fault object string
    1033           1 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1034             :                                                                      cFaultCurrentObject,
    1035             :                                                                      jFault_TowerFouling,
    1036             :                                                                      cAlphaArgs,
    1037             :                                                                      NumAlphas,
    1038             :                                                                      rNumericArgs,
    1039             :                                                                      NumNumbers,
    1040             :                                                                      IOStatus,
    1041             :                                                                      lNumericFieldBlanks,
    1042             :                                                                      lAlphaFieldBlanks,
    1043             :                                                                      cAlphaFieldNames,
    1044             :                                                                      cNumericFieldNames);
    1045             : 
    1046           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).FaultType = cFaultCurrentObject;
    1047           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).FaultTypeEnum = Fault::Fouling_Tower;
    1048           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).Name = cAlphaArgs(1);
    1049             : 
    1050             :             // Fault availability schedule
    1051           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).AvaiSchedule = cAlphaArgs(2);
    1052           1 :             if (lAlphaFieldBlanks(2)) {
    1053           1 :                 state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).AvaiSchedPtr = -1; // returns schedule value of 1
    1054             :             } else {
    1055           0 :                 state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
    1056           0 :                 if (state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).AvaiSchedPtr == 0) {
    1057           0 :                     ShowSevereError(state,
    1058           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) +
    1059             :                                         "\" not found.");
    1060           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1061             :                 }
    1062             :             }
    1063             : 
    1064             :             // Fault severity schedule
    1065           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).SeveritySchedule = cAlphaArgs(3);
    1066           1 :             if (lAlphaFieldBlanks(3)) {
    1067           1 :                 state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).SeveritySchedPtr = -1; // returns schedule value of 1
    1068             :             } else {
    1069           0 :                 state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
    1070           0 :                 if (state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).SeveritySchedPtr == 0) {
    1071           0 :                     ShowSevereError(state,
    1072           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
    1073             :                                         "\" not found.");
    1074           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1075             :                 }
    1076             :             }
    1077             : 
    1078             :             // UAReductionFactor - degree of fault
    1079           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).UAReductionFactor = rNumericArgs(1);
    1080             : 
    1081             :             // Cooling tower type
    1082           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).TowerType = cAlphaArgs(4);
    1083           1 :             if (lAlphaFieldBlanks(4)) {
    1084           0 :                 ShowSevereError(state,
    1085           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
    1086             :                                     "\" blank.");
    1087           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1088             :             }
    1089             : 
    1090             :             // Cooling tower name
    1091           1 :             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).TowerName = cAlphaArgs(5);
    1092           1 :             if (lAlphaFieldBlanks(5)) {
    1093           0 :                 ShowSevereError(state,
    1094           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1095             :                                     "\" blank.");
    1096           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1097             :             }
    1098             : 
    1099             :             // Tower check and link
    1100             :             {
    1101             :                 // Read in tower input if not done yet
    1102           1 :                 if (state.dataCondenserLoopTowers->GetInput) {
    1103           0 :                     CondenserLoopTowers::GetTowerInput(state);
    1104           0 :                     state.dataCondenserLoopTowers->GetInput = false;
    1105             :                 }
    1106             :                 // Check the tower name and tower type
    1107           1 :                 int TowerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).TowerName,
    1108           2 :                                                                state.dataCondenserLoopTowers->towers);
    1109           1 :                 if (TowerNum <= 0) {
    1110           0 :                     ShowSevereError(state,
    1111           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1112             :                                         "\" not found.");
    1113           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1114             :                 } else {
    1115             :                     // Link the tower with the fault model
    1116           1 :                     state.dataCondenserLoopTowers->towers(TowerNum).FaultyTowerFoulingFlag = true;
    1117           1 :                     state.dataCondenserLoopTowers->towers(TowerNum).FaultyTowerFoulingIndex = jFault_TowerFouling;
    1118             : 
    1119             :                     // Check the faulty tower type
    1120           2 :                     if (!UtilityRoutines::SameString(
    1121           1 :                             DataPlant::PlantEquipTypeNames[static_cast<int>(state.dataCondenserLoopTowers->towers(TowerNum).TowerType)],
    1122           1 :                             state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).TowerType)) {
    1123           0 :                         ShowWarningError(state,
    1124           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" +
    1125           0 :                                              cAlphaArgs(4) + "\" not match the type of " + cAlphaFieldNames(5) +
    1126             :                                              ". Tower type in the fault model is updated. ");
    1127           0 :                         state.dataFaultsMgr->FaultsTowerFouling(jFault_TowerFouling).TowerType =
    1128           0 :                             DataPlant::PlantEquipTypeNames[static_cast<int>(state.dataCondenserLoopTowers->towers(TowerNum).TowerType)];
    1129             :                     }
    1130             : 
    1131             :                     // Check the tower model
    1132             :                     // Performance Input Method should be UFactorTimesAreaAndDesignWaterFlowRate to apply the fault model
    1133           1 :                     if (state.dataCondenserLoopTowers->towers(TowerNum).PerformanceInputMethod_Num != CondenserLoopTowers::PIM::UFactor) {
    1134           0 :                         ShowWarningError(state,
    1135           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
    1136           0 :                                              cAlphaFieldNames(5) +
    1137           0 :                                              ". Tower Performance Input Method is not UFactorTimesAreaAndDesignWaterFlowRate. " +
    1138             :                                              "The tower fouling fault model will not be applied to the tower. ");
    1139           0 :                         state.dataCondenserLoopTowers->towers(TowerNum).FaultyTowerFoulingFlag = false;
    1140             :                     }
    1141             :                 }
    1142             :             }
    1143             :         }
    1144             : 
    1145             :         // read faults input of Condenser SWT Sensor Offset
    1146          13 :         for (int jFault_CondenserSWT = 1; jFault_CondenserSWT <= state.dataFaultsMgr->NumFaultyCondenserSWTSensor; ++jFault_CondenserSWT) {
    1147             : 
    1148           1 :             cFaultCurrentObject = cFaults(10); // fault object string
    1149           1 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1150             :                                                                      cFaultCurrentObject,
    1151             :                                                                      jFault_CondenserSWT,
    1152             :                                                                      cAlphaArgs,
    1153             :                                                                      NumAlphas,
    1154             :                                                                      rNumericArgs,
    1155             :                                                                      NumNumbers,
    1156             :                                                                      IOStatus,
    1157             :                                                                      lNumericFieldBlanks,
    1158             :                                                                      lAlphaFieldBlanks,
    1159             :                                                                      cAlphaFieldNames,
    1160             :                                                                      cNumericFieldNames);
    1161             : 
    1162           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).FaultType = cFaultCurrentObject;
    1163           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).FaultTypeEnum = Fault::TemperatureSensorOffset_CondenserSupplyWater;
    1164           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).Name = cAlphaArgs(1);
    1165             : 
    1166             :             // Fault availability schedule
    1167           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).AvaiSchedule = cAlphaArgs(2);
    1168           1 :             if (lAlphaFieldBlanks(2)) {
    1169           1 :                 state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).AvaiSchedPtr = -1; // returns schedule value of 1
    1170             :             } else {
    1171           0 :                 state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
    1172           0 :                 if (state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).AvaiSchedPtr == 0) {
    1173           0 :                     ShowSevereError(state,
    1174           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) +
    1175             :                                         "\" not found.");
    1176           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1177             :                 }
    1178             :             }
    1179             : 
    1180             :             // Fault severity schedule
    1181           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).SeveritySchedule = cAlphaArgs(3);
    1182           1 :             if (lAlphaFieldBlanks(3)) {
    1183           1 :                 state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).SeveritySchedPtr = -1; // returns schedule value of 1
    1184             :             } else {
    1185           0 :                 state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
    1186           0 :                 if (state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).SeveritySchedPtr == 0) {
    1187           0 :                     ShowSevereError(state,
    1188           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
    1189             :                                         "\" not found.");
    1190           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1191             :                 }
    1192             :             }
    1193             : 
    1194             :             // offset - degree of fault
    1195           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).Offset = rNumericArgs(1);
    1196             : 
    1197             :             // Cooling tower type
    1198           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).TowerType = cAlphaArgs(4);
    1199           1 :             if (lAlphaFieldBlanks(4)) {
    1200           0 :                 ShowSevereError(state,
    1201           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
    1202             :                                     "\" blank.");
    1203           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1204             :             }
    1205             : 
    1206             :             // Cooling tower name
    1207           1 :             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).TowerName = cAlphaArgs(5);
    1208           1 :             if (lAlphaFieldBlanks(5)) {
    1209           0 :                 ShowSevereError(state,
    1210           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1211             :                                     "\" blank.");
    1212           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1213             :             }
    1214             : 
    1215             :             // Tower check and link
    1216             :             {
    1217             :                 // Read in tower input if not done yet
    1218           1 :                 if (state.dataCondenserLoopTowers->GetInput) {
    1219           0 :                     CondenserLoopTowers::GetTowerInput(state);
    1220           0 :                     state.dataCondenserLoopTowers->GetInput = false;
    1221             :                 }
    1222             :                 // Check the tower name and tower type
    1223           1 :                 int TowerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).TowerName,
    1224           2 :                                                                state.dataCondenserLoopTowers->towers);
    1225           1 :                 if (TowerNum <= 0) {
    1226           0 :                     ShowSevereError(state,
    1227           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1228             :                                         "\" not found.");
    1229           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1230             :                 } else {
    1231             :                     // Link the tower with the fault model
    1232           1 :                     state.dataCondenserLoopTowers->towers(TowerNum).FaultyCondenserSWTFlag = true;
    1233           1 :                     state.dataCondenserLoopTowers->towers(TowerNum).FaultyCondenserSWTIndex = jFault_CondenserSWT;
    1234             : 
    1235             :                     // Check the faulty tower type
    1236           2 :                     if (!UtilityRoutines::SameString(
    1237           1 :                             DataPlant::PlantEquipTypeNames[static_cast<int>(state.dataCondenserLoopTowers->towers(TowerNum).TowerType)],
    1238           1 :                             state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).TowerType)) {
    1239           0 :                         ShowWarningError(state,
    1240           0 :                                          cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" +
    1241           0 :                                              cAlphaArgs(4) + "\" not match the type of " + cAlphaFieldNames(5) + ". Tower type is updated. ");
    1242           0 :                         state.dataFaultsMgr->FaultsCondenserSWTSensor(jFault_CondenserSWT).TowerType =
    1243           0 :                             DataPlant::PlantEquipTypeNames[static_cast<int>(state.dataCondenserLoopTowers->towers(TowerNum).TowerType)];
    1244             :                     }
    1245             :                 }
    1246             :             }
    1247             :         }
    1248             : 
    1249             :         // read faults input of Chiller SWT Sensor Offset
    1250          13 :         for (int jFault_ChillerSWT = 1; jFault_ChillerSWT <= state.dataFaultsMgr->NumFaultyChillerSWTSensor; ++jFault_ChillerSWT) {
    1251             : 
    1252           1 :             cFaultCurrentObject = cFaults(9); // fault object string
    1253           1 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1254             :                                                                      cFaultCurrentObject,
    1255             :                                                                      jFault_ChillerSWT,
    1256             :                                                                      cAlphaArgs,
    1257             :                                                                      NumAlphas,
    1258             :                                                                      rNumericArgs,
    1259             :                                                                      NumNumbers,
    1260             :                                                                      IOStatus,
    1261             :                                                                      lNumericFieldBlanks,
    1262             :                                                                      lAlphaFieldBlanks,
    1263             :                                                                      cAlphaFieldNames,
    1264             :                                                                      cNumericFieldNames);
    1265             : 
    1266           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).FaultType = cFaultCurrentObject;
    1267           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).FaultTypeEnum = Fault::TemperatureSensorOffset_ChillerSupplyWater;
    1268           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).Name = cAlphaArgs(1);
    1269             : 
    1270             :             // Fault availability schedule
    1271           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).AvaiSchedule = cAlphaArgs(2);
    1272           1 :             if (lAlphaFieldBlanks(2)) {
    1273           1 :                 state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).AvaiSchedPtr = -1; // returns schedule value of 1
    1274             :             } else {
    1275           0 :                 state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
    1276           0 :                 if (state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).AvaiSchedPtr == 0) {
    1277           0 :                     ShowSevereError(state,
    1278           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) +
    1279             :                                         "\" not found.");
    1280           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1281             :                 }
    1282             :             }
    1283             : 
    1284             :             // Fault severity schedule
    1285           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).SeveritySchedule = cAlphaArgs(3);
    1286           1 :             if (lAlphaFieldBlanks(3)) {
    1287           1 :                 state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).SeveritySchedPtr = -1; // returns schedule value of 1
    1288             :             } else {
    1289           0 :                 state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
    1290           0 :                 if (state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).SeveritySchedPtr == 0) {
    1291           0 :                     ShowSevereError(state,
    1292           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
    1293             :                                         "\" not found.");
    1294           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1295             :                 }
    1296             :             }
    1297             : 
    1298             :             // offset - degree of fault
    1299           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).Offset = rNumericArgs(1);
    1300             : 
    1301             :             // Chiller type
    1302           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerType = cAlphaArgs(4);
    1303           1 :             if (lAlphaFieldBlanks(4)) {
    1304           0 :                 ShowSevereError(state,
    1305           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
    1306             :                                     "\" blank.");
    1307           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1308             :             }
    1309             : 
    1310             :             // Chiller name
    1311           1 :             state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName = cAlphaArgs(5);
    1312           1 :             if (lAlphaFieldBlanks(5)) {
    1313           0 :                 ShowSevereError(state,
    1314           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1315             :                                     "\" blank.");
    1316           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1317             :             }
    1318             : 
    1319             :             // Chiller check
    1320             :             int ChillerNum;
    1321           2 :             ChillerType ChillerTypeCheck = static_cast<ChillerType>(getEnumerationValue(
    1322           3 :                 ChillerTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerType)));
    1323           1 :             switch (ChillerTypeCheck) {
    1324           0 :             case ChillerType::ChillerElectric: {
    1325             :                 // Check whether the chiller name and chiller type match each other
    1326           0 :                 ChillerNum = 0;
    1327           0 :                 int thisChil = 0;
    1328           0 :                 for (auto &ch : state.dataPlantChillers->ElectricChiller) {
    1329           0 :                     thisChil++;
    1330           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName) {
    1331           0 :                         ChillerNum = thisChil;
    1332             :                     }
    1333             :                 }
    1334           0 :                 if (ChillerNum <= 0) {
    1335           0 :                     ShowSevereError(state,
    1336           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1337             :                                         "\" not found.");
    1338           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1339             :                 } else {
    1340             :                     // Link the chiller with the fault model
    1341           0 :                     state.dataPlantChillers->ElectricChiller(ChillerNum).FaultyChillerSWTFlag = true;
    1342           0 :                     state.dataPlantChillers->ElectricChiller(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1343             :                 }
    1344           0 :             } break;
    1345           0 :             case ChillerType::ChillerElectricEIR: {
    1346             :                 // Read in chiller if not done yet
    1347           0 :                 if (state.dataChillerElectricEIR->getInputFlag) {
    1348           0 :                     ChillerElectricEIR::GetElectricEIRChillerInput(state);
    1349           0 :                     state.dataChillerElectricEIR->getInputFlag = false;
    1350             :                 }
    1351             :                 // Check whether the chiller name and chiller type match each other
    1352           0 :                 ChillerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName,
    1353           0 :                                                              state.dataChillerElectricEIR->ElectricEIRChiller);
    1354           0 :                 if (ChillerNum <= 0) {
    1355           0 :                     ShowSevereError(state,
    1356           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1357             :                                         "\" not found.");
    1358           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1359             :                 } else {
    1360             :                     // Link the chiller with the fault model
    1361           0 :                     state.dataChillerElectricEIR->ElectricEIRChiller(ChillerNum).FaultyChillerSWTFlag = true;
    1362           0 :                     state.dataChillerElectricEIR->ElectricEIRChiller(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1363             :                 }
    1364           0 :             } break;
    1365           1 :             case ChillerType::ChillerElectricReformulatedEIR: {
    1366             :                 // Read in chiller if not done yet
    1367           1 :                 if (state.dataChillerReformulatedEIR->GetInputREIR) {
    1368           0 :                     ChillerReformulatedEIR::GetElecReformEIRChillerInput(state);
    1369           0 :                     state.dataChillerReformulatedEIR->GetInputREIR = false;
    1370             :                 }
    1371             :                 // Check whether the chiller name and chiller type match each other
    1372           1 :                 ChillerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName,
    1373           1 :                                                              state.dataChillerReformulatedEIR->ElecReformEIRChiller);
    1374           1 :                 if (ChillerNum <= 0) {
    1375           0 :                     ShowSevereError(state,
    1376           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1377             :                                         "\" not found.");
    1378           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1379             :                 } else {
    1380             :                     // Link the chiller with the fault model
    1381           1 :                     state.dataChillerReformulatedEIR->ElecReformEIRChiller(ChillerNum).FaultyChillerSWTFlag = true;
    1382           1 :                     state.dataChillerReformulatedEIR->ElecReformEIRChiller(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1383             :                 }
    1384           1 :             } break;
    1385           0 :             case ChillerType::ChillerEngineDriven: {
    1386             :                 // Check whether the chiller name and chiller type match each other
    1387           0 :                 ChillerNum = 0;
    1388           0 :                 int thisChil = 0;
    1389           0 :                 for (auto &ch : state.dataPlantChillers->EngineDrivenChiller) {
    1390           0 :                     thisChil++;
    1391           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName) {
    1392           0 :                         ChillerNum = thisChil;
    1393             :                     }
    1394             :                 }
    1395           0 :                 if (ChillerNum <= 0) {
    1396           0 :                     ShowSevereError(state,
    1397           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1398             :                                         "\" not found.");
    1399           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1400             :                 } else {
    1401             :                     // Link the chiller with the fault model
    1402           0 :                     state.dataPlantChillers->EngineDrivenChiller(ChillerNum).FaultyChillerSWTFlag = true;
    1403           0 :                     state.dataPlantChillers->EngineDrivenChiller(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1404             :                 }
    1405           0 :             } break;
    1406           0 :             case ChillerType::ChillerCombustionTurbine: {
    1407           0 :                 ChillerNum = 0;
    1408           0 :                 int thisChil = 0;
    1409           0 :                 for (auto &ch : state.dataPlantChillers->GTChiller) {
    1410           0 :                     thisChil++;
    1411           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName) {
    1412           0 :                         ChillerNum = thisChil;
    1413             :                     }
    1414             :                 }
    1415           0 :                 if (ChillerNum <= 0) {
    1416           0 :                     ShowSevereError(state,
    1417           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1418             :                                         "\" not found.");
    1419           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1420             :                 } else {
    1421             :                     // Link the chiller with the fault model
    1422           0 :                     state.dataPlantChillers->GTChiller(ChillerNum).FaultyChillerSWTFlag = true;
    1423           0 :                     state.dataPlantChillers->GTChiller(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1424             :                 }
    1425           0 :             } break;
    1426           0 :             case ChillerType::ChillerConstantCOP: {
    1427           0 :                 ChillerNum = 0;
    1428           0 :                 int thisChil = 0;
    1429           0 :                 for (auto &ch : state.dataPlantChillers->ConstCOPChiller) {
    1430           0 :                     thisChil++;
    1431           0 :                     if (ch.Name == state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName) {
    1432           0 :                         ChillerNum = thisChil;
    1433             :                     }
    1434             :                 }
    1435           0 :                 if (ChillerNum <= 0) {
    1436           0 :                     ShowSevereError(state,
    1437           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1438             :                                         "\" not found.");
    1439           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1440             :                 } else {
    1441             :                     // Link the chiller with the fault model
    1442           0 :                     state.dataPlantChillers->ConstCOPChiller(ChillerNum).FaultyChillerSWTFlag = true;
    1443           0 :                     state.dataPlantChillers->ConstCOPChiller(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1444             :                 }
    1445           0 :             } break;
    1446           0 :             case ChillerType::ChillerAbsorption: {
    1447             :                 // Read in chiller if not done yet
    1448           0 :                 if (state.dataChillerAbsorber->getInput) {
    1449           0 :                     ChillerAbsorption::GetBLASTAbsorberInput(state);
    1450           0 :                     state.dataChillerAbsorber->getInput = false;
    1451             :                 }
    1452             :                 // Check whether the chiller name and chiller type match each other
    1453           0 :                 ChillerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName,
    1454           0 :                                                              state.dataChillerAbsorber->absorptionChillers);
    1455           0 :                 if (ChillerNum <= 0) {
    1456           0 :                     ShowSevereError(state,
    1457           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1458             :                                         "\" not found.");
    1459           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1460             :                 } else {
    1461             :                     // Link the chiller with the fault model
    1462           0 :                     state.dataChillerAbsorber->absorptionChillers(ChillerNum).FaultyChillerSWTFlag = true;
    1463           0 :                     state.dataChillerAbsorber->absorptionChillers(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1464             :                 }
    1465           0 :             } break;
    1466           0 :             case ChillerType::ChillerAbsorptionIndirect: {
    1467             :                 // Read in chiller if not done yet
    1468           0 :                 if (state.dataChillerIndirectAbsorption->GetInput) {
    1469           0 :                     ChillerIndirectAbsorption::GetIndirectAbsorberInput(state);
    1470           0 :                     state.dataChillerIndirectAbsorption->GetInput = false;
    1471             :                 }
    1472             :                 // Check whether the chiller name and chiller type match each other
    1473           0 :                 ChillerNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName,
    1474           0 :                                                              state.dataChillerIndirectAbsorption->IndirectAbsorber);
    1475           0 :                 if (ChillerNum <= 0) {
    1476           0 :                     ShowSevereError(state,
    1477           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1478             :                                         "\" not found.");
    1479           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1480             :                 } else {
    1481           0 :                     state.dataChillerIndirectAbsorption->IndirectAbsorber(ChillerNum).FaultyChillerSWTFlag = true;
    1482           0 :                     state.dataChillerIndirectAbsorption->IndirectAbsorber(ChillerNum).FaultyChillerSWTIndex = jFault_ChillerSWT;
    1483             :                 }
    1484           0 :             } break;
    1485           0 :             default:
    1486           0 :                 break;
    1487             :             }
    1488             :         }
    1489             : 
    1490             :         // read faults input of Fouled Air Filters
    1491          13 :         for (int jFault_AirFilter = 1; jFault_AirFilter <= state.dataFaultsMgr->NumFaultyAirFilter; ++jFault_AirFilter) {
    1492             : 
    1493             :             // Read in fan if not done yet
    1494           1 :             if (state.dataFans->GetFanInputFlag) {
    1495           0 :                 Fans::GetFanInput(state);
    1496             :             }
    1497             : 
    1498           1 :             cFaultCurrentObject = cFaults(8); // fault object string
    1499           1 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1500             :                                                                      cFaultCurrentObject,
    1501             :                                                                      jFault_AirFilter,
    1502             :                                                                      cAlphaArgs,
    1503             :                                                                      NumAlphas,
    1504             :                                                                      rNumericArgs,
    1505             :                                                                      NumNumbers,
    1506             :                                                                      IOStatus,
    1507             :                                                                      lNumericFieldBlanks,
    1508             :                                                                      lAlphaFieldBlanks,
    1509             :                                                                      cAlphaFieldNames,
    1510             :                                                                      cNumericFieldNames);
    1511             : 
    1512           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultType = cFaultCurrentObject;
    1513           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultTypeEnum = Fault::Fouling_AirFilter;
    1514           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).Name = cAlphaArgs(1);
    1515             : 
    1516             :             // Information of the fan associated with the fouling air filter
    1517           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterFanType = cAlphaArgs(2);
    1518           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterFanName = cAlphaArgs(3);
    1519             : 
    1520             :             // Check whether the specified fan exists in the fan list
    1521           1 :             if (UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataFans->Fan, &Fans::FanEquipConditions::FanName) <= 0) {
    1522           0 :                 ShowSevereError(state,
    1523           0 :                                 cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
    1524             :                                     "\" not found.");
    1525           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1526             :             }
    1527             : 
    1528             :             // Assign fault index to the fan object
    1529           1 :             for (int FanNum = 1; FanNum <= state.dataFans->NumFans; ++FanNum) {
    1530           1 :                 if (UtilityRoutines::SameString(state.dataFans->Fan(FanNum).FanName, cAlphaArgs(3))) {
    1531           1 :                     state.dataFans->Fan(FanNum).FaultyFilterFlag = true;
    1532           1 :                     state.dataFans->Fan(FanNum).FaultyFilterIndex = jFault_AirFilter;
    1533           1 :                     break;
    1534             :                 }
    1535             :             }
    1536             : 
    1537             :             // Fault availability schedule
    1538           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).AvaiSchedule = cAlphaArgs(4);
    1539           1 :             if (lAlphaFieldBlanks(4)) {
    1540           0 :                 state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).AvaiSchedPtr = -1; // returns schedule value of 1
    1541             :             } else {
    1542           1 :                 state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(4));
    1543           1 :                 if (state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).AvaiSchedPtr == 0) {
    1544           0 :                     ShowSevereError(state,
    1545           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
    1546             :                                         "\" not found.");
    1547           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1548             :                 }
    1549             :             }
    1550             : 
    1551             :             // Fan pressure increase fraction schedule
    1552           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterPressFracSche = cAlphaArgs(5);
    1553           1 :             if (lAlphaFieldBlanks(5)) {
    1554           0 :                 state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterPressFracSchePtr = -1; // returns schedule value of 1
    1555             :             } else {
    1556           1 :                 state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterPressFracSchePtr =
    1557           1 :                     GetScheduleIndex(state, cAlphaArgs(5));
    1558           1 :                 if (state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterPressFracSchePtr == 0) {
    1559           0 :                     ShowSevereError(state,
    1560           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1561             :                                         "\" not found.");
    1562           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1563             :                 }
    1564             :             }
    1565             : 
    1566             :             // Fan curve describing the relationship between fan pressure rise and air flow rate
    1567           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterFanCurve = cAlphaArgs(6);
    1568           1 :             state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterFanCurvePtr = GetCurveIndex(state, cAlphaArgs(6));
    1569           1 :             if (state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterFanCurvePtr == 0) {
    1570           0 :                 ShowSevereError(state, cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\"");
    1571           0 :                 ShowContinueError(state, "Invalid " + cAlphaFieldNames(6) + " = \"" + cAlphaArgs(6) + "\" not found.");
    1572           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1573             :             }
    1574             : 
    1575             :             // Checking  whether the specified fan curve covers the **design** operational point of the fan cannot be done here
    1576             :             // as the fan might be autosized and is not sized yet, so we call it in Fan::SizeFan instead
    1577             : 
    1578             :             // In the fan object, calculate by each time-step: 1) pressure increase value; 2) air flow rate decrease value.
    1579             :         }
    1580             : 
    1581             :         // read faults input of HumidistatOffset
    1582          14 :         for (int jFault_Humidistat = 1; jFault_Humidistat <= state.dataFaultsMgr->NumFaultyHumidistat; ++jFault_Humidistat) {
    1583             : 
    1584           2 :             cFaultCurrentObject = cFaults(7); // fault object string
    1585           2 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1586             :                                                                      cFaultCurrentObject,
    1587             :                                                                      jFault_Humidistat,
    1588             :                                                                      cAlphaArgs,
    1589             :                                                                      NumAlphas,
    1590             :                                                                      rNumericArgs,
    1591             :                                                                      NumNumbers,
    1592             :                                                                      IOStatus,
    1593             :                                                                      lNumericFieldBlanks,
    1594             :                                                                      lAlphaFieldBlanks,
    1595             :                                                                      cAlphaFieldNames,
    1596             :                                                                      cNumericFieldNames);
    1597             : 
    1598           2 :             state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).FaultType = cFaultCurrentObject;
    1599           2 :             state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).FaultTypeEnum = Fault::HumidistatOffset;
    1600           2 :             state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).Name = cAlphaArgs(1);
    1601           2 :             state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).FaultyHumidistatName = cAlphaArgs(2);
    1602           2 :             state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).FaultyHumidistatType = cAlphaArgs(3);
    1603             : 
    1604           2 :             if (UtilityRoutines::SameString(state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).FaultyHumidistatType,
    1605           2 :                                             "ThermostatOffsetDependent")) {
    1606             :                 // For Humidistat Offset Type: ThermostatOffsetDependent
    1607             : 
    1608             :                 // Related Thermostat Offset Fault Name is required for Humidistat Offset Type: ThermostatOffsetDependent
    1609           1 :                 if (lAlphaFieldBlanks(6)) {
    1610           0 :                     ShowSevereError(state,
    1611           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\": " + cAlphaFieldNames(6) +
    1612             :                                         " cannot be blank for Humidistat Offset Type = \"ThermostatOffsetDependent\".");
    1613           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1614             :                 } else {
    1615           1 :                     state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).FaultyThermostatName = cAlphaArgs(6);
    1616             :                 }
    1617             : 
    1618             :             } else {
    1619             :                 // For Humidistat Offset Type: ThermostatOffsetIndependent
    1620             : 
    1621             :                 // Availability schedule
    1622           1 :                 state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).AvaiSchedule = cAlphaArgs(4);
    1623           1 :                 if (lAlphaFieldBlanks(4)) {
    1624           1 :                     state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).AvaiSchedPtr = -1; // returns schedule value of 1
    1625             :                 } else {
    1626           0 :                     state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(4));
    1627           0 :                     if (state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).AvaiSchedPtr == 0) {
    1628           0 :                         ShowSevereError(state,
    1629           0 :                                         cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" +
    1630           0 :                                             cAlphaArgs(4) + "\" not found.");
    1631           0 :                         state.dataFaultsMgr->ErrorsFound = true;
    1632             :                     }
    1633             :                 }
    1634             : 
    1635             :                 // Severity schedule
    1636           1 :                 state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).SeveritySchedule = cAlphaArgs(5);
    1637           1 :                 if (lAlphaFieldBlanks(5)) {
    1638           1 :                     state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).SeveritySchedPtr = -1; // returns schedule value of 1
    1639             :                 } else {
    1640           0 :                     state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(5));
    1641           0 :                     if (state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).SeveritySchedPtr == 0) {
    1642           0 :                         ShowSevereError(state,
    1643           0 :                                         cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
    1644           0 :                                             cAlphaArgs(5) + "\" not found.");
    1645           0 :                         state.dataFaultsMgr->ErrorsFound = true;
    1646             :                     }
    1647             :                 }
    1648             : 
    1649             :                 // Reference offset value is required for Humidistat Offset Type: ThermostatOffsetIndependent
    1650           1 :                 if (lAlphaFieldBlanks(1)) {
    1651           0 :                     ShowSevereError(state,
    1652           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\": " + cNumericFieldNames(1) +
    1653             :                                         " cannot be blank for Humidistat Offset Type = \"ThermostatOffsetIndependent\".");
    1654           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1655             :                 } else {
    1656           1 :                     state.dataFaultsMgr->FaultsHumidistatOffset(jFault_Humidistat).Offset = rNumericArgs(1);
    1657             :                 }
    1658             :             }
    1659             :         }
    1660             : 
    1661             :         // read faults input of ThermostatOffset
    1662          28 :         for (int jFault_Thermostat = 1; jFault_Thermostat <= state.dataFaultsMgr->NumFaultyThermostat; ++jFault_Thermostat) {
    1663             : 
    1664          16 :             cFaultCurrentObject = cFaults(6); // fault object string
    1665          16 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1666             :                                                                      cFaultCurrentObject,
    1667             :                                                                      jFault_Thermostat,
    1668             :                                                                      cAlphaArgs,
    1669             :                                                                      NumAlphas,
    1670             :                                                                      rNumericArgs,
    1671             :                                                                      NumNumbers,
    1672             :                                                                      IOStatus,
    1673             :                                                                      lNumericFieldBlanks,
    1674             :                                                                      lAlphaFieldBlanks,
    1675             :                                                                      cAlphaFieldNames,
    1676             :                                                                      cNumericFieldNames);
    1677             : 
    1678          16 :             state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).FaultType = cFaultCurrentObject;
    1679          16 :             state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).FaultTypeEnum = Fault::ThermostatOffset;
    1680          16 :             state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).Name = cAlphaArgs(1);
    1681          16 :             state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).FaultyThermostatName = cAlphaArgs(2);
    1682             : 
    1683             :             // Availability schedule
    1684          16 :             state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).AvaiSchedule = cAlphaArgs(3);
    1685          16 :             if (lAlphaFieldBlanks(3)) {
    1686          16 :                 state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).AvaiSchedPtr = -1; // returns schedule value of 1
    1687             :             } else {
    1688           0 :                 state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
    1689           0 :                 if (state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).AvaiSchedPtr == 0) {
    1690           0 :                     ShowSevereError(state,
    1691           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
    1692             :                                         "\" not found.");
    1693           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1694             :                 }
    1695             :             }
    1696             : 
    1697             :             // Severity schedule
    1698          16 :             state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).SeveritySchedule = cAlphaArgs(4);
    1699          16 :             if (lAlphaFieldBlanks(4)) {
    1700          16 :                 state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).SeveritySchedPtr = -1; // returns schedule value of 1
    1701             :             } else {
    1702           0 :                 state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(4));
    1703           0 :                 if (state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).SeveritySchedPtr == 0) {
    1704           0 :                     ShowSevereError(state,
    1705           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
    1706             :                                         "\" not found.");
    1707           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1708             :                 }
    1709             :             }
    1710             : 
    1711             :             // Reference offset value is required
    1712          16 :             if (lAlphaFieldBlanks(1)) {
    1713           0 :                 ShowSevereError(state, cFaultCurrentObject + " = \"" + cNumericFieldNames(1) + "\" cannot be blank.");
    1714           0 :                 state.dataFaultsMgr->ErrorsFound = true;
    1715             :             } else {
    1716          16 :                 state.dataFaultsMgr->FaultsThermostatOffset(jFault_Thermostat).Offset = rNumericArgs(1);
    1717             :             }
    1718             :         }
    1719             : 
    1720             :         // read faults input of Fouling_Coil
    1721          14 :         for (int jFault_FoulingCoil = 1; jFault_FoulingCoil <= state.dataFaultsMgr->NumFouledCoil; ++jFault_FoulingCoil) {
    1722             : 
    1723           2 :             cFaultCurrentObject = cFaults(5); // fault object string
    1724           2 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1725             :                                                                      cFaultCurrentObject,
    1726             :                                                                      jFault_FoulingCoil,
    1727             :                                                                      cAlphaArgs,
    1728             :                                                                      NumAlphas,
    1729             :                                                                      rNumericArgs,
    1730             :                                                                      NumNumbers,
    1731             :                                                                      IOStatus,
    1732             :                                                                      lNumericFieldBlanks,
    1733             :                                                                      lAlphaFieldBlanks,
    1734             :                                                                      cAlphaFieldNames,
    1735             :                                                                      cNumericFieldNames);
    1736             : 
    1737           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FaultType = cFaultCurrentObject;
    1738           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FaultTypeEnum = Fault::Fouling_Coil;
    1739           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).Name = cAlphaArgs(1);
    1740           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoilName = cAlphaArgs(2);
    1741             : 
    1742             :             // Availability schedule
    1743           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).AvaiSchedule = cAlphaArgs(3);
    1744           2 :             if (lAlphaFieldBlanks(3)) {
    1745           0 :                 state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).AvaiSchedPtr = -1; // returns schedule value of 1
    1746             :             } else {
    1747           2 :                 state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
    1748           2 :                 if (state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).AvaiSchedPtr == 0) {
    1749           0 :                     ShowSevereError(state,
    1750           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) +
    1751             :                                         "\" not found.");
    1752           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1753             :                 }
    1754             :             }
    1755             : 
    1756             :             // Severity schedule
    1757           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).SeveritySchedule = cAlphaArgs(4);
    1758           2 :             if (lAlphaFieldBlanks(4)) {
    1759           0 :                 state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).SeveritySchedPtr = -1; // returns schedule value of 1
    1760             :             } else {
    1761           2 :                 state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(4));
    1762           2 :                 if (state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).SeveritySchedPtr == 0) {
    1763           0 :                     ShowSevereError(state,
    1764           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
    1765             :                                         "\" not found.");
    1766           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1767             :                 }
    1768             :             }
    1769             : 
    1770           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FoulingInputMethod =
    1771           4 :                 static_cast<FouledCoil>(getEnumerationValue(FouledCoilNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(5))));
    1772           2 :             if (state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FoulingInputMethod == FouledCoil::Invalid) {
    1773           0 :                 state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FoulingInputMethod = FouledCoil::UARated;
    1774             :             }
    1775             : 
    1776           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).UAFouled = rNumericArgs(1);
    1777           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).Rfw = rNumericArgs(2);
    1778           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).Rfa = rNumericArgs(3);
    1779           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).Aout = rNumericArgs(4);
    1780           2 :             state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).Aratio = rNumericArgs(5);
    1781             : 
    1782             :             // Coil check and link
    1783             :             {
    1784             :                 // Obtains and Allocates WaterCoil related parameters from input file
    1785           2 :                 if (state.dataWaterCoils->GetWaterCoilsInputFlag) {
    1786           0 :                     WaterCoils::GetWaterCoilInput(state);
    1787           0 :                     state.dataWaterCoils->GetWaterCoilsInputFlag = false;
    1788             :                 }
    1789             : 
    1790             :                 // Check the coil name and type
    1791           2 :                 int CoilNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoilName,
    1792           4 :                                                               state.dataWaterCoils->WaterCoil);
    1793           2 :                 if (CoilNum <= 0) {
    1794           0 :                     ShowSevereError(state,
    1795           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\". Referenced Coil named \"" +
    1796           0 :                                         state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoilName + "\" was not found.");
    1797           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1798             :                 } else {
    1799             :                     // Coil is found: check if the right type
    1800           3 :                     if ((state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) ||
    1801           1 :                         (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::PlantEquipmentType::CoilWaterCooling)) {
    1802             :                         // Link the Coil with the fault model
    1803           2 :                         state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag = true;
    1804           2 :                         state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex = jFault_FoulingCoil;
    1805             : 
    1806           2 :                         state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoilType = state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType;
    1807           2 :                         state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoilNum = CoilNum;
    1808             : 
    1809           8 :                         SetupOutputVariable(state,
    1810             :                                             "Coil Fouling Factor",
    1811             :                                             OutputProcessor::Unit::K_W,
    1812           2 :                                             state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFactor,
    1813             :                                             OutputProcessor::SOVTimeStepType::System,
    1814             :                                             OutputProcessor::SOVStoreType::Average,
    1815           4 :                                             state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1816             : 
    1817             :                         // Coil:Cooling:Water doesn't report UA because it's not variable,
    1818             :                         // but here, it's useful since we do change it via fouling, so report it
    1819           2 :                         if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::PlantEquipmentType::CoilWaterCooling) {
    1820           4 :                             SetupOutputVariable(state,
    1821             :                                                 "Cooling Coil Total U Factor Times Area Value",
    1822             :                                                 OutputProcessor::Unit::W_K,
    1823           1 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).UACoilTotal,
    1824             :                                                 OutputProcessor::SOVTimeStepType::System,
    1825             :                                                 OutputProcessor::SOVStoreType::Average,
    1826           2 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1827             : 
    1828           4 :                             SetupOutputVariable(state,
    1829             :                                                 "Cooling Coil External U Factor Times Area Value",
    1830             :                                                 OutputProcessor::Unit::W_K,
    1831           1 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).UACoilExternal,
    1832             :                                                 OutputProcessor::SOVTimeStepType::System,
    1833             :                                                 OutputProcessor::SOVStoreType::Average,
    1834           2 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1835             : 
    1836           4 :                             SetupOutputVariable(state,
    1837             :                                                 "Cooling Coil Internal U Factor Times Area Value",
    1838             :                                                 OutputProcessor::Unit::W_K,
    1839           1 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).UACoilInternal,
    1840             :                                                 OutputProcessor::SOVTimeStepType::System,
    1841             :                                                 OutputProcessor::SOVStoreType::Average,
    1842           2 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1843             : 
    1844           4 :                             SetupOutputVariable(state,
    1845             :                                                 "Cooling Coil Total U Factor Times Area Value Before Fouling",
    1846             :                                                 OutputProcessor::Unit::W_K,
    1847           1 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).OriginalUACoilVariable,
    1848             :                                                 OutputProcessor::SOVTimeStepType::System,
    1849             :                                                 OutputProcessor::SOVStoreType::Average,
    1850           2 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1851             : 
    1852           4 :                             SetupOutputVariable(state,
    1853             :                                                 "Cooling Coil External U Factor Times Area Value Before Fouling",
    1854             :                                                 OutputProcessor::Unit::W_K,
    1855           1 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).OriginalUACoilExternal,
    1856             :                                                 OutputProcessor::SOVTimeStepType::System,
    1857             :                                                 OutputProcessor::SOVStoreType::Average,
    1858           2 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1859             : 
    1860           4 :                             SetupOutputVariable(state,
    1861             :                                                 "Cooling Coil Internal U Factor Times Area Value Before Fouling",
    1862             :                                                 OutputProcessor::Unit::W_K,
    1863           1 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).OriginalUACoilInternal,
    1864             :                                                 OutputProcessor::SOVTimeStepType::System,
    1865             :                                                 OutputProcessor::SOVStoreType::Average,
    1866           2 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1867             : 
    1868             :                         } else {
    1869           4 :                             SetupOutputVariable(state,
    1870             :                                                 "Heating Coil U Factor Times Area Value Before Fouling",
    1871             :                                                 OutputProcessor::Unit::W_K,
    1872           1 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).OriginalUACoilVariable,
    1873             :                                                 OutputProcessor::SOVTimeStepType::System,
    1874             :                                                 OutputProcessor::SOVStoreType::Average,
    1875           2 :                                                 state.dataWaterCoils->WaterCoil(CoilNum).Name);
    1876             :                         }
    1877             :                     } else {
    1878           0 :                         ShowSevereError(state,
    1879           0 :                                         cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" +
    1880           0 :                                             cAlphaArgs(2) + "\".");
    1881           0 :                         ShowContinueError(
    1882             :                             state, R"(Coil was found but it is not one of the supported types ("Coil:Cooling:Water" or "Coil:Heating:Water").)");
    1883           0 :                         state.dataFaultsMgr->ErrorsFound = true;
    1884             :                     }
    1885             :                 }
    1886             :             }
    1887             :         }
    1888             : 
    1889             :         // read faults input: Fault_type 0 to 4, which are related with economizer sensors
    1890          72 :         for (int j = 0, i = 0; i <= 4; ++i) {
    1891          60 :             cFaultCurrentObject = cFaults(i); // fault object string
    1892          60 :             int NumFaultsTemp = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cFaultCurrentObject);
    1893             : 
    1894          65 :             for (int jj = 1; jj <= NumFaultsTemp; ++jj) {
    1895           5 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1896             :                                                                          cFaultCurrentObject,
    1897             :                                                                          jj,
    1898             :                                                                          cAlphaArgs,
    1899             :                                                                          NumAlphas,
    1900             :                                                                          rNumericArgs,
    1901             :                                                                          NumNumbers,
    1902             :                                                                          IOStatus,
    1903             :                                                                          lNumericFieldBlanks,
    1904             :                                                                          lAlphaFieldBlanks,
    1905             :                                                                          cAlphaFieldNames,
    1906             :                                                                          cNumericFieldNames);
    1907             : 
    1908           5 :                 ++j;
    1909           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).FaultType = cFaultCurrentObject;
    1910           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).FaultTypeEnum = static_cast<Fault>(i);
    1911             : 
    1912           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).Name = cAlphaArgs(1);
    1913           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).AvaiSchedule = cAlphaArgs(2);
    1914             :                 // check availability schedule
    1915           5 :                 if (lAlphaFieldBlanks(2)) {
    1916           2 :                     state.dataFaultsMgr->FaultsEconomizer(j).AvaiSchedPtr = -1; // returns schedule value of 1
    1917             :                 } else {
    1918           3 :                     state.dataFaultsMgr->FaultsEconomizer(j).AvaiSchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
    1919           3 :                     if (state.dataFaultsMgr->FaultsEconomizer(j).AvaiSchedPtr == 0) {
    1920           0 :                         ShowSevereError(state,
    1921           0 :                                         cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" +
    1922           0 :                                             cAlphaArgs(2) + "\" not found.");
    1923           0 :                         state.dataFaultsMgr->ErrorsFound = true;
    1924             :                     }
    1925             :                 }
    1926             : 
    1927           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).SeveritySchedule = cAlphaArgs(3);
    1928             :                 // check severity schedule
    1929           5 :                 if (lAlphaFieldBlanks(3)) {
    1930           4 :                     state.dataFaultsMgr->FaultsEconomizer(j).SeveritySchedPtr = -1; // returns schedule value of 1
    1931             :                 } else {
    1932           1 :                     state.dataFaultsMgr->FaultsEconomizer(j).SeveritySchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
    1933           1 :                     if (state.dataFaultsMgr->FaultsEconomizer(j).SeveritySchedPtr == 0) {
    1934           0 :                         ShowSevereError(state,
    1935           0 :                                         cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" +
    1936           0 :                                             cAlphaArgs(3) + "\" not found.");
    1937           0 :                         state.dataFaultsMgr->ErrorsFound = true;
    1938             :                     }
    1939             :                 }
    1940             : 
    1941           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).ControllerType = cAlphaArgs(4);
    1942             :                 // check controller type
    1943           5 :                 if (lAlphaFieldBlanks(4)) {
    1944           0 :                     ShowSevereError(state,
    1945           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(4) + " = \"" + cAlphaArgs(4) +
    1946             :                                         "\" blank.");
    1947           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1948             :                 } else {
    1949           5 :                     if (UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)) == "CONTROLLER:OUTDOORAIR") {
    1950           5 :                         state.dataFaultsMgr->FaultsEconomizer(j).ControllerTypeEnum = iController_AirEconomizer;
    1951             : 
    1952             :                         // CASE ...
    1953             : 
    1954             :                     } else {
    1955             :                     }
    1956             :                 }
    1957             : 
    1958           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).ControllerName = cAlphaArgs(5);
    1959             :                 // check controller name
    1960           5 :                 if (lAlphaFieldBlanks(5)) {
    1961           0 :                     ShowSevereError(state,
    1962           0 :                                     cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) +
    1963             :                                         "\" blank.");
    1964           0 :                     state.dataFaultsMgr->ErrorsFound = true;
    1965             :                 }
    1966             : 
    1967             :                 // offset - degree of fault
    1968           5 :                 state.dataFaultsMgr->FaultsEconomizer(j).Offset = rNumericArgs(1);
    1969             :             }
    1970             :         }
    1971             : 
    1972          12 :         state.dataFaultsMgr->RunFaultMgrOnceFlag = true;
    1973             : 
    1974          12 :         if (state.dataFaultsMgr->ErrorsFound) {
    1975           0 :             ShowFatalError(state, "CheckAndReadFaults: Errors found in getting FaultModel input data. Preceding condition(s) cause termination.");
    1976             :         }
    1977             :     }
    1978             : 
    1979       54131 :     Real64 FaultProperties::CalFaultOffsetAct(EnergyPlusData &state)
    1980             :     {
    1981             : 
    1982             :         // SUBROUTINE INFORMATION:
    1983             :         //       AUTHOR         Rongpeng Zhang
    1984             :         //       DATE WRITTEN   Jun. 2016
    1985             : 
    1986             :         // PURPOSE OF THIS SUBROUTINE:
    1987             :         //       To calculate the dynamic fault offset based on the fault availability schedule and severity schedule.
    1988             : 
    1989             :         // Using/Aliasing
    1990             :         using Curve::CurveValue;
    1991             :         using ScheduleManager::GetCurrentScheduleValue;
    1992             : 
    1993             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1994       54131 :         Real64 FaultFac(0.0); // fault modification factor
    1995             :         Real64 OffsetAct;     // actual offset after applying the modification factor
    1996             : 
    1997             :         // Check fault availability schedules
    1998       54131 :         if (GetCurrentScheduleValue(state, this->AvaiSchedPtr) > 0.0) {
    1999             : 
    2000             :             // Check fault severity schedules
    2001       54131 :             if (this->SeveritySchedPtr >= 0) {
    2002           0 :                 FaultFac = GetCurrentScheduleValue(state, this->SeveritySchedPtr);
    2003             :             } else {
    2004       54131 :                 FaultFac = 1.0;
    2005             :             }
    2006             :         }
    2007             : 
    2008       54131 :         OffsetAct = FaultFac * this->Offset;
    2009             : 
    2010       54131 :         return OffsetAct;
    2011             :     }
    2012             : 
    2013      108270 :     Real64 FaultPropertiesFouling::CalFoulingFactor(EnergyPlusData &state)
    2014             :     {
    2015             : 
    2016             :         // SUBROUTINE INFORMATION:
    2017             :         //       AUTHOR         Rongpeng Zhang
    2018             :         //       DATE WRITTEN   Nov. 2016
    2019             : 
    2020             :         // PURPOSE OF THIS SUBROUTINE:
    2021             :         // To calculate the dynamic Nominal Capacity or Efficiency Reduction due to fouling, based on the fault availability schedule and severity
    2022             :         // schedule. The factor is the ratio between the nominal capacity or efficiency at fouling case and that at fault free case
    2023             : 
    2024             :         // Using/Aliasing
    2025             :         using Curve::CurveValue;
    2026             :         using ScheduleManager::GetCurrentScheduleValue;
    2027             : 
    2028             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2029      108270 :         Real64 FaultFac(0.0); // fault modification factor
    2030      108270 :         Real64 FoulingFactor(
    2031             :             1.0); // Actual Nominal Fouling Factor, ratio between the nominal capacity or efficiency at fouling case and that at fault free case
    2032             : 
    2033             :         // Check fault availability schedules
    2034      108270 :         if (GetCurrentScheduleValue(state, this->AvaiSchedPtr) > 0.0) {
    2035             : 
    2036             :             // Check fault severity schedules
    2037      108270 :             if (this->SeveritySchedPtr >= 0) {
    2038           0 :                 FaultFac = GetCurrentScheduleValue(state, this->SeveritySchedPtr);
    2039             :             } else {
    2040      108270 :                 FaultFac = 1.0;
    2041             :             }
    2042             :         }
    2043             : 
    2044             :         // The more severe the fouling fault is (i.e., larger FaultFac), the less the FoulingFactor is
    2045      108270 :         if (FaultFac > 0.0) FoulingFactor = min(this->FoulingFactor / FaultFac, 1.0);
    2046             : 
    2047      108270 :         return FoulingFactor;
    2048             :     }
    2049             : 
    2050        3328 :     Real64 FaultPropertiesTowerFouling::CalFaultyTowerFoulingFactor(EnergyPlusData &state)
    2051             :     {
    2052             : 
    2053             :         // SUBROUTINE INFORMATION:
    2054             :         //       AUTHOR         Rongpeng Zhang
    2055             :         //       DATE WRITTEN   Jul. 2016
    2056             : 
    2057             :         // PURPOSE OF THIS SUBROUTINE:
    2058             :         // To calculate the dynamic tower fouling factor based on the fault availability schedule and severity schedule.
    2059             :         // Fouling factor is the ratio between the UA value at fouling case and that at fault free case
    2060             : 
    2061             :         // Using/Aliasing
    2062             :         using Curve::CurveValue;
    2063             :         using ScheduleManager::GetCurrentScheduleValue;
    2064             : 
    2065             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2066        3328 :         Real64 FaultFac(0.0);             // fault modification factor
    2067        3328 :         Real64 UAReductionFactorAct(1.0); // actual UA Reduction Factor, ratio between the UA value at fouling case and that at fault free case
    2068             : 
    2069             :         // Check fault availability schedules
    2070        3328 :         if (GetCurrentScheduleValue(state, this->AvaiSchedPtr) > 0.0) {
    2071             : 
    2072             :             // Check fault severity schedules
    2073        3328 :             if (this->SeveritySchedPtr >= 0) {
    2074           0 :                 FaultFac = GetCurrentScheduleValue(state, this->SeveritySchedPtr);
    2075             :             } else {
    2076        3328 :                 FaultFac = 1.0;
    2077             :             }
    2078             :         }
    2079             : 
    2080             :         // The more severe the fouling fault is (i.e., larger FaultFac), the less the UAReductionFactor is
    2081        3328 :         if (FaultFac > 0.0) UAReductionFactorAct = min(this->UAReductionFactor / FaultFac, 1.0);
    2082             : 
    2083        3328 :         return UAReductionFactorAct;
    2084             :     }
    2085             : 
    2086        2618 :     Real64 FaultPropertiesFoulingCoil::FaultFraction(EnergyPlusData &state)
    2087             :     {
    2088             :         // SUBROUTINE INFORMATION:
    2089             :         //       AUTHOR         Julien Marrec, EffiBEM
    2090             :         //       DATE WRITTEN   Feb. 2020
    2091             : 
    2092             :         // PURPOSE OF THIS SUBROUTINE:
    2093             :         // Calculate the Fault Fraction based on Availability and Severity Schedules
    2094             : 
    2095             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2096        2618 :         Real64 FaultFrac(0.0); // Fault Fraction
    2097             : 
    2098             :         // Check fault availability schedules
    2099        2618 :         if (ScheduleManager::GetCurrentScheduleValue(state, this->AvaiSchedPtr) > 0.0) {
    2100             : 
    2101             :             // Check fault severity schedules (Ptr initialized to -1, so would return a FaultFrac of 1 if not set)
    2102        2618 :             FaultFrac = ScheduleManager::GetCurrentScheduleValue(state, this->SeveritySchedPtr);
    2103             :         }
    2104             : 
    2105        2618 :         return FaultFrac;
    2106             :     }
    2107             : 
    2108       50280 :     void FaultPropertiesChillerSWT::CalFaultChillerSWT(bool FlagVariableFlow, // True if chiller is variable flow and false if it is constant flow
    2109             :                                                        Real64 FaultyChillerSWTOffset, // Faulty chiller SWT sensor offset
    2110             :                                                        Real64 Cp,                     // Local fluid specific heat
    2111             :                                                        Real64 EvapInletTemp,          // Chiller evaporator inlet water temperature
    2112             :                                                        Real64 &EvapOutletTemp,        // Chiller evaporator outlet water temperature
    2113             :                                                        Real64 &EvapMassFlowRate,      // Chiller mass flow rate
    2114             :                                                        Real64 &QEvaporator            // Chiller evaporator heat transfer rate
    2115             :     )
    2116             :     {
    2117             :         // SUBROUTINE INFORMATION:
    2118             :         //       AUTHOR         Rongpeng Zhang
    2119             :         //       DATE WRITTEN   Jun. 2016
    2120             : 
    2121             :         // PURPOSE OF THIS SUBROUTINE:
    2122             :         // To calculate the mass flow rate and supply water temperature of a chiller with faulty SWT sensor.
    2123             : 
    2124             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2125             :         // Variables for fault free cases
    2126       50280 :         Real64 EvapOutletTemp_ff = EvapOutletTemp;     // Chiller supply water temperature, fault free [C]
    2127       50280 :         Real64 EvapMassFlowRate_ff = EvapMassFlowRate; // Chiller mass flow rate, fault free [kg/s]
    2128       50280 :         Real64 QEvaporator_ff = QEvaporator;           // Chiller evaporator heat transfer rate, fault free [W]
    2129             : 
    2130             :         // Variables for faulty cases
    2131       50280 :         Real64 EvapOutletTemp_f = EvapOutletTemp_ff;     // Chiller supply water temperature, faulty case [C]
    2132       50280 :         Real64 EvapMassFlowRate_f = EvapMassFlowRate_ff; // Chiller mass flow rate, faulty case [kg/s]
    2133       50280 :         Real64 QEvaporator_f = QEvaporator_ff;           // Chiller evaporator heat transfer rate, faulty case [W]
    2134             : 
    2135       50280 :         if (!FlagVariableFlow) {
    2136             :             // Chillers with ConstantFlow mode
    2137             : 
    2138       25059 :             EvapOutletTemp_f = EvapOutletTemp_ff - FaultyChillerSWTOffset;
    2139             : 
    2140       25059 :             if ((EvapInletTemp > EvapOutletTemp_f) && (EvapMassFlowRate_ff > 0)) {
    2141       25059 :                 QEvaporator_f = EvapMassFlowRate_ff * Cp * (EvapInletTemp - EvapOutletTemp_f);
    2142             :             } else {
    2143           0 :                 EvapMassFlowRate_f = 0.0;
    2144           0 :                 QEvaporator_f = 0.0;
    2145             :             }
    2146             : 
    2147             :         } else {
    2148             :             // Chillers with LeavingSetpointModulated mode
    2149             : 
    2150       25221 :             EvapOutletTemp_f = EvapOutletTemp_ff - FaultyChillerSWTOffset;
    2151             : 
    2152       25221 :             if ((EvapInletTemp > EvapOutletTemp_f) && (Cp > 0) && (EvapMassFlowRate_ff > 0)) {
    2153       25221 :                 EvapMassFlowRate_f = QEvaporator_ff / Cp / (EvapInletTemp - EvapOutletTemp_ff);
    2154       25221 :                 QEvaporator_f = EvapMassFlowRate_f * Cp * (EvapInletTemp - EvapOutletTemp_f);
    2155             :             } else {
    2156           0 :                 EvapMassFlowRate_f = 0.0;
    2157           0 :                 QEvaporator_f = 0.0;
    2158             :             }
    2159             :         }
    2160             : 
    2161             :         // Return variables
    2162       50280 :         EvapOutletTemp = EvapOutletTemp_f;
    2163       50280 :         EvapMassFlowRate = EvapMassFlowRate_f;
    2164       50280 :         QEvaporator = QEvaporator_f;
    2165       50280 :     }
    2166             : 
    2167           1 :     bool FaultPropertiesAirFilter::CheckFaultyAirFilterFanCurve(EnergyPlusData &state)
    2168             :     {
    2169             : 
    2170             :         // SUBROUTINE INFORMATION:
    2171             :         //       AUTHOR         Rongpeng Zhang
    2172             :         //       DATE WRITTEN   Apr. 2015
    2173             : 
    2174             :         // PURPOSE OF THIS SUBROUTINE:
    2175             :         // To check whether the fan curve specified in the FaultModel:Fouling:AirFilter object
    2176             :         // covers the rated operational point of the corresponding fan
    2177             :         // Return true if the curve covers the fan rated operational point
    2178             : 
    2179             :         // Using/Aliasing
    2180             :         using Curve::CurveValue;
    2181             :         using namespace Fans;
    2182             : 
    2183             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2184             :         Real64 FanMaxAirFlowRate; // Design Max Specified Volume Flow Rate of Fan [m3/sec]
    2185             :         Real64 FanDeltaPress;     // Design Delta Pressure Across the Fan [Pa]
    2186             :         Real64 FanDeltaPressCal;  // Calculated Delta Pressure Across the Fan [Pa]
    2187             :         bool FanFound;            // Whether the fan is found or not
    2188             : 
    2189           2 :         std::string const FanName = this->FaultyAirFilterFanName; // name of the fan
    2190           1 :         int const FanCurvePtr = this->FaultyAirFilterFanCurvePtr; // pointer of the fan curve
    2191             : 
    2192           1 :         FanFound = false;
    2193             : 
    2194           1 :         for (int FanNum = 1; FanNum <= state.dataFans->NumFans; ++FanNum) {
    2195           1 :             if (UtilityRoutines::SameString(state.dataFans->Fan(FanNum).FanName, FanName)) {
    2196           1 :                 FanMaxAirFlowRate = state.dataFans->Fan(FanNum).MaxAirFlowRate;
    2197           1 :                 FanDeltaPress = state.dataFans->Fan(FanNum).DeltaPress;
    2198           1 :                 FanFound = true;
    2199           1 :                 break;
    2200             :             }
    2201             :         }
    2202             : 
    2203           1 :         if (!FanFound) {
    2204           0 :             return false;
    2205             :         }
    2206             : 
    2207           1 :         FanDeltaPressCal = CurveValue(state, FanCurvePtr, FanMaxAirFlowRate);
    2208             : 
    2209           1 :         return ((FanDeltaPressCal > 0.95 * FanDeltaPress) && (FanDeltaPressCal < 1.05 * FanDeltaPress));
    2210             :     }
    2211             : 
    2212         592 :     void SetFaultyCoilSATSensor(
    2213             :         EnergyPlusData &state, std::string const &CompType, std::string_view CompName, bool &FaultyCoilSATFlag, int &FaultyCoilSATIndex)
    2214             :     {
    2215             : 
    2216         592 :         FaultyCoilSATFlag = false;
    2217         592 :         FaultyCoilSATIndex = 0;
    2218         592 :         if (state.dataFaultsMgr->NumFaultyCoilSATSensor == 0) return;
    2219           0 :         for (int jFault_CoilSAT = 1; jFault_CoilSAT <= state.dataFaultsMgr->NumFaultyCoilSATSensor; ++jFault_CoilSAT) {
    2220           0 :             if (UtilityRoutines::SameString(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilType, CompType) &&
    2221           0 :                 UtilityRoutines::SameString(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName, CompName)) {
    2222           0 :                 FaultyCoilSATFlag = true;
    2223           0 :                 FaultyCoilSATIndex = jFault_CoilSAT;
    2224           0 :                 break;
    2225             :             }
    2226             :         }
    2227             :     }
    2228             : 
    2229             : } // namespace FaultsManager
    2230             : 
    2231        2313 : } // namespace EnergyPlus

Generated by: LCOV version 1.13