Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | usingVariable |
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 evaluateChargeSimple(usingVariable)
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer of GARD Analytics, Inc.
! DATE WRITTEN July 2004
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! METHODOLOGY EMPLOYED:
! REFERENCES:
! na
! USE STATEMENTS:
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: usingVariable
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: curTariff
INTEGER :: indexInChg
REAL(r64), DIMENSION(MaxNumMonths) :: sourceVals
REAL(r64), DIMENSION(MaxNumMonths) :: costPer
REAL(r64), DIMENSION(MaxNumMonths) :: resultChg
REAL(r64), DIMENSION(MaxNumMonths) :: seasonMask
curTariff = econVar(usingVariable)%tariffIndx
indexInChg = econVar(usingVariable)%index
!check the tariff - make sure they match
IF (chargeSimple(indexInChg)%namePt .NE. usingVariable) THEN
CALL ShowWarningError('UtilityCost:Tariff Debugging issue. ChargeSimple index does not match variable pointer.')
CALL ShowContinueError(' Between: ' // TRIM(econVar(usingVariable)%name))
CALL ShowContinueError(' And: ' // TRIM(econVar(chargeSimple(indexInChg)%namePt)%name))
END IF
IF (chargeSimple(indexInChg)%tariffIndx .NE. curTariff) THEN
CALL ShowWarningError('UtilityCost:Tariff Debugging issue. ChargeSimple index does not match tariff index.')
CALL ShowContinueError(' Between: ' // TRIM(tariff(curTariff)%tariffName))
CALL ShowContinueError(' And: ' // TRIM(tariff(chargeSimple(indexInChg)%tariffIndx)%tariffName))
END IF
! data from the Charge:Simple
sourceVals = econVar(chargeSimple(indexInChg)%sourcePt)%values
! determine if costPer should be based on variable or value
IF (chargeSimple(indexInChg)%costPerPt .NE. 0) THEN
costPer = econVar(chargeSimple(indexInChg)%costPerPt)%values
ELSE
costPer = chargeSimple(indexInChg)%costPerVal
END IF
! find proper season mask
SELECT CASE (chargeSimple(indexInChg)%season)
CASE (seasonSummer)
seasonMask = econVar(tariff(curTariff)%nativeIsSummer)%values
CASE (seasonWinter)
seasonMask = econVar(tariff(curTariff)%nativeIsWinter)%values
CASE (seasonSpring)
seasonMask = econVar(tariff(curTariff)%nativeIsSpring)%values
CASE (seasonFall)
seasonMask = econVar(tariff(curTariff)%nativeIsAutumn)%values
CASE (seasonAnnual)
seasonMask = 1.0d0 !all months are 1
END SELECT
! finally perform calculations
resultChg = sourceVals * costPer * seasonMask
!store the cost in the name of the variable
econVar(usingVariable)%values = resultChg
!set the flag that it has been evaluated so it won't be evaluated multiple times
econVar(usingVariable)%isEvaluated = .TRUE.
END SUBROUTINE evaluateChargeSimple