SUBROUTINE TYPE62 (TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*) C*********************************************************************** C* Copyright ASHRAE. Toolkit for HVAC System Energy Calculations C*********************************************************************** C* SUBROUTINE: VLVMDET (TRNLIB COMPONENT 1213) C* C* LANGUAGE: FORTRAN 77 C* C* PURPOSE: Calculates the performance of a valve or C* damper. Flow is determined as a function C* of inlet pressure, outlet pressure and C* valve position. C*********************************************************************** C* INPUT VARIABLES DESCRIPTION(UNITS) SAMPLE VALUES C* XIN(1) PLvg Pressure of fluid leaving valve(Pa) 21951.0 C* XIN(2) PEnt Pressure of fluid entering valve(Pa) 103425.0 C* XIN(3) Pos Valve position (0=closed,1=open)(-) .50 C* C* OUTPUT VARIABLES: C* OUT(1) M Mass flow rate through valve(kg/s) 2.71 C* OUT(2) ErrStat Error status indicator, 0=ok, 1=error(-) 0.0 C* C* PARAMETERS C* PAR(1) ResOpen Flow resistance coefficient at full open(1/kgm) 2779.0 C* PAR(2) WtFactor Weighting factor for valve characteristic(-) 1.0 C* WtFactor = 0 : exponential characteristic C* WtFactor = 1 : linear characteristic C* 0 < WtFactor < 1 : intermediate characteristic C* PAR(3) LeakPar Leakage parameter, ratio of flow through(-) .001 C* closed valve to flow through open valve C* at fixed pressure differential C* C*********************************************************************** C MAJOR RESTRICTIONS: Pressure drop proportional to square of C flow rate. 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 resistance (1/kg m) C resistCoef Flow resistance coefficient relating (1/kg m) C flow to pressure drop C deltaP Pressure drop across the valve (Pa) C small Small number used in place of zero C*********************************************************************** DOUBLE PRECISION XIN, OUT INTEGER ErrStat, INFO, IOPT, NI, NP, ND REAL leak,M,PAR,SMALL,LEAKPAR DIMENSION XIN(3),OUT(2),PAR(3), INFO(15) CHARACTER*3 YCHECK(3), OCHECK(2) DATA small/1.E-6/ DATA YCHECK/'PR3','PR3','DM1'/ DATA OCHECK/'MF2','DM1'/ ErrStat = 0 IOPT = -1 NI = 3 !CORRECT NUMBER OF INPUTS NP = 3 !CORRECT NUMBER OF PARAMETERS ND = 0 !CORRECT NUMBER OF DERIVATIVES PLVG = XIN(1) PENT = XIN(2) POS = XIN(3) RESOPEN = PAR(1) WTFACTOR = PAR(2) LEAKPAR = PAR(3) IF (INFO(7).EQ.-1) THEN CALL TYPECK(IOPT,INFO,NI,NP,ND) C CHECKS TO SEE IF USER'S INFO MATCHES CORRECT NUMBERS 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 coefficient as the weighted average C1*** of linear and exponential valves. rLinear = 1./(((1-leak)*Pos+leak)**2) rExp = leak**(2*(1-Pos)) resistCoef = ResOpen*(WtFactor*rLinear+(1-WtFactor)*rExp) C1*** Calculate the flow rate through the valve C2*** SIGN( SQRT(ABS(x)), x) allows negative M for negative deltaP deltaP = PEnt - PLvg M = SIGN(SQRT(ABS(deltaP)/resistCoef),deltaP) OUT(1) = M OUT(2) = ERRSTAT RETURN 1 END