SUBROUTINE TYPE52 (TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*) C*********************************************************************** C* Copyright ASHRAE. Toolkit for HVAC System Energy Calculations C*********************************************************************** C* SUBROUTINE: VLVCIRC C* C* LANGUAGE: FORTRAN 77 C* C* PURPOSE: Calculates the mass flow as a function C* of valve position using the definition of C* valve authority and the valve flow C* characteristics when fully open. C*********************************************************************** C* INPUT VARIABLES DESCRIPTION(UNITS) SAMPLE VALUES C* XIN(1) Pos Valve position (0=closed,1=open)(-) .50 C* C* OUTPUT VARIABLES C* OUT(1) M Mass flow rate through valve(kg/s) 1.71533 C* OUT(2) ErrStat Error status indicator, 0 = ok, 1 = error 0.0 C* C* PARAMETERS C* PAR(1) Auth Valve authority(-) .50 C* PAR(2) MOpen Mass flow rate through open valve(kg/s) 2.71 C* PAR(3) WtFactor Weighting factor for valve characteristics(-) 1.0 C* W = 0 : exponential characteristic C* W = 1 : linear characteristic C* 0 < W < 1 : intermediate characteristic C* PAR(4) LeakPar Leakage parameter, ratio of flow through(-) .001 C* closed valve to flow through open valve C* at fixed pressure differential C*********************************************************************** C MAJOR RESTRICTIONS: Total pressure drop independent of valve C position. C C DEVELOPER: Shauna Gabel C Michael J. Brandemuehl, PhD, PE C University of Colorado at Boulder C C DATE: January 1, 1992 C C INCLUDE FILES: vlv.inc C SUBROUTINES CALLED: None C FUNCTIONS CALLED: None C C REVISION HISTORY: None C C REFERENCE: Clark, D.R. 1985. HVACSIM+ building C systems and equipment simulation program: C Reference Manual. NBSIR 84-2996, National C Institute of Standards and Technology, C Washingtion, D.C. C*********************************************************************** C* INTERNAL VARIABLES: C* rlinear Characterizes linear resistance (1/kg m) C* rExp Characterizes exponential C* resistance (1/kg m) C* resistCoeff Flow resistance coefficient as a C* fuction of valve position (1/kg m) C* small Small number used in place of zero C*********************************************************************** DOUBLE PRECISION XIN,OUT INTEGER ErrStat,INFO,IOPT,NI,NP,ND REAL M,leak,LEAKPAR,AUTH,MOPEN,PAR C DIMENSION P(NPVlv) DIMENSION XIN(1),OUT(2),PAR(4),INFO(15) CHARACTER*3 YCHECK(1),OCHECK(2) DATA small/1.E-9/ DATA YCHECK/'DM1'/ DATA OCHECK/'MF2','DM1'/ POS = XIN(1) AUTH = PAR(1) MOPEN = PAR(2) WTFACTOR = PAR(3) LeakPar = PAR(4) ErrStat = 0 IOPT = -1 NI = 1 !CORRECT NUMBER OF INPUTS NP = 4 !CORRECT NUMBER OF PARAMETERS ND = 0 !CORRECT NUMBER OF DERIVATIVES IF (INFO(7).EQ.-1) THEN CALL TYPECK(IOPT,INFO,NI,NP,ND) C CHECKS TO SEE IF USER'S INFO MATCHES THE CORRECT NUMBER CALL RCHECK(INFO,YCHECK,OCHECK) C CHECKS TO SEE IF INPUT AND OUTPUT UNITS MATCH ENDIF C2*** Check to ensure non-zero leakage parameter. leak = MAX (LeakPar,small) C1*** Calculate the flow resistance for a linear valve. rLinear = 1/((1-leak)*Pos+Leak)**2 C1*** Calculate the flow resistance for an exponential valve. rExp = 1/(1-leak)**(2*Pos-2) C1*** Calculate the flow resistance coefficient where the weighting C1*** factor determines the represented model. relResistCoeff = WtFactor*rLinear + (1.0-WtFactor)*rExp C1*** Calculate the mass flow rate as a function of valve authority M = MOpen*SQRT(1/(Auth*relResistCoeff+(1-Auth))) OUT(1) = M OUT(2) = ERRSTAT RETURN 1 END