LCOV - code coverage report
Current view: top level - EnergyPlus - ExteriorEnergyUse.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 191 296 64.5 %
Date: 2024-08-24 18:31:18 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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     1985870 :     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     1985870 :         if (state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag) {
      90         795 :             ExteriorEnergyUse::GetExteriorEnergyUseInput(state);
      91         795 :             state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag = false;
      92             :         }
      93             : 
      94     1985870 :         ExteriorEnergyUse::ReportExteriorEnergyUse(state);
      95     1985870 :     }
      96             : 
      97         795 :     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             : 
     111             :         using ScheduleManager::GetScheduleIndex;
     112             :         using ScheduleManager::GetScheduleMaxValue;
     113             :         using ScheduleManager::GetScheduleMinValue;
     114             :         using ScheduleManager::GetScheduleName;
     115             :         using namespace OutputReportPredefined;
     116             :         // SUBROUTINE PARAMETER DEFINITIONS:
     117         795 :         std::string_view constexpr routineName = "GetExteriorEnergyUseInput";
     118             : 
     119             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     120             :         int NumAlphas;           // Number of Alphas for each GetObjectItem call
     121             :         int NumNumbers;          // Number of Numbers for each GetObjectItem call
     122             :         int IOStatus;            // Used in GetObjectItem
     123         795 :         bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine
     124         795 :         std::string EndUseSubcategoryName;
     125             :         Real64 SchMax; // Max value of schedule for item
     126             :         Real64 SchMin; // Min value of schedule for item
     127             : 
     128         795 :         auto &ipsc = state.dataIPShortCut;
     129             : 
     130         795 :         state.dataExteriorEnergyUse->NumExteriorLights = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:Lights");
     131         795 :         state.dataExteriorEnergyUse->ExteriorLights.allocate(state.dataExteriorEnergyUse->NumExteriorLights);
     132             : 
     133         795 :         int NumFuelEq = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:FuelEquipment");
     134         795 :         int NumWtrEq = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:WaterEquipment");
     135         795 :         state.dataExteriorEnergyUse->ExteriorEquipment.allocate(NumFuelEq + NumWtrEq);
     136         795 :         state.dataExteriorEnergyUse->UniqueExteriorEquipNames.reserve(NumFuelEq + NumWtrEq);
     137             : 
     138         795 :         state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag = false;
     139         795 :         state.dataExteriorEnergyUse->NumExteriorEqs = 0;
     140             : 
     141             :         // =================================  Get Exterior Lights
     142         795 :         std::string_view cCurrentModuleObject = "Exterior:Lights";
     143         986 :         for (int Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) {
     144         382 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     145             :                                                                      cCurrentModuleObject,
     146             :                                                                      Item,
     147         191 :                                                                      ipsc->cAlphaArgs,
     148             :                                                                      NumAlphas,
     149         191 :                                                                      ipsc->rNumericArgs,
     150             :                                                                      NumNumbers,
     151             :                                                                      IOStatus,
     152         191 :                                                                      ipsc->lNumericFieldBlanks,
     153         191 :                                                                      ipsc->lAlphaFieldBlanks,
     154         191 :                                                                      ipsc->cAlphaFieldNames,
     155         191 :                                                                      ipsc->cNumericFieldNames);
     156             : 
     157         191 :             state.dataExteriorEnergyUse->ExteriorLights(Item).Name = ipsc->cAlphaArgs(1);
     158         191 :             state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(2));
     159         191 :             if (state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr == 0) {
     160           0 :                 if (ipsc->lAlphaFieldBlanks(2)) {
     161           0 :                     ShowSevereError(state,
     162           0 :                                     format("{}: {}: {} is required, missing for {}={}",
     163             :                                            routineName,
     164             :                                            cCurrentModuleObject,
     165           0 :                                            ipsc->cAlphaFieldNames(2),
     166           0 :                                            ipsc->cAlphaFieldNames(1),
     167           0 :                                            ipsc->cAlphaArgs(1)));
     168             :                 } else {
     169           0 :                     ShowSevereError(state,
     170           0 :                                     format("{}: {}: invalid {} entered={} for {}={}",
     171             :                                            routineName,
     172             :                                            cCurrentModuleObject,
     173           0 :                                            ipsc->cAlphaFieldNames(2),
     174           0 :                                            ipsc->cAlphaArgs(2),
     175           0 :                                            ipsc->cAlphaFieldNames(1),
     176           0 :                                            ipsc->cAlphaArgs(1)));
     177             :                 }
     178           0 :                 ErrorsFound = true;
     179             :             } else { // check min/max on schedule
     180         191 :                 SchMin = GetScheduleMinValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
     181         191 :                 SchMax = GetScheduleMaxValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
     182         191 :                 if (SchMin < 0.0 || SchMax < 0.0) {
     183           0 :                     if (SchMin < 0.0) {
     184           0 :                         ShowSevereError(state,
     185           0 :                                         format("{}: {}: invalid {} minimum, is < 0.0 for {}={}",
     186             :                                                routineName,
     187             :                                                cCurrentModuleObject,
     188           0 :                                                ipsc->cAlphaFieldNames(2),
     189           0 :                                                ipsc->cAlphaFieldNames(1),
     190           0 :                                                ipsc->cAlphaArgs(1)));
     191           0 :                         ShowContinueError(state, format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(2), SchMin));
     192           0 :                         ErrorsFound = true;
     193             :                     }
     194           0 :                     if (SchMax < 0.0) {
     195           0 :                         ShowSevereError(state,
     196           0 :                                         format("{}: {}: invalid {} maximum, is < 0.0 for {}={}",
     197             :                                                routineName,
     198             :                                                cCurrentModuleObject,
     199           0 :                                                ipsc->cAlphaFieldNames(2),
     200           0 :                                                ipsc->cAlphaFieldNames(1),
     201           0 :                                                ipsc->cAlphaArgs(1)));
     202           0 :                         ShowContinueError(state, format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(2), SchMax));
     203           0 :                         ErrorsFound = true;
     204             :                     }
     205             :                 }
     206             :             }
     207         191 :             if (ipsc->lAlphaFieldBlanks(3)) {
     208           7 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly;
     209         184 :             } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "ScheduleNameOnly")) {
     210          12 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly;
     211         172 :             } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "AstronomicalClock")) {
     212         172 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::AstroClockOverride;
     213             :             } else {
     214           0 :                 ShowSevereError(state,
     215           0 :                                 format("{}: {}: invalid {} entered={} for {}={}",
     216             :                                        routineName,
     217             :                                        cCurrentModuleObject,
     218           0 :                                        state.dataIPShortCut->cAlphaFieldNames(3),
     219           0 :                                        state.dataIPShortCut->cAlphaArgs(3),
     220           0 :                                        state.dataIPShortCut->cAlphaFieldNames(1),
     221           0 :                                        state.dataIPShortCut->cAlphaArgs(1)));
     222             :             }
     223             : 
     224         191 :             if (NumAlphas > 3) {
     225         178 :                 EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(4);
     226             :             } else {
     227          13 :                 EndUseSubcategoryName = "General";
     228             :             }
     229             : 
     230         191 :             state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel = state.dataIPShortCut->rNumericArgs(1);
     231         191 :             if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
     232         144 :                 SetupEMSActuator(state,
     233             :                                  "ExteriorLights",
     234          72 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     235             :                                  "Electricity Rate",
     236             :                                  "W",
     237          72 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorOn,
     238          72 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorValue);
     239             :             }
     240             : 
     241         382 :             SetupOutputVariable(state,
     242             :                                 "Exterior Lights Electricity Rate",
     243             :                                 Constant::Units::W,
     244         191 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power,
     245             :                                 OutputProcessor::TimeStepType::Zone,
     246             :                                 OutputProcessor::StoreType::Average,
     247         191 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).Name);
     248             : 
     249         382 :             SetupOutputVariable(state,
     250             :                                 "Exterior Lights Electricity Energy",
     251             :                                 Constant::Units::J,
     252         191 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse,
     253             :                                 OutputProcessor::TimeStepType::Zone,
     254             :                                 OutputProcessor::StoreType::Sum,
     255         191 :                                 state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     256             :                                 Constant::eResource::Electricity,
     257             :                                 OutputProcessor::Group::Invalid,
     258             :                                 OutputProcessor::EndUseCat::ExteriorLights,
     259             :                                 EndUseSubcategoryName);
     260             : 
     261             :             // entries for predefined tables
     262         382 :             PreDefTableEntry(state,
     263         191 :                              state.dataOutRptPredefined->pdchExLtPower,
     264         191 :                              state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     265         191 :                              state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel);
     266         191 :             state.dataExteriorEnergyUse->sumDesignLevel += state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel;
     267         191 :             if (state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode ==
     268             :                 ExteriorEnergyUse::LightControlType::AstroClockOverride) { // photocell/schedule
     269         344 :                 PreDefTableEntry(
     270         172 :                     state, state.dataOutRptPredefined->pdchExLtClock, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "AstronomicalClock");
     271         172 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtSchd, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "-");
     272             :             } else {
     273          38 :                 PreDefTableEntry(
     274          19 :                     state, state.dataOutRptPredefined->pdchExLtClock, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "Schedule");
     275          38 :                 PreDefTableEntry(state,
     276          19 :                                  state.dataOutRptPredefined->pdchExLtSchd,
     277          19 :                                  state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
     278          38 :                                  GetScheduleName(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr));
     279             :             }
     280             :         }
     281         795 :         PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtPower, "Exterior Lighting Total", state.dataExteriorEnergyUse->sumDesignLevel);
     282             : 
     283             :         // =================================  Get Exterior Fuel Equipment
     284             : 
     285         795 :         cCurrentModuleObject = "Exterior:FuelEquipment";
     286         855 :         for (int Item = 1; Item <= NumFuelEq; ++Item) {
     287         120 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     288             :                                                                      cCurrentModuleObject,
     289             :                                                                      Item,
     290          60 :                                                                      state.dataIPShortCut->cAlphaArgs,
     291             :                                                                      NumAlphas,
     292          60 :                                                                      state.dataIPShortCut->rNumericArgs,
     293             :                                                                      NumNumbers,
     294             :                                                                      IOStatus,
     295          60 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     296          60 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
     297          60 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     298          60 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     299         120 :             GlobalNames::VerifyUniqueInterObjectName(state,
     300          60 :                                                      state.dataExteriorEnergyUse->UniqueExteriorEquipNames,
     301          60 :                                                      state.dataIPShortCut->cAlphaArgs(1),
     302             :                                                      cCurrentModuleObject,
     303          60 :                                                      state.dataIPShortCut->cAlphaFieldNames(1),
     304             :                                                      ErrorsFound);
     305             : 
     306          60 :             ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)};
     307             : 
     308          60 :             ++state.dataExteriorEnergyUse->NumExteriorEqs;
     309             : 
     310          60 :             auto &exteriorEquip = state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs);
     311          60 :             exteriorEquip.Name = state.dataIPShortCut->cAlphaArgs(1);
     312             : 
     313          60 :             if (NumAlphas > 3) {
     314          45 :                 EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(4);
     315             :             } else {
     316          15 :                 EndUseSubcategoryName = "General";
     317             :             }
     318             : 
     319          60 :             if (state.dataIPShortCut->lAlphaFieldBlanks(2)) {
     320           0 :                 ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2));
     321           0 :                 ErrorsFound = true;
     322             : 
     323         120 :             } else if ((exteriorEquip.FuelType = static_cast<Constant::eFuel>(
     324          60 :                             getEnumValue(Constant::eFuelNamesUC, Util::makeUPPER(ipsc->cAlphaArgs(2))))) == Constant::eFuel::Invalid) {
     325           0 :                 ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2));
     326           0 :                 ErrorsFound = true;
     327             : 
     328          60 :             } else if (exteriorEquip.FuelType != Constant::eFuel::Water) {
     329         118 :                 SetupOutputVariable(state,
     330             :                                     "Exterior Equipment Fuel Rate",
     331             :                                     Constant::Units::W,
     332          59 :                                     exteriorEquip.Power,
     333             :                                     OutputProcessor::TimeStepType::Zone,
     334             :                                     OutputProcessor::StoreType::Average,
     335          59 :                                     exteriorEquip.Name);
     336         177 :                 SetupOutputVariable(state,
     337         118 :                                     format("Exterior Equipment {} Energy", Constant::eFuelNames[(int)exteriorEquip.FuelType]),
     338             :                                     Constant::Units::J,
     339          59 :                                     exteriorEquip.CurrentUse,
     340             :                                     OutputProcessor::TimeStepType::Zone,
     341             :                                     OutputProcessor::StoreType::Sum,
     342          59 :                                     exteriorEquip.Name,
     343          59 :                                     Constant::eFuel2eResource[(int)exteriorEquip.FuelType],
     344             :                                     OutputProcessor::Group::Invalid,
     345             :                                     OutputProcessor::EndUseCat::ExteriorEquipment,
     346             :                                     EndUseSubcategoryName);
     347             :             } else {
     348           2 :                 SetupOutputVariable(state,
     349             :                                     "Exterior Equipment Water Volume Flow Rate",
     350             :                                     Constant::Units::m3_s,
     351           1 :                                     exteriorEquip.Power,
     352             :                                     OutputProcessor::TimeStepType::Zone,
     353             :                                     OutputProcessor::StoreType::Average,
     354           1 :                                     exteriorEquip.Name);
     355           3 :                 SetupOutputVariable(state,
     356           2 :                                     format("Exterior Equipment {} Volume", Constant::eFuelNames[(int)exteriorEquip.FuelType]),
     357             :                                     Constant::Units::m3,
     358           1 :                                     exteriorEquip.CurrentUse,
     359             :                                     OutputProcessor::TimeStepType::Zone,
     360             :                                     OutputProcessor::StoreType::Sum,
     361           1 :                                     exteriorEquip.Name,
     362           1 :                                     Constant::eFuel2eResource[(int)exteriorEquip.FuelType],
     363             :                                     OutputProcessor::Group::Invalid,
     364             :                                     OutputProcessor::EndUseCat::ExteriorEquipment,
     365             :                                     EndUseSubcategoryName);
     366             :             }
     367             : 
     368          60 :             exteriorEquip.SchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(3));
     369          60 :             if (exteriorEquip.SchedPtr == 0) {
     370           0 :                 if (ipsc->lAlphaFieldBlanks(3)) {
     371           0 :                     ShowSevereError(state,
     372           0 :                                     format("{}: {}: {} is required, missing for {}={}",
     373             :                                            routineName,
     374             :                                            cCurrentModuleObject,
     375           0 :                                            ipsc->cAlphaFieldNames(3),
     376           0 :                                            ipsc->cAlphaFieldNames(1),
     377           0 :                                            ipsc->cAlphaArgs(1)));
     378             :                 } else {
     379           0 :                     ShowSevereError(state,
     380           0 :                                     format("{}: {}: invalid {} entered={} for {}={}",
     381             :                                            routineName,
     382             :                                            cCurrentModuleObject,
     383           0 :                                            ipsc->cAlphaFieldNames(3),
     384           0 :                                            ipsc->cAlphaArgs(3),
     385           0 :                                            ipsc->cAlphaFieldNames(1),
     386           0 :                                            ipsc->cAlphaArgs(1)));
     387             :                 }
     388           0 :                 ErrorsFound = true;
     389             :             } else { // check min/max on schedule
     390          60 :                 SchMin = GetScheduleMinValue(state, exteriorEquip.SchedPtr);
     391          60 :                 SchMax = GetScheduleMaxValue(state, exteriorEquip.SchedPtr);
     392          60 :                 if (SchMin < 0.0 || SchMax < 0.0) {
     393           0 :                     if (SchMin < 0.0) {
     394           0 :                         ShowSevereError(state,
     395           0 :                                         format("{}: {}: invalid {} minimum, is < 0.0 for {}={}",
     396             :                                                routineName,
     397             :                                                cCurrentModuleObject,
     398           0 :                                                ipsc->cAlphaFieldNames(3),
     399           0 :                                                ipsc->cAlphaFieldNames(1),
     400           0 :                                                ipsc->cAlphaArgs(1)));
     401           0 :                         ShowContinueError(state, format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMin));
     402           0 :                         ErrorsFound = true;
     403             :                     }
     404           0 :                     if (SchMax < 0.0) {
     405           0 :                         ShowSevereError(state,
     406           0 :                                         format("{}: {}: invalid {} maximum, is < 0.0 for {}={}",
     407             :                                                routineName,
     408             :                                                cCurrentModuleObject,
     409           0 :                                                ipsc->cAlphaFieldNames(3),
     410           0 :                                                ipsc->cAlphaFieldNames(1),
     411           0 :                                                ipsc->cAlphaArgs(1)));
     412           0 :                         ShowContinueError(state, format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMax));
     413           0 :                         ErrorsFound = true;
     414             :                     }
     415             :                 }
     416             :             }
     417          60 :             exteriorEquip.DesignLevel = ipsc->rNumericArgs(1);
     418             :         }
     419             : 
     420             :         // =================================  Get Exterior Water Equipment
     421             : 
     422         795 :         cCurrentModuleObject = "Exterior:WaterEquipment";
     423         796 :         for (int Item = 1; Item <= NumWtrEq; ++Item) {
     424           2 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     425             :                                                                      cCurrentModuleObject,
     426             :                                                                      Item,
     427           1 :                                                                      ipsc->cAlphaArgs,
     428             :                                                                      NumAlphas,
     429           1 :                                                                      ipsc->rNumericArgs,
     430             :                                                                      NumNumbers,
     431             :                                                                      IOStatus,
     432           1 :                                                                      ipsc->lNumericFieldBlanks,
     433           1 :                                                                      ipsc->lAlphaFieldBlanks,
     434           1 :                                                                      ipsc->cAlphaFieldNames,
     435           1 :                                                                      ipsc->cNumericFieldNames);
     436           2 :             GlobalNames::VerifyUniqueInterObjectName(state,
     437           1 :                                                      state.dataExteriorEnergyUse->UniqueExteriorEquipNames,
     438           1 :                                                      ipsc->cAlphaArgs(1),
     439             :                                                      cCurrentModuleObject,
     440           1 :                                                      ipsc->cAlphaFieldNames(1),
     441             :                                                      ErrorsFound);
     442             : 
     443           1 :             ++state.dataExteriorEnergyUse->NumExteriorEqs;
     444             : 
     445           1 :             auto &exteriorEquip = state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs);
     446           1 :             exteriorEquip.Name = ipsc->cAlphaArgs(1);
     447           1 :             exteriorEquip.FuelType = Constant::eFuel::Water;
     448           1 :             exteriorEquip.SchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(3));
     449           1 :             if (exteriorEquip.SchedPtr == 0) {
     450           0 :                 if (ipsc->lAlphaFieldBlanks(3)) {
     451           0 :                     ShowSevereError(state,
     452           0 :                                     format("{}: {}: {} is required, missing for {}={}",
     453             :                                            routineName,
     454             :                                            cCurrentModuleObject,
     455           0 :                                            ipsc->cAlphaFieldNames(3),
     456           0 :                                            ipsc->cAlphaFieldNames(1),
     457           0 :                                            ipsc->cAlphaArgs(1)));
     458             :                 } else {
     459           0 :                     ShowSevereError(state,
     460           0 :                                     format("{}: {}: invalid {} entered={} for {}={}",
     461             :                                            routineName,
     462             :                                            cCurrentModuleObject,
     463           0 :                                            ipsc->cAlphaFieldNames(3),
     464           0 :                                            ipsc->cAlphaArgs(3),
     465           0 :                                            ipsc->cAlphaFieldNames(1),
     466           0 :                                            ipsc->cAlphaArgs(1)));
     467             :                 }
     468           0 :                 ErrorsFound = true;
     469             :             } else { // check min/max on schedule
     470           1 :                 SchMin = GetScheduleMinValue(state, exteriorEquip.SchedPtr);
     471           1 :                 SchMax = GetScheduleMaxValue(state, exteriorEquip.SchedPtr);
     472           1 :                 if (SchMin < 0.0 || SchMax < 0.0) {
     473           0 :                     if (SchMin < 0.0) {
     474           0 :                         ShowSevereError(state,
     475           0 :                                         format("{}: {}: invalid {} minimum, is < 0.0 for {}={}",
     476             :                                                routineName,
     477             :                                                cCurrentModuleObject,
     478           0 :                                                ipsc->cAlphaFieldNames(3),
     479           0 :                                                ipsc->cAlphaFieldNames(1),
     480           0 :                                                ipsc->cAlphaArgs(1)));
     481           0 :                         ShowContinueError(state, format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMin));
     482           0 :                         ErrorsFound = true;
     483             :                     }
     484           0 :                     if (SchMax < 0.0) {
     485           0 :                         ShowSevereError(state,
     486           0 :                                         format("{}: {}: invalid {} maximum, is < 0.0 for {}={}",
     487             :                                                routineName,
     488             :                                                cCurrentModuleObject,
     489           0 :                                                ipsc->cAlphaFieldNames(3),
     490           0 :                                                ipsc->cAlphaFieldNames(1),
     491           0 :                                                ipsc->cAlphaArgs(1)));
     492           0 :                         ShowContinueError(state, format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMax));
     493           0 :                         ErrorsFound = true;
     494             :                     }
     495             :                 }
     496             :             }
     497             : 
     498           1 :             if (NumAlphas > 3) {
     499           0 :                 EndUseSubcategoryName = ipsc->cAlphaArgs(4);
     500             :             } else {
     501           1 :                 EndUseSubcategoryName = "General";
     502             :             }
     503             : 
     504           1 :             exteriorEquip.DesignLevel = ipsc->rNumericArgs(1);
     505             : 
     506           2 :             SetupOutputVariable(state,
     507             :                                 "Exterior Equipment Water Volume Flow Rate",
     508             :                                 Constant::Units::m3_s,
     509           1 :                                 exteriorEquip.Power,
     510             :                                 OutputProcessor::TimeStepType::Zone,
     511             :                                 OutputProcessor::StoreType::Average,
     512           1 :                                 exteriorEquip.Name);
     513             : 
     514           2 :             SetupOutputVariable(state,
     515             :                                 "Exterior Equipment Water Volume",
     516             :                                 Constant::Units::m3,
     517           1 :                                 exteriorEquip.CurrentUse,
     518             :                                 OutputProcessor::TimeStepType::Zone,
     519             :                                 OutputProcessor::StoreType::Sum,
     520           1 :                                 exteriorEquip.Name,
     521             :                                 Constant::eResource::Water,
     522             :                                 OutputProcessor::Group::Invalid,
     523             :                                 OutputProcessor::EndUseCat::ExteriorEquipment,
     524             :                                 EndUseSubcategoryName);
     525           2 :             SetupOutputVariable(state,
     526             :                                 "Exterior Equipment Mains Water Volume",
     527             :                                 Constant::Units::m3,
     528           1 :                                 exteriorEquip.CurrentUse,
     529             :                                 OutputProcessor::TimeStepType::Zone,
     530             :                                 OutputProcessor::StoreType::Sum,
     531           1 :                                 exteriorEquip.Name,
     532             :                                 Constant::eResource::MainsWater,
     533             :                                 OutputProcessor::Group::Invalid,
     534             :                                 OutputProcessor::EndUseCat::ExteriorEquipment,
     535             :                                 EndUseSubcategoryName);
     536             :         }
     537             : 
     538         795 :         if (ErrorsFound) {
     539           0 :             ShowFatalError(state, format("{}Errors found in input.  Program terminates.", routineName));
     540             :         }
     541         795 :     }
     542             : 
     543     1985870 :     void ReportExteriorEnergyUse(EnergyPlusData &state)
     544             :     {
     545             : 
     546             :         // SUBROUTINE INFORMATION:
     547             :         //       AUTHOR         Linda Lawrie
     548             :         //       DATE WRITTEN   January 2001
     549             :         //       MODIFIED       na
     550             :         //       RE-ENGINEERED  na
     551             : 
     552             :         // PURPOSE OF THIS SUBROUTINE:
     553             :         // This subroutine performs the calculations necessary to report
     554             :         // the exterior energy use types.
     555             : 
     556             :         // METHODOLOGY EMPLOYED:
     557             :         // na
     558             : 
     559             :         // REFERENCES:
     560             :         // na
     561             : 
     562             :         // Using/Aliasing
     563             :         using ScheduleManager::GetCurrentScheduleValue;
     564             : 
     565             :         // Locals
     566             :         // SUBROUTINE ARGUMENT DEFINITIONS:
     567             :         // na
     568             : 
     569             :         // SUBROUTINE PARAMETER DEFINITIONS:
     570             :         // na
     571             : 
     572             :         // INTERFACE BLOCK SPECIFICATIONS:
     573             :         // na
     574             : 
     575             :         // DERIVED TYPE DEFINITIONS:
     576             :         // na
     577             : 
     578             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     579             :         int Item; // Loop Control
     580             : 
     581     2493199 :         for (Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) {
     582      507329 :             switch (state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode) {
     583       29335 :             case ExteriorEnergyUse::LightControlType::ScheduleOnly:
     584       29335 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power =
     585       29335 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel *
     586       29335 :                     GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
     587       29335 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     588       29335 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     589       29335 :                 break;
     590      477994 :             case ExteriorEnergyUse::LightControlType::AstroClockOverride:
     591      477994 :                 if (state.dataEnvrn->SunIsUp) {
     592      233168 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power = 0.0;
     593      233168 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse = 0.0;
     594             :                 } else {
     595      244826 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power =
     596      244826 :                         state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel *
     597      244826 :                         GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
     598      244826 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     599      244826 :                         state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     600             :                 }
     601      477994 :                 break;
     602           0 :             default:
     603             :                 // should not happen
     604           0 :                 break;
     605             :             }
     606             : 
     607             :             // Reduce lighting power due to demand limiting
     608      507549 :             if (state.dataExteriorEnergyUse->ExteriorLights(Item).ManageDemand &&
     609         220 :                 (state.dataExteriorEnergyUse->ExteriorLights(Item).Power > state.dataExteriorEnergyUse->ExteriorLights(Item).DemandLimit)) {
     610         220 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).DemandLimit;
     611         220 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     612         220 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     613             :             }
     614             :             // EMS controls
     615      507329 :             if (state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorOn)
     616           0 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorValue;
     617             : 
     618      507329 :             state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
     619      507329 :                 state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
     620             : 
     621             :             // gather for tabular reports
     622      507329 :             if (!state.dataGlobal->WarmupFlag) {
     623             :                 //      IF (DoOutputReporting .AND.  WriteTabularFiles .and. (KindOfSim == ksRunPeriodWeather)) THEN !for weather simulations only
     624      120686 :                 if (state.dataGlobal->DoOutputReporting &&
     625       60343 :                     (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather)) { // for weather simulations only
     626             :                     // for tabular report, accumua the total electricity used for each ExteriorLights object
     627           0 :                     state.dataExteriorEnergyUse->ExteriorLights(Item).SumConsumption += state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse;
     628             :                     // for tabular report, accumulate the time when each ExteriorLights has consumption
     629             :                     //(using a very small threshold instead of zero)
     630           0 :                     if (state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse > 0.01) {
     631           0 :                         state.dataExteriorEnergyUse->ExteriorLights(Item).SumTimeNotZeroCons += state.dataGlobal->TimeStepZone;
     632             :                     }
     633             :                 }
     634             :             }
     635             :         }
     636             : 
     637     2106086 :         for (Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorEqs; ++Item) {
     638      120216 :             state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power =
     639      120216 :                 state.dataExteriorEnergyUse->ExteriorEquipment(Item).DesignLevel *
     640      120216 :                 GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorEquipment(Item).SchedPtr);
     641      120216 :             state.dataExteriorEnergyUse->ExteriorEquipment(Item).CurrentUse =
     642      120216 :                 state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power * state.dataGlobal->TimeStepZoneSec;
     643             :         }
     644     1985870 :     }
     645             : 
     646             : } // namespace ExteriorEnergyUse
     647             : 
     648             : } // namespace EnergyPlus

Generated by: LCOV version 1.14