```
SETS
i streams /1*7/
j components /CO2,CH4,CO,H2,H2O,CH3OH,N2/
k reactions /1*2/
l equipments /m, r, s1, s2/;
SCALAR
T total flowrate /1/;
PARAMETERS
A(j,i) stream 1;
A('CO2','1')=0.1;
A('CH4','1')=0.05;
A('CO','1')=0.184;
A('H2','1')=0.59;
A('H2O','1')=0.008;
A('CH3OH','1')=0;
A('N2','1')=0.068;
TABLE
n(j,k) stoichiometric coefficients
1 2
CO2 0 1
CH4 0 0
CO 1 1
H2 2 1
H2O 0 1
CH3OH 1 0
N2 0 0 ;
TABLE
v(j,k) extent of reaction
1 2
CO2 0 1280
CH4 0 0
CO 1 -1280
H2 2560 1280
H2O 0 -1280
CH3OH -1280 0
N2 0 0 ;
VARIABLES
*Mixer, Reactor, Product, Seperator 1, Seperator 2/Recycle , Purge
pv product value
fc feed cost
p(l) processing cost
profit profit;
EQUATIONS
*Mass Balances (Stream 2)
EQ1
*Mass Balances (Stream 3)
EQ2
*Mass Balances (Stream 4)
EQ3
*Mass Balances (Stream 5)
EQ4
*Mass Balances (Stream 6)
EQ5
*Mass Balances (Stream 7)
EQ6
*Product Value
EQ7
*Feed Cost
EQ8
*Processing costs
EQ9
EQ10
EQ11
EQ12
*Profit
EQ13;
EQ1..sum('2',A(j,'2'))=E=T+sum('6',A(j,'6'));
EQ2..sum('3',A(j,'3'))=E=sum('2',A(j,'2'))-sum(k,v(j,k)*n(j,k));
EQ3..sum('4',A(j,'4'))=E=(0.99*sum('3',A('H2O','3')))+(0.96*sum('3',A('CH3OH','3')));
EQ4..sum('5',A(j,'5'))=E=sum('3',A('C02','3'))+sum('3',A('CH4','3'))+sum('3',A('C0','3'))+sum('3',A('H2','3'))+sum('3',A('N2','3'));
EQ5..sum('6',A(j,'6'))=E=0.9*sum('5',A(j,'5'));
EQ6..sum('7',A(j,'7'))=E=0.1*sum('5',A(j,'5'));
EQ7..pv=E=1000*sum('4',A(j,'4'));
EQ8..fc=E=1.5*T;
EQ9..p('m')=E=0.1*(T+sum('6',A(j,'6')));
EQ10..p('r')=E=0.2*sum('2',A(j,'2'));
EQ11..p('s1')=E=0.15*sum('3',A(j,'3'));
EQ12..p('s2')=E=0.15*sum('5',A(j,'5'));
EQ13..profit=E=pv-fc-p('m')-p('r')-p('s1')-p('s2');
MODEL QA /all/;
SOLVE QA using LP maximising profit;
```