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) | :: | ListNum | |||
logical, | intent(inout) | :: | ResimExt | |||
logical, | intent(inout) | :: | ResimHB | |||
logical, | intent(inout) | :: | ResimHVAC |
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 SimulateDemandManagerList(ListNum, ResimExt, ResimHB, ResimHVAC)
! SUBROUTINE INFORMATION:
! AUTHOR Peter Graham Ellis
! DATE WRITTEN July 2005
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
!
! METHODOLOGY EMPLOYED:
!
! USE STATEMENTS:
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE DataGlobals, ONLY: TimeStepZone, SecInHour
USE DataHVACGlobals, ONLY : TimeStepSys
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: ListNum
LOGICAL, INTENT(INOUT) :: ResimExt ! Flag to resimulate the exterior energy use simulation
LOGICAL, INTENT(INOUT) :: ResimHB ! Flag to resimulate the heat balance simulation (including HVAC)
LOGICAL, INTENT(INOUT) :: ResimHVAC ! Flag to resimulate the HVAC simulation
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: MgrNum
INTEGER :: MgrPtr
REAL(r64) :: AverageDemand
REAL(r64) :: OverLimit
LOGICAL :: OnPeak
REAL(r64), EXTERNAL :: GetInstantMeterValue
! FLOW:
DemandManagerList(ListNum)%ScheduledLimit = GetCurrentScheduleValue(DemandManagerList(ListNum)%LimitSchedule)
DemandManagerList(ListNum)%DemandLimit = DemandManagerList(ListNum)%ScheduledLimit &
* DemandManagerList(ListNum)%SafetyFraction
DemandManagerList(ListNum)%MeterDemand = &
GetInstantMeterValue(DemandManagerList(ListNum)%Meter, 1) / (TimeStepZone * SecInHour) &
+ GetInstantMeterValue(DemandManagerList(ListNum)%Meter, 2) / (TimeStepSys * SecInHour)
! Calculate average demand over the averaging window including the current timestep meter demand
AverageDemand = DemandManagerList(ListNum)%AverageDemand &
+ (DemandManagerList(ListNum)%MeterDemand - DemandManagerList(ListNum)%History(1)) &
/ DemandManagerList(ListNum)%AveragingWindow
IF (DemandManagerList(ListNum)%PeakSchedule .EQ. 0) THEN
OnPeak = .TRUE.
ELSE
IF (GetCurrentScheduleValue(DemandManagerList(ListNum)%PeakSchedule) .EQ. 1) THEN
OnPeak = .TRUE.
ELSE
OnPeak = .FALSE.
END IF
END IF
IF (OnPeak) THEN
OverLimit = AverageDemand - DemandManagerList(ListNum)%DemandLimit
IF (OverLimit > 0.0d0) THEN
SELECT CASE (DemandManagerList(ListNum)%ManagerPriority)
CASE (ManagerPrioritySequential) ! Activate first Demand Manager that can reduce demand
DO MgrNum = 1, DemandManagerList(ListNum)%NumOfManager
MgrPtr = DemandManagerList(ListNum)%Manager(MgrNum)
IF (DemandMgr(MgrPtr)%CanReduceDemand) THEN
DemandMgr(MgrPtr)%Activate = .TRUE.
SELECT CASE (DemandMgr(MgrPtr)%Type)
CASE (ManagerTypeExtLights)
ResimExt = .TRUE.
CASE (ManagerTypeLights, ManagerTypeElecEquip)
ResimHB = .TRUE.
ResimHVAC = .TRUE.
CASE (ManagerTypeThermostats)
ResimHVAC = .TRUE.
END SELECT
EXIT ! Leave the loop
END IF
END DO ! MgrNum
CASE (ManagerPriorityOptimal)
! Not yet implemented
CASE (ManagerPriorityAll) ! Activate ALL Demand Managers that can reduce demand
DO MgrNum = 1, DemandManagerList(ListNum)%NumOfManager
MgrPtr = DemandManagerList(ListNum)%Manager(MgrNum)
IF (DemandMgr(MgrPtr)%CanReduceDemand) THEN
DemandMgr(MgrPtr)%Activate = .TRUE.
SELECT CASE (DemandMgr(MgrPtr)%Type)
CASE (ManagerTypeExtLights)
ResimExt = .TRUE.
CASE (ManagerTypeLights, ManagerTypeElecEquip)
ResimHB = .TRUE.
ResimHVAC = .TRUE.
CASE (ManagerTypeThermostats)
ResimHVAC = .TRUE.
END SELECT
END IF
END DO ! MgrNum
END SELECT
END IF
END IF
RETURN
END SUBROUTINE SimulateDemandManagerList