"Example 3.5 on Page 89-90.  Day 13 Notes"

"See class notes for additional explanation"

T_e = 1700					"[K]"
P_e = Po#						"Assume 1 atm."

"Mass balance for the main reaction"

a+c=8

2*b + 2*d = 18

2*a+b+c = 25/1.2

e = 12.5/1.2 * 3.773

n_T = a+b+c+d+e

y1 = a / n_T			"Mole frac CO2"
y2 = b / n_T			"Mole frac H2O"
y3 = c / n_T			"Mole frac CO"
y4 = d / n_T			"Mole frac H2"
y5 = e / n_T			"Mole frac N2"

"Gibbs Free Energy of Reactant and Product Species"

g_CO2 = ENTHALPY(CO2,T=T_e) - T_e*ENTROPY(CO2, T=T_e,P=y1*P_e)
g_H2    = ENTHALPY(H2,    T=T_e) - T_e*ENTROPY(H2,    T=T_e,P=y4*P_e)
g_CO   = ENTHALPY(CO,   T=T_e) - T_e*ENTROPY(CO,   T=T_e,P=y3*P_e)
g_H2O = ENTHALPY(H2O, T=T_e) - T_e*ENTROPY(H2O, T=T_e,P=y2*P_e)

"Gibbs Free Energy of the Products"

G_P = 1*g_CO     +    1*g_H2O

"Gibbs Free Energy of the Reactants"

G_R = 1*g_CO2   +    1*g_H2

"Equilibrium"

DELTAG  =   G_P - G_R

DELTAG = 0

"Now see if we get close to the book's equilibrium constant.  Why do these simplified
  calculations of the equilibrium constant work"

K_P1 = (b*c)/(a*d)
K_P2 = (y2*y3)/(y1*y4)

K_book = 3.388