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) | :: | DomainNum | |||
integer, | intent(in) | :: | CircuitNum |
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 InitPipingSystems(DomainNum, CircuitNum)
! SUBROUTINE INFORMATION:
! AUTHOR Edwin Lee
! DATE WRITTEN Summer 2011
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! <description>
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! na
! USE STATEMENTS:
USE DataHVACGlobals, ONLY : TimeStepSys, SysTimeElapsed
USE DataPlant, ONLY: ScanPlantLoopsForObject, TypeOf_PipingSystemPipeCircuit, PlantLoop, &
TypeOf_GrndHtExchgHorizTrench
USE DataGlobals, ONLY : BeginSimFlag, BeginEnvrnFlag, DayOfSim, HourOfDay, &
TimeStep, TimeStepZone, SecInHour, InitConvTemp
USE DataLoopNode, ONLY: Node
USE PlantUtilities, ONLY: SetComponentFlowRate
USE FluidProperties, ONLY: GetDensityGlycol
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: DomainNum
INTEGER, INTENT(IN) :: CircuitNum
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: RoutineName = 'InitPipingSystems'
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
LOGICAL :: errFlag
INTEGER :: InletNodeNum
INTEGER :: OutletNodeNum
INTEGER :: CircCtr
INTEGER :: SegCtr
INTEGER :: SegmentIndex
REAL(r64) :: rho
INTEGER :: TypeToLookFor
!Do any one-time initializations
IF (PipingSystemCircuits(CircuitNum)%NeedToFindOnPlantLoop) THEN
errFlag = .FALSE.
IF (PipingSystemCircuits(CircuitNum)%IsActuallyPartOfAHorizontalTrench) THEN
TypeToLookFor = TypeOf_GrndHtExchgHorizTrench
ELSE
TypeToLookFor = TypeOf_PipingSystemPipeCircuit
END IF
CALL ScanPlantLoopsForObject(PipingSystemCircuits(CircuitNum)%Name, &
TypeToLookFor, &
PipingSystemCircuits(CircuitNum)%LoopNum, &
PipingSystemCircuits(CircuitNum)%LoopSideNum, &
PipingSystemCircuits(CircuitNum)%BranchNum, &
PipingSystemCircuits(CircuitNum)%CompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowFatalError('PipingSystems:'//RoutineName//': Program terminated due to previous condition(s).')
END IF
!Once we find ourselves on the plant loop, we can do other things
rho = GetDensityGlycol(PlantLoop(PipingSystemCircuits(CircuitNum)%LoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(PipingSystemCircuits(CircuitNum)%LoopNum)%FluidIndex,&
RoutineName)
PipingSystemCircuits(CircuitNum)%DesignMassFlowRate = &
PipingSystemCircuits(CircuitNum)%DesignVolumeFlowRate * rho
PipingSystemCircuits(CircuitNum)%NeedToFindOnPlantLoop = .FALSE.
END IF
IF (PipingSystemDomains(DomainNum)%DomainNeedsToBeMeshed) THEN
CALL DevelopMesh(DomainNum)
! would be OK to do some post-mesh error handling here I think
DO CircCtr = 1, SIZE(PipingSystemDomains(DomainNum)%CircuitIndeces)
DO SegCtr = 1, SIZE(PipingSystemCircuits(PipingSystemDomains(DomainNum)%CircuitIndeces(CircCtr))%PipeSegmentIndeces)
SegmentIndex = PipingSystemCircuits(PipingSystemDomains(DomainNum)%CircuitIndeces(CircCtr))%PipeSegmentIndeces(SegCtr)
IF (.NOT. PipingSystemSegments(SegmentIndex)%PipeCellCoordinatesSet) THEN
CALL ShowSevereError('PipingSystems:'//RoutineName//':Pipe segment index not set.')
CALL ShowContinueError('...Possibly because pipe segment was placed outside of the domain.')
CALL ShowContinueError('...Verify piping system domain inputs, circuits, and segments.')
CALL ShowFatalError('Preceding error causes program termination')
END IF
END DO
END DO
PipingSystemDomains(DomainNum)%DomainNeedsToBeMeshed = .FALSE.
END IF
!The time init should be done here before we DoOneTimeInits because the DoOneTimeInits
! includes a ground temperature initialization, which is based on the Cur%CurSimTimeSeconds variable
! which would be carried over from the previous environment
PipingSystemDomains(DomainNum)%Cur%CurSimTimeStepSize = TimeStepSys*SecInHour
PipingSystemDomains(DomainNum)%Cur%CurSimTimeSeconds = (dayofSim - 1) * 24 &
+ (hourofday - 1) &
+ (timestep - 1) * timestepZone &
+ SysTimeElapsed
!There are also some inits that are "close to one time" inits...(one-time in standalone, each envrn in E+)
IF( (BeginSimFlag .AND. PipingSystemDomains(DomainNum)%BeginSimInit) &
.OR. (BeginEnvrnFlag .AND. PipingSystemDomains(DomainNum)%BeginSimEnvrn)) THEN
! this seemed to clean up a lot of reverse DD stuff because fluid thermal properties were
! being based on the inlet temperature, which wasn't updated until later
InletNodeNum = PipingSystemCircuits(CircuitNum)%InletNodeNum
PipingSystemCircuits(CircuitNum)%CurCircuitInletTemp = Node(InletNodeNum)%Temp
PipingSystemCircuits(CircuitNum)%InletTemperature = PipingSystemCircuits(CircuitNum)%CurCircuitInletTemp
CALL DoOneTimeInitializations(DomainNum, CircuitNum)
PipingSystemDomains(DomainNum)%BeginSimInit = .FALSE.
PipingSystemDomains(DomainNum)%BeginSimEnvrn = .FALSE.
END IF
IF (.NOT. BeginSimFlag) PipingSystemDomains(DomainNum)%BeginSimInit = .TRUE.
IF (.NOT. BeginEnvrnFlag) PipingSystemDomains(DomainNum)%BeginSimEnvrn = .TRUE.
!Shift history arrays only if necessary
IF(ABS(PipingSystemDomains(DomainNum)%Cur%CurSimTimeSeconds-PipingSystemDomains(DomainNum)%Cur%PrevSimTimeSeconds)>1.0d-6)THEN
PipingSystemDomains(DomainNum)%Cur%PrevSimTimeSeconds = PipingSystemDomains(DomainNum)%Cur%CurSimTimeSeconds
CALL ShiftTemperaturesForNewTimeStep(DomainNum)
PipingSystemDomains(DomainNum)%DomainNeedsSimulation = .TRUE.
END IF
!Get the mass flow and inlet temperature to use for this time step
InletNodeNum = PipingSystemCircuits(CircuitNum)%InletNodeNum
OutletNodeNum = PipingSystemCircuits(CircuitNum)%OutletNodeNum
PipingSystemCircuits(CircuitNum)%CurCircuitInletTemp = Node(InletNodeNum)%Temp
!request design, set component flow will decide what to give us based on restrictions and flow lock status
PipingSystemCircuits(CircuitNum)%CurCircuitFlowRate = PipingSystemCircuits(CircuitNum)%DesignMassFlowRate
CALL SetComponentFlowRate( PipingSystemCircuits(CircuitNum)%CurCircuitFlowRate, &
InletNodeNum, &
OutletNodeNum, &
PipingSystemCircuits(CircuitNum)%LoopNum, &
PipingSystemCircuits(CircuitNum)%LoopSideNum, &
PipingSystemCircuits(CircuitNum)%BranchNum, &
PipingSystemCircuits(CircuitNum)%CompNum)
RETURN
END SUBROUTINE InitPipingSystems