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 CheckAndReadFaults
! SUBROUTINE INFORMATION:
! AUTHOR Tianzhen Hong
! DATE WRITTEN August 2013
! MODIFIED
! RE-ENGINEERED
! PURPOSE OF THIS SUBROUTINE:
! 1. Determine if any operational faults are present in a model and set flags
! 2. Read faults input
! METHODOLOGY EMPLOYED:
! Get number of faults-related input objects and assign faults input to data structure
! REFERENCES:
! na
! USE STATEMENTS:
USE ScheduleManager, ONLY: GetScheduleIndex
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 :: RunMeOnceFlag = .FALSE.
LOGICAL :: ErrorsFound = .false. ! If errors detected in input
INTEGER :: NumAlphas ! Number of Alphas for each GetobjectItem call
INTEGER :: NumNumbers ! Number of Numbers for each GetobjectItem call
INTEGER :: IOStatus
CHARACTER(len=MaxNameLength), DIMENSION(5) :: cAlphaArgs ! Alpha input items for object
LOGICAL, DIMENSION(5) :: lAlphaFieldBlanks = .FALSE.
LOGICAL, DIMENSION(1) :: lNumericFieldBlanks = .FALSE.
CHARACTER(len=MaxNameLength), DIMENSION(5) :: cAlphaFieldNames
CHARACTER(len=MaxNameLength), DIMENSION(1) :: cNumericFieldNames
REAL(r64), DIMENSION(1) :: rNumericArgs ! Numeric input items for object
INTEGER :: i
INTEGER :: j
INTEGER :: jj
INTEGER :: iFaults
INTEGER :: iTotalFaults
CHARACTER(len=MaxNameLength) :: cFault1
IF (RunMeOnceFlag) RETURN
! check number of faults
NumFaults = 0
Do i = 1, NumFaultTypes
iFaults = 0
iFaults = GetNumObjectsFound(cFaults(i))
NumFaults = NumFaults + iFaults
ENDDO
IF (NumFaults > 0) THEN
AnyFaultsInModel = .TRUE.
ELSE
AnyFaultsInModel = .FALSE.
ENDIF
IF (.NOT. AnyFaultsInModel) THEN
RunMeOnceFlag = .TRUE.
RETURN
ENDIF
! read faults input
ALLOCATE (Faults(NumFaults))
j = 0
Do i = 1, NumFaultTypes
cFault1 = cFaults(i)
iFaults = GetNumObjectsFound(cFault1)
DO jj = 1, iFaults
CALL GetObjectItem(cFault1,jj,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,IOStatus, &
AlphaBlank=lAlphaFieldBlanks,NumBlank=lNumericFieldBlanks, &
AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
j = j + 1
Faults(j)%FaultType = cFault1
Faults(j)%FaultTypeEnum = iFaultTypeEnums(i)
Faults(j)%Name = cAlphaArgs(1)
Faults(j)%AvaiSchedule = cAlphaArgs(2)
! check availability schedule
IF (lAlphaFieldBlanks(2)) THEN
Faults(j)%AvaiSchedPtr = -1 ! returns schedule value of 1
ELSE
Faults(j)%AvaiSchedPtr = GetScheduleIndex(cAlphaArgs(2))
IF (Faults(j)%AvaiSchedPtr == 0) THEN
CALL ShowSevereError(TRIM(cFault1)//' = "'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(2))//' = "'//trim(cAlphaArgs(2))//'" not found.')
ErrorsFound = .TRUE.
ENDIF
END IF
Faults(j)%SeveritySchedule = cAlphaArgs(3)
! check severity schedule
IF (lAlphaFieldBlanks(3)) THEN
Faults(j)%SeveritySchedPtr = -1 ! returns schedule value of 1
ELSE
Faults(j)%SeveritySchedPtr = GetScheduleIndex(cAlphaArgs(3))
IF (Faults(j)%SeveritySchedPtr == 0) THEN
CALL ShowSevereError(TRIM(cFault1)//' = "'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(3))//' = "'//trim(cAlphaArgs(3))//'" not found.')
ErrorsFound = .TRUE.
ENDIF
END IF
Faults(j)%ControllerType = cAlphaArgs(4)
! check controller type
IF (lAlphaFieldBlanks(4)) THEN
CALL ShowSevereError(TRIM(cFault1)//' = "'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(4))//' = "'//trim(cAlphaArgs(4))//'" blank.')
ErrorsFound = .TRUE.
ELSE
SELECT CASE(MakeUPPERCase(TRIM(cAlphaArgs(4))))
CASE('CONTROLLER:OUTDOORAIR')
Faults(j)%ControllerTypeEnum = iController_AirEconomizer
!CASE ...
CASE DEFAULT
END SELECT
ENDIF
Faults(j)%ControllerName = cAlphaArgs(5)
! check controller name
IF (lAlphaFieldBlanks(5)) THEN
CALL ShowSevereError(TRIM(cFault1)//' = "'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(5))//' = "'//trim(cAlphaArgs(5))//'" blank.')
ErrorsFound = .TRUE.
ENDIF
! offset - degree of fault
Faults(j)%Offset = rNumericArgs(1)
ENDDO
ENDDO
RunMeOnceFlag = .TRUE.
IF (ErrorsFound) THEN
CALL ShowFatalError('Errors getting FaultModel input data. Preceding condition(s) cause termination.')
END IF
RETURN
END SUBROUTINE CheckAndReadFaults