$DEBUG
C     THIS IS THE EXAMPLE PROGRAM DESCRIBING HOW TO USE KDB ROUTINES.
      PROGRAM HC_VSG_E
      IMPLICIT DOUBLE PRECISION (A-H,O-Z) 
      INTEGER NCMP
      CHARACTER*50 CNAME
      CHARACTER*20 FORMULA 
      COMMON/HC_NAME/ICMP(50),CNAME(50),FORMULA(50),ICLASS(50) 
      COMMON/HC_PROP/WT(50),TB(50),TF(50),TC(50),PC(50),VC(50),ZC(50)
	1    ,ACCF(50),WSRK(50),VEST(50),ZRA(50),SOLP(50),VOLP(50)
     2    ,QI(50),RI(50),DM(50) 
      COMMON/HC_KPVP/IEQ_PVP(50),PVP_A(50),PVP_B(50),PVP_C(50),
     1	PVP_D(50),PVP_E(50),PVP_F(50),PVP_G(50),PVP_T1(50),PVP_T2(50)
      COMMON/HC_KVSG/IEQ_VSG(50),VSG_A(50),VSG_B(50),VSG_C(50),
     1	VSG_D(50),VSG_E(50),VSG_F(50),VSG_G(50),VSG_T1(50),VSG_T2(50)

	REAL*8 LTEXP(3),HPEXP(3),LVISEXP(3),HVISEXP(3),VOL(3)

C	EXPERIMENTAL DATA FOR ETHANEOL AT LOW PRESSURE
	DATA (LTEXP(J),J=1,3) /383.15D0,470.15D0,540.15D0/
	DATA (LVISEXP(J),J=1,3) /111.D0,137.D0,156.D0/
	DATA (HPEXP(J),J=1,3) /40.D2,100.D2,200.D2/
	DATA (HVISEXP(J),J=1,3) /90.D0,296.D0,415.D0/
	DATA (VOL(J),J=1,3) / 282.D0,60.2D0,51.1D0 /
	OPEN(UNIT=5,FILE="RESULT.TXT")
C     NUMBER OF COMPONENT = 1
      NCMP = 1

C	GAS VISCOSITY FOR LOW PRESSURE

C     SPECIFY THE ID OF EACH COMPONENT 
      ICMP(1) = 818		! EHTANOL
	CNAME(1) = "ETHANOL"
	ICLASS(1) = 11	
C	LOW PRESSURE VISCOSITY COEFFICIENT FOR ETHANOL
	IEQ_VSG(1) = 1		
      VSG_A(1)=0.0001396D0
	VSG_B(1)=2.848D-5
	VSG_C(1)=1.241D-9
	VSG_T1(1)=273.15D0
	VSG_T2(1)=1273.15D0
C	PURE PROPERTIES FOR ETHANOL
	WT(1)=4.60688D1
	TC(1)=514.0D0			 
 	PC(1)=6137.D0
	VC(1)=0.168D0
	ZC(1)=0.241249D0
	ACCF(1)=0.644
	DM(1)=1.7D0

	WRITE(5,*) CNAME(1)
	WRITE(5,*) "VISCOSITY FOR LOW PRESSURE"
	WRITE(5,*) 'COMPARISON OF EXPERIMENTAL AND ESTIMATED VALUE ',
	1		'(% ERROR)'
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'
	WRITE(5,*) ' T(K)   VSG(kPa)    KDB      LP_LUCAS   LP_CHUNG',
	1		'     IST1  IST2  IST3'
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'

	DO I = 1, 3
		CALL HC_VSGEQN(1,LTEXP(I),VSG1,IST1)
		VSG1 = VSG1*1.D4				  ! cP --> MICRO POISE
		CALL HC_VSGLUCAS_LP(1,LTEXP(I),VSG2,IST2)
		CALL HC_VSGCHUNG_LP(1,LTEXP(I),VSG3,IST3)
		ERR1 = DABS( (VSG1-LVISEXP(I))/LVISEXP(I) )*100.D0
		ERR2 = DABS( (VSG2-LVISEXP(I))/LVISEXP(I) )*100.D0
		ERR3 = DABS( (VSG3-LVISEXP(I))/LVISEXP(I) )*100.D0
		WRITE(5,5) LTEXP(I),LVISEXP(I),ERR1,ERR2,ERR3,IST1,IST2,IST3
	ENDDO
5	FORMAT(1x,F6.2,1X,4(1X,G10.5),3I6) 
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'

C	GAS VISCOSITY FOR HIGH PRESSURE

      ICMP(1) = 1		! METHANE
	CNAME(1) = "METHANE"
	ICLASS(1) = 1	
C	LOW PRESSURE VISCOSITY COEFFICIENT FOR METHANE
	IEQ_VSG(1) = 1		
      VSG_A(1)=0.001596D0
	VSG_B(1)=3.439D-5
	VSG_C(1)=-8.14D-9
	VSG_T1(1)=193.15D0
	VSG_T2(1)=1273.15D0
C	PURE PROPERTIES FOR METHANE
	WT(1)=1.60426D1
	TC(1)=190.564D0			 
 	PC(1)=4599.D0
	VC(1)=0.0986D0
	ZC(1)=0.286196D0
	ACCF(1)=0.011D0
	DM(1)=0.D0
C	VAPOR PRESSURE COEFFICIENT FOR METHANE FOR HC_VSGLUCAS_HP
	IEQ_PVP(1) = 1
	PVP_A(1)=-2.374836D0
	PVP_B(1)=-1.238032D3
	PVP_C(1)=2.664952D1 
	PVP_D(1)=2.048824D-5
	PVP_T1(1)=90.67
	PVP_T2(1)=190.58 
	WRITE(5,*) CNAME(1)
	WRITE(5,*) "VISCOSITY FOR HIGH PRESSURE"
	WRITE(5,*) 'COMPARISON OF EXPERIMENTAL AND ESTIMATED VALUE ',
	1		'(% ERROR)'
	WRITE(5,*) '----------------------------------------------------'
	1	   ,'------------------------'
	WRITE(5,*) ' T      P(EXP)    VSG(EXP)     LUCAS CHUNG(VOL)',
	1		'CHUNG(EOS) IST1  IST2  IST3'
	WRITE(5,*) '----------------------------------------------------'
	1	   ,'------------------------'
	T=200.D0
	DO I = 1, 3
		CALL HC_VSGLUCAS_HP(1,T,HPEXP(I),VSG1,IST1)
		CALL HC_VSGCHUNG_HP(1,T,HPEXP(I),1,1,VOL(I),VSG2,IST2)
		CALL HC_VSGCHUNG_HP(1,T,HPEXP(I),1,2,VOL(I),VSG3,IST3)
		ERR1 = DABS( (VSG1-HVISEXP(I))/HVISEXP(I) )*100.D0
		ERR2 = DABS( (VSG2-HVISEXP(I))/HVISEXP(I) )*100.D0
		ERR3 = DABS( (VSG3-HVISEXP(I))/HVISEXP(I) )*100.D0
		WRITE(5,15) T,HPEXP(I),HVISEXP(I),ERR1,ERR2,ERR3
	1				,IST1,IST2,IST3
	ENDDO
15	FORMAT(2(1x,F7.1),1X,4(1X,F9.3),3I6) 
	WRITE(5,*) '----------------------------------------------------'
	1	   ,'------------------------'

	CLOSE(5) 
      STOP 
      END 