ExteriorEnergyUseManager.f90 Source File

This File Depends On

sourcefile~~exteriorenergyusemanager.f90~~EfferentGraph sourcefile~exteriorenergyusemanager.f90 ExteriorEnergyUseManager.f90 sourcefile~schedulemanager.f90 ScheduleManager.f90 sourcefile~schedulemanager.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~general.f90 General.f90 sourcefile~general.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~general.f90->sourcefile~schedulemanager.f90 sourcefile~dataenvironment.f90 DataEnvironment.f90 sourcefile~general.f90->sourcefile~dataenvironment.f90 sourcefile~dataprecisionglobals.f90 DataPrecisionGlobals.f90 sourcefile~dataprecisionglobals.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~dataprecisionglobals.f90->sourcefile~schedulemanager.f90 sourcefile~dataprecisionglobals.f90->sourcefile~general.f90 sourcefile~dataglobals.f90 DataGlobals.f90 sourcefile~dataprecisionglobals.f90->sourcefile~dataglobals.f90 sourcefile~dataipshortcuts.f90 DataIPShortCuts.f90 sourcefile~dataprecisionglobals.f90->sourcefile~dataipshortcuts.f90 sourcefile~datainterfaces.f90 DataInterfaces.f90 sourcefile~dataprecisionglobals.f90->sourcefile~datainterfaces.f90 sourcefile~outputreportpredefined.f90 OutputReportPredefined.f90 sourcefile~dataprecisionglobals.f90->sourcefile~outputreportpredefined.f90 sourcefile~inputprocessor.f90 InputProcessor.f90 sourcefile~dataprecisionglobals.f90->sourcefile~inputprocessor.f90 sourcefile~dataprecisionglobals.f90->sourcefile~dataenvironment.f90 sourcefile~datasystemvariables.f90 DataSystemVariables.f90 sourcefile~dataprecisionglobals.f90->sourcefile~datasystemvariables.f90 sourcefile~datahvacglobals.f90 DataHVACGlobals.f90 sourcefile~dataprecisionglobals.f90->sourcefile~datahvacglobals.f90 sourcefile~datasurfaces.f90 DataSurfaces.f90 sourcefile~dataprecisionglobals.f90->sourcefile~datasurfaces.f90 sourcefile~dataruntimelanguage.f90 DataRuntimeLanguage.f90 sourcefile~dataprecisionglobals.f90->sourcefile~dataruntimelanguage.f90 sourcefile~datavectortypes.f90 DataVectorTypes.f90 sourcefile~dataprecisionglobals.f90->sourcefile~datavectortypes.f90 sourcefile~databsdfwindow.f90 DataBSDFWindow.f90 sourcefile~dataprecisionglobals.f90->sourcefile~databsdfwindow.f90 sourcefile~datasizing.f90 DataSizing.f90 sourcefile~dataprecisionglobals.f90->sourcefile~datasizing.f90 sourcefile~dataglobals.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~dataglobals.f90->sourcefile~schedulemanager.f90 sourcefile~dataglobals.f90->sourcefile~general.f90 sourcefile~dataglobals.f90->sourcefile~dataipshortcuts.f90 sourcefile~dataglobals.f90->sourcefile~outputreportpredefined.f90 sourcefile~dataglobals.f90->sourcefile~inputprocessor.f90 sourcefile~dataglobals.f90->sourcefile~dataenvironment.f90 sourcefile~dataglobals.f90->sourcefile~datahvacglobals.f90 sourcefile~dataglobals.f90->sourcefile~datasurfaces.f90 sourcefile~dataglobals.f90->sourcefile~dataruntimelanguage.f90 sourcefile~dataglobals.f90->sourcefile~databsdfwindow.f90 sourcefile~sortandstringutilities.f90 SortAndStringUtilities.f90 sourcefile~dataglobals.f90->sourcefile~sortandstringutilities.f90 sourcefile~dataoutputs.f90 DataOutputs.f90 sourcefile~dataglobals.f90->sourcefile~dataoutputs.f90 sourcefile~dataglobals.f90->sourcefile~datasizing.f90 sourcefile~dataipshortcuts.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~dataipshortcuts.f90->sourcefile~schedulemanager.f90 sourcefile~dataipshortcuts.f90->sourcefile~general.f90 sourcefile~dataipshortcuts.f90->sourcefile~inputprocessor.f90 sourcefile~datainterfaces.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~datainterfaces.f90->sourcefile~schedulemanager.f90 sourcefile~datainterfaces.f90->sourcefile~general.f90 sourcefile~datainterfaces.f90->sourcefile~inputprocessor.f90 sourcefile~datainterfaces.f90->sourcefile~dataenvironment.f90 sourcefile~datainterfaces.f90->sourcefile~dataruntimelanguage.f90 sourcefile~outputreportpredefined.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~inputprocessor.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~inputprocessor.f90->sourcefile~schedulemanager.f90 sourcefile~inputprocessor.f90->sourcefile~general.f90 sourcefile~dataenvironment.f90->sourcefile~exteriorenergyusemanager.f90 sourcefile~dataenvironment.f90->sourcefile~schedulemanager.f90 sourcefile~datastringglobals.f90 DataStringGlobals.f90 sourcefile~datastringglobals.f90->sourcefile~schedulemanager.f90 sourcefile~datastringglobals.f90->sourcefile~general.f90 sourcefile~datastringglobals.f90->sourcefile~inputprocessor.f90 sourcefile~datastringglobals.f90->sourcefile~datasystemvariables.f90 sourcefile~datasystemvariables.f90->sourcefile~schedulemanager.f90 sourcefile~datasystemvariables.f90->sourcefile~inputprocessor.f90 sourcefile~datahvacglobals.f90->sourcefile~general.f90 sourcefile~datasurfaces.f90->sourcefile~general.f90 sourcefile~dataruntimelanguage.f90->sourcefile~general.f90 sourcefile~datavectortypes.f90->sourcefile~datasurfaces.f90 sourcefile~datavectortypes.f90->sourcefile~databsdfwindow.f90 sourcefile~databsdfwindow.f90->sourcefile~datasurfaces.f90 sourcefile~sortandstringutilities.f90->sourcefile~inputprocessor.f90 sourcefile~dataoutputs.f90->sourcefile~inputprocessor.f90 sourcefile~datasizing.f90->sourcefile~inputprocessor.f90
Help

Files Dependent On This One

sourcefile~~exteriorenergyusemanager.f90~~AfferentGraph sourcefile~exteriorenergyusemanager.f90 ExteriorEnergyUseManager.f90 sourcefile~outputreporttabular.f90 OutputReportTabular.f90 sourcefile~exteriorenergyusemanager.f90->sourcefile~outputreporttabular.f90 sourcefile~demandmanager.f90 DemandManager.f90 sourcefile~exteriorenergyusemanager.f90->sourcefile~demandmanager.f90 sourcefile~simulationmanager.f90 SimulationManager.f90 sourcefile~exteriorenergyusemanager.f90->sourcefile~simulationmanager.f90 sourcefile~outputreporttabular.f90->sourcefile~simulationmanager.f90 sourcefile~sizingmanager.f90 SizingManager.f90 sourcefile~outputreporttabular.f90->sourcefile~sizingmanager.f90 sourcefile~heatbalanceinternalheatgains.f90 HeatBalanceInternalHeatGains.f90 sourcefile~outputreporttabular.f90->sourcefile~heatbalanceinternalheatgains.f90 sourcefile~heatbalancemanager.f90 HeatBalanceManager.f90 sourcefile~outputreporttabular.f90->sourcefile~heatbalancemanager.f90 sourcefile~economiclifecyclecost.f90 EconomicLifeCycleCost.f90 sourcefile~outputreporttabular.f90->sourcefile~economiclifecyclecost.f90 sourcefile~roomairmodelusertemppattern.f90 RoomAirModelUserTempPattern.f90 sourcefile~outputreporttabular.f90->sourcefile~roomairmodelusertemppattern.f90 sourcefile~hvacmanager.f90 HVACManager.f90 sourcefile~outputreporttabular.f90->sourcefile~hvacmanager.f90 sourcefile~economictariff.f90 EconomicTariff.f90 sourcefile~outputreporttabular.f90->sourcefile~economictariff.f90 sourcefile~thermalcomfort.f90 ThermalComfort.f90 sourcefile~outputreporttabular.f90->sourcefile~thermalcomfort.f90 sourcefile~heatbalancesurfacemanager.f90 HeatBalanceSurfaceManager.f90 sourcefile~outputreporttabular.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~demandmanager.f90->sourcefile~simulationmanager.f90 sourcefile~demandmanager.f90->sourcefile~hvacmanager.f90 sourcefile~utilityroutines.f90 UtilityRoutines.f90 sourcefile~simulationmanager.f90->sourcefile~utilityroutines.f90 sourcefile~energyplus.f90 EnergyPlus.f90 sourcefile~simulationmanager.f90->sourcefile~energyplus.f90 sourcefile~sizingmanager.f90->sourcefile~simulationmanager.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~heatbalancemanager.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~roomairmodelusertemppattern.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~hvacmanager.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~zoneequipmentmanager.f90 Zoneequipmentmanager.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~zoneequipmentmanager.f90 sourcefile~daylightingmanager.f90 DaylightingManager.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~daylightingmanager.f90 sourcefile~roomairmodelcrossvent.f90 RoomAirModelCrossVent.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~roomairmodelcrossvent.f90 sourcefile~zonecontaminantpredictorcorrector.f90 ZoneContaminantPredictorCorrector.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~zonecontaminantpredictorcorrector.f90 sourcefile~delightmanagerf.f90 DElightManagerF.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~delightmanagerf.f90 sourcefile~roomairmodelufad.f90 RoomAirModelUFAD.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~roomairmodelufad.f90 sourcefile~roomairmodeldisplacementvent.f90 RoomAirModelDisplacementVent.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~roomairmodeldisplacementvent.f90 sourcefile~zonetemppredictorcorrector.f90 ZoneTempPredictorCorrector.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~zonetemppredictorcorrector.f90 sourcefile~roomairmodelmundt.f90 RoomAirModelMundt.f90 sourcefile~heatbalanceinternalheatgains.f90->sourcefile~roomairmodelmundt.f90 sourcefile~heatbalancemanager.f90->sourcefile~simulationmanager.f90 sourcefile~heatbalancemanager.f90->sourcefile~sizingmanager.f90 sourcefile~economiclifecyclecost.f90->sourcefile~simulationmanager.f90 sourcefile~roomairmanager.f90 RoomAirManager.f90 sourcefile~roomairmodelusertemppattern.f90->sourcefile~roomairmanager.f90 sourcefile~hvacmanager.f90->sourcefile~simulationmanager.f90 sourcefile~heatbalanceairmanager.f90 HeatBalanceAirManager.f90 sourcefile~hvacmanager.f90->sourcefile~heatbalanceairmanager.f90 sourcefile~economictariff.f90->sourcefile~simulationmanager.f90 sourcefile~economictariff.f90->sourcefile~heatbalancemanager.f90 sourcefile~economictariff.f90->sourcefile~economiclifecyclecost.f90 sourcefile~thermalcomfort.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~thermalcomfort.f90->sourcefile~zonetemppredictorcorrector.f90 sourcefile~airflownetworkbalancemanager.f90 AirflowNetworkBalanceManager.f90 sourcefile~thermalcomfort.f90->sourcefile~airflownetworkbalancemanager.f90 sourcefile~weathermanager.f90 WeatherManager.f90 sourcefile~thermalcomfort.f90->sourcefile~weathermanager.f90 sourcefile~heatbalancesurfacemanager.f90->sourcefile~simulationmanager.f90 sourcefile~heatbalancesurfacemanager.f90->sourcefile~heatbalancemanager.f90 sourcefile~zoneequipmentmanager.f90->sourcefile~sizingmanager.f90 sourcefile~zoneequipmentmanager.f90->sourcefile~hvacmanager.f90 sourcefile~daylightingmanager.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~solarshading.f90 SolarShading.f90 sourcefile~daylightingmanager.f90->sourcefile~solarshading.f90 sourcefile~daylightingmanager.f90->sourcefile~utilityroutines.f90 sourcefile~windowequivalentlayer.f90 WindowEquivalentLayer.f90 sourcefile~daylightingmanager.f90->sourcefile~windowequivalentlayer.f90 sourcefile~roomairmodelcrossvent.f90->sourcefile~roomairmanager.f90 sourcefile~zonecontaminantpredictorcorrector.f90->sourcefile~simulationmanager.f90 sourcefile~zonecontaminantpredictorcorrector.f90->sourcefile~hvacmanager.f90 sourcefile~delightmanagerf.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~delightmanagerf.f90->sourcefile~daylightingmanager.f90 sourcefile~roomairmodelufad.f90->sourcefile~roomairmanager.f90 sourcefile~roomairmodeldisplacementvent.f90->sourcefile~roomairmanager.f90 sourcefile~zonetemppredictorcorrector.f90->sourcefile~simulationmanager.f90 sourcefile~zonetemppredictorcorrector.f90->sourcefile~hvacmanager.f90 sourcefile~zonetemppredictorcorrector.f90->sourcefile~zoneequipmentmanager.f90 sourcefile~zonetemppredictorcorrector.f90->sourcefile~zonecontaminantpredictorcorrector.f90 sourcefile~roomairmodelmundt.f90->sourcefile~roomairmanager.f90 sourcefile~solarshading.f90->sourcefile~simulationmanager.f90 sourcefile~solarshading.f90->sourcefile~heatbalancemanager.f90 sourcefile~solarshading.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~solarshading.f90->sourcefile~utilityroutines.f90 sourcefile~windowequivalentlayer.f90->sourcefile~heatbalancemanager.f90 sourcefile~windowequivalentlayer.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~windowequivalentlayer.f90->sourcefile~solarshading.f90 sourcefile~windowmanager.f90 WindowManager.f90 sourcefile~windowequivalentlayer.f90->sourcefile~windowmanager.f90 sourcefile~heatbalanceintradexchange.f90 HeatBalanceIntRadExchange.f90 sourcefile~windowequivalentlayer.f90->sourcefile~heatbalanceintradexchange.f90 sourcefile~windowmanager.f90->sourcefile~heatbalancemanager.f90 sourcefile~windowmanager.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~heatbalanceintradexchange.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~roomairmanager.f90->sourcefile~zonetemppredictorcorrector.f90 sourcefile~heatbalanceairmanager.f90->sourcefile~simulationmanager.f90 sourcefile~heatbalanceairmanager.f90->sourcefile~heatbalancesurfacemanager.f90 sourcefile~airflownetworkbalancemanager.f90->sourcefile~hvacmanager.f90 sourcefile~systemavailabilitymanager.f90 SystemAvailabilityManager.f90 sourcefile~airflownetworkbalancemanager.f90->sourcefile~systemavailabilitymanager.f90 sourcefile~weathermanager.f90->sourcefile~simulationmanager.f90 sourcefile~weathermanager.f90->sourcefile~sizingmanager.f90 sourcefile~systemavailabilitymanager.f90->sourcefile~hvacmanager.f90 sourcefile~systemavailabilitymanager.f90->sourcefile~zoneequipmentmanager.f90 sourcefile~systemavailabilitymanager.f90->sourcefile~heatbalanceairmanager.f90 sourcefile~simairservingzones.f90 SimAirServingZones.f90 sourcefile~systemavailabilitymanager.f90->sourcefile~simairservingzones.f90 sourcefile~plantmanager.f90 PlantManager.f90 sourcefile~systemavailabilitymanager.f90->sourcefile~plantmanager.f90 sourcefile~simairservingzones.f90->sourcefile~sizingmanager.f90 sourcefile~simairservingzones.f90->sourcefile~hvacmanager.f90 sourcefile~plantmanager.f90->sourcefile~simulationmanager.f90 sourcefile~plantmanager.f90->sourcefile~hvacmanager.f90 sourcefile~plantmanager.f90->sourcefile~utilityroutines.f90
Help


Source Code

MODULE ExteriorEnergyUse

  ! Module containing the routines dealing with the reporting of Exterior Energy Usage Elements

  ! MODULE INFORMATION:
  !       AUTHOR         Linda Lawrie
  !       DATE WRITTEN   January 2001
  !       MODIFIED       na
  !       RE-ENGINEERED  na

  ! PURPOSE OF THIS MODULE:
  ! This module provides the reporting for exterior energy usage.  This usage does not directly
  ! affect simulation results for the energy usage in a building but may affect the "metered"
  ! usage of a facility.

  ! METHODOLOGY EMPLOYED:
  ! No simulation, this is just reporting consumption.

  ! REFERENCES: none

  ! OTHER NOTES: none

  ! USE STATEMENTS:
  ! Use statements for data only modules
USE DataPrecisionGlobals
USE DataGlobals, ONLY: MaxNameLength, TimeStepZone
USE DataInterfaces, ONLY: ShowWarningError, ShowSevereError, ShowFatalError, ShowContinueError, &
                       SetupOutputVariable

  ! Use statements for access to subroutines in other modules

IMPLICIT NONE         ! Enforce explicit typing of all variables

PRIVATE ! Everything private unless explicitly made public

  ! MODULE PARAMETER DEFINITIONS:
INTEGER, PARAMETER :: ElecUse=1     ! Electricity
INTEGER, PARAMETER :: GasUse=2      ! Gas (Natural)
INTEGER, PARAMETER :: WaterUse=3    ! Water
INTEGER, PARAMETER :: CoalUse=4     ! Coal
INTEGER, PARAMETER :: FuelOil1Use=5 ! FuelOil#1
INTEGER, PARAMETER :: FuelOil2Use=6 ! FuelOil#2
INTEGER, PARAMETER :: LPGUse=7      ! PropaneGas
INTEGER, PARAMETER :: GasolineUse=8 ! Gasoline
INTEGER, PARAMETER :: DieselUse=9   ! Diesel
INTEGER, PARAMETER :: SteamUse=10   ! Steam
INTEGER, PARAMETER :: DistrictCoolUse=11  ! Purchased Cooling
INTEGER, PARAMETER :: DistrictHeatUse=12  ! Purchased Heating
INTEGER, PARAMETER :: OtherFuel1Use=13 ! OtherFuel1
INTEGER, PARAMETER :: OtherFuel2Use=14 ! OtherFuel2

INTEGER, PARAMETER, PUBLIC :: ScheduleOnly = 1  ! exterior lights only on schedule
INTEGER, PARAMETER, PUBLIC :: AstroClockOverride = 2 !exterior lights controlled to turn off during day.


  ! DERIVED TYPE DEFINITIONS:
TYPE, PUBLIC :: ExteriorLightUsage
  CHARACTER(len=MaxNameLength) :: Name = ' '             ! Descriptive name -- will show on reporting
  INTEGER                      :: SchedPtr = 0           ! Can be scheduled
  REAL(r64)                    :: DesignLevel = 0.0d0      ! Consumption in Watts
  REAL(r64)                    :: Power = 0.0d0            ! Power = DesignLevel * ScheduleValue
  REAL(r64)                    :: CurrentUse = 0.0d0       ! Use for this time step
  INTEGER                      :: ControlMode = 1        ! Control mode Schedule Only or Astronomical Clock plus schedule

  LOGICAL                      :: ManageDemand = .FALSE. ! Flag to indicate whether to use demand limiting
  REAL(r64)                    :: DemandLimit = 0.0d0      ! Demand limit set by demand manager [W]
  LOGICAL                      :: PowerActuatorOn  = .FALSE.       ! EMS flag
  REAL(r64)                    :: PowerActuatorValue     ! EMS value
  REAL(r64)                    :: SumConsumption = 0.0d0   ! sum of electric consumption [J] for reporting
  REAL(r64)                    :: SumTimeNotZeroCons = 0.0d0 ! sum of time of positive electric consumption [hr]
END TYPE

TYPE, PUBLIC :: ExteriorEquipmentUsage
  CHARACTER(len=MaxNameLength) :: Name = ' '             ! Descriptive name -- will show on reporting
  INTEGER                      :: FuelType = 0
  INTEGER                      :: SchedPtr = 0           ! Can be scheduled
  REAL(r64)                    :: DesignLevel = 0.0d0      ! Design Consumption (Watts, except for Water Equipment)
  REAL(r64)                    :: Power = 0.0d0            ! Power = DesignLevel * ScheduleValue
  REAL(r64)                    :: CurrentUse = 0.0d0       ! Use for this time step

  LOGICAL                      :: ManageDemand = .FALSE. ! Flag to indicate whether to use demand limiting
  REAL(r64)                    :: DemandLimit = 0.0d0      ! Demand limit set by demand manager [W]
END TYPE

  ! MODULE VARIABLE DECLARATIONS:
TYPE (ExteriorLightUsage), PUBLIC, ALLOCATABLE, &
                           DIMENSION(:)    :: ExteriorLights     ! Structure for Exterior Light reporting
INTEGER, PUBLIC                            :: NumExteriorLights  ! Number of Exterior Light Inputs
TYPE (ExteriorEquipmentUsage), PUBLIC, ALLOCATABLE, &
                               DIMENSION(:):: ExteriorEquipment  ! Structure for Exterior Equipment Reporting
INTEGER, PUBLIC                            :: NumExteriorEqs     ! Number of Exterior Equipment Inputs

  ! SUBROUTINE SPECIFICATIONS FOR MODULE <module_name>

  ! Name Public routines, optionally name Private routines within this module

PUBLIC  ManageExteriorEnergyUse
PRIVATE GetExteriorEnergyUseInput
PRIVATE ReportExteriorEnergyUse

CONTAINS

SUBROUTINE ManageExteriorEnergyUse

          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Linda Lawrie
          !       DATE WRITTEN   January 2001
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS SUBROUTINE:
          ! This subroutine provides the usual call for the Simulation Manager.

          ! METHODOLOGY EMPLOYED:
          ! na

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
          ! na

  IMPLICIT NONE    ! Enforce explicit typing of all variables in this routine

          ! SUBROUTINE ARGUMENT DEFINITIONS:
          ! na

          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  LOGICAL,SAVE      :: GetInputFlag = .true.  ! First time, input is "gotten"

  IF (GetInputFlag) THEN
    CALL GetExteriorEnergyUseInput
    GetInputFlag=.false.
  ENDIF

  CALL ReportExteriorEnergyUse

  RETURN

END SUBROUTINE ManageExteriorEnergyUse

SUBROUTINE GetExteriorEnergyUseInput

          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Linda Lawrie
          !       DATE WRITTEN   January 2001
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS SUBROUTINE:
          ! This subroutine gets the input for the Exterior Lights and Equipment.

          ! METHODOLOGY EMPLOYED:
          ! na

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
  USE DataIPShortCuts
  USE InputProcessor, ONLY: GetNumObjectsFound, GetObjectItem, VerifyName, SameString
  USE ScheduleManager, ONLY: GetScheduleIndex, GetScheduleMinValue, GetScheduleMaxValue, GetScheduleName
  USE General, ONLY: RoundSigDigits
  USE OutputReportPredefined
  USE DataGlobals, ONLY: AnyEnergyManagementSystemInModel
  USE DataInterfaces, ONLY: SetupEMSActuator

  IMPLICIT NONE    ! Enforce explicit typing of all variables in this routine

          ! SUBROUTINE ARGUMENT DEFINITIONS:
          ! na

          ! SUBROUTINE PARAMETER DEFINITIONS:
  CHARACTER(len=*), PARAMETER :: RoutineName='GetExteriorEnergyUseInput: '
  CHARACTER(len=*), PARAMETER :: Blank=' '

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  INTEGER                        :: Item    ! Item to be "gotten"
  INTEGER                        :: NumAlphas  ! Number of Alphas for each GetObjectItem call
  INTEGER                        :: NumNumbers ! Number of Numbers for each GetObjectItem call
  INTEGER                        :: IOStatus   ! Used in GetObjectItem
  LOGICAL                        :: ErrorsFound=.false.  ! Set to true if errors in input, fatal at end of routine
  INTEGER                        :: NumFuelEq  ! Temporary -- number of ExteriorFuelEquipment statements
  INTEGER                        :: NumWtrEq   ! Temporary -- number of ExteriorWaterEquipment statements
  CHARACTER(len=20)              :: TypeString ! Fuel Type string (returned from Validation)
  CHARACTER(len=4)               :: ConUnits   ! String for Fuel Consumption units (allow Water)
  CHARACTER(len=MaxNameLength)   :: EndUseSubcategoryName
  LOGICAL :: ErrorInName
  LOGICAL :: IsBlank
  REAL(r64)    :: SchMax           ! Max value of schedule for item
  REAL(r64)    :: SchMin           ! Min value of schedule for item
  REAL(r64)    :: sumDesignLevel = 0.0d0 !for predefined report of design level total


  NumExteriorLights=GetNumObjectsFound('Exterior:Lights')
  ALLOCATE(ExteriorLights(NumExteriorLights))

  NumFuelEq=GetNumObjectsFound('Exterior:FuelEquipment')
  NumWtrEq=GetNumObjectsFound('Exterior:WaterEquipment')
  ALLOCATE(ExteriorEquipment(NumFuelEq+NumWtrEq))

  NumExteriorEqs=0

! =================================  Get Exterior Lights

  cCurrentModuleObject='Exterior:Lights'
  DO Item=1,NumExteriorLights
    CALL GetObjectItem(cCurrentModuleObject,Item,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,IOStatus,  &
                   AlphaBlank=lAlphaFieldBlanks,NumBlank=lNumericFieldBlanks,  &
                   AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
    ErrorInName=.false.
    IsBlank=.false.
    CALL VerifyName(cAlphaArgs(1),ExteriorLights%Name,Item,ErrorInName,IsBlank,TRIM(cCurrentModuleObject)//' Name')
    IF (ErrorInName) THEN
      ErrorsFound=.true.
      CYCLE
    ENDIF
    ExteriorLights(Item)%Name=cAlphaArgs(1)
    ExteriorLights(Item)%SchedPtr  = GetScheduleIndex(cAlphaArgs(2))
    IF (ExteriorLights(Item)%SchedPtr == 0) THEN
      IF (lAlphaFieldBlanks(2)) THEN
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': '//TRIM(cAlphaFieldNames(2))//  &
           ' is required, missing for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ELSE
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(2))//  &
           ' entered='//TRIM(cAlphaArgs(2))// &
           ' for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ENDIF
      ErrorsFound=.true.
    ELSE  ! check min/max on schedule
      SchMin=GetScheduleMinValue(ExteriorLights(Item)%SchedPtr)
      SchMax=GetScheduleMaxValue(ExteriorLights(Item)%SchedPtr)
      IF (SchMin < 0.0d0 .or. SchMax < 0.0d0) THEN
        IF (SchMin < 0.0d0) THEN
          CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(2))//  &
             ' minimum, is < 0.0 for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
          CALL ShowContinueError(TRIM(cAlphaArgs(2))//  &
                             '". Minimum is ['//TRIM(RoundSigDigits(SchMin,1))//']. Values must be >= 0.0.')
          ErrorsFound=.true.
        ENDIF
        IF (SchMax < 0.0d0) THEN
          CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(2))//  &
             ' maximum, is < 0.0 for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
          CALL ShowContinueError(TRIM(cAlphaArgs(2))//  &
                             '". Maximum is ['//TRIM(RoundSigDigits(SchMax,1))//']. Values must be >= 0.0.')
          ErrorsFound=.true.
        ENDIF
      ENDIF
    ENDIF
    IF (lAlphaFieldBlanks(3)) THEN
      ExteriorLights(Item)%ControlMode = ScheduleOnly
    ELSEIF (SameString(cAlphaArgs(3), 'ScheduleNameOnly')) THEN
      ExteriorLights(Item)%ControlMode = ScheduleOnly
    ELSEIF (SameString(cAlphaArgs(3), 'AstronomicalClock')) then
      ExteriorLights(Item)%ControlMode = AstroClockOverride
    ELSE
      CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(3))//  &
         '='//TRIM(cAlphaArgs(3))//  &
         ' for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
    ENDIF

    IF (NumAlphas > 3) THEN
      EndUseSubcategoryName = cAlphaArgs(4)
    ELSE
      EndUseSubcategoryName = 'General'
    END IF

    ExteriorLights(Item)%DesignLevel=rNumericArgs(1)
    IF (AnyEnergyManagementSystemInModel) THEN
      CALL SetupEMSActuator('ExteriorLights', ExteriorLights(Item)%Name, 'Electric Power', 'W',  &
        ExteriorLights(Item)%PowerActuatorOn, ExteriorLights(Item)%PowerActuatorValue)
    ENDIF

    CALL SetupOutputVariable('Exterior Lights Electric Power [W]',ExteriorLights(Item)%Power, &
                             'Zone','Average',ExteriorLights(Item)%Name)

    CALL SetupOutputVariable('Exterior Lights Electric Energy [J]',ExteriorLights(Item)%CurrentUse, &
                             'Zone','Sum',ExteriorLights(Item)%Name, &
                             ResourceTypeKey='Electricity',EndUseKey='Exterior Lights',EndUseSubKey=EndUseSubcategoryName)

    ! entries for predefined tables
    CALL PreDefTableEntry(pdchExLtPower,ExteriorLights(Item)%Name,ExteriorLights(Item)%DesignLevel)
    sumDesignLevel = sumDesignLevel + ExteriorLights(Item)%DesignLevel
    IF (ExteriorLights(Item)%ControlMode .EQ. AstroClockOverride) THEN                          !photocell/schedule
      CALL PreDefTableEntry(pdchExLtClock,ExteriorLights(Item)%Name,'AstronomicalClock')
      CALL PreDefTableEntry(pdchExLtSchd,ExteriorLights(Item)%Name,'-')
    ELSE
      CALL PreDefTableEntry(pdchExLtClock,ExteriorLights(Item)%Name,'Schedule')
      CALL PreDefTableEntry(pdchExLtSchd,ExteriorLights(Item)%Name,GetScheduleName(ExteriorLights(Item)%SchedPtr))
    END IF

  ENDDO
  CALL PreDefTableEntry(pdchExLtPower,'Exterior Lighting Total',sumDesignLevel)

! =================================  Get Exterior Fuel Equipment

  cCurrentModuleObject='Exterior:FuelEquipment'
  DO Item=1,NumFuelEq
    CALL GetObjectItem(cCurrentModuleObject,Item,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,IOStatus,  &
                   AlphaBlank=lAlphaFieldBlanks,NumBlank=lNumericFieldBlanks,  &
                   AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
    ErrorInName=.false.
    IsBlank=.false.
    CALL VerifyName(cAlphaArgs(1),ExteriorEquipment%Name,Item,ErrorInName,IsBlank,TRIM(cCurrentModuleObject)//' Name')
    IF (ErrorInName) THEN
      ErrorsFound=.true.
      CYCLE
    ENDIF
    NumExteriorEqs=NumExteriorEqs+1
    ExteriorEquipment(NumExteriorEqs)%Name=cAlphaArgs(1)

    IF (NumAlphas > 3) THEN
      EndUseSubcategoryName = cAlphaArgs(4)
    ELSE
      EndUseSubcategoryName = 'General'
    END IF

    CALL ValidateFuelType(ExteriorEquipment(NumExteriorEqs)%FuelType,cAlphaArgs(2),TypeString,cCurrentModuleObject,  &
       cAlphaFieldNames(2),cAlphaArgs(2))
    IF (ExteriorEquipment(NumExteriorEqs)%FuelType == 0) THEN
      IF (lAlphaFieldBlanks(2)) THEN
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': '//TRIM(cAlphaFieldNames(2))//  &
           ' is required, missing for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ELSE
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(2))//  &
           ' entered='//TRIM(cAlphaArgs(2))// &
           ' for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ENDIF
      ErrorsFound=.true.
    ELSE
      IF (ExteriorEquipment(NumExteriorEqs)%FuelType /= WaterUse) THEN
        CALL SetupOutputVariable('Exterior Equipment Fuel Rate [W]',ExteriorEquipment(NumExteriorEqs)%Power, &
                                 'Zone','Average',ExteriorEquipment(NumExteriorEqs)%Name)

        ConUnits='[J]'
        CALL SetupOutputVariable('Exterior Equipment '//TRIM(TypeString)//' Energy '//TRIM(ConUnits), &
                             ExteriorEquipment(NumExteriorEqs)%CurrentUse, &
                             'Zone','Sum',ExteriorEquipment(NumExteriorEqs)%Name, &
                             ResourceTypeKey=TypeString,EndUseKey='ExteriorEquipment',EndUseSubKey=EndUseSubcategoryName)
      ELSE
        CALL SetupOutputVariable('Exterior Equipment Water Volume Flow Rate [m3/s]',ExteriorEquipment(NumExteriorEqs)%Power, &
                                 'Zone','Average',TRIM(ExteriorEquipment(NumExteriorEqs)%Name))

        ConUnits='[m3]'
        CALL SetupOutputVariable('Exterior Equipment '//TRIM(TypeString)//' Volume '//TRIM(ConUnits), &
                             ExteriorEquipment(NumExteriorEqs)%CurrentUse, &
                             'Zone','Sum',ExteriorEquipment(NumExteriorEqs)%Name, &
                             ResourceTypeKey=TypeString,EndUseKey='ExteriorEquipment',EndUseSubKey=EndUseSubcategoryName)
      ENDIF


    ENDIF
    ExteriorEquipment(NumExteriorEqs)%SchedPtr  = GetScheduleIndex(cAlphaArgs(3))
    IF (ExteriorEquipment(NumExteriorEqs)%SchedPtr == 0) THEN
      IF (lAlphaFieldBlanks(3)) THEN
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': '//TRIM(cAlphaFieldNames(3))//  &
           ' is required, missing for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ELSE
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(3))//  &
           ' entered='//TRIM(cAlphaArgs(3))// &
           ' for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ENDIF
      ErrorsFound=.true.
    ELSE  ! check min/max on schedule
      SchMin=GetScheduleMinValue(ExteriorEquipment(NumExteriorEqs)%SchedPtr)
      SchMax=GetScheduleMaxValue(ExteriorEquipment(NumExteriorEqs)%SchedPtr)
      IF (SchMin < 0.0d0 .or. SchMax < 0.0d0) THEN
        IF (SchMin < 0.0d0) THEN
          CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(3))//  &
             ' minimum, is < 0.0 for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
          CALL ShowContinueError(TRIM(cAlphaArgs(3))//  &
                             '". Minimum is ['//TRIM(RoundSigDigits(SchMin,1))//']. Values must be >= 0.0.')
          ErrorsFound=.true.
        ENDIF
        IF (SchMax < 0.0d0) THEN
          CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(3))//  &
             ' maximum, is < 0.0 for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
          CALL ShowContinueError(TRIM(cAlphaArgs(3))//  &
                             '". Maximum is ['//TRIM(RoundSigDigits(SchMax,1))//']. Values must be >= 0.0.')
          ErrorsFound=.true.
        ENDIF
      ENDIF
    ENDIF
    ExteriorEquipment(NumExteriorEqs)%DesignLevel=rNumericArgs(1)
  ENDDO

! =================================  Get Exterior Water Equipment

  cCurrentModuleObject='Exterior:WaterEquipment'
  DO Item=1,NumWtrEq
    CALL GetObjectItem(cCurrentModuleObject,Item,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,IOStatus,  &
                   AlphaBlank=lAlphaFieldBlanks,NumBlank=lNumericFieldBlanks,  &
                   AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
    ErrorInName=.false.
    IsBlank=.false.
    CALL VerifyName(cAlphaArgs(1),ExteriorEquipment%Name,Item,ErrorInName,IsBlank,TRIM(cCurrentModuleObject)//' Name')
    IF (ErrorInName) THEN
      ErrorsFound=.true.
      CYCLE
    ENDIF
    NumExteriorEqs=NumExteriorEqs+1
    ExteriorEquipment(NumExteriorEqs)%Name=cAlphaArgs(1)
    ExteriorEquipment(NumExteriorEqs)%FuelType=WaterUse
    ExteriorEquipment(NumExteriorEqs)%SchedPtr  = GetScheduleIndex(cAlphaArgs(3))
    IF (ExteriorEquipment(NumExteriorEqs)%SchedPtr == 0) THEN
      IF (lAlphaFieldBlanks(3)) THEN
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': '//TRIM(cAlphaFieldNames(3))//  &
           ' is required, missing for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ELSE
        CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(3))//  &
           ' entered='//TRIM(cAlphaArgs(3))// &
           ' for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
      ENDIF
      ErrorsFound=.true.
    ELSE  ! check min/max on schedule
      SchMin=GetScheduleMinValue(ExteriorEquipment(NumExteriorEqs)%SchedPtr)
      SchMax=GetScheduleMaxValue(ExteriorEquipment(NumExteriorEqs)%SchedPtr)
      IF (SchMin < 0.0d0 .or. SchMax < 0.0d0) THEN
        IF (SchMin < 0.0d0) THEN
          CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(3))//  &
             ' minimum, is < 0.0 for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
          CALL ShowContinueError(TRIM(cAlphaArgs(3))//  &
                             '". Minimum is ['//TRIM(RoundSigDigits(SchMin,1))//']. Values must be >= 0.0.')
          ErrorsFound=.true.
        ENDIF
        IF (SchMax < 0.0d0) THEN
          CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//': invalid '//TRIM(cAlphaFieldNames(3))//  &
             ' maximum, is < 0.0 for '//TRIM(cAlphaFieldNames(1))//'='//TRIM(cAlphaArgs(1)))
          CALL ShowContinueError(TRIM(cAlphaArgs(3))//  &
                             '". Maximum is ['//TRIM(RoundSigDigits(SchMax,1))//']. Values must be >= 0.0.')
          ErrorsFound=.true.
        ENDIF
      ENDIF
    ENDIF

    IF (NumAlphas > 3) THEN
      EndUseSubcategoryName = cAlphaArgs(4)
    ELSE
      EndUseSubcategoryName = 'General'
    END IF

    ExteriorEquipment(NumExteriorEqs)%DesignLevel=rNumericArgs(1)

    CALL SetupOutputVariable('Exterior Equipment Water Volume Flow Rate [m3/s]',ExteriorEquipment(NumExteriorEqs)%Power, &
                             'Zone','Average',ExteriorEquipment(NumExteriorEqs)%Name)

    CALL SetupOutputVariable('Exterior Equipment Water Volume [m3]', &
                             ExteriorEquipment(NumExteriorEqs)%CurrentUse, &
                             'Zone','Sum',ExteriorEquipment(NumExteriorEqs)%Name, &
                             ResourceTypeKey='Water',EndUseKey='ExteriorEquipment',EndUseSubKey=EndUseSubcategoryName)
    CALL SetupOutputVariable('Exterior Equipment Mains Water Volume [m3]', &
                             ExteriorEquipment(NumExteriorEqs)%CurrentUse, &
                             'Zone','Sum',ExteriorEquipment(NumExteriorEqs)%Name, &
                             ResourceTypeKey='MainsWater',EndUseKey='ExteriorEquipment',EndUseSubKey=EndUseSubcategoryName)
  ENDDO

  IF (ErrorsFound) THEN
    CALL ShowFatalError(RoutineName//'Errors found in input.  Program terminates.')
  ENDIF

  RETURN

END SUBROUTINE GetExteriorEnergyUseInput

SUBROUTINE ValidateFuelType(FuelTypeNumber,FuelTypeAlpha,FuelTypeString,CurrentModuleObject,CurrentField,CurrentName)

          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Linda K. Lawrie
          !       DATE WRITTEN   January 2001
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS SUBROUTINE:
          ! This subroutine compares the input Fuel Type value against the
          ! valid values and sets the correct in the returned FuelTypeNumber.

          ! METHODOLOGY EMPLOYED:
          ! na

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
  USE InputProcessor, ONLY: SameString

  IMPLICIT NONE    ! Enforce explicit typing of all variables in this routine

          ! SUBROUTINE ARGUMENT DEFINITIONS:
  INTEGER, INTENT(OUT)          :: FuelTypeNumber  ! Fuel Type to be set in structure.
  CHARACTER(len=*), INTENT(IN)  :: FuelTypeAlpha   ! Fuel Type String
  CHARACTER(len=*), INTENT(OUT) :: FuelTypeString  ! Standardized Fuel Type String (for variable naming)
  CHARACTER(len=*), INTENT(IN)  :: CurrentModuleObject ! object being parsed
  CHARACTER(len=*), INTENT(IN)  :: CurrentField    ! current field being parsed
  CHARACTER(len=*), INTENT(IN)  :: CurrentName     ! current object name being parsed

          ! SUBROUTINE PARAMETER DEFINITIONS:
  CHARACTER(len=*), PARAMETER :: RoutineName='ValidateFuelType: '

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:


    FuelTypeNumber=0
    FuelTypeString=' '

    !Select the correct Number for the associated ascii name for the fuel type
    IF (SameString(FuelTypeAlpha,'Electricity') .or. SameString(FuelTypeAlpha,'Electric')) THEN
       FuelTypeNumber=ElecUse
       FuelTypeString='Electric'
    ENDIF
    IF (SameString(FuelTypeAlpha,'Gas').or. SameString(FuelTypeAlpha,'NaturalGas')) THEN
      IF (SameString(FuelTypeAlpha,'Gas')) THEN
        CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//trim(CurrentName)//'".')
        CALL ShowContinueError('Deprecated value in '//TRIM(CurrentField)//'="'//    &
              TRIM(FuelTypeAlpha)//'", using "NaturalGas".')
      ENDIF
      FuelTypeNumber=GasUse
      FuelTypeString='Gas'
    ENDIF
    IF (SameString(FuelTypeAlpha,'Coal')) THEN
      FuelTypeNumber=CoalUse
      FuelTypeString='Coal'
    ENDIF
    IF (SameString(FuelTypeAlpha,'FuelOil#1')) THEN
      FuelTypeNumber=FuelOil1Use
      FuelTypeString='FuelOil#1'
    ENDIF
    IF (SameString(FuelTypeAlpha,'PropaneGas') .or. SameString(FuelTypeAlpha,'LPG')) THEN
      IF (SameString(FuelTypeAlpha,'LPG')) THEN
        CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//trim(CurrentName)//'".')
        CALL ShowContinueError('Deprecated value in '//TRIM(CurrentField)//'="'//    &
              TRIM(FuelTypeAlpha)//'", using "PropaneGas".')
      ENDIF
      FuelTypeNumber=LPGUse
      FuelTypeString='Propane'
    ENDIF
    IF (SameString(FuelTypeAlpha,'Gasoline')) THEN
      FuelTypeNumber=GasolineUse
      FuelTypeString='Gasoline'
    ENDIF
    IF (SameString(FuelTypeAlpha,'Diesel')) THEN
      FuelTypeNumber=DieselUse
      FuelTypeString='Diesel'
    ENDIF
    IF (SameString(FuelTypeAlpha,'FuelOil#2')) THEN
      FuelTypeNumber=FuelOil2Use
      FuelTypeString='FuelOil#2'
    ENDIF
    IF (SameString(FuelTypeAlpha,'OtherFuel1')) THEN
      FuelTypeNumber=OtherFuel1Use
      FuelTypeString='OtherFuel1'
    ENDIF
    IF (SameString(FuelTypeAlpha,'OtherFuel2')) THEN
      FuelTypeNumber=OtherFuel1Use
      FuelTypeString='OtherFuel2'
    ENDIF
    IF (SameString(FuelTypeAlpha,'Water')) THEN
      FuelTypeNumber=WaterUse
      FuelTypeString='Water'
    ENDIF
    IF (SameString(FuelTypeAlpha,'Steam')) THEN
      FuelTypeNumber=SteamUse
      FuelTypeString='Steam'
    ENDIF
    IF (SameString(FuelTypeAlpha,'DistrictCooling')) THEN
      FuelTypeNumber=DistrictCoolUse
      FuelTypeString='DistrictCooling'
    ENDIF
    IF (SameString(FuelTypeAlpha,'DistrictHeating')) THEN
      FuelTypeNumber=DistrictHeatUse
      FuelTypeString='DistrictHeating'
    ENDIF

  RETURN

END SUBROUTINE ValidateFuelType

SUBROUTINE ReportExteriorEnergyUse

          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Linda Lawrie
          !       DATE WRITTEN   January 2001
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS SUBROUTINE:
          ! This subroutine performs the calculations necessary to report
          ! the exterior energy use types.

          ! METHODOLOGY EMPLOYED:
          ! na

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
  USE DataGlobals, ONLY: SecInHour,WarmUpFlag, DoOutputReporting, KindOfSim, ksRunPeriodWeather
  USE ScheduleManager, ONLY: GetCurrentScheduleValue
  USE DataEnvironment,  ONLY: SunIsUP

  IMPLICIT NONE    ! Enforce explicit typing of all variables in this routine

          ! SUBROUTINE ARGUMENT DEFINITIONS:
          ! na

          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  INTEGER Item   ! Loop Control

  DO Item=1,NumExteriorLights
    SELECT CASE (ExteriorLights(Item)%ControlMode)

    CASE (ScheduleOnly)
        ExteriorLights(Item)%Power = ExteriorLights(Item)%DesignLevel * GetCurrentScheduleValue(ExteriorLights(Item)%SchedPtr)
        ExteriorLights(Item)%CurrentUse = ExteriorLights(Item)%Power * TimeStepZone * SecInHour

    CASE (AstroClockOverride)

      IF (SunIsUP) THEN
        ExteriorLights(Item)%Power = 0.0d0
        ExteriorLights(Item)%CurrentUse = 0.0d0
      ELSE
        ExteriorLights(Item)%Power = ExteriorLights(Item)%DesignLevel * GetCurrentScheduleValue(ExteriorLights(Item)%SchedPtr)
        ExteriorLights(Item)%CurrentUse = ExteriorLights(Item)%Power * TimeStepZone * SecInHour
      END IF

    CASE DEFAULT
       !should not occur

    END SELECT

    ! Reduce lighting power due to demand limiting
    IF (ExteriorLights(Item)%ManageDemand .AND. (ExteriorLights(Item)%Power > ExteriorLights(Item)%DemandLimit)) THEN
      ExteriorLights(Item)%Power = ExteriorLights(Item)%DemandLimit
      ExteriorLights(Item)%CurrentUse = ExteriorLights(Item)%Power * TimeStepZone * SecInHour
    END IF
    ! EMS controls
    IF (ExteriorLights(Item)%PowerActuatorOn) ExteriorLights(Item)%Power = ExteriorLights(Item)%PowerActuatorValue

    ExteriorLights(Item)%CurrentUse = ExteriorLights(Item)%Power * TimeStepZone * SecInHour

    !gather for tabular reports
    IF (.NOT. WarmUpFlag) THEN
!      IF (DoOutputReporting .AND.  WriteTabularFiles .and. (KindOfSim == ksRunPeriodWeather)) THEN !for weather simulations only
      IF (DoOutputReporting  .and. (KindOfSim == ksRunPeriodWeather)) THEN !for weather simulations only
        !for tabular report, accumlate the total electricity used for each ExteriorLights object
        ExteriorLights(Item)%SumConsumption = ExteriorLights(Item)%SumConsumption + ExteriorLights(Item)%CurrentUse
        !for tabular report, accumulate the time when each ExteriorLights has consumption
        !(using a very small threshold instead of zero)
        IF (ExteriorLights(Item)%CurrentUse > 0.01d0) THEN
          ExteriorLights(Item)%SumTimeNotZeroCons = ExteriorLights(Item)%SumTimeNotZeroCons + TimeStepZone
        END IF
      ENDIF
    END IF
  END DO

  DO Item=1,NumExteriorEqs
    ExteriorEquipment(Item)%CurrentUse = ExteriorEquipment(Item)%DesignLevel* &
                         GetCurrentScheduleValue(ExteriorEquipment(Item)%SchedPtr)*TimeStepZone*SecInHour
  END DO

  RETURN

END SUBROUTINE ReportExteriorEnergyUse

!     NOTICE
!
!     Copyright © 1996-2013 The Board of Trustees of the University of Illinois
!     and The Regents of the University of California through Ernest Orlando Lawrence
!     Berkeley National Laboratory.  All rights reserved.
!
!     Portions of the EnergyPlus software package have been developed and copyrighted
!     by other individuals, companies and institutions.  These portions have been
!     incorporated into the EnergyPlus software package under license.   For a complete
!     list of contributors, see "Notice" located in EnergyPlus.f90.
!
!     NOTICE: The U.S. Government is granted for itself and others acting on its
!     behalf a paid-up, nonexclusive, irrevocable, worldwide license in this data to
!     reproduce, prepare derivative works, and perform publicly and display publicly.
!     Beginning five (5) years after permission to assert copyright is granted,
!     subject to two possible five year renewals, the U.S. Government is granted for
!     itself and others acting on its behalf a paid-up, non-exclusive, irrevocable
!     worldwide license in this data to reproduce, prepare derivative works,
!     distribute copies to the public, perform publicly and display publicly, and to
!     permit others to do so.
!
!     TRADEMARKS: EnergyPlus is a trademark of the US Department of Energy.
!

END MODULE ExteriorEnergyUse

AirflowNetworkBalanceManager.f90 AirflowNetworkSolver.f90 BaseboardRadiator.f90 BaseboardRadiatorElectric.f90 BaseboardRadiatorSteam.f90 BaseboardRadiatorWater.f90 BranchInputManager.f90 BranchNodeConnections.f90 ConductionTransferFunctionCalc.f90 CoolTower.f90 CostEstimateManager.f90 CurveManager.f90 CVFOnlyRoutines.f90 DataAirflowNetwork.f90 DataAirLoop.f90 DataAirSystems.f90 DataBranchAirLoopPlant.f90 DataBranchNodeConnections.f90 DataBSDFWindow.f90 DataComplexFenestration.f90 DataContaminantBalance.f90 DataConvergParams.f90 DataConversions.f90 DataCostEstimate.f90 DataDaylighting.f90 DataDaylightingDevices.f90 Datadefineequip.f90 DataDElight.f90 DataEnvironment.f90 DataEquivalentLayerWindow.f90 DataErrorTracking.f90 DataGenerators.f90 DataGlobalConstants.f90 DataGlobals.f90 DataHeatBalance.f90 DataHeatBalFanSys.f90 DataHeatBalSurface.f90 DataHVACControllers.f90 DataHVACGlobals.f90 DataInterfaces.f90 DataIPShortCuts.f90 DataLoopNode.f90 DataMoistureBalance.f90 DataMoistureBalanceEMPD.f90 DataOutputs.f90 DataPhotovoltaics.f90 DataPlant.f90 DataPlantPipingSystems.f90 DataPrecisionGlobals.f90 DataReportingFlags.f90 DataRoomAir.f90 DataRootFinder.f90 DataRuntimeLanguage.f90 DataShadowingCombinations.f90 DataSizing.f90 DataStringGlobals.f90 DataSurfaceColors.f90 DataSurfaceLists.f90 DataSurfaces.f90 DataSystemVariables.f90 DataTimings.f90 DataUCSDSharedData.f90 DataVectorTypes.f90 DataViewFactorInformation.f90 DataWater.f90 DataZoneControls.f90 DataZoneEnergyDemands.f90 DataZoneEquipment.f90 DaylightingDevices.f90 DaylightingManager.f90 DElightManagerF.f90 DElightManagerF_NO.f90 DemandManager.f90 DesiccantDehumidifiers.f90 DirectAir.f90 DisplayRoutines.f90 DXCoil.f90 EarthTube.f90 EconomicLifeCycleCost.f90 EconomicTariff.f90 EcoRoof.f90 ElectricPowerGenerators.f90 ElectricPowerManager.f90 EMSManager.f90 EnergyPlus.f90 ExteriorEnergyUseManager.f90 ExternalInterface_NO.f90 FanCoilUnits.f90 FaultsManager.f90 FluidProperties.f90 General.f90 GeneralRoutines.f90 GlobalNames.f90 HeatBalanceAirManager.f90 HeatBalanceConvectionCoeffs.f90 HeatBalanceHAMTManager.f90 HeatBalanceInternalHeatGains.f90 HeatBalanceIntRadExchange.f90 HeatBalanceManager.f90 HeatBalanceMovableInsulation.f90 HeatBalanceSurfaceManager.f90 HeatBalFiniteDifferenceManager.f90 HeatRecovery.f90 Humidifiers.f90 HVACControllers.f90 HVACCooledBeam.f90 HVACDualDuctSystem.f90 HVACDuct.f90 HVACDXSystem.f90 HVACEvapComponent.f90 HVACFanComponent.f90 HVACFurnace.f90 HVACHeatingCoils.f90 HVACHXAssistedCoolingCoil.f90 HVACInterfaceManager.f90 HVACManager.f90 HVACMixerComponent.f90 HVACMultiSpeedHeatPump.f90 HVACSingleDuctInduc.f90 HVACSingleDuctSystem.f90 HVACSplitterComponent.f90 HVACStandAloneERV.f90 HVACSteamCoilComponent.f90 HVACTranspiredCollector.f90 HVACUnitaryBypassVAV.f90 HVACUnitarySystem.f90 HVACVariableRefrigerantFlow.f90 HVACWaterCoilComponent.f90 HVACWatertoAir.f90 HVACWatertoAirMultiSpeedHP.f90 InputProcessor.f90 MatrixDataManager.f90 MixedAir.f90 MoistureBalanceEMPDManager.f90 NodeInputManager.f90 NonZoneEquipmentManager.f90 OutAirNodeManager.f90 OutdoorAirUnit.f90 OutputProcessor.f90 OutputReportPredefined.f90 OutputReports.f90 OutputReportTabular.f90 PackagedTerminalHeatPump.f90 PackagedThermalStorageCoil.f90 Photovoltaics.f90 PhotovoltaicThermalCollectors.f90 PlantAbsorptionChillers.f90 PlantBoilers.f90 PlantBoilersSteam.f90 PlantCentralGSHP.f90 PlantChillers.f90 PlantCondLoopOperation.f90 PlantCondLoopTowers.f90 PlantEIRChillers.f90 PlantEvapFluidCoolers.f90 PlantExhaustAbsorptionChiller.f90 PlantFluidCoolers.f90 PlantGasAbsorptionChiller.f90 PlantGroundHeatExchangers.f90 PlantHeatExchanger.f90 PlantIceThermalStorage.f90 PlantLoadProfile.f90 PlantLoopEquipment.f90 PlantLoopSolver.f90 PlantManager.f90 PlantOutsideEnergySources.f90 PlantPipeHeatTransfer.f90 PlantPipes.f90 PlantPipingSystemManager.f90 PlantPondGroundHeatExchanger.f90 PlantPressureSystem.f90 PlantPumps.f90 PlantSolarCollectors.f90 PlantSurfaceGroundHeatExchanger.f90 PlantUtilities.f90 PlantValves.f90 PlantWaterSources.f90 PlantWaterThermalTank.f90 PlantWatertoWaterGSHP.f90 PlantWaterUse.f90 PollutionAnalysisModule.f90 PoweredInductionUnits.f90 PsychRoutines.f90 Purchasedairmanager.f90 RadiantSystemHighTemp.f90 RadiantSystemLowTemp.f90 RefrigeratedCase.f90 ReportSizingManager.f90 ReturnAirPath.f90 RoomAirManager.f90 RoomAirModelCrossVent.f90 RoomAirModelDisplacementVent.f90 RoomAirModelMundt.f90 RoomAirModelUFAD.f90 RoomAirModelUserTempPattern.f90 RootFinder.f90 RuntimeLanguageProcessor.f90 ScheduleManager.f90 SetPointManager.f90 SimAirServingZones.f90 SimulationManager.f90 SizingManager.f90 SolarReflectionManager.f90 SolarShading.f90 SortAndStringUtilities.f90 sqlite3.c SQLiteCRoutines.c SQLiteFortranRoutines.f90 SQLiteFortranRoutines_NO.f90 StandardRatings.f90 SurfaceGeometry.f90 SystemAvailabilityManager.f90 SystemReports.f90 TarcogComplexFenestration.f90 ThermalChimney.f90 ThermalComfort.f90 UnitHeater.f90 UnitVentilator.f90 UserDefinedComponents.f90 UtilityRoutines.f90 VectorUtilities.f90 VentilatedSlab.f90 WaterManager.f90 WeatherManager.f90 WindowAC.f90 WindowComplexManager.f90 WindowEquivalentLayer.f90 WindowManager.f90 WindTurbine.f90 Zoneairloopequipmentmanager.f90 ZoneContaminantPredictorCorrector.f90 ZoneDehumidifier.f90 Zoneequipmentmanager.f90 ZonePlenumComponent.f90 ZoneTempPredictorCorrector.f90