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.
SUBROUTINE CheckIFAnyEMS
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN April 2009
! MODIFIED Rui Zhang February 2010
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Determine if EMS is used in model and set flag
! This needs to be checked early so calls to SetupEMSActuator
! can be avoided if there is no EMS in model.
! We cannot do error checking during the full get input until later in the simulation.
! METHODOLOGY EMPLOYED:
! Get number of EMS-related input objects and set
! global logical AnyEnergyManagementSystemInModel
! REFERENCES:
! na
! USE STATEMENTS:
! USE DataIPShortcuts
USE InputProcessor , ONLY: GetNumObjectsFound
USE DataGlobals , ONLY: AnyEnergyManagementSystemInModel
USE General, ONLY: ScanForReports
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, EXTERNAL :: GetNewUnitNumber
INTEGER :: write_stat
CHARACTER(len=MaxNameLength) :: cCurrentModuleObject
cCurrentModuleObject = 'EnergyManagementSystem:Sensor'
NumSensors = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:Actuator'
numActuatorsUsed = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:ProgramCallingManager'
NumProgramCallManagers = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:Program'
NumErlPrograms = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:Subroutine'
NumErlSubroutines = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:GlobalVariable'
NumUserGlobalVariables = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:OutputVariable'
NumEMSOutputVariables = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:MeteredOutputVariable'
NumEMSMeteredOutputVariables= GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:CurveOrTableIndexVariable'
NumEMSCurveIndices = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'ExternalInterface:Variable'
NumExternalInterfaceGlobalVariables = GetNumObjectsFound(cCurrentModuleObject)
! added for FMUImport
cCurrentModuleObject = 'ExternalInterface:FunctionalMockupUnitImport:To:Variable'
NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables = GetNumObjectsFound(cCurrentModuleObject)
! added for FMUExport
cCurrentModuleObject = 'ExternalInterface:FunctionalMockupUnitExport:To:Variable'
NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'ExternalInterface:Actuator'
NumExternalInterfaceActuatorsUsed = GetNumObjectsFound(cCurrentModuleObject)
! added for FMUImport
cCurrentModuleObject = 'ExternalInterface:FunctionalMockupUnitImport:To:Actuator'
NumExternalInterfaceFunctionalMockupUnitImportActuatorsUsed = GetNumObjectsFound(cCurrentModuleObject)
! added for FMUExport
cCurrentModuleObject = 'ExternalInterface:FunctionalMockupUnitExport:To:Actuator'
NumExternalInterfaceFunctionalMockupUnitExportActuatorsUsed = GetNumObjectsFound(cCurrentModuleObject)
cCurrentModuleObject = 'EnergyManagementSystem:ConstructionIndexVariable'
NumEMSConstructionIndices = GetNumObjectsFound(cCurrentModuleObject)
! added for FMU
IF ((NumSensors + numActuatorsUsed + NumProgramCallManagers + NumErlPrograms + NumErlSubroutines &
+ NumUserGlobalVariables + NumEMSOutputVariables + NumEMSCurveIndices &
+ NumExternalInterfaceGlobalVariables + NumExternalInterfaceActuatorsUsed &
+ NumEMSConstructionIndices + NumEMSMeteredOutputVariables + NumExternalInterfaceFunctionalMockupUnitImportActuatorsUsed &
+ NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables &
+ NumExternalInterfaceFunctionalMockupUnitExportActuatorsUsed &
+ NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables) > 0 ) THEN
AnyEnergyManagementSystemInModel = .TRUE.
ELSE
AnyEnergyManagementSystemInModel = .FALSE.
ENDIF
IF (AnyEnergyManagementSystemInModel) THEN
CALL ScanForReports('EnergyManagementSystem', OutputEDDFile)
IF (OutputEDDFile) THEN
! open up output file for EMS EDD file EMS Data and Debug
OutputEMSFileUnitNum=GetNewUnitNumber()
OPEN (OutputEMSFileUnitNum,FILE='eplusout.edd',ACTION='write',IOSTAT=write_stat)
IF (write_stat /= 0) THEN
CALL ShowFatalError('CheckIFAnyEMS: Could not open file "eplusout.edd" for output (write).')
ENDIF
ENDIF
ELSE
CALL ScanForReports('EnergyManagementSystem', OutputEDDFile)
IF (OutputEDDFile) THEN
CALL ShowWarningError('CheckIFAnyEMS: No EnergyManagementSystem has been set up in the input file but'// &
' output is requested.')
CALL ShowContinueError('No EDD file will be produced. Refer to EMS Application Guide and/or InputOutput Reference'// &
' to set up your EnergyManagementSystem.')
ENDIF
ENDIF
RETURN
END SUBROUTINE CheckIFAnyEMS