Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE GatherForEconomics
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer of GARD Analytics, Inc.
! DATE WRITTEN June 2004
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Gathers the data each timestep and updates the arrays
! holding the data that will be used by the tariff
! calculation.
! METHODOLOGY EMPLOYED:
! REFERENCES:
! na
! USE STATEMENTS:
USE DataGlobals, ONLY: HourOfDay,TimeStep,SecInHour,TimeStepZone
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE DataEnvironment, ONLY: Month
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
REAL(r64), external :: GetCurrentMeterValue
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: iTariff
REAL(r64) :: curInstantValue
REAL(r64) :: curDemand
REAL(r64) :: curEnergy
LOGICAL :: isGood
INTEGER :: curSeason
INTEGER :: curMonth
INTEGER :: curPeriod
REAL(r64) :: curRTPprice !real time price
REAL(r64) :: curRTPbaseline !real time price customer baseline load
REAL(r64) :: curRTPenergy !energy applied to real time price
REAL(r64) :: curRTPcost !cost for energy for current time
IF (numTariff .GE. 1) THEN
DO iTariff = 1, numTariff
isGood = .FALSE.
!if the meter is defined get the value
IF (tariff(iTariff)%reportMeterIndx .NE. 0) THEN
curInstantValue = GetCurrentMeterValue(tariff(iTariff)%reportMeterIndx)
ELSE
curInstantValue = 0.0d0
END IF
! remember the demand is still energy over a period of time divided by the
! length of time. This gathers the energy also.
tariff(iTariff)%collectEnergy = tariff(iTariff)%collectEnergy + curInstantValue
tariff(iTariff)%collectTime = tariff(iTariff)%collectTime + (TimeStepZone * SecInHour)
!added *SecInHour when adding RTP support August 2008
IF (tariff(iTariff)%collectTime .GE. tariff(iTariff)%demWinTime * SecInHour) THEN
!get current value that has been converted into desired units
curDemand = tariff(iTariff)%demandConv * tariff(iTariff)%collectEnergy / tariff(iTariff)%collectTime
curEnergy = tariff(iTariff)%energyConv * tariff(iTariff)%collectEnergy
! get the schedule values
! remember no confirmation of schedule values occurs prior to now
IF (tariff(iTariff)%seasonSchIndex .NE. 0) THEN
curSeason = GetCurrentScheduleValue(tariff(iTariff)%seasonSchIndex)
ELSE
curSeason = 1
END IF
IF (tariff(iTariff)%periodSchIndex .NE. 0) THEN
curPeriod = GetCurrentScheduleValue(tariff(iTariff)%periodSchIndex)
ELSE
curPeriod = 1
END IF
IF (tariff(iTariff)%monthSchIndex .NE. 0) THEN
curMonth = GetCurrentScheduleValue(tariff(iTariff)%monthSchIndex)
ELSE
curMonth = Month !from DataEnvironment
END IF
IF (isWithinRange(curSeason,1,5)) THEN
IF (isWithinRange(curPeriod,1,4)) THEN
IF (isWithinRange(curMonth,1,12)) THEN
isGood = .TRUE.
END IF
END IF
END IF
IF (isGood) THEN
tariff(iTariff)%seasonForMonth(curMonth) = curSeason
tariff(iTariff)%gatherEnergy(curPeriod,curMonth) = tariff(iTariff)%gatherEnergy(curPeriod,curMonth) + curEnergy
IF (tariff(iTariff)%gatherDemand(curPeriod,curMonth) .LT. curDemand) THEN
tariff(iTariff)%gatherDemand(curPeriod,curMonth) = curDemand
END IF
ELSE
CALL ShowWarningError('UtilityCost:Tariff: While gathering for: ' // tariff(iTariff)%tariffName)
CALL ShowContinueError('Invalid schedule values - outside of range')
END IF
! Real Time Pricing
IF (tariff(iTariff)%chargeSchIndex .NE. 0) THEN
curRTPprice = GetCurrentScheduleValue(tariff(iTariff)%chargeSchIndex)
! if customer baseline load schedule is used, subtract that off of the
! current energy
IF (tariff(iTariff)%baseUseSchIndex .NE. 0) THEN
curRTPbaseline = GetCurrentScheduleValue(tariff(iTariff)%baseUseSchIndex)
curRTPenergy = curEnergy - curRTPbaseline
ELSE
curRTPenergy = curEnergy
END IF
! calculate the real time cost for current times energy
curRTPcost = curRTPenergy * curRTPprice
tariff(iTariff)%RTPcost(curMonth) = tariff(iTariff)%RTPcost(curMonth) + curRTPcost
IF (curRTPcost .GT. 0) THEN
tariff(iTariff)%RTPaboveBaseCost(curMonth) = tariff(iTariff)%RTPaboveBaseCost(curMonth) + curRTPcost
ELSE
tariff(iTariff)%RTPbelowBaseCost(curMonth) = tariff(iTariff)%RTPbelowBaseCost(curMonth) + curRTPcost
END IF
IF (curRTPenergy .GT. 0) THEN
tariff(iTariff)%RTPaboveBaseEnergy(curMonth) = tariff(iTariff)%RTPaboveBaseEnergy(curMonth) + curRTPenergy
ELSE
tariff(iTariff)%RTPbelowBaseEnergy(curMonth) = tariff(iTariff)%RTPbelowBaseEnergy(curMonth) + curRTPenergy
END IF
END IF
! reset the counters
tariff(iTariff)%collectEnergy = 0.0d0
tariff(iTariff)%collectTime = 0.0d0
END IF
END DO
END IF
END SUBROUTINE GatherForEconomics