$DEBUG
C     THIS IS THE EXAMPLE PROGRAM DESCRIBING HOW TO USE KDB ROUTINES.
      PROGRAM HC_THG_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_KTHG/IEQ_THG(50),THG_A(50),THG_B(50),THG_C(50),
     1	THG_D(50),THG_E(50),THG_F(50),THG_G(50),THG_T1(50),THG_T2(50)
      COMMON/HC_KCPG/IEQ_CPG(50),CPG_A(50),CPG_B(50),CPG_C(50),
     1	CPG_D(50),CPG_E(50),CPG_F(50),CPG_G(50),CPG_T1(50),CPG_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 TEXP(2),THGEXP(2)
C	EXPERIMENTAL DATA FOR ETHANEOL AT LOW PRESSURE
	DATA (TEXP(J),J=1,2) /293.D0,401.D0/
	DATA (THGEXP(J),J=1,2) /15.0D-3,24.9D-3/
	OPEN(UNIT=5,FILE="RESULT.TXT")
C     NUMBER OF COMPONENT = 1
      NCMP = 1

C     SPECIFY THE ID OF EACH COMPONENT 
      ICMP(1) = 818		! EHTANOL
	CNAME(1) = "ETHANOL"
	ICLASS(1) = 11	
C	LOW PRESSURE GAS THERMAL CONDUCTIVITY COEFFICIENT FOR ETHANOL
	IEQ_THG(1) = 1		
      THG_A(1)=-0.007797D0
	THG_B(1)=4.167D-5
	THG_C(1)=1.214D-7
	THG_D(1)=-5.184D-11
	THG_T1(1)=270.D0
	THG_T2(1)=1270.D0
C	LOW PRESSURE VISCOSITY COEFFICIENT FOR ETHANOL FOR HC_THGCHUNG
	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	IDEAL GAS HEAT CAPACITY COEFFICIENT FOR ETHANOL FOR HC_THGCHUNG
	IEQ_CPG(1) = 1		
      CPG_A(1)=1.995901D1
	CPG_B(1)=1.428467D-1
	CPG_C(1)=7.763252D-5
	CPG_D(1)=-1.512772D-7
	CPG_E(1)=5.366231D-11


C	PURE PROPERTIES FOR ETHANOL
	WT(1)=4.60688D1
	TC(1)=514.0D0			 
	ACCF(1)=0.644

	WRITE(5,*) CNAME(1)
	WRITE(5,*) 'COMPARISON OF EXPERIMENTAL AND ESTIMATED VALUE ',
	1		'(% ERROR)'
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'
	WRITE(5,*) ' T(K)   THG(EXP)     KDB       CHUNG ',
	1		'      IST1  IST2'
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'

	DO I = 1, 2
		CALL HC_THGEQN(1,TEXP(I),THG1,IST1)
		CALL HC_THGCHUNG(1,TEXP(I),THG2,IST2)
		ERR1 = DABS( (THG1-THGEXP(I))/THGEXP(I) )*100.D0
		ERR2 = DABS( (THG2-THGEXP(I))/THGEXP(I) )*100.D0
		WRITE(5,5) TEXP(I),THGEXP(I),ERR1,ERR2,IST1,IST2
	ENDDO
5	FORMAT(1x,F6.2,1X,3(1X,G10.5),2I6) 
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'

C	GAS THERMAL CONDUCTIVITY FOR HIGH PRESSURE
	
C     SPECIFY THE ID OF EACH COMPONENT 
      ICMP(1) = 185		! PROPYLENE
	CNAME(1) = "PROPYLENE"
	ICLASS(1) = 3 

	TC(1)=364.9D0
	PC(1)=4600.D0
	VC(1)=0.1846D0
	ACCF(1)=0.144D0
	WT(1)=42.0804D0
	DM(1)=0.4D0

	
      IEQ_VSG(1)=0

	IEQ_CPG(1)=1
      CPG_A(1)=1.790513D1  
	CPG_B(1)=1.478080D-1  
	CPG_C(1)=6.877262D-5  
	CPG_D(1)=-1.383731D-7  
	CPG_E(1)=4.844714D-11
  	
	T=473.D0
	P=150.D0
	IEXP = 1 
	RHO = 1.D0/172.1D0
	EXPTHG=6.64D-2
	WRITE(5,*)
	WRITE(5,*)

	WRITE(5,*) CNAME(1)
	WRITE(5,*) 'COMPARISON OF EXPERIMENTAL AND ESTIMATED VALUE ',
	1		'(% ERROR)'
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'
	WRITE(5,*) ' T(K)   P(Bar)      THG(EXP)   CHUNG     ERROR',
	1		'       IST1  '
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'
	CALL HC_THGCHUNG_HP(1,T,P,THG,RHO,IEXP,IST)
	ERR1 = DABS( (THG-EXPTHG)/EXPTHG )*100.D0
	WRITE(5,15) T,P,EXPTHG,THG,ERR1,IST
	
15	FORMAT(1x,F6.2,1X,4(1X,G10.5),I6) 
	WRITE(5,*) '-----------------------------------------------------'
	1	   ,'----------------'
      

	CLOSE(5) 
      STOP 
      END 