SUBROUTINE TYPE63 (TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*) C*********************************************************************** C* Copyright ASHRAE. Toolkit for HVAC System Energy Calculations C*********************************************************************** C* SUBROUTINE: VLV3PDET (TRNLIB COMPONENT 1214) C* C* LANGUAGE: FORTRAN 77 C* C* PURPOSE: Calculates the performance of a three-way C* mixing valve. Determines valve flows for C* given inlet pressures, outlet pressure and C* valve position. The routine can model a C* diverting valve if the flow rates are C* negative, resulting in PLvg > PEnt. C*********************************************************************** C* INPUT VARIABLES DESCRIPTION(UNITS) SAMPLE VALUES C* XIN(1) M1Ent Mass flow rate entering valve valve port #1(kg/s) 3.0 C* XIN(2) M2Ent Mass flow rate entering valve valve port #2(kg/s) 3.0 C* XIN(3) PLvg Pressure of fluid leaving valve(Pa) 0.0 C* XIN(4) Pos1 Valve position for port #1 (0=closed,1=open)(-) .50 C* C* OUTPUT VARIABLES: C* OUT(1) P1Ent Pressure of fluid entering valve port #1(Pa) 98072.7 C* OUT(2) P2Ent Pressure of fluid entering valve port #2(Pa) 98072.7 C* OUT(3) MLvg Mass flow rate leaving valve(kg/s) 6.0 C* OUT(4)ErrStat Error status indicator, 0 = ok, 1 = error(-) 0.0 C* C* PARAMETERS C* PAR(1) ResOp1 Flow resistance coefficient of open port #1(1/kgm) 2779.0 C* PAR(2) ResOp2 Flow resistance coefficient of open port #2(1/kgm) 2779.0 C* PAR(3) WtFac1 Weighting factor for port #1 characteristic(-) 1.0 C* PAR(4) WtFac2 Weighting factor for port #2 characteristic(-) 1.0 C* WtFac = 0 : exponential characteristic C* WtFac = 1 : linear characteristic C* 0 < WtFac < 1 : intermediate characteristic C* PAR(5) LeakP1 Leakage parameter for port #1, ratio of flow(-) .01 C* through closed valve to flow through open valve C* at fixed pressure differential C* PAR(6) LeakP2 Leakage parameter for port #2, ratio of flow(-) .01 C* through closed valve to flow through open valve C* at fixed pressure differential C*********************************************************************** C MAJOR RESTRICTIONS: Three way valve modeled as two separate C two-way valves. C C DEVELOPER: Michael J. Brandemuehl, PhD, PE C University of Colorado at Boulder C C DATE: January 1, 1992 C C INCLUDE FILES: vlv3.inc C SUBROUTINES CALLED: VLVPDET 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 port1 Parameter array index for port #1 parameters C port2 Parameter array index for port #2 parameters C pos2 Valve position of port #2 C mInvert Negative value of flow rate, used to (kg/s) C calculate entering pressure from leaving pressure C*********************************************************************** DOUBLE PRECISION XIN,OUT INTEGER ErrStat, INFO, IOPT, NI, NP, ND REAL MLvg,mInvert,PAR DIMENSION XIN(4),OUT(4),PAR(6),INFO(15) CHARACTER*3 YCHECK(4), OCHECK(4) DATA YCHECK/'MF2','MF2','PR3','DM1'/ DATA OCHECK/'PR3','PR3','MF2','DM1'/ ErrStat = 0 IOPT = -1 NI = 4 !CORRECT NUMBER OF INPUTS NP = 6 !CORRECT NUMBER OF PARAMETERS ND = 0 !CORRECT NUMBER OF DERIVATIVES M1ENT = XIN(1) M2ENT = XIN(2) PLVG = XIN(3) POS1 = XIN(4) RESOP1 = PAR(1) RESOP2 = PAR(2) WTFAC1 = PAR(3) WTFAC2 = PAR(4) LEAKP1 = PAR(5) LEAKP2 = PAR(6) 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*** A three-way valve or damper is modeled as two separate two-way C2*** valves. The valve model is called for each flow port. C1*** Calculate the pressure entering port #1 given valve characteristics, C1*** flow rate, leaving pressure, and valve position. C2*** Use negative flow rate to calculate entering pressure. mInvert = -M1Ent CALL VLVPDET (RESOP1,WTFAC1,LEAKP1,mInvert, & PLvg,Pos1,P1Ent,ErrStat) C1*** Calculate the pressure entering port #2 given valve characteristics, C1*** flow rate, leaving pressure, and valve position. C2*** Use negative flow rate to calculate entering pressure. pos2 = 1-Pos1 mInvert = -M2Ent CALL VLVPDET (RESOP2,WTFAC2,LEAKP2,mInvert, & PLvg,Pos2,P2Ent,ErrStat) C1*** Calculate leaving flow from entering flows. MLvg = M1Ent + M2Ent OUT(1) = P1ENT OUT(2) = P2ENT OUT(3) = MLVG OUT(4) = ERRSTAT RETURN 1 END SUBROUTINE VLVPDET (RESOPEN,WTFACTOR,LEAKPAR,M, & PEnt,Pos,PLvg,ErrStat) C*********************************************************************** C* Copyright ASHRAE. Toolkit for HVAC System Energy Calculations C*********************************************************************** C* SUBROUTINE: VLVPDET C* C* LANGUAGE: FORTRAN 77 C* C* PURPOSE: Calculates the performance of a valve or C* damper. Outlet pressure is determined as C* a function of inlet pressure, flow rate, C* and valve position. C*********************************************************************** C* INPUT VARIABLES: C* M Mass flow rate through valve (kg/s) C* PEnt Pressure of fluid entering valve (Pa) C* Pos Valve position (0=closed,1=open) (-) C* C* OUTPUT VARIABLES: C* PLvg Pressure of fluid leaving valve (Pa) C* ErrStat Error status indicator, 0 = ok, 1 = error (-) C* C* PARAMETERS C* ResOpen Flow resistance coefficient at full open (1/kg m) C* WtFactor Weighting factor for valve characteristic (-) C* WtFactor = 0 : exponential characteristic C* WtFactor = 1 : linear characteristic C* 0 < WtFactor < 1 : intermediate characteristic C* LeakPar Leakage parameter, ratio of flow through (-) C* closed valve to flow through open valve C* at fixed pressure differential 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*********************************************************************** INTEGER ErrStat REAL leak,M,LEAKPAR,RESOPEN,WTFACTOR DATA small/1.E-6/ ErrStat = 0 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 pressure drop across the valve. C2*** M*ABS(M) allows negative deltaP for negative M. deltaP = resistCoef*M*ABS(M) C1*** Calculate the outlet pressure. PLvg = PEnt-deltaP RETURN END