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 | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | FirstHVACIteration | |||
integer, | intent(in) | :: | AirLoopPass | |||
integer, | intent(in) | :: | AirLoopNum | |||
logical, | intent(out) | :: | AirLoopConvergedFlag | |||
integer, | intent(out) | :: | IterMax | |||
integer, | intent(out) | :: | IterTot | |||
integer, | intent(out) | :: | NumCalls |
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 ReSolveAirLoopControllers(FirstHVACIteration, AirLoopPass, AirLoopNum, AirLoopConvergedFlag, &
IterMax, IterTot, NumCalls)
! SUBROUTINE INFORMATION
! AUTHOR: Dimitri Curtil (LBNL)
! DATE WRITTEN: Feb 2006
! MODIFIED:
! RE-ENGINEERED: This is new code
! PURPOSE OF THIS SUBROUTINE:
! This subroutine solves for the controllers on the specfied air loop by reusing
! the solution from the previous HVAC iteration.
! It is used in the context of the optimization technique referred to as
! speculative warm restart.
! METHODOLOGY EMPLOYED:
! For the specified primary air system:
! (1) each component in the system is simulated in natural order, beginning at
! the return air inlet and progressing to the supply air outlets. Node data
! is passed in the same direction.
! (2) The controllers and their actions are simulated.
! REFERENCES: None
! USE STATEMENTS:
USE DataHVACControllers
USE HVACControllers, ONLY : ManageControllers
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
! TRUE if first full HVAC iteration in an HVAC timestep
LOGICAL, INTENT(IN) :: FirstHVACIteration
! DO loop index; there are 2 passes the 2nd is done only if mass balance fails
INTEGER, INTENT(IN) :: AirLoopPass
INTEGER, INTENT(IN) :: AirLoopNum
! TRUE when primary air system & controllers simulation has converged;
LOGICAL, INTENT(OUT) :: AirLoopConvergedFlag
! Max number of iterations performed by controllers across all air loops
INTEGER, INTENT(OUT) :: IterMax
! Aggregated number of iterations across all air loops
INTEGER, INTENT(OUT) :: IterTot
! Total number of times SimAirLoopComponents() has been invoked
INTEGER, INTENT(OUT) :: NumCalls
! SUBROUTINE PARAMETER DEFINITIONS: None
! INTERFACE BLOCK DEFINITIONS: None
! DERIVED TYPE DEFINITIONS: None
! SUBROUTINE LOCAL VARIABLE DEFINITIONS
! Controller DO loop index
INTEGER :: AirLoopControlNum
! TRUE when controller has converged
LOGICAL :: ControllerConvergedFlag
! TRUE when air loop needs to be refreshed.
! Note that it is not used by ManageControllers() in the WARM_RESTART mode.
LOGICAL :: IsUpToDateFlag
! FLOW:
! To track number of calls to SimAirLoopComponents() for each air loop
! Represents the most computationally expensive operation in the iteration.
! Best metric to use to assess the runtime performance of air loop simulation
NumCalls = 0
IterMax = 0
IterTot = 0
AirLoopConvergedFlag = .TRUE.
IsUpToDateFlag = .FALSE.
PrimaryAirSystem(AirLoopNum)%ControlConverged = .FALSE.
! This call to ManageControllers reinitializes the controllers actuated variables to zero
! E.g., actuator inlet water flow
DO AirLoopControlNum = 1,PrimaryAirSystem(AirLoopNum)%NumControllers
CALL ManageControllers( &
PrimaryAirSystem(AirLoopNum)%ControllerName(AirLoopControlNum), &
PrimaryAirSystem(AirLoopNum)%ControllerIndex(AirLoopControlNum), &
FirstHVACIteration, AirLoopNum, AirLoopPass, &
iControllerOpWarmRestart, ControllerConvergedFlag, IsUpToDateFlag )
END DO
! Evaluate air loop components with new actuated variables
NumCalls = NumCalls + 1
CALL SimAirLoopComponents( AirLoopNum, FirstHVACIteration )
IsUpToDateFlag = .TRUE.
! Check that all active controllers are still convergence
! Check that actuated variables are within min/max constraints
DO AirLoopControlNum = 1,PrimaryAirSystem(AirLoopNum)%NumControllers
ControllerConvergedFlag = .FALSE.
CALL ManageControllers( &
PrimaryAirSystem(AirLoopNum)%ControllerName(AirLoopControlNum), &
PrimaryAirSystem(AirLoopNum)%ControllerIndex(AirLoopControlNum), &
FirstHVACIteration, AirLoopNum, AirLoopPass, &
iControllerOpEnd, ControllerConvergedFlag, IsUpToDateFlag )
PrimaryAirSystem(AirLoopNum)%ControlConverged(AirLoopControlNum) = ControllerConvergedFlag
AirLoopConvergedFlag = AirLoopConvergedFlag .AND. ControllerConvergedFlag
! Update tracker for max iteration counter across all controllers on all air loops
IterMax = MAX(IterMax,0)
! Update tracker for aggregated counter of air loop inner iterations across all controllers
IterTot = IterTot + 0
END DO ! end of controller loop
RETURN
END SUBROUTINE ReSolveAirLoopControllers