Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | PartLoadRatio | |||
real(kind=r64), | intent(in), | optional | DIMENSION(:) | :: | Par |
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 CalcUnitarySystemLoadResidual(PartLoadRatio, Par) RESULT (Residuum)
! FUNCTION INFORMATION:
! AUTHOR Richard Raustad, FSEC
! DATE WRITTEN February 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! To calculate the part-load ratio for the unitary system
! METHODOLOGY EMPLOYED:
! Use SolveRegulaFalsi to CALL this Function to converge on a solution
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
REAL(r64), INTENT(IN) :: PartLoadRatio ! DX cooling coil part load ratio
REAL(r64), INTENT(IN), DIMENSION(:), OPTIONAL :: Par ! Function parameters
REAL(r64) :: Residuum ! Result (force to 0)
! Parameter description example:
! Par(1) = REAL(UnitarySysNum,r64) ! Index to Unitary System
! Par(2) = 0.0 ! FirstHVACIteration FLAG, IF 1.0 then TRUE, if 0.0 then FALSE
! Par(3) = REAL(OpMode,r64) ! Fan control, IF 1.0 then cycling fan, if 0.0 then continuous fan
! Par(4) = REAL(CompOp,r64) ! Compressor control, IF 1.0 then compressor ON, if 0.0 then compressor OFF
! Par(5) = SensLoad or MoistureLoad ! Sensible or Latent load to be met by unitary system
! Par(6) = HeatingLoad or CoolingLoad ! Type of load FLAG, 0.0 IF heating load, 1.0 IF cooling or moisture load
! Par(7) = 1.0 ! Output calculation FLAG, 0.0 for latent capacity, 1.0 for sensible capacity
! Par(8) = OnOffAirFlowRatio ! Ratio of compressor ON air mass flow to AVERAGE air mass flow over time step
! Par(9) = HXUnitOn ! flag to enable HX, 1=ON and 2=OFF
! Par(10) = HeatingCoilPLR ! used to calculate latent degradation for cycling fan RH control
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: UnitarySysNum ! Index to this unitary system
LOGICAL :: FirstHVACIteration ! FirstHVACIteration flag
INTEGER :: FanOpMode ! Cycling fan or constant fan
INTEGER :: CompOp ! Compressor on/off; 1=on, 0=off
REAL(r64) :: LoadToBeMet ! Sensible or Latent load to be met
REAL(r64) :: OnOffAirFlowRatio ! Ratio of compressor ON air mass flow to AVERAGE air mass flow over time step
LOGICAL :: HXUnitOn ! flag to enable HX based on zone moisture load
REAL(r64) :: HeatPLR ! heating coil part load ratio
REAL(r64) :: CoolPLR ! cooling coil part load ratio
LOGICAL :: SensibleLoad ! sensible load
REAL(r64) :: SensOutput ! sensible output of system
REAL(r64) :: LatOutput ! latent output of system
! Convert parameters to usable variables
UnitarySysNum = INT(Par(1))
IF(Par(2) .EQ. 1.0d0)THEN
FirstHVACIteration = .TRUE.
ELSE
FirstHVACIteration = .FALSE.
END IF
FanOpMode = INT(Par(3))
CompOp = INT(Par(4))
LoadToBeMet = Par(5)
OnOffAirFlowRatio = Par(8)
IF(Par(6) .EQ. 1.0d0)THEN
CoolPLR = PartLoadRatio
HeatPLR = 0.0d0
ELSE
CoolPLR = 0.0d0
HeatPLR = PartLoadRatio
END IF
SensibleLoad = .FALSE.
IF(Par(7) .EQ. 1.0d0) SensibleLoad = .TRUE.
IF(Par(9) .EQ. 1.0d0)THEN
HXUnitOn = .TRUE.
ELSE
HXUnitOn = .FALSE.
END IF
CALL SetSpeedVariables(UnitarySysNum,SensibleLoad,PartLoadRatio)
CALL CalcUnitarySystemToLoad(UnitarySysNum,FirstHVACIteration,CoolPLR,HeatPLR, &
OnOffAirFlowRatio,SensOutput,LatOutput,HXUnitOn=HXUnitOn,CompOn=CompOp)
! Calculate residual based on output calculation flag
IF(SensibleLoad) THEN
IF(ABS(LoadToBeMet) .EQ. 0.0d0)THEN
Residuum = (SensOutput - LoadToBeMet)/100.0d0
ELSE
Residuum = (SensOutput - LoadToBeMet)/LoadToBeMet
END IF
ELSE
IF(ABS(LoadToBeMet) .EQ. 0.0d0)THEN
Residuum = (LatOutput - LoadToBeMet)/100.0d0
ELSE
Residuum = (LatOutput - LoadToBeMet)/LoadToBeMet
END IF
END IF
RETURN
END FUNCTION CalcUnitarySystemLoadResidual