Changeset 41 for mso/sample/reactors/fogler
 Timestamp:
 Oct 25, 2006, 5:48:09 PM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

mso/sample/reactors/fogler/chap3/oxidation_of_so2.mso
r28 r41 106 106 mode = "steady"; 107 107 end 108 109 110 FlowSheet pfr_ploting111 PARAMETERS112 NComp as Integer;113 stoic(NComp) as Real(Brief="Stoichiometric coefficients");114 k as Real (Brief="Specific rate of reaction", Unit="l/mol/s");115 R as Real (Brief="Universal gas constant", Unit="atm*l/mol/K", Default=0.082);116 117 VARIABLES118 Inlet as stream; # Inlet stream119 Outlet as stream; # Outlet stream120 X as fraction (Brief="Molar conversion", Lower=0);121 r as reaction_mol (Brief="Rate of reaction of A", Unit="mol/l/s");122 T as temperature (Brief="Temperature", Unit="K");123 P as pressure (Brief="Pressure", Unit="atm");124 Theta(NComp)as Real (Brief="Parameter Theta");125 epsilon as Real (Brief="Parameter epsilon");126 127 EQUATIONS128 "Change time in X"129 X = time*"1/s";130 131 "Outlet molar fraction"132 Outlet.C = Outlet.z*sum(Outlet.C);133 134 "Inlet concentration"135 Inlet.C = Inlet.z*P/(R*T);136 137 "Outlet concentration"138 Outlet.C = Inlet.C(1)*(Theta + stoic*X)/(1 + epsilon*X);139 140 "Parameter Theta"141 Theta = Inlet.z/Inlet.z(1);142 143 "Parameter epsilon"144 epsilon = Inlet.z(1)*sum(stoic);145 146 "Rate of reaction"147 (r) = k*Outlet.C(1)*Outlet.C(2);148 149 SET150 NComp = 4; # A, B, C and I151 stoic = [1.0, 0.5, 1.0, 0.0];152 k = 200*"l/mol/s";153 154 SPECIFY155 "Inlet molar fraction"156 Inlet.z = [0.28, 0.1512, 0.0, 0.5688];157 "Inlet pressure"158 P = 1485*"kPa";159 "Inlet temperature"160 T = (227 + 273.15)*"K";161 162 OPTIONS163 time = [0:0.005:1];164 end165 166 167 168 FlowSheet pfr_ploting2169 PARAMETERS170 NComp as Integer (Brief="Number of chemical components", Lower=1);171 stoic(NComp)as Real(Brief="Stoichiometric coefficients");172 N as Integer(Brief="Number of descrete points", Default=200);173 k as Real(Brief="Specific rate of reaction", Unit="l/mol/s");174 R as Real(Brief="Universal gas constant", Unit="atm*l/mol/K", Default=0.082);175 176 VARIABLES177 C(N,NComp) as conc_mol(Brief="Outlet concentration", Unit="mol/l", Lower=0);178 Ct(N) as conc_mol(Brief="Total outlet concentration", Unit="mol/l", Lower=0);179 z(N,NComp) as fraction(Brief="Outlet molar fraction", Lower=0);180 X(N) as fraction(Brief="Molar conversion", Lower=0, Upper=1);181 dX as fraction (Brief="Molar conversion increment");182 r(N) as reaction_mol (Brief="Rate of reaction of A", Unit="mol/l/s");183 184 Co(NComp) as conc_mol(Brief="Inlet concentration", Unit="mol/l", Lower=0);185 zo(NComp) as fraction(Brief="Inlet molar fraction");186 187 T as temperature(Brief="Temperature", Unit="K");188 P as pressure(Brief="Pressure", Unit="atm");189 Theta(NComp)as Real(Brief="Parameter Theta");190 epsilon as Real(Brief="Parameter epsilon");191 192 Cto as conc_mol(Brief="Total inlet concentration", Unit="mol/l", Lower=0);193 194 EQUATIONS195 "Total inlet concentration"196 Cto = sum(Co);197 198 "Inlet concentration"199 Co = zo*P/(R*T);200 201 "Parameter Theta"202 Theta = zo/zo(1);203 204 "Parameter epsilon"205 epsilon = zo(1)*sum(stoic);206 207 "Descrete interval"208 dX = (X(N)  X(1))/N;209 210 for i in [1:(N2)]211 "Descrete molar convertion"212 X(i+1) = X(i) + dX;213 end214 215 for i in [1:N]216 "Outlet concentration"217 C(i,:) = Co(1)*(Theta + stoic*X(i))/(1 + epsilon*X(i));218 219 "Outlet molar fraction"220 C(i,:) = z(i,:)*sum(C(i,:));221 222 "Total outlet concentration"223 Ct(i) = sum(C(i,:));224 225 "Rate of reaction"226 (r(i)) = k*C(i,1)*C(i,2);227 end228 229 230 SET231 NComp = 4; # A, B, C and I232 stoic = [1.0, 0.5, 1.0, 0.0];233 k = 200*"l/mol/s";234 # N = 200;235 236 SPECIFY237 "Inlet molar fraction"238 zo = [0.28, 0.1512, 0.0, 0.5688];239 "Inlet pressure"240 P = 1485*"kPa";241 "Inlet temperature"242 T = (227 + 273.15)*"K";243 244 "Inlet molar conversion"245 X(1) = 0.0;246 "Outlet molar conversion"247 X(N) = 1.0;248 249 OPTIONS250 mode = "steady";251 end252 253 254 #*255 * Plot using the Matlab (emso2ml.m) (below version 0.9.45)256 *257 N=200; % Numbers of descrete points258 ncomp=4; % Numbers of components259 y=zeros(ncomp,N); % Concentration matrix260 [time, values, name]=emso2ml('pfr_ploting.rlt',0);261 for n=1:N262 y(:,n)=values((n1)*ncomp+1:n*ncomp)';263 end264 plot(values(9*N+1:10*N),y(1,:),values(9*N+1:10*N),y(2,:),...265 values(9*N+1:10*N),y(3,:),values(9*N+1:10*N),y(4,:));266 legend('SO_2','O_2', 'SO_3', 'N_2');267 xlabel('Molar conversion, X');268 ylabel('Molar concentration, (mol/l)');269 **#
Note: See TracChangeset
for help on using the changeset viewer.