Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | NomHeatGen | |||
real(kind=r64), | intent(in) | :: | Tcwin | |||
real(kind=r64), | intent(in) | :: | Tcwout | |||
real(kind=r64), | intent(in) | :: | Teng | |||
real(kind=r64), | intent(in) | :: | Troom | |||
real(kind=r64), | intent(in) | :: | UAHX | |||
real(kind=r64), | intent(in) | :: | UAskin | |||
real(kind=r64), | intent(in) | :: | Qgenss | |||
real(kind=r64), | intent(in) | :: | MCeng | |||
real(kind=r64), | intent(in) | :: | MCcw | |||
real(kind=r64), | intent(in) | :: | MdotCpcw |
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.
Logical FUNCTION CheckMicroCHPThermalBalance(NomHeatGen, Tcwin, Tcwout, Teng, Troom, &
UAHX, UAskin, Qgenss, MCeng, MCcw , MdotCpcw )
! FUNCTION INFORMATION:
! AUTHOR B. Griffith
! DATE WRITTEN Feb. 2007
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! Check for energy balance to test if can exit iteration loop
! METHODOLOGY EMPLOYED:
! put all terms of dynamic energy balances on RHS and compute magnitude of imbalance
! compare imbalance to scalable thresholds and make a boolean conclusion.
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
REAL(r64), INTENT(IN) :: NomHeatGen ! nominal heat generation rate for scaling
REAL(r64), INTENT(IN) :: Tcwin ! hot water inlet temp
REAL(r64), INTENT(IN) :: Tcwout ! hot water leaving temp
REAL(r64), INTENT(IN) :: Teng ! engine mass temperature C
REAL(r64), INTENT(IN) :: Troom ! surrounding zone temperature C
REAL(r64), INTENT(IN) :: UAHX ! Heat exchanger UA
REAL(r64), INTENT(IN) :: UAskin ! Skin losses UA
REAL(r64), INTENT(IN) :: Qgenss ! steady state generator heat generation
REAL(r64), INTENT(IN) :: MCeng ! Fictitious mass and heat capacity of engine
REAL(r64), INTENT(IN) :: MCcw ! Fictitious mass and heat capacity of coolant hx
REAL(r64), INTENT(IN) :: MdotCpcw ! mass flow and specific heat of coolant water
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: a ! working variable, "a" term in generic ODE
REAL(r64) :: b ! working variable "b" term in generic ODE
REAL(r64) :: DTengDTime ! derivative of engine temp wrt time
REAL(r64) :: DCoolOutTDtime ! derivative of coolant exit temp wrt time
REAL(r64) :: magImbalEng ! energy imbalance for engine control volume
REAL(r64) :: magImbalCooling ! energy imbalance for coolant control volume
REAL(r64) :: threshold ! criteria for when to call energy balance okay
!first compute derivatives using a + bT
a = ( ( UAHX * Tcwout / MCeng) + ( UAskin * Troom / MCeng ) + ( Qgenss / MCeng ) )
b = ( ( -1.0d0 * UAHX / MCeng ) + ( -1.0d0 * UAskin / MCeng ) )
DTengDtime = a + b*Teng
a = ( MdotCpcw * Tcwin / MCcw) + ( UAHX * Teng / MCcw )
b = ( ( -1.0d0 * MdotCpcw / MCcw ) + ( -1.0d0 * UAHX / MCcw ) )
DCoolOutTDtime = a + b*Tcwout
magImbalEng = UAHX * (Tcwout - Teng) + UAskin*(Troom - Teng) + Qgenss - MCeng * DTengDtime
magImbalCooling = MdotCpcw * (Tcwin - Tcwout) + UAHX * (Teng - Tcwout)- MCcw * DCoolOutTDtime
threshold = NomHeatGen / 10000000.0d0
CheckMicroCHPThermalBalance = .false.
If ((threshold > magImbalEng ) .and. (threshold > magImbalCooling) ) then
CheckMicroCHPThermalBalance = .true.
endif
RETURN
END FUNCTION CheckMicroCHPThermalBalance