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 GetInputLifeCycleCostParameters
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer of GARD Analytics, Inc.
! DATE WRITTEN May 2010
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Read the input file for "LifeCycleCost:Parameters" object.
! METHODOLOGY EMPLOYED:
! 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:
INTEGER :: jFld
INTEGER :: NumAlphas ! Number of elements in the alpha array
INTEGER :: NumNums ! Number of elements in the numeric array
CHARACTER(len=MaxNameLength),DIMENSION(100) :: AlphaArray !character string data
REAL(r64), DIMENSION(100) :: NumArray !numeric data
INTEGER :: IOStat ! IO Status when calling get input subroutine
CHARACTER(len=MaxNameLength) :: CurrentModuleObject ! for ease in renaming.
INTEGER :: NumObj !count of objects
CurrentModuleObject = 'LifeCycleCost:Parameters'
NumObj = GetNumObjectsFound(CurrentModuleObject)
IF (NumObj .EQ. 0) THEN
LCCparamPresent = .FALSE.
ELSEIF (NumObj .EQ. 1) THEN
LCCparamPresent = .TRUE.
CALL GetObjectItem(CurrentModuleObject,1,AlphaArray,NumAlphas,NumArray,NumNums,IOSTAT, &
AlphaBlank=lAlphaFieldBlanks,NumBlank=lNumericFieldBlanks, &
AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
!check to make sure none of the values are another life cycle cost object
DO jFld = 1, NumAlphas
IF (INDEX(MakeUpperCase(AlphaArray(jFld)),'LifeCycleCost:') .GT. 0) THEN
CALL ShowWarningError('In '//TRIM(CurrentModuleObject)//' named ' // TRIM(AlphaArray(1)) // &
' a field was found containing LifeCycleCost: which may indicate a missing comma.')
END IF
END DO
! start to extract values from input array into appropriate fields
! A1, \field Name
! \required-field
! \type alpha
LCCname = AlphaArray(1)
! A2, \field Discounting Convention
! \type choice
! \key EndOfYear
! \key MidYear
! \key BeginningOfYear
! \default EndOfYear
IF (SameString(AlphaArray(2),'EndOfYear')) THEN
discountConvension = disConvEndOfYear
ELSEIF (SameString(AlphaArray(2),'MidYear')) THEN
discountConvension = disConvMidYear
ELSEIF (SameString(AlphaArray(2),'BeginningOfYear')) THEN
discountConvension = disConvBeginOfYear
ELSE
discountConvension = disConvEndOfYear
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid '//TRIM(cAlphaFieldNames(2))//'="'// &
TRIM(AlphaArray(2))//'". EndOfYear will be used.')
END IF
! A3, \field Inflation Approach
! \type choice
! \key ConstantDollar
! \key CurrentDollar
! \default ConstantDollar
IF (SameString(AlphaArray(3),'ConstantDollar')) THEN
inflationApproach = inflAppConstantDollar
ELSEIF (SameString(AlphaArray(3),'CurrentDollar')) THEN
inflationApproach = inflAppCurrentDollar
ELSE
inflationApproach = inflAppConstantDollar
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid '//TRIM(cAlphaFieldNames(3))//'="'// &
TRIM(AlphaArray(3))//'". ConstantDollar will be used.')
END IF
! N1, \field Real Discount Rate
! \type real
realDiscountRate = NumArray(1)
IF ((inflationApproach .EQ. inflAppConstantDollar) .AND. lNumericFieldBlanks(1)) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid for field '//TRIM(cNumericFieldNames(1))// &
' to be blank when ConstantDollar analysis is be used.')
END IF
IF ((realDiscountRate .GT. 0.30d0) .OR. (realDiscountRate .LT. -0.30d0)) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(1))// &
'. This value is the decimal value not a percentage so most values are between 0.02 and 0.15. ')
END IF
! N2, \field Nominal Discount Rate
! \type real
nominalDiscountRate = NumArray(2)
IF ((inflationApproach .EQ. inflAppCurrentDollar) .AND. lNumericFieldBlanks(2)) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid for field '//TRIM(cNumericFieldNames(2))// &
' to be blank when CurrentDollar analysis is be used.')
END IF
IF ((nominalDiscountRate .GT. 0.30d0) .OR. (nominalDiscountRate .LT. -0.30d0)) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(2))// &
'. This value is the decimal value not a percentage so most values are between 0.02 and 0.15. ')
END IF
! N3, \field Inflation
! \type real
inflation = NumArray(3)
IF ((inflationApproach .EQ. inflAppConstantDollar) .AND. (.NOT. lNumericFieldBlanks(3))) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid for field '//TRIM(cNumericFieldNames(3))// &
' contain a value when ConstantDollar analysis is be used.')
END IF
IF ((inflation .GT. 0.30d0) .OR. (inflation .LT. -0.30d0)) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(3))// &
'. This value is the decimal value not a percentage so most values are between 0.02 and 0.15. ')
END IF
! A4, \field Base Date Month
! \type choice
! \key January
! \key February
! \key March
! \key April
! \key May
! \key June
! \key July
! \key August
! \key September
! \key October
! \key November
! \key December
! \default January
baseDateMonth = MonthToMonthNumber(AlphaArray(4),1)
! N4, \field Base Date Year
! \type integer
! \minimum 1900
! \maximum 2100
baseDateYear = INT(NumArray(4))
IF (baseDateYear .GT. 2100) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(4))// &
'. Value greater than 2100 yet it is representing a year. ')
END IF
IF (baseDateYear .LT. 1900) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(4))// &
'. Value less than 1900 yet it is representing a year. ')
END IF
! A5, \field Service Date Month
! \type choice
! \key January
! \key February
! \key March
! \key April
! \key May
! \key June
! \key July
! \key August
! \key September
! \key October
! \key November
! \key December
! \default January
serviceDateMonth = MonthToMonthNumber(AlphaArray(5),1)
! N5, \field Service Date Year
! \type integer
! \minimum 1900
! \maximum 2100
serviceDateYear = INT(NumArray(5))
IF (serviceDateYear .GT. 2100) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(5))// &
'. Value greater than 2100 yet it is representing a year. ')
END IF
IF (serviceDateYear .LT. 1900) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(5))// &
'. Value less than 1900 yet it is representing a year. ')
END IF
! N6, \field Length of Study Period in Years
! \type integer
! \minimum 1
! \maximum 100
lengthStudyYears = INT(NumArray(6))
IF (lengthStudyYears .GT. 100) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(6))// &
'. A value greater than 100 is not reasonable for an economic evaluation. ')
END IF
IF (lengthStudyYears .LT. 1) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(6))// &
'. A value less than 1 is not reasonable for an economic evaluation. ')
END IF
lengthStudyTotalMonths = lengthStudyYears * 12
! N7, \field Tax rate
! \type real
! \minimum 0.0
taxRate = NumArray(7)
IF (taxRate .LT. 0.0d0 .AND. (.NOT. lNumericFieldBlanks(7))) THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid value in field '//TRIM(cNumericFieldNames(10))// &
'. A value less than 0 is not reasonable for a tax rate. ')
END IF
! A6; \field Depreciation Method
! \type choice
! \key ModifiedAcceleratedCostRecoverySystem-3year
! \key ModifiedAcceleratedCostRecoverySystem-5year
! \key ModifiedAcceleratedCostRecoverySystem-7year
! \key ModifiedAcceleratedCostRecoverySystem-10year
! \key ModifiedAcceleratedCostRecoverySystem-15year
! \key ModifiedAcceleratedCostRecoverySystem-20year
! \key StraightLine-27year
! \key StraightLine-31year
! \key StraightLine-39year
! \key StraightLine-40year
! \key None
! \default None
IF (SameString(AlphaArray(6),'ModifiedAcceleratedCostRecoverySystem-3year')) THEN
depreciationMethod = depMethMACRS3
ELSEIF (SameString(AlphaArray(6),'ModifiedAcceleratedCostRecoverySystem-5year')) THEN
depreciationMethod = depMethMACRS5
ELSEIF (SameString(AlphaArray(6),'ModifiedAcceleratedCostRecoverySystem-7year')) THEN
depreciationMethod = depMethMACRS7
ELSEIF (SameString(AlphaArray(6),'ModifiedAcceleratedCostRecoverySystem-10year')) THEN
depreciationMethod = depMethMACRS10
ELSEIF (SameString(AlphaArray(6),'ModifiedAcceleratedCostRecoverySystem-15year')) THEN
depreciationMethod = depMethMACRS15
ELSEIF (SameString(AlphaArray(6),'ModifiedAcceleratedCostRecoverySystem-20year')) THEN
depreciationMethod = depMethMACRS20
ELSEIF (SameString(AlphaArray(6),'StraightLine-27year')) THEN
depreciationMethod = depMethStraight27
ELSEIF (SameString(AlphaArray(6),'StraightLine-31year')) THEN
depreciationMethod = depMethStraight31
ELSEIF (SameString(AlphaArray(6),'StraightLine-39year')) THEN
depreciationMethod = depMethStraight39
ELSEIF (SameString(AlphaArray(6),'StraightLine-40year')) THEN
depreciationMethod = depMethStraight40
ELSEIF (SameString(AlphaArray(6),'None')) THEN
depreciationMethod = depMethNone
ELSEIF (lAlphaFieldBlanks(6)) THEN
depreciationMethod = depMethNone
CALL ShowWarningError(TRIM(CurrentModuleObject)//': The input field '//TRIM(cAlphaFieldNames(6)) // &
'is blank. "None" will be used.')
ELSE
depreciationMethod = depMethNone
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Invalid '//TRIM(cAlphaFieldNames(6))//'="'// &
TRIM(AlphaArray(6))//'". "None" will be used.')
END IF
! compute derived variables
lastDateMonth = baseDateMonth - 1 !same month of the year for first and last month
IF (lastDateMonth .EQ. 0) lastDateMonth = 12
lastDateYear = baseDateYear + lengthStudyYears - 1
ELSE
CALL ShowWarningError(TRIM(CurrentModuleObject)//': Only one instance of this object is allowed. ' // &
'No life-cycle cost reports will be generated. ')
LCCparamPresent = .FALSE.
END IF
END SUBROUTINE GetInputLifeCycleCostParameters