File mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_sm.m artifact 8997bae617 part of check-in cd14981d1e


function [mtta,mttb,mttc,mttd] = ReactorTF_sm(mttpar);
% [mtta,mttb,mttc,mttd] = ReactorTF_sm(mttpar);
%System ReactorTF, representation sm, language m;
%File ReactorTF_sm.m;
%Generated by MTT on Thu Aug 24 14:45:50 BST 2000;
%
%====== Set up the global variables ======%
global ...
a ...
b ...
c ...
c_0 ...
c_a ...
c_b ...
c_p ...
e_1 ...
e_2 ...
e_3 ...
f_s ...
h ...
h_1 ...
h_2 ...
h_3 ...
k ...
k_1 ...
k_2 ...
k_3 ...
n ...
q ...
q_1 ...
q_2 ...
q_3 ...
q_s ...
rho ...
t_0 ...
t_s ...
v_r ...
x1 ...
x2 ...
x3 ;
a 	= mttpar(1);
b 	= mttpar(2);
c 	= mttpar(3);
c_0 	= mttpar(4);
c_a 	= mttpar(5);
c_b 	= mttpar(6);
c_p 	= mttpar(7);
e_1 	= mttpar(8);
e_2 	= mttpar(9);
e_3 	= mttpar(10);
f_s 	= mttpar(11);
h 	= mttpar(12);
h_1 	= mttpar(13);
h_2 	= mttpar(14);
h_3 	= mttpar(15);
k 	= mttpar(16);
k_1 	= mttpar(17);
k_2 	= mttpar(18);
k_3 	= mttpar(19);
n 	= mttpar(20);
q 	= mttpar(21);
q_1 	= mttpar(22);
q_2 	= mttpar(23);
q_3 	= mttpar(24);
q_s 	= mttpar(25);
rho 	= mttpar(26);
t_0 	= mttpar(27);
t_s 	= mttpar(28);
v_r 	= mttpar(29);
x1 	= mttpar(30);
x2 	= mttpar(31);
x3 	= mttpar(32);
%a matrix%
mtta = zeros(2,2);
mtt_t1 = exp((2.0*q_1+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s^2*h_3;
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_0*f_s*h_3*k_3;
mtt_t1 = mtt_t1-(exp((q_1+q_3)/t_s)*abs(exp(q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q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1+mtt_t3*h_2*k_1*k_2;
mtt_t2 = 2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_0;
mtt_t2 = mtt_t2-(2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_s);
mtt_t2 = mtt_t2+2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_0;
mtta(2,2) = mtt_t1/(mtt_t2-(2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_s));
%b matrix%
mttb = zeros(2,1);
mtt_t1 = -(exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))*f_s);
mtt_t1 = mtt_t1-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_0*k_3);
mtt_t1 = mtt_t1-(exp(q_3/t_s)*abs(exp(q_1/t_s))*k_1);
mtt_t3 = exp((q_1+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t1 = mtt_t1+mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t4 = 2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_0;
mttb(1) = mtt_t1/(mtt_t4-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_s));
mtt_t1 = -(exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))*f_s*k_1);
mtt_t3 = exp((q_1+q_2+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1-(exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))*k_1^2)+mtt_t3*k_1;
mtt_t2 = 2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_0;
mtt_t2 = mtt_t2-(2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_s);
mtt_t2 = mtt_t2+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_0;
mttb(2) = mtt_t1/(mtt_t2-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_s));
%c matrix%
mttc = zeros(1,2);
mttc(1,2) = 1.0;
%d matrix%
mttd = zeros(1,1);


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]