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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | MeterNumber | |||
integer, | intent(in) | :: | IndexType |
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.
FUNCTION GetInstantMeterValue(MeterNumber,IndexType) RESULT(InstantMeterValue)
! FUNCTION INFORMATION:
! AUTHOR Richard Liesen
! DATE WRITTEN February 2003
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This function returns the Instantaneous meter value (timestep) for the meter number indicated
! using IndexType to differentiate between Zone and HVAC values.
! METHODOLOGY EMPLOYED:
! Uses internal EnergyMeters structure to get value.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataPrecisionGlobals
USE OutputProcessor
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: MeterNumber ! Which Meter Number (from GetMeterIndex)
INTEGER, INTENT(IN) :: IndexType ! Whether this is zone of HVAC
REAL(r64) :: InstantMeterValue
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
INTEGER :: Loop
INTEGER :: Meter
InstantMeterValue = 0.0d0
! EnergyMeters(Meter)%TSValue=EnergyMeters(EnergyMeters(Meter)%SourceMeter)%TSValue-MeterValue(Meter)
If(MeterNumber == 0) THEN
InstantMeterValue = 0.0d0
ElseIf (EnergyMeters(MeterNumber)%TypeOfMeter /= MeterType_CustomDec) THEN
! section added to speed up the execution of this routine
! instead of looping through all the VarMeterArrays to see if a RVariableType is used for a
! specific meter, create a list of all the indexes for RVariableType that are used for that
! meter.
IF (EnergyMeters(MeterNumber)%InstMeterCacheStart .EQ. 0) THEN !not yet added to the cache
DO Loop=1,NumVarMeterArrays
DO Meter=1,VarMeterArrays(Loop)%NumOnMeters
IF(VarMeterArrays(Loop)%OnMeters(Meter) == MeterNumber) THEN
CALL IncrementInstMeterCache
EnergyMeters(MeterNumber)%InstMeterCacheEnd = InstMeterCacheLastUsed
IF (EnergyMeters(MeterNumber)%InstMeterCacheStart .EQ. 0) THEN
EnergyMeters(MeterNumber)%InstMeterCacheStart = InstMeterCacheLastUsed
END IF
InstMeterCache(InstMeterCacheLastUsed) = VarMeterArrays(Loop)%RepVariable
EXIT
END IF
END Do
DO Meter=1,VarMeterArrays(Loop)%NumOnCustomMeters
IF(VarMeterArrays(Loop)%OnCustomMeters(Meter) == MeterNumber) THEN
CALL IncrementInstMeterCache
EnergyMeters(MeterNumber)%InstMeterCacheEnd = InstMeterCacheLastUsed
IF (EnergyMeters(MeterNumber)%InstMeterCacheStart .EQ. 0) THEN
EnergyMeters(MeterNumber)%InstMeterCacheStart = InstMeterCacheLastUsed
END IF
InstMeterCache(InstMeterCacheLastUsed) = VarMeterArrays(Loop)%RepVariable
EXIT
END IF
END DO ! End Number of Meters Loop
END DO
END IF
DO loop = EnergyMeters(MeterNumber)%InstMeterCacheStart, EnergyMeters(MeterNumber)%InstMeterCacheEnd
RVar=>RVariableTypes(InstMeterCache(loop))%VarPtr
!Separate the Zone variables from the HVAC variables using IndexType
IF (RVariableTypes(InstMeterCache(loop))%IndexType == IndexType) THEN
!Add to the total all of the appropriate variables
InstantMeterValue=InstantMeterValue+RVar%Which*RVar%ZoneMult*RVar%ZoneListMult
END IF
END DO
Else ! MeterType_CustomDec
! Get Source Meter value
!Loop through all report meters to find correct report variables to add to instant meter total
Do Loop=1,NumVarMeterArrays
DO Meter=1,VarMeterArrays(Loop)%NumOnMeters
IF(VarMeterArrays(Loop)%OnMeters(Meter) == EnergyMeters(MeterNumber)%SourceMeter) THEN
RVar=>RVariableTypes(VarMeterArrays(Loop)%RepVariable)%VarPtr
!Separate the Zone variables from the HVAC variables using IndexType
IF (RVariableTypes(VarMeterArrays(Loop)%RepVariable)%IndexType == IndexType) THEN
!Add to the total all of the appropriate variables
InstantMeterValue=InstantMeterValue+RVar%Which*RVar%ZoneMult*RVar%ZoneListMult
Exit
END IF
End IF
End Do
DO Meter=1,VarMeterArrays(Loop)%NumOnCustomMeters
IF(VarMeterArrays(Loop)%OnCustomMeters(Meter) == EnergyMeters(MeterNumber)%SourceMeter) THEN
RVar=>RVariableTypes(VarMeterArrays(Loop)%RepVariable)%VarPtr
!Separate the Zone variables from the HVAC variables using IndexType
IF (RVariableTypes(VarMeterArrays(Loop)%RepVariable)%IndexType == IndexType) THEN
!Add to the total all of the appropriate variables
InstantMeterValue=InstantMeterValue+RVar%Which*RVar%ZoneMult*RVar%ZoneListMult
Exit
END IF
End IF
ENDDO
END DO ! End Number of Meters Loop
Do Loop=1,NumVarMeterArrays
DO Meter=1,VarMeterArrays(Loop)%NumOnMeters
IF(VarMeterArrays(Loop)%OnMeters(Meter) == MeterNumber) THEN
RVar=>RVariableTypes(VarMeterArrays(Loop)%RepVariable)%VarPtr
!Separate the Zone variables from the HVAC variables using IndexType
IF (RVariableTypes(VarMeterArrays(Loop)%RepVariable)%IndexType == IndexType) THEN
!Add to the total all of the appropriate variables
InstantMeterValue=InstantMeterValue-RVar%Which*RVar%ZoneMult*RVar%ZoneListMult
Exit
END IF
End IF
End Do
DO Meter=1,VarMeterArrays(Loop)%NumOnCustomMeters
IF(VarMeterArrays(Loop)%OnCustomMeters(Meter) == MeterNumber) THEN
RVar=>RVariableTypes(VarMeterArrays(Loop)%RepVariable)%VarPtr
!Separate the Zone variables from the HVAC variables using IndexType
IF (RVariableTypes(VarMeterArrays(Loop)%RepVariable)%IndexType == IndexType) THEN
!Add to the total all of the appropriate variables
InstantMeterValue=InstantMeterValue-RVar%Which*RVar%ZoneMult*RVar%ZoneListMult
Exit
END IF
End IF
ENDDO
END DO ! End Number of Meters Loop
End IF
RETURN
END FUNCTION GetInstantMeterValue