"In class exercise ME410 Day 15."

"Calculate the molecular weight, enthalpy (kJ/kg), and entropy (kJ/kg-K) of a gas
  mixture at P = 2000 kPa and T = 1000 K.  The mole fractions are defined below."

y_CO2 = 0.109
y_H2O = 0.121
y_N2    = 0.694
y_CO   = 0.0283
y_H2    = 0.0455

"Data"

P1=2000											"[kPa]"
T1=1000											"[K]"

"Molecular weight"

M = y_CO2*MOLARMASS(CO2)+y_H2O*MOLARMASS(H2O)+y_N2*MOLARMASS(N2)+y_CO*MOLARMASS(CO)+y_H2*MOLARMASS(H2)

"We are set on molar specific quantities for now."

hbar = y_CO2*ENTHALPY(CO2,T=T1)+y_H2O*ENTHALPY(H2O,T=T1)+y_N2*ENTHALPY(N2,T=T1)+y_CO*ENTHALPY(CO,T=T1)+y_H2*ENTHALPY(H2,T=T1)

sbar = y_CO2*ENTROPY(CO2,T=T1,P=Y_CO2*P1)+y_H2O*ENTROPY(H2O,T=T1,P=Y_H2O*P1)+y_N2*ENTROPY(N2,T=T1,P=Y_N2*P1)+y_CO*ENTROPY(CO,T=T1,P=Y_CO*P1)+y_H2*ENTROPY(H2,T=T1,P=Y_H2*P1)

"We convert the molar specific quantities to mass specific quantities by dividing them by M"

h = hbar / M
s = sbar / M

"Get specific heat at const pressure."

cpbar = y_CO2*CP(CO2,T=T1)+y_H2O*CP(H2O,T=T1)+y_N2*CP(N2,T=T1)+y_CO*CP(CO,T=T1)+y_H2*CP(H2,T=T1)

"Calculation of gamma"

cpbar - cvbar = R#
gamma = cpbar / cvbar