LCOV - code coverage report
Current view: top level - EnergyPlus - ExteriorEnergyUse.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 50.5 % 218 110
Test Date: 2025-06-02 12:03:30 Functions: 100.0 % 3 3

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : // EnergyPlus Headers
      49              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      50              : #include <EnergyPlus/DataEnvironment.hh>
      51              : #include <EnergyPlus/DataGlobalConstants.hh>
      52              : #include <EnergyPlus/DataIPShortCuts.hh>
      53              : #include <EnergyPlus/EMSManager.hh>
      54              : #include <EnergyPlus/ExteriorEnergyUse.hh>
      55              : #include <EnergyPlus/GlobalNames.hh>
      56              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      57              : #include <EnergyPlus/OutputProcessor.hh>
      58              : #include <EnergyPlus/OutputReportPredefined.hh>
      59              : #include <EnergyPlus/ScheduleManager.hh>
      60              : #include <EnergyPlus/UtilityRoutines.hh>
      61              : 
      62              : namespace EnergyPlus {
      63              : 
      64              : namespace ExteriorEnergyUse {
      65              : 
      66              :     // MODULE INFORMATION:
      67              :     //       AUTHOR         Linda Lawrie
      68              :     //       DATE WRITTEN   January 2001
      69              :     //       MODIFIED       na
      70              :     //       RE-ENGINEERED  na
      71              : 
      72              :     // PURPOSE OF THIS MODULE:
      73              :     // This module provides the reporting for exterior energy usage.  This usage does not directly
      74              :     // affect simulation results for the energy usage in a building but may affect the "metered"
      75              :     // usage of a facility.
      76              : 
      77       166295 :     void ManageExteriorEnergyUse(EnergyPlusData &state)
      78              :     {
      79              : 
      80              :         // SUBROUTINE INFORMATION:
      81              :         //       AUTHOR         Linda Lawrie
      82              :         //       DATE WRITTEN   January 2001
      83              :         //       MODIFIED       na
      84              :         //       RE-ENGINEERED  na
      85              : 
      86              :         // PURPOSE OF THIS SUBROUTINE:
      87              :         // This subroutine provides the usual call for the Simulation Manager.
      88              : 
      89       166295 :         if (state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag) {
      90           92 :             ExteriorEnergyUse::GetExteriorEnergyUseInput(state);
      91           92 :             state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag = false;
      92              :         }
      93              : 
      94       166295 :         ExteriorEnergyUse::ReportExteriorEnergyUse(state);
      95       166295 :     }
      96              : 
      97           93 :     void GetExteriorEnergyUseInput(EnergyPlusData &state)
      98              :     {
      99              : 
     100              :         // SUBROUTINE INFORMATION:
     101              :         //       AUTHOR         Linda Lawrie
     102              :         //       DATE WRITTEN   January 2001
     103              :         //       MODIFIED       na
     104              :         //       RE-ENGINEERED  na
     105              : 
     106              :         // PURPOSE OF THIS SUBROUTINE:
     107              :         // This subroutine gets the input for the Exterior Lights and Equipment.
     108              : 
     109              :         // Using/Aliasing
     110              :         using namespace OutputReportPredefined;
     111              :         // SUBROUTINE PARAMETER DEFINITIONS:
     112           93 :         std::string_view constexpr routineName = "GetExteriorEnergyUseInput";
     113              : 
     114              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     115              :         int NumAlphas;           // Number of Alphas for each GetObjectItem call
     116              :         int NumNumbers;          // Number of Numbers for each GetObjectItem call
     117              :         int IOStatus;            // Used in GetObjectItem
     118           93 :         bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine
     119           93 :         std::string EndUseSubcategoryName;
     120              : 
     121           93 :         auto &s_ipsc = state.dataIPShortCut;
     122              : 
     123           93 :         state.dataExteriorEnergyUse->NumExteriorLights = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:Lights");
     124           93 :         state.dataExteriorEnergyUse->ExteriorLights.allocate(state.dataExteriorEnergyUse->NumExteriorLights);
     125              : 
     126           93 :         int NumFuelEq = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:FuelEquipment");
     127           93 :         int NumWtrEq = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:WaterEquipment");
     128           93 :         state.dataExteriorEnergyUse->ExteriorEquipment.allocate(NumFuelEq + NumWtrEq);
     129           93 :         state.dataExteriorEnergyUse->UniqueExteriorEquipNames.reserve(NumFuelEq + NumWtrEq);
     130              : 
     131           93 :         state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag = false;
     132           93 :         state.dataExteriorEnergyUse->NumExteriorEqs = 0;
     133              : 
     134              :         // =================================  Get Exterior Lights
     135           93 :         std::string_view cCurrentModuleObject = "Exterior:Lights";
     136          120 :         for (int Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) {
     137           54 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     138              :                                                                      cCurrentModuleObject,
     139              :                                                                      Item,
     140           27 :                                                                      s_ipsc->cAlphaArgs,
     141              :                                                                      NumAlphas,
     142           27 :                                                                      s_ipsc->rNumericArgs,
     143              :                                                                      NumNumbers,
     144              :                                                                      IOStatus,
     145           27 :                                                                      s_ipsc->lNumericFieldBlanks,
     146           27 :                                                                      s_ipsc->lAlphaFieldBlanks,
     147           27 :                                                                      s_ipsc->cAlphaFieldNames,
     148           27 :                                                                      s_ipsc->cNumericFieldNames);
     149              : 
     150           27 :             ErrorObjectHeader eoh{routineName, cCurrentModuleObject, s_ipsc->cAlphaArgs(1)};
     151              : 
     152           27 :             state.dataExteriorEnergyUse->ExteriorLights(Item).Name = s_ipsc->cAlphaArgs(1);
     153              : 
     154           27 :             if (s_ipsc->lAlphaFieldBlanks(2)) {
     155            0 :                 ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2));
     156            0 :                 ErrorsFound = true;
     157           27 :             } else if ((state.dataExteriorEnergyUse->ExteriorLights(Item).sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) {
     158            0 :                 ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2));
     159            0 :                 ErrorsFound = true;
     160           27 :             } else if (int SchMin = state.dataExteriorEnergyUse->ExteriorLights(Item).sched->getMinVal(state); SchMin < 0.0) {
     161            0 :                 ShowSevereCustom(
     162              :                     state,
     163              :                     eoh,
     164            0 :                     format("{} = {} minimum is [{:.1R}]. Values must be >= 0.0.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), SchMin));
     165            0 :                 ErrorsFound = true;
     166              :             }
     167              : 
     168           27 :             if (s_ipsc->lAlphaFieldBlanks(3)) {
     169            0 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly;
     170           27 :             } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "ScheduleNameOnly")) {
     171            4 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly;
     172           23 :             } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "AstronomicalClock")) {
     173           23 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::AstroClockOverride;
     174              :             } else {
     175            0 :                 ShowSevereInvalidKey(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3));
     176              :             }
     177              : 
     178           27 :             if (NumAlphas > 3) {
     179           26 :                 EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(4);
     180              :             } else {
     181            1 :                 EndUseSubcategoryName = "General";
     182              :             }
     183              : 
     184           27 :             state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel = state.dataIPShortCut->rNumericArgs(1);
     185           27 :             if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
     186           40 :                 SetupEMSActuator(state,
     187              :                                  "ExteriorLights",
     188           20 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     189              :                                  "Electricity Rate",
     190              :                                  "W",
     191           20 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorOn,
     192           20 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorValue);
     193              :             }
     194              : 
     195           54 :             SetupOutputVariable(state,
     196              :                                 "Exterior Lights Electricity Rate",
     197              :                                 Constant::Units::W,
     198           27 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power,
     199              :                                 OutputProcessor::TimeStepType::Zone,
     200              :                                 OutputProcessor::StoreType::Average,
     201           27 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).Name);
     202              : 
     203           54 :             SetupOutputVariable(state,
     204              :                                 "Exterior Lights Electricity Energy",
     205              :                                 Constant::Units::J,
     206           27 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse,
     207              :                                 OutputProcessor::TimeStepType::Zone,
     208              :                                 OutputProcessor::StoreType::Sum,
     209           27 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     210              :                                 Constant::eResource::Electricity,
     211              :                                 OutputProcessor::Group::Invalid,
     212              :                                 OutputProcessor::EndUseCat::ExteriorLights,
     213              :                                 EndUseSubcategoryName);
     214              : 
     215              :             // entries for predefined tables
     216           54 :             PreDefTableEntry(state,
     217           27 :                              state.dataOutRptPredefined->pdchExLtPower,
     218           27 :                              state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     219           27 :                              state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel);
     220           27 :             state.dataExteriorEnergyUse->sumDesignLevel += state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel;
     221           27 :             if (state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode ==
     222              :                 ExteriorEnergyUse::LightControlType::AstroClockOverride) { // photocell/schedule
     223           46 :                 PreDefTableEntry(
     224           23 :                     state, state.dataOutRptPredefined->pdchExLtClock, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "AstronomicalClock");
     225           23 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtSchd, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "-");
     226              :             } else {
     227            8 :                 PreDefTableEntry(
     228            4 :                     state, state.dataOutRptPredefined->pdchExLtClock, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "Schedule");
     229            4 :                 PreDefTableEntry(state,
     230            4 :                                  state.dataOutRptPredefined->pdchExLtSchd,
     231            4 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     232            4 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).sched->Name);
     233              :             }
     234              :         }
     235           93 :         PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtPower, "Exterior Lighting Total", state.dataExteriorEnergyUse->sumDesignLevel);
     236              : 
     237              :         // =================================  Get Exterior Fuel Equipment
     238              : 
     239           93 :         cCurrentModuleObject = "Exterior:FuelEquipment";
     240           93 :         for (int Item = 1; Item <= NumFuelEq; ++Item) {
     241            0 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     242              :                                                                      cCurrentModuleObject,
     243              :                                                                      Item,
     244            0 :                                                                      state.dataIPShortCut->cAlphaArgs,
     245              :                                                                      NumAlphas,
     246            0 :                                                                      state.dataIPShortCut->rNumericArgs,
     247              :                                                                      NumNumbers,
     248              :                                                                      IOStatus,
     249            0 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     250            0 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
     251            0 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     252            0 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     253            0 :             GlobalNames::VerifyUniqueInterObjectName(state,
     254            0 :                                                      state.dataExteriorEnergyUse->UniqueExteriorEquipNames,
     255            0 :                                                      state.dataIPShortCut->cAlphaArgs(1),
     256              :                                                      cCurrentModuleObject,
     257            0 :                                                      state.dataIPShortCut->cAlphaFieldNames(1),
     258              :                                                      ErrorsFound);
     259              : 
     260            0 :             ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)};
     261              : 
     262            0 :             ++state.dataExteriorEnergyUse->NumExteriorEqs;
     263              : 
     264            0 :             auto &exteriorEquip = state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs);
     265            0 :             exteriorEquip.Name = state.dataIPShortCut->cAlphaArgs(1);
     266              : 
     267            0 :             if (NumAlphas > 3) {
     268            0 :                 EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(4);
     269              :             } else {
     270            0 :                 EndUseSubcategoryName = "General";
     271              :             }
     272              : 
     273            0 :             if (state.dataIPShortCut->lAlphaFieldBlanks(2)) {
     274            0 :                 ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2));
     275            0 :                 ErrorsFound = true;
     276              : 
     277            0 :             } else if ((exteriorEquip.FuelType = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, s_ipsc->cAlphaArgs(2)))) ==
     278              :                        Constant::eFuel::Invalid) {
     279            0 :                 ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2));
     280            0 :                 ErrorsFound = true;
     281              : 
     282            0 :             } else if (exteriorEquip.FuelType != Constant::eFuel::Water) {
     283            0 :                 SetupOutputVariable(state,
     284              :                                     "Exterior Equipment Fuel Rate",
     285              :                                     Constant::Units::W,
     286            0 :                                     exteriorEquip.Power,
     287              :                                     OutputProcessor::TimeStepType::Zone,
     288              :                                     OutputProcessor::StoreType::Average,
     289            0 :                                     exteriorEquip.Name);
     290            0 :                 SetupOutputVariable(state,
     291            0 :                                     format("Exterior Equipment {} Energy", Constant::eFuelNames[(int)exteriorEquip.FuelType]),
     292              :                                     Constant::Units::J,
     293            0 :                                     exteriorEquip.CurrentUse,
     294              :                                     OutputProcessor::TimeStepType::Zone,
     295              :                                     OutputProcessor::StoreType::Sum,
     296            0 :                                     exteriorEquip.Name,
     297            0 :                                     Constant::eFuel2eResource[(int)exteriorEquip.FuelType],
     298              :                                     OutputProcessor::Group::Invalid,
     299              :                                     OutputProcessor::EndUseCat::ExteriorEquipment,
     300              :                                     EndUseSubcategoryName);
     301              :             } else {
     302            0 :                 SetupOutputVariable(state,
     303              :                                     "Exterior Equipment Water Volume Flow Rate",
     304              :                                     Constant::Units::m3_s,
     305            0 :                                     exteriorEquip.Power,
     306              :                                     OutputProcessor::TimeStepType::Zone,
     307              :                                     OutputProcessor::StoreType::Average,
     308            0 :                                     exteriorEquip.Name);
     309            0 :                 SetupOutputVariable(state,
     310            0 :                                     format("Exterior Equipment {} Volume", Constant::eFuelNames[(int)exteriorEquip.FuelType]),
     311              :                                     Constant::Units::m3,
     312            0 :                                     exteriorEquip.CurrentUse,
     313              :                                     OutputProcessor::TimeStepType::Zone,
     314              :                                     OutputProcessor::StoreType::Sum,
     315            0 :                                     exteriorEquip.Name,
     316            0 :                                     Constant::eFuel2eResource[(int)exteriorEquip.FuelType],
     317              :                                     OutputProcessor::Group::Invalid,
     318              :                                     OutputProcessor::EndUseCat::ExteriorEquipment,
     319              :                                     EndUseSubcategoryName);
     320              :             }
     321              : 
     322            0 :             if (s_ipsc->lAlphaFieldBlanks(3)) {
     323            0 :                 ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3));
     324            0 :                 ErrorsFound = true;
     325            0 :             } else if ((exteriorEquip.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) {
     326            0 :                 ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3));
     327            0 :                 ErrorsFound = true;
     328            0 :             } else if (int SchMin = exteriorEquip.sched->getMinVal(state); SchMin < 0.0) {
     329            0 :                 ShowSevereCustom(
     330              :                     state,
     331              :                     eoh,
     332            0 :                     format("{} = {} minimum is [{:.1R}]. Values must be >= 0.0.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), SchMin));
     333            0 :                 ErrorsFound = true;
     334              :             }
     335            0 :             exteriorEquip.DesignLevel = s_ipsc->rNumericArgs(1);
     336              :         }
     337              : 
     338              :         // =================================  Get Exterior Water Equipment
     339              : 
     340           93 :         cCurrentModuleObject = "Exterior:WaterEquipment";
     341           93 :         for (int Item = 1; Item <= NumWtrEq; ++Item) {
     342            0 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     343              :                                                                      cCurrentModuleObject,
     344              :                                                                      Item,
     345            0 :                                                                      s_ipsc->cAlphaArgs,
     346              :                                                                      NumAlphas,
     347            0 :                                                                      s_ipsc->rNumericArgs,
     348              :                                                                      NumNumbers,
     349              :                                                                      IOStatus,
     350            0 :                                                                      s_ipsc->lNumericFieldBlanks,
     351            0 :                                                                      s_ipsc->lAlphaFieldBlanks,
     352            0 :                                                                      s_ipsc->cAlphaFieldNames,
     353            0 :                                                                      s_ipsc->cNumericFieldNames);
     354              : 
     355            0 :             ErrorObjectHeader eoh{routineName, cCurrentModuleObject, s_ipsc->cAlphaArgs(1)};
     356              : 
     357            0 :             GlobalNames::VerifyUniqueInterObjectName(state,
     358            0 :                                                      state.dataExteriorEnergyUse->UniqueExteriorEquipNames,
     359            0 :                                                      s_ipsc->cAlphaArgs(1),
     360              :                                                      cCurrentModuleObject,
     361            0 :                                                      s_ipsc->cAlphaFieldNames(1),
     362              :                                                      ErrorsFound);
     363              : 
     364            0 :             ++state.dataExteriorEnergyUse->NumExteriorEqs;
     365              : 
     366            0 :             auto &exteriorEquip = state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs);
     367            0 :             exteriorEquip.Name = s_ipsc->cAlphaArgs(1);
     368            0 :             exteriorEquip.FuelType = Constant::eFuel::Water;
     369              : 
     370            0 :             if (s_ipsc->lAlphaFieldBlanks(3)) {
     371            0 :                 ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3));
     372            0 :                 ErrorsFound = true;
     373            0 :             } else if ((exteriorEquip.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) {
     374            0 :                 ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3));
     375            0 :                 ErrorsFound = true;
     376            0 :             } else if (int SchMin = exteriorEquip.sched->getMinVal(state); SchMin < 0.0) {
     377            0 :                 ShowSevereCustom(
     378              :                     state,
     379              :                     eoh,
     380            0 :                     format("{} = {} minimum is [{:.1R}]. Values must be >= 0.0.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), SchMin));
     381            0 :                 ErrorsFound = true;
     382              :             }
     383              : 
     384            0 :             if (NumAlphas > 3) {
     385            0 :                 EndUseSubcategoryName = s_ipsc->cAlphaArgs(4);
     386              :             } else {
     387            0 :                 EndUseSubcategoryName = "General";
     388              :             }
     389              : 
     390            0 :             exteriorEquip.DesignLevel = s_ipsc->rNumericArgs(1);
     391              : 
     392            0 :             SetupOutputVariable(state,
     393              :                                 "Exterior Equipment Water Volume Flow Rate",
     394              :                                 Constant::Units::m3_s,
     395            0 :                                 exteriorEquip.Power,
     396              :                                 OutputProcessor::TimeStepType::Zone,
     397              :                                 OutputProcessor::StoreType::Average,
     398            0 :                                 exteriorEquip.Name);
     399              : 
     400            0 :             SetupOutputVariable(state,
     401              :                                 "Exterior Equipment Water Volume",
     402              :                                 Constant::Units::m3,
     403            0 :                                 exteriorEquip.CurrentUse,
     404              :                                 OutputProcessor::TimeStepType::Zone,
     405              :                                 OutputProcessor::StoreType::Sum,
     406            0 :                                 exteriorEquip.Name,
     407              :                                 Constant::eResource::Water,
     408              :                                 OutputProcessor::Group::Invalid,
     409              :                                 OutputProcessor::EndUseCat::ExteriorEquipment,
     410              :                                 EndUseSubcategoryName);
     411            0 :             SetupOutputVariable(state,
     412              :                                 "Exterior Equipment Mains Water Volume",
     413              :                                 Constant::Units::m3,
     414            0 :                                 exteriorEquip.CurrentUse,
     415              :                                 OutputProcessor::TimeStepType::Zone,
     416              :                                 OutputProcessor::StoreType::Sum,
     417            0 :                                 exteriorEquip.Name,
     418              :                                 Constant::eResource::MainsWater,
     419              :                                 OutputProcessor::Group::Invalid,
     420              :                                 OutputProcessor::EndUseCat::ExteriorEquipment,
     421              :                                 EndUseSubcategoryName);
     422              :         }
     423              : 
     424           93 :         if (ErrorsFound) {
     425            0 :             ShowFatalError(state, format("{}Errors found in input.  Program terminates.", routineName));
     426              :         }
     427           93 :     } // GetExteriorEnergyUseInput()
     428              : 
     429       166296 :     void ReportExteriorEnergyUse(EnergyPlusData &state)
     430              :     {
     431              : 
     432              :         // SUBROUTINE INFORMATION:
     433              :         //       AUTHOR         Linda Lawrie
     434              :         //       DATE WRITTEN   January 2001
     435              : 
     436              :         // PURPOSE OF THIS SUBROUTINE:
     437              :         // This subroutine performs the calculations necessary to report
     438              :         // the exterior energy use types.
     439              : 
     440       288514 :         for (int Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) {
     441       122218 :             switch (state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode) {
     442          681 :             case ExteriorEnergyUse::LightControlType::ScheduleOnly:
     443         1362 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel *
     444          681 :                                                                           state.dataExteriorEnergyUse->ExteriorLights(Item).sched->getCurrentVal();
     445          681 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     446          681 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     447          681 :                 break;
     448       121537 :             case ExteriorEnergyUse::LightControlType::AstroClockOverride:
     449       121537 :                 if (state.dataEnvrn->SunIsUp) {
     450        57428 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power = 0.0;
     451        57428 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse = 0.0;
     452              :                 } else {
     453        64109 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power =
     454       128218 :                         state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel *
     455        64109 :                         state.dataExteriorEnergyUse->ExteriorLights(Item).sched->getCurrentVal();
     456        64109 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     457        64109 :                         state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     458              :                 }
     459       121537 :                 break;
     460            0 :             default:
     461              :                 // should not happen
     462            0 :                 break;
     463              :             }
     464              : 
     465              :             // Reduce lighting power due to demand limiting
     466       122218 :             if (state.dataExteriorEnergyUse->ExteriorLights(Item).ManageDemand &&
     467            0 :                 (state.dataExteriorEnergyUse->ExteriorLights(Item).Power > state.dataExteriorEnergyUse->ExteriorLights(Item).DemandLimit)) {
     468            0 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).DemandLimit;
     469            0 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     470            0 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     471              :             }
     472              :             // EMS controls
     473       122218 :             if (state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorOn) {
     474            0 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorValue;
     475              :             }
     476              : 
     477       122218 :             state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     478       122218 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     479              : 
     480              :             // gather for tabular reports
     481       122218 :             if (!state.dataGlobal->WarmupFlag) {
     482              :                 //      IF (DoOutputReporting .AND.  WriteTabularFiles .and. (KindOfSim == ksRunPeriodWeather)) THEN !for weather simulations only
     483        19399 :                 if (state.dataGlobal->DoOutputReporting &&
     484         9697 :                     (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather)) { // for weather simulations only
     485              :                     // for tabular report, accumua the total electricity used for each ExteriorLights object
     486            1 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).SumConsumption += state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse;
     487              :                     // for tabular report, accumulate the time when each ExteriorLights has consumption
     488              :                     //(using a very small threshold instead of zero)
     489            1 :                     if (state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse > 0.01) {
     490            1 :                         state.dataExteriorEnergyUse->ExteriorLights(Item).SumTimeNotZeroCons += state.dataGlobal->TimeStepZone;
     491              :                     }
     492              :                 }
     493              :             }
     494              :         }
     495              : 
     496       166298 :         for (int Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorEqs; ++Item) {
     497            4 :             state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power = state.dataExteriorEnergyUse->ExteriorEquipment(Item).DesignLevel *
     498            2 :                                                                          state.dataExteriorEnergyUse->ExteriorEquipment(Item).sched->getCurrentVal();
     499            2 :             state.dataExteriorEnergyUse->ExteriorEquipment(Item).CurrentUse =
     500            2 :                 state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power * state.dataGlobal->TimeStepZoneSec;
     501              :         }
     502       166296 :     }
     503              : 
     504              : } // namespace ExteriorEnergyUse
     505              : 
     506              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1