Overview
Comment:To RCS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0109c21441e916fa7850949115d1a9edcb12ff6a13190a43f24c20176663cc95
User & Date: gawthrop@users.sourceforge.net on 2000-12-28 17:12:57
Other Links: branch diff | manifest | tags
Context
2000-12-28
18:17:57
To RCS check-in: cf57d50cce user: gawthrop@users.sourceforge.net tags: origin/master, trunk
17:12:57
To RCS check-in: 0109c21441 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
17:04:39
To RCS check-in: 9405d8f836 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/examples/Chemical/Reactor/MakeFigure.m version [bcab2a5c23].











































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


par = Reactor_numpar;		# Parameters
sym = Reactor_sympar;		# Parameter indices

F_s= [90:10:500];		# Range of flows

Z_a = []; Z_b = []; P = [];
for f_s=F_s
  par(sym.f_s) = f_s;
  [A,B,C,D] = Reactor_sm(par);	# Linearised system

  p = sort(eig(A));
  P = [P p];

  C_a = C([1 3],:);		# C vector for c_a and t
  D_a = D([1 3],:);		# D vector for c_a and t
  z_a = tzero(A,B,C_a,D_a);	# Transmission zeros for c_a and t
  Z_a = [Z_a z_a];

  C_b = C(2:3,:);		# C vector for c_b and t
  D_b = D(2:3,:);		# D vector for c_b and t
  z_b = tzero(A,B,C_b,D_b);	# Transmission zeros for c_b and t
  Z_b = [Z_b z_b];
endfor

grid; xlabel("f_s"); ylabel("p1,p2");
plot(F_s,P(1:2,:));
psfig("Reactor_pole_1_2");

grid; xlabel("f_s"); ylabel("p3");
plot(F_s,P(3,:));
psfig("Reactor_pole_3");

grid; xlabel("f_s"); ylabel("z_a");
plot(F_s,Z_a);
psfig("Reactor_zero_a");

grid; xlabel("f_s"); ylabel("z_b");
plot(F_s,Z_b);
psfig("Reactor_zero_b");

Added mttroot/mtt/lib/examples/Chemical/Reactor/Makefile version [97d3b40e97].














1
2
3
4
5
6
7
8
9
10
11
12
13
+
+
+
+
+
+
+
+
+
+
+
+
+
## Makes the schematic diagram and the (trasmission) zero figure
all: Reactor_pic.ps Reactor_zero_b.ps

Reactor_pic.ps: Reactor_pic.fig
	fig2dev -Lps Reactor_pic.fig> Reactor_pic.ps

Reactor_zero_b.ps: Reactor_abg.fig
	mtt -q Reactor sm m
	mtt -q Reactor numpar m;
	mtt -q Reactor sympar m;
	octave MakeFigure.m


Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_abg.fig version [42573cb4d6].










































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#FIG 3.2
Portrait
Center
Inches
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3001 8701 3001 7801 3151 7951
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1801 9001 2701 9001 2551 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 8776 2701 9226
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3301 9001 4201 9001 4051 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4201 9301 3601 9901 3826 9901
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5701 9001 4801 9001 4951 9151
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 6000 2700 6000 2550 6150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 10350 5025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6000 1800 5775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6225 1800 6000
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 10200 600 10200 600 7500 11100 7500 11100 10200
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 6600 600 6600 600 5400 11100 5400 11100 6600
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5700 8775 5700 9225
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4425 9300 3975 9300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4800 4500 8700 4650 8550
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6000 4800 4800 8700 5025 8625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9000 4800 5100 8700 5400 8700
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4800 4275 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4200 4275 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4800 5775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4200 5775 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4800 8775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4200 8775 4200
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 7200 3000 6300 3150 6450
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 10500 4800 3300 6000 3525 6075
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 5100 600 5100 600 3300 11100 3300 11100 5100
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4485 2395 4485 4130 4633 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 2999 2395 2999 4130 3148 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5970 2395 5970 4130 6119 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 10428 2397 10428 4132 10577 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8943 2397 8943 4132 9091 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 2100 2700 2100 2550 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3300 2100 4200 2100 4050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4800 2100 5700 2100 5550 2250
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4200 1800 3600 1200 3600 1425
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 1875 2700 2325
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 8701 1801 8101 1201 8101 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9301 2101 10201 2101 10051 2251
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6300 2100 7200 2100 7050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7800 2100 8700 2100 8550 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 1950 4350 1650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 1950 8850 1650
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 300 600 300 600 2700 11100 2700 11100 300
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 4800 3000 5700 3150 5550
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 9301 1801 9901 1201 9901 1426
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10050 1350 9900 1200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 1200 9750 1050
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4801 1801 5401 1201 5401 1426
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5550 1350 5400 1200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5400 1200 5250 1050
4 1 0 0 0 0 20 0.0000 4 210 1035 3075 4575 FMR:rfa\001
4 1 0 0 0 0 20 0.0000 4 210 1065 4575 4575 Rate:AD\001
4 1 0 0 0 0 20 0.0000 4 210 1050 6000 4575 Rate:AB\001
4 2 0 0 0 0 20 0.0000 4 285 780 1651 9076 SS:t_0\001
4 2 0 0 0 0 20 0.0000 4 285 690 3451 9976 C:h_r\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 6075 1\001
4 2 0 0 0 0 20 0.0000 4 210 480 1725 6075 SS:f\001
4 1 0 0 0 0 20 0.0000 4 210 150 3001 9076 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4501 9076 0\001
4 1 0 0 0 0 20 0.0000 4 210 1005 9001 4576 Rate:BC\001
4 1 0 0 0 0 20 0.0000 4 210 1050 10576 4576 FMR:rfb\001
4 1 1 1 0 3 20 0.0000 4 210 2625 9600 7800 THERMAL MODEL\001
4 1 1 1 0 3 20 0.0000 4 210 2940 9450 5700 HYDRAULIC MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 900 3000 7575 FMR:rt\001
4 1 1 1 0 3 20 0.0000 4 210 2700 9675 3750 REACTION MODEL\001
4 2 0 0 0 0 20 0.0000 4 285 825 1650 2175 SS:c_0\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4500 2175 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 6000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 9001 2176 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 10501 2176 1\001
4 1 0 0 0 0 20 0.0000 4 210 420 7500 2175 AF\001
4 1 0 0 0 0 20 0.0000 4 285 795 8100 1050 C:m_b\001
4 1 0 0 0 0 20 0.0000 4 285 780 3600 1050 C:m_a\001
4 1 1 0 0 3 20 0.0000 4 210 3735 9075 600 CONCENTRATION MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 480 6151 9076 SS:t\001
4 1 0 0 0 0 20 0.0000 4 285 825 9975 1050 SS:c_b\001
4 1 0 0 0 0 20 0.0000 4 285 810 5475 1050 SS:c_a\001

Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_desc.tex version [b3d301e887].































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Reactor (Reactor_desc.tex)
% Generated by MTT on Fri Mar 3 12:43:33 GMT 2000.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\fig{Reactor_pic}
{Reactor_pic} {0.9} {System \textbf{Reactor}, Schematic}

Figure \Ref{fig:Reactor_pic} is the schematic diagram od a chemical reactor.
The acausal bond graph of system \textbf{Reactor} is displayed in
Figure \Ref{fig:Reactor_abg.ps} and its label file is listed in
Section \Ref{sec:Reactor_lbl}.  The subsystems are listed in Section
\Ref{sec:Reactor_sub}.

This example of a (nonlinear) chemical reactor is due to Trickett and
Bogle\footnote{ K. J. Tricket, \emph{Quantification of Inverse
    Responses for Controllability Assessment of Nonlinear Processes},
  PhD Thesis, University College London, 1994} is used in this
section.  The reactor has two reaction mechanisms: $\text{A}
\rightarrow \text{B} \rightarrow \text{C}$ and $\text{2A} \rightarrow
\text{D}$.  The reactor mass inflow and outflow $f_r$ are identical.
$q$ represents the heat inflow to the reactor.

This is a two input, two-output unstable nonlinear system with unstable zero
dynamics.
The following figures illustrate the properties of the
\emph{linearised} system.

\fig{Reactor_pole_1_2}
{Reactor_pole_1_2} {0.9} {System \textbf{Reactor}: poles 1 and 2
  v. steady-state flow $f_s$}

\fig{Reactor_pole_3}
{Reactor_pole_3} {0.9} {System \textbf{Reactor}: pole 3
  v. steady-state flow $f_s$}

\fig{Reactor_zero_a}
{Reactor_zero_a} {0.9} {System \textbf{Reactor}: zero of system with
  $t$ and $c_a$ as output
  v. steady-state flow $f_s$}

\fig{Reactor_zero_b}
{Reactor_zero_b} {0.9} {System \textbf{Reactor}: pole 3
  v. steady-state flow $f_s$}

\begin{itemize}
\item Figures \Ref{fig:Reactor_pole_1_2} and
  \Ref{fig:Reactor_pole_3} show the three poles of the
  \emph{linearised} system as the steady-state flow varies. 
\item Figure \Ref{fig:Reactor_zero_a} shows the system zero (when $t$ and
  $c_a$ are the two system outputs) as the
  \emph{linearised} system as the steady-state flow varies. 
\item Figure \Ref{fig:Reactor_zero_b} shows the system zero (when $t$ and
  $c_b$ are the two system outputs) as the
  \emph{linearised} system as the steady-state flow varies. 
\end{itemize}

Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_input.txt version [94324e4c27].


























































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# Input specification (Reactor_input.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (Reactor_sspar.r)
## as siso_sspar ecxept that inputs/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume Reactor:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
x3 = c_p*t_s*v_r;


#Steady-state input q needed to achieve steady-state t_s
q_s = -( (t_0-t_s)*c_p*f_s + e_1*h_1*k_1*x1 + e_2*h_2*k_2*x2 + e_3*h_3*k_3*x1^2);

## The two inputs at steady-state
u1 = f_s;
u2 = q_s;


# Set the inputs
mttu(1) = u1 + 0.1*u1*(t>0.01); # f (Reactor)
mttu(2) = u2 + 0.1*u2*(t>0.05) ; # t (Reactor)



Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_lbl.txt version [4b8c69ad2e].






































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
%% Label file for system Reactor (Reactor_lbl.txt)
%SUMMARY Reactor: Simple reactor model
%DESCRIPTION Pseudo bond graph reactor model (based on ancient version)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%ALIAS Rate Chemical/Rate

% Extra variables
%VAR t_s
%VAR f_s
%VAR t_0
%VAR c_0
%VAR rho
%VAR v_r
%VAR e_1
%VAR e_2
%VAR e_3
%VAR a
%VAR b
%VAR c
%VAR c_A
%VAR c_B
%VAR x1
%VAR x2
%VAR x3
%VAR q_S

%VAR u1
%VAR u2

% Port aliases

% Argument aliases

%% each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type C
	m_a	lin		effort,1
	m_b	lin		effort,1
	h_r	lin		effort,c_p

% Component type FMR
	rfa	lin		effort,1		
	rfb	lin		effort,1		
	rt	lin		effort,c_p

% Component type Rate
        AB	Rate	k_1,q_1,h_1,1
	BC	Rate	k_2,q_2,h_2,1
	AD	Rate	k_3,q_3,h_3,2

% Component type SS
	c_0	SS		c_0,internal
	c_a	SS		external,0
	c_b	SS		external,0
	f	SS		internal,external
	t	SS		external,external
	t_0	SS		t_0,internal

Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_numpar.txt version [a664ac56b4].
















































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (Reactor_numpar.txt)
# Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

## Dummies
a = 0;				# Dummy
b = 0;				# Dummy
c = 0;				# Dummy
c_0 = 0;			# Dummy
c_a = 0;			# Dummy
c_b = 0;			# Dummy
c_p = 0;			# Dummy
e_1 = 0;			# Dummy
e_2 = 0;			# Dummy
e_3 = 0;			# Dummy
f_s = 0;			# Dummy
h = 0;				# Dummy
h_1 = 0;			# Dummy
h_2 = 0;			# Dummy
h_3 = 0;			# Dummy
k = 0;				# Dummy
k_1 = 0;			# Dummy
k_2 = 0;			# Dummy
k_3 = 0;			# Dummy
n = 0;				# Dummy
q = 0;				# Dummy
q_1 = 0;			# Dummy
q_2 = 0;			# Dummy
q_3 = 0;			# Dummy
q_s = 0;			# Dummy
rho = 0;			# Dummy
t_0 = 0;			# Dummy
t_s = 0;			# Dummy
v_r = 0;			# Dummy
x1 = 0;				# Dummy
x2 = 0;				# Dummy
x3 = 0;				# Dummy

## The bulk liquid
rho = 900;			# Density
c_p = 5.0;			# Specific heat

## Substance A
k_1 = 2.5e10;			# Reaction rate constant
q_1 = 1e4;			# Exotherm constant
h_1 = 1e4;			# Heat of reaction

## Substance B
k_2 = 2.65e12;			# Reaction rate constant
q_2 = 1.2e4;			# Exotherm constant
h_2 = 1.2e4;			# Heat of reaction

## Substance C
k_3 = 6e7;			# Reaction rate constant
q_3 = 8e3;			# Exotherm constant
h_3 = 3e4;			# Heat of reaction

## Inflow parameters
c_0 = 10;			# Inflow conc
t_0 = 530;			# Inflow temp

## Steady-state values
t_s = 530;			# Steady-state temp
f_s = 100;			# Steady-state flow








Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_pic.fig version [c396b14562].





















































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#FIG 3.2
Landscape
Center
Inches
Letter  
100.00
Single
-2
1200 2
6 2400 3150 3225 3375
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2625 3300 2925 3300
4 0 -1 0 0 2 20 0.0000 4 210 210 2400 3375 A\001
4 0 -1 0 0 2 20 0.0000 4 210 225 3000 3375 D\001
-6
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 2100 2100 2100 3900 1500 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 1500 4050 3900 4050
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 1500 4350 2100 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2100 3600 3900 4200 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 3600 4350 4200 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 3900 4050 4200 4050
2 1 1 2 -1 -1 0 0 -1 6.000 0 0 -1 0 0 2
	 2100 2400 3600 2400
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2400 2925 2700 2925
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3000 2925 3300 2925
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 2850 4800 2850 3750
4 0 -1 0 0 2 20 0.0000 4 210 210 2175 3000 A\001
4 0 -1 0 0 2 20 0.0000 4 210 195 2775 3000 B\001
4 0 -1 0 0 2 20 0.0000 4 210 210 3375 3000 C\001
4 0 -1 0 0 2 20 0.0000 4 210 150 2250 3375 2\001
4 0 -1 0 0 3 12 0.0000 4 135 90 1875 4950 0\001
4 0 -1 0 0 3 12 0.0000 4 135 90 2250 4950 0\001
4 0 -1 0 0 3 20 0.0000 4 210 150 2775 5025 q\001
4 0 -1 0 0 3 20 0.0000 4 285 765 1500 4800 f , c  , t\001
4 0 -1 0 0 3 20 0.0000 4 285 765 3600 4800 f , c  , t\001
4 0 -1 0 0 3 12 0.0000 4 135 90 3975 4950 b\001
4 0 -1 0 0 3 12 0.0000 4 90 75 4350 4950 r\001

Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_rep.txt version [db07825607].


































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system Reactor (Reactor_rep.txt)
## Generated by MTT on" Fri Mar  3 12:13:34 GMT 2000.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

mtt Reactor abg tex			# The system description
mtt Reactor cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt Reactor struc tex	        # The system structure
## mtt Reactor dae tex	        # The system dae
mtt Reactor ode tex	        # The system ode 
mtt Reactor sspar tex		# Steady-state parameters
mtt Reactor ss tex 		# Steady state
## mtt Reactor dm tex		# Descriptor matrices (of linearised system)
mtt Reactor sm tex		# State matrices (of linearised system)
## mtt Reactor tf tex		# Transfer function (of linearised system)
## mtt Reactor lmfr ps		# log modulus of frequency response (of linearised system)
mtt Reactor simpar tex		# Simulation parameters
mtt Reactor numpar tex		# Numerical simulation parameters
mtt Reactor input tex		# Simulation input
mtt Reactor state tex		# Simulation initial state

## The system outputs
mtt -c Reactor odeso ps 'Reactor_c_a'
mtt -c Reactor odeso ps 'Reactor_c_b'
mtt -c Reactor odeso ps 'Reactor_t'

Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_simp.r version [c0625028b5].






















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
%% Reduce comands to simplify output (mimo_sim.r)
m_r   := rho*v_r;
%mttx1 := c_a*v_r;
%mttx2 := c_b*v_r;

% THIS MUST BE CHANGED - probs with cp and FMRs
%c_p := 1;

%let mttx3/c_p = t;

let  e^(q_1/(mttx3/c_p)) = 1/epsilon_1;
let  e^(q_2/(mttx3/c_p)) = 1/epsilon_2;
let  e^(q_3/(mttx3/c_p)) = 1/epsilon_3;

let  e^(q_1/t_s) = 1/epsilon_1;
let  e^(q_2/t_s) = 1/epsilon_2;
let  e^(q_3/t_s) = 1/epsilon_3;

FACTOR mttx1,mttx2;

END;

Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_simpar.txt version [5dd7482825].






















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system Reactor (Reactor_simpar.txt)
# Generated by MTT on Fri Mar 3 12:11:48 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/08/24 12:32:25  peterg
## Initial revision
##
###############################################################


LAST        = 0.1;       # Last time in simulation
DT          = 0.0002;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_sspar.r version [f8d86e9c44].


























































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
%% Reduce steady-state parameter file (Reactor_sspar.r)
%% as siso_sspar ecxept that inputs/states have different meaning
%% Steady state for constant c_a, c_b and t=t_s and f=f_s

%% Unit volume Reactor:
v_r := 1;

%% Do the inputs first -- this avoids problems with reduce not
%% recognising that complicated expressions are zero

%% The exponentials.
e_1 := e^(-q_1/t_s);
e_2 := e^(-q_2/t_s);
e_3 := e^(-q_3/t_s);

%Steady-state input q needed to achieve steady-state t_s
q_s := -( 
        + (t_0-t_s)*c_p*f_s
        + e_1*h_1*k_1*x1
        + e_2*h_2*k_2*x2
        + e_3*h_3*k_3*x1^2
       );

%% The two inputs at steady-state
MTTu1 := f_s;
MTTu2 := q_s;

%States (masses)
x1 := c_a*v_r;
x2 := c_b*v_r;

%Thermal state
x3 := c_p*t_s*v_r;

%Load up the vectors
MTTx1 := x1;
MTTx2 := x2;
MTTx3 := x3;

MTTy1 := c_b;
MTTy2 := t_s;

%% Finally, solve for the steady-state concentrations
%% Solve for ca - a quadratic.
a 	:= k_3*e_3;	%ca^2 
b 	:= k_1*e_1 + f_s;	%ca^1 
c 	:= -c_0*f_s;

c_a	:= (-b + sqrt(b^2 - 4*a*c))/(2*a);

%% solve for c_b
c_b 	:= c_a*k_1*e_1/(f_s+k_2*e_2);


END;


Added mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_state.txt version [47f84318d6].



























































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# State specification (Reactor_state.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (Reactor_sspar.r)
## as siso_sspar ecxept that states/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume Reactor:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
x3 = c_p*t_s*v_r;


#Steady-state state q needed to achieve steady-state t_s
q_s = -((t_0-t_s)*c_p*f_s + e_1*h_1*k_1*x1 + e_2*h_2*k_2*x2 + e_3*h_3*k_3*x1^2);

## The two inputs at steady-state
u1 = f_s;
u2 = q_s;

## Load up the states
mttx(1) = x1;
mttx(2) = x2;
mttx(3) = x3;




Modified mttroot/mtt/lib/examples/Chemical/ReactorTF/MakeFigure.m from [bef9cb3f0c] to [138a415543].

1
2
3
4

5
6
7
8
9
10
11
1
2
3

4
5
6
7
8
9
10
11



-
+







## Makes the figures

par = ReactorTF_numpar;		# Parameters
sym = Reactor_sympar;		# Parameter indices
sym = ReactorTF_sympar;		# Parameter indices

F_s= [90:10:500];		# Range of flows

Z = [];
for f_s=F_s
  par(sym.f_s) = f_s;
  z = sort(eig(ReactorTF_sm(par)));

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_abg.fig version [986d2c3f0d].



































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#FIG 3.2
Portrait
Center
Inches
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3001 8701 3001 7801 3151 7951
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1801 9001 2701 9001 2551 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 8776 2701 9226
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3301 9001 4201 9001 4051 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4201 9301 3601 9901 3826 9901
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5701 9001 4801 9001 4951 9151
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 6000 2700 6000 2550 6150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 10350 5025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6000 1800 5775
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 10200 600 10200 600 7500 11100 7500 11100 10200
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 6600 600 6600 600 5400 11100 5400 11100 6600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4800 4500 8700 4650 8550
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6000 4800 4800 8700 5025 8625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9000 4800 5100 8700 5400 8700
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4800 4275 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4200 4275 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4800 5775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4200 5775 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4800 8775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4200 8775 4200
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 7200 3000 6300 3150 6450
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 10500 4800 3300 6000 3525 6075
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 5100 600 5100 600 3300 11100 3300 11100 5100
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4485 2395 4485 4130 4633 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 2999 2395 2999 4130 3148 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5970 2395 5970 4130 6119 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 10428 2397 10428 4132 10577 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8943 2397 8943 4132 9091 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 2100 2700 2100 2550 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3300 2100 4200 2100 4050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4800 2100 5700 2100 5550 2250
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4200 1800 3600 1200 3600 1425
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 1875 2700 2325
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 8701 1801 8101 1201 8101 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9301 2101 10201 2101 10051 2251
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 9301 1801 9901 1201 9901 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6300 2100 7200 2100 7050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7800 2100 8700 2100 8550 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 1950 4350 1650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10050 1350 9900 1200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 1200 9750 1050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 1950 8850 1650
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 300 600 300 600 2700 11100 2700 11100 300
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 4800 3000 5700 3150 5550
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 4800 8775 4800 9000
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5700 9000 5700 9225
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 6225 2700 6000
4 1 0 0 0 0 20 0.0000 4 210 1035 3075 4575 FMR:rfa\001
4 1 0 0 0 0 20 0.0000 4 210 1065 4575 4575 Rate:AD\001
4 1 0 0 0 0 20 0.0000 4 210 1050 6000 4575 Rate:AB\001
4 2 0 0 0 0 20 0.0000 4 285 780 1651 9076 SS:t_0\001
4 2 0 0 0 0 20 0.0000 4 285 690 3451 9976 C:h_r\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 6075 1\001
4 2 0 0 0 0 20 0.0000 4 210 480 1725 6075 SS:f\001
4 1 0 0 0 0 20 0.0000 4 210 150 3001 9076 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4501 9076 0\001
4 1 0 0 0 0 20 0.0000 4 210 1005 9001 4576 Rate:BC\001
4 1 0 0 0 0 20 0.0000 4 210 1050 10576 4576 FMR:rfb\001
4 1 1 1 0 3 20 0.0000 4 210 2625 9600 7800 THERMAL MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 900 3000 7575 FMR:rt\001
4 1 1 1 0 3 20 0.0000 4 210 2700 9675 3750 REACTION MODEL\001
4 2 0 0 0 0 20 0.0000 4 285 825 1650 2175 SS:c_0\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4500 2175 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 6000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 9001 2176 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 10501 2176 1\001
4 1 0 0 0 0 20 0.0000 4 210 420 7500 2175 AF\001
4 1 0 0 0 0 20 0.0000 4 285 795 8100 1050 C:m_b\001
4 1 0 0 0 0 20 0.0000 4 285 825 9975 1050 SS:c_b\001
4 1 0 0 0 0 20 0.0000 4 285 780 3600 1050 C:m_a\001
4 1 1 0 0 3 20 0.0000 4 210 3735 9075 600 CONCENTRATION MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 480 6151 9076 SS:t\001
4 1 1 1 0 3 20 0.0000 4 210 2940 9450 5700 HYDRAULIC MODEL\001

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_args.new version [5936bc7523].


1
+
 

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_desc.tex version [75defbbb1b].



















































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system ReactorTF (ReactorTF_desc.tex)
% Generated by MTT on Fri Mar 3 12:43:33 GMT 2000.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\fig{ReactorTF_pic}
{ReactorTF_pic} {0.9} {System \textbf{ReactorTF}, Schematic}

Figure \Ref{fig:ReactorTF_pic} is the schematic diagram of a chemical
reactor.

The acausal bond graph of system \textbf{ReactorTF} is displayed in
Figure \Ref{fig:ReactorTF_abg.ps} and its label file is listed in
Section \Ref{sec:ReactorTF_lbl}.  The subsystems are listed in Section
\Ref{sec:ReactorTF_sub}.

This example of a (nonlinear) chemical reactor is due to Trickett and
Bogle\footnote{ K. J. Tricket, \emph{Quantification of Inverse
    Responses for Controllability Assessment of Nonlinear Processes},
  PhD Thesis, University College London, 1994} is used in this
section.  The reactor has two reaction mechanisms: $\text{A}
\rightarrow \text{B} \rightarrow \text{C}$ and $\text{2A} \rightarrow
\text{D}$.  The reactor mass inflow and outflow $f_r$ are identical.
$q$ represents the heat inflow to the reactor.

The control loop $t$/$f$ has been inverted. The resulting SISO
system has two interpretations:
\begin{enumerate}
\item the \emph{dynamics} of the $c_b$/$q$ loop when the $t$/$f$ loop
  is under perfect control and
\item the \emph{inverse} dynamics of the  $t$/$f$ loop.
\end{enumerate}

\fig{ReactorTF_zero_1} {ReactorTF_zero_1} {0.9}
{System\textbf{ReactorTF}: zero 1 v flow} 
\fig{ReactorTF_zero_2} {ReactorTF_zero_2} {0.9}
{System\textbf{ReactorTF}: zero 2 v flow} 

Figures \Ref{fig:ReactorTF_zero_1} and \Ref{fig:ReactorTF_zero_2}
shows the poles of the linearised system as the steady-state flow
varies: these are the \emph{zeros} of the $t$/$f$ control-loop when
the $c_b$/$q$ loop is \emph{open}.


Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_input.txt version [f7ef1cabad].





















































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# Input specification (ReactorTF_input.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (ReactorTF_sspar.r)
## as siso_sspar ecxept that inputs/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume ReactorTF:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
#x3 = c_p*t_s*v_r;


#Steady-state input q needed to achieve steady-state t_s
q_s = -( (t_0-t_s)*c_p*f_s + e_1*h_1*k_1*x1 + e_2*h_2*k_2*x2 + e_3*h_3*k_3*x1^2);

# Set the inputs
mttu(1) = q_s + 0.1*q_s*(t>0.01); # q (ReactorTF)




Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_lbl.txt version [ee07601a68].






































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
%% Label file for system ReactorTF (ReactorTF_lbl.txt)
%SUMMARY ReactorTF: Simple reactor model -- TF loop inverted
%DESCRIPTION Pseudo bond graph reactor model (based on ancient version)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%ALIAS Rate Chemical/Rate

% Extra variables
%VAR t_s
%VAR f_s
%VAR t_0
%VAR c_0
%VAR rho
%VAR v_r
%VAR e_1
%VAR e_2
%VAR e_3
%VAR a
%VAR b
%VAR c
%VAR c_A
%VAR c_B
%VAR x1
%VAR x2
%VAR x3
%VAR q_S


% Port aliases

% Argument aliases

%% each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type C
	m_a	lin		effort,1
	m_b	lin		effort,1
	h_r	lin		effort,c_p

% Component type FMR
	rfa	lin		effort,1		
	rfb	lin		effort,1		
	rt	lin		effort,c_p

% Component type Rate
        AB	Rate	k_1,q_1,h_1,1
	BC	Rate	k_2,q_2,h_2,1
	AD	Rate	k_3,q_3,h_3,2

% Component type SS
	c_0	SS		c_0,internal
	c_b	SS		external,0
	f	SS		internal,internal
	t	SS		t_s,external
	t_0	SS		t_0,internal



Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_numpar.m version [b474b96e57].



























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function mttpar = ReactorTF_numpar();
% mttpar = ReactorTF_numpar();
%System ReactorTF, representation numpar, language m;
%File ReactorTF_numpar.m;
%Generated by MTT on Thu Aug 24 14:28:46 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 ;
## Set parameters to zero
 a = 0.0;
 b = 0.0;
 c = 0.0;
 c_0 = 0.0;
 c_a = 0.0;
 c_b = 0.0;
 c_p = 0.0;
 e_1 = 0.0;
 e_2 = 0.0;
 e_3 = 0.0;
 f_s = 0.0;
 h = 0.0;
 h_1 = 0.0;
 h_2 = 0.0;
 h_3 = 0.0;
 k = 0.0;
 k_1 = 0.0;
 k_2 = 0.0;
 k_3 = 0.0;
 n = 0.0;
 q = 0.0;
 q_1 = 0.0;
 q_2 = 0.0;
 q_3 = 0.0;
 q_s = 0.0;
 rho = 0.0;
 t_0 = 0.0;
 t_s = 0.0;
 v_r = 0.0;
 x1 = 0.0;
 x2 = 0.0;
 x3 = 0.0;
 %  -*-octave-*- Put Emacs into octave-mode
 %  Numerical parameter file (ReactorTF_numpar.txt)
 %  Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% Version control history
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% $Id$
 %  %% $Log$
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 % 
a =  0;				 %  Dummy
b =  0;				 %  Dummy
c =  0;				 %  Dummy
c_0 =  0;			 %  Dummy
c_a =  0;			 %  Dummy
c_b =  0;			 %  Dummy
c_p =  0;			 %  Dummy
e_1 =  0;			 %  Dummy
e_2 =  0;			 %  Dummy
e_3 =  0;			 %  Dummy
f_s =  0;			 %  Dummy
h =  0;				 %  Dummy
h_1 =  0;			 %  Dummy
h_2 =  0;			 %  Dummy
h_3 =  0;			 %  Dummy
k =  0;				 %  Dummy
k_1 =  0;			 %  Dummy
k_2 =  0;			 %  Dummy
k_3 =  0;			 %  Dummy
n =  0;				 %  Dummy
q =  0;				 %  Dummy
q_1 =  0;			 %  Dummy
q_2 =  0;			 %  Dummy
q_3 =  0;			 %  Dummy
q_s =  0;			 %  Dummy
rho =  0;			 %  Dummy
t_0 =  0;			 %  Dummy
t_s =  0;			 %  Dummy
v_r =  0;			 %  Dummy
x1 =  0;				 %  Dummy
x2 =  0;				 %  Dummy
x3 =  0;				 %  Dummy

 % 
rho =  900;			 %  Density
c_p =  5.0;			 %  Specific heat

 % 
k_1 =  2.5e10;			 %  Reaction rate constant
q_1 =  1e4;			 %  Exotherm constant
h_1 =  1e4;			 %  Heat of reaction

 % 
k_2 =  2.65e12;			 %  Reaction rate constant
q_2 =  1.2e4;			 %  Exotherm constant
h_2 =  1.2e4;			 %  Heat of reaction

 % 
k_3 =  6e7;			 %  Reaction rate constant
q_3 =  8e3;			 %  Exotherm constant
h_3 =  3e4;			 %  Heat of reaction

 % 
c_0 =  10;			 %  Inflow conc
t_0 =  500;			 %  Inflow temp

 % 
t_s =  530;			 %  Steady-state temp
f_s =  100;			 %  Steady-state flow








## Set up the parameter vector
  mttpar(1) 	= a;
  mttpar(2) 	= b;
  mttpar(3) 	= c;
  mttpar(4) 	= c_0;
  mttpar(5) 	= c_a;
  mttpar(6) 	= c_b;
  mttpar(7) 	= c_p;
  mttpar(8) 	= e_1;
  mttpar(9) 	= e_2;
  mttpar(10) 	= e_3;
  mttpar(11) 	= f_s;
  mttpar(12) 	= h;
  mttpar(13) 	= h_1;
  mttpar(14) 	= h_2;
  mttpar(15) 	= h_3;
  mttpar(16) 	= k;
  mttpar(17) 	= k_1;
  mttpar(18) 	= k_2;
  mttpar(19) 	= k_3;
  mttpar(20) 	= n;
  mttpar(21) 	= q;
  mttpar(22) 	= q_1;
  mttpar(23) 	= q_2;
  mttpar(24) 	= q_3;
  mttpar(25) 	= q_s;
  mttpar(26) 	= rho;
  mttpar(27) 	= t_0;
  mttpar(28) 	= t_s;
  mttpar(29) 	= v_r;
  mttpar(30) 	= x1;
  mttpar(31) 	= x2;
  mttpar(32) 	= x3;

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_numpar.txt version [28d37b19ef].
















































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (ReactorTF_numpar.txt)
# Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

## Dummies
a = 0;				# Dummy
b = 0;				# Dummy
c = 0;				# Dummy
c_0 = 0;			# Dummy
c_a = 0;			# Dummy
c_b = 0;			# Dummy
c_p = 0;			# Dummy
e_1 = 0;			# Dummy
e_2 = 0;			# Dummy
e_3 = 0;			# Dummy
f_s = 0;			# Dummy
h = 0;				# Dummy
h_1 = 0;			# Dummy
h_2 = 0;			# Dummy
h_3 = 0;			# Dummy
k = 0;				# Dummy
k_1 = 0;			# Dummy
k_2 = 0;			# Dummy
k_3 = 0;			# Dummy
n = 0;				# Dummy
q = 0;				# Dummy
q_1 = 0;			# Dummy
q_2 = 0;			# Dummy
q_3 = 0;			# Dummy
q_s = 0;			# Dummy
rho = 0;			# Dummy
t_0 = 0;			# Dummy
t_s = 0;			# Dummy
v_r = 0;			# Dummy
x1 = 0;				# Dummy
x2 = 0;				# Dummy
x3 = 0;				# Dummy

## The bulk liquid
rho = 900;			# Density
c_p = 5.0;			# Specific heat

## Substance A
k_1 = 2.5e10;			# Reaction rate constant
q_1 = 1e4;			# Exotherm constant
h_1 = 1e4;			# Heat of reaction

## Substance B
k_2 = 2.65e12;			# Reaction rate constant
q_2 = 1.2e4;			# Exotherm constant
h_2 = 1.2e4;			# Heat of reaction

## Substance C
k_3 = 6e7;			# Reaction rate constant
q_3 = 8e3;			# Exotherm constant
h_3 = 3e4;			# Heat of reaction

## Inflow parameters
c_0 = 10;			# Inflow conc
t_0 = 500;			# Inflow temp

## Steady-state values
t_s = 530;			# Steady-state temp
f_s = 100;			# Steady-state flow








Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_pic.fig version [c396b14562].





















































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#FIG 3.2
Landscape
Center
Inches
Letter  
100.00
Single
-2
1200 2
6 2400 3150 3225 3375
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2625 3300 2925 3300
4 0 -1 0 0 2 20 0.0000 4 210 210 2400 3375 A\001
4 0 -1 0 0 2 20 0.0000 4 210 225 3000 3375 D\001
-6
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 2100 2100 2100 3900 1500 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 1500 4050 3900 4050
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 1500 4350 2100 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2100 3600 3900 4200 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 3600 4350 4200 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 3900 4050 4200 4050
2 1 1 2 -1 -1 0 0 -1 6.000 0 0 -1 0 0 2
	 2100 2400 3600 2400
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2400 2925 2700 2925
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3000 2925 3300 2925
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 2850 4800 2850 3750
4 0 -1 0 0 2 20 0.0000 4 210 210 2175 3000 A\001
4 0 -1 0 0 2 20 0.0000 4 210 195 2775 3000 B\001
4 0 -1 0 0 2 20 0.0000 4 210 210 3375 3000 C\001
4 0 -1 0 0 2 20 0.0000 4 210 150 2250 3375 2\001
4 0 -1 0 0 3 12 0.0000 4 135 90 1875 4950 0\001
4 0 -1 0 0 3 12 0.0000 4 135 90 2250 4950 0\001
4 0 -1 0 0 3 20 0.0000 4 210 150 2775 5025 q\001
4 0 -1 0 0 3 20 0.0000 4 285 765 1500 4800 f , c  , t\001
4 0 -1 0 0 3 20 0.0000 4 285 765 3600 4800 f , c  , t\001
4 0 -1 0 0 3 12 0.0000 4 135 90 3975 4950 b\001
4 0 -1 0 0 3 12 0.0000 4 90 75 4350 4950 r\001

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_rep.tex version [c4b39857a2].

























































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


\section{\textbf{ReactorTF}: representation \textbf{abg}, language \textbf{tex}}
\label{sec:ReactorTF_abg.tex}
\index{\textbf{ReactorTF} -- abg}


MTT command:
\begin{verbatim}
mtt ReactorTF abg tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_abg.tex}


\section{\textbf{ReactorTF}: representation \textbf{cbg}, language \textbf{ps}}
\label{sec:ReactorTF_cbg.ps}
\index{\textbf{ReactorTF} -- cbg}


MTT command:
\begin{verbatim}
mtt ReactorTF cbg ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:ReactorTF_cbg.ps}.
\fig{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_cbg}
    {ReactorTF_cbg.ps}
    {0.9}
    {System \textbf{ReactorTF}, representation cbg}


\section{\textbf{ReactorTF}: representation \textbf{struc}, language \textbf{tex}}
\label{sec:ReactorTF_struc.tex}
\index{\textbf{ReactorTF} -- struc}


MTT command:
\begin{verbatim}
mtt ReactorTF struc tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_struc.tex}


\section{\textbf{ReactorTF}: representation \textbf{ode}, language \textbf{tex}}
\label{sec:ReactorTF_ode.tex}
\index{\textbf{ReactorTF} -- ode}


MTT command:
\begin{verbatim}
mtt ReactorTF ode tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_ode.tex}


\section{\textbf{ReactorTF}: representation \textbf{sspar}, language \textbf{tex}}
\label{sec:ReactorTF_sspar.tex}
\index{\textbf{ReactorTF} -- sspar}


MTT command:
\begin{verbatim}
mtt ReactorTF sspar tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_sspar.tex}


\section{\textbf{ReactorTF}: representation \textbf{ss}, language \textbf{tex}}
\label{sec:ReactorTF_ss.tex}
\index{\textbf{ReactorTF} -- ss}


MTT command:
\begin{verbatim}
mtt ReactorTF ss tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_ss.tex}


\section{\textbf{ReactorTF}: representation \textbf{sm}, language \textbf{tex}}
\label{sec:ReactorTF_sm.tex}
\index{\textbf{ReactorTF} -- sm}


MTT command:
\begin{verbatim}
mtt ReactorTF sm tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_sm.tex}


\section{\textbf{ReactorTF}: representation \textbf{simpar}, language \textbf{tex}}
\label{sec:ReactorTF_simpar.tex}
\index{\textbf{ReactorTF} -- simpar}


MTT command:
\begin{verbatim}
mtt ReactorTF simpar tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_simpar.tex}


\section{\textbf{ReactorTF}: representation \textbf{numpar}, language \textbf{tex}}
\label{sec:ReactorTF_numpar.tex}
\index{\textbf{ReactorTF} -- numpar}


MTT command:
\begin{verbatim}
mtt ReactorTF numpar tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_numpar.tex}


\section{\textbf{ReactorTF}: representation \textbf{input}, language \textbf{tex}}
\label{sec:ReactorTF_input.tex}
\index{\textbf{ReactorTF} -- input}


MTT command:
\begin{verbatim}
mtt ReactorTF input tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_input.tex}


\section{\textbf{ReactorTF}: representation \textbf{state}, language \textbf{tex}}
\label{sec:ReactorTF_state.tex}
\index{\textbf{ReactorTF} -- state}


MTT command:
\begin{verbatim}
mtt ReactorTF state tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_state.tex}


\section{\textbf{ReactorTF}: representation \textbf{odeso}, language \textbf{ps}}
\label{sec:ReactorTF_odeso.ps}
\index{\textbf{ReactorTF} -- odeso}


MTT command:
\begin{verbatim}
mtt ReactorTF odeso ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:ReactorTF_odeso.ps}.
\fig{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_odeso}
    {ReactorTF_odeso.ps}
    {0.9}
    {System \textbf{ReactorTF}, representation odeso}

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_rep.txt version [e0ee6f308d].






























1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system ReactorTF (ReactorTF_rep.txt)
## Generated by MTT on" Fri Mar  3 12:13:34 GMT 2000.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

mtt ReactorTF abg tex			# The system description
mtt ReactorTF cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt ReactorTF struc tex	        # The system structure
## mtt ReactorTF dae tex	        # The system dae
mtt ReactorTF ode tex	        # The system ode 
mtt ReactorTF sspar tex		# Steady-state parameters
mtt ReactorTF ss tex 		# Steady state
## mtt ReactorTF dm tex		# Descriptor matrices (of linearised system)
mtt ReactorTF sm tex		# State matrices (of linearised system)
## mtt ReactorTF tf tex		# Transfer function (of linearised system)
## mtt ReactorTF lmfr ps		# log modulus of frequency response (of linearised system)
mtt ReactorTF simpar tex		# Simulation parameters
mtt ReactorTF numpar tex		# Numerical simulation parameters
mtt ReactorTF input tex		# Simulation input
mtt ReactorTF state tex		# Simulation initial state
mtt -c ReactorTF odeso ps

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_simp.r version [c0625028b5].






















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
%% Reduce comands to simplify output (mimo_sim.r)
m_r   := rho*v_r;
%mttx1 := c_a*v_r;
%mttx2 := c_b*v_r;

% THIS MUST BE CHANGED - probs with cp and FMRs
%c_p := 1;

%let mttx3/c_p = t;

let  e^(q_1/(mttx3/c_p)) = 1/epsilon_1;
let  e^(q_2/(mttx3/c_p)) = 1/epsilon_2;
let  e^(q_3/(mttx3/c_p)) = 1/epsilon_3;

let  e^(q_1/t_s) = 1/epsilon_1;
let  e^(q_2/t_s) = 1/epsilon_2;
let  e^(q_3/t_s) = 1/epsilon_3;

FACTOR mttx1,mttx2;

END;

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_simpar.txt version [a9ebdd151e].



















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system ReactorTF (ReactorTF_simpar.txt)
# Generated by MTT on Fri Mar 3 12:11:48 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 0.05;       # Last time in simulation
DT          = 0.0002;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_sm.m version [8997bae617].


























































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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_1/t_s))^2*f_s*h_1*k_1);
mtt_t1 = mtt_t1+2.0*exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s*h_3*k_1;
mtt_t1 = mtt_t1-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))^2*c_0*h_1*k_1*k_3);
mtt_t1 = mtt_t1+2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))^2*c_0*h_3*k_1*k_3;
mtt_t1 = mtt_t1-(exp(q_3/t_s)*abs(exp(q_1/t_s))^2*h_1*k_1^2);
mtt_t1 = mtt_t1+exp(q_3/t_s)*abs(exp(q_1/t_s))^2*h_3*k_1^2;
mtt_t3 = 2.0*exp((2.0*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_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_t4 = 2.0*exp((2.0*q_1)/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_t4 = mtt_t4*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-(mtt_t3*abs(exp(q_1/t_s))*f_s*h_3)-(mtt_t4*abs(exp(q_1/t_s))*c_0*h_3*k_3);
mtt_t5 = 2.0*exp((2.0*q_1)/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_t5 = mtt_t5*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_t3 = 2.0*exp((2.0*q_1)/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-(mtt_t5*abs(exp(q_1/t_s))*c_p*k_3*t_0)+mtt_t3*abs(exp(q_1/t_s))*c_p*k_3*t_s;
mtt_t4 = 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_t4 = mtt_t4*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_t3 = 2.0*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_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+mtt_t4*abs(exp(q_1/t_s))*h_1*k_1-(mtt_t3*abs(exp(q_1/t_s))*h_3*k_1);
mtt_t1 = mtt_t1+exp((4.0*q_1+q_3)/t_s)*f_s^2*h_3;
mtt_t1 = mtt_t1+4.0*exp((4.0*q_1)/t_s)*c_0*f_s*h_3*k_3;
mtt_t1 = mtt_t1+2.0*exp((3.0*q_1+q_3)/t_s)*f_s*h_3*k_1;
mtt_t1 = mtt_t1+exp((2.0*q_1+q_3)/t_s)*h_3*k_1^2;
mtt_t2 = 2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_3*t_0;
mtta(1,1) = mtt_t1/(mtt_t2-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_3*t_s));
mtt_t1 = -(exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))*f_s*h_2*k_2);
mtt_t1 = mtt_t1-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_0*h_2*k_2*k_3);
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_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_3/t_s)*abs(exp(q_1/t_s))*h_2*k_1*k_2)+mtt_t3*h_2*k_2;
mtt_t2 = 2.0*exp((q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_0;
mtta(1,2) = mtt_t1/(mtt_t2-(2.0*exp((q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_s));
mtt_t1 = exp((2.0*q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s^2*h_3*k_1;
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_1*k_3*t_0;
mtt_t1 = mtt_t1-(2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_1*k_3*t_s);
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_1*k_2*k_3*t_0;
mtt_t1 = mtt_t1-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_1*k_2*k_3*t_s);
mtt_t1 = mtt_t1-(exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s*h_1*k_1^2);
mtt_t1 = mtt_t1+2.0*exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s*h_3*k_1^2;
mtt_t1 = mtt_t1-(exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*h_1*k_1^3);
mtt_t1 = mtt_t1+exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*h_3*k_1^3;
mtt_t3 = 2.0*exp((2.0*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_t4 = 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_t4 = mtt_t4*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-(mtt_t3*abs(exp(q_1/t_s))*f_s*h_3*k_1)+mtt_t4*abs(exp(q_1/t_s))*h_1*k_1^2;
mtt_t5 = 2.0*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_t5 = mtt_t5*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-(mtt_t5*abs(exp(q_1/t_s))*h_3*k_1^2);
mtt_t1 = mtt_t1+exp((4.0*q_1+q_2+q_3)/t_s)*f_s^2*h_3*k_1;
mtt_t1 = mtt_t1+4.0*exp((4.0*q_1+q_2)/t_s)*c_0*f_s*h_3*k_1*k_3;
mtt_t1 = mtt_t1+2.0*exp((3.0*q_1+q_2+q_3)/t_s)*f_s*h_3*k_1^2;
mtt_t1 = mtt_t1+exp((2.0*q_1+q_2+q_3)/t_s)*h_3*k_1^3;
mtt_t2 = 2.0*exp((3.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_3*t_0;
mtt_t2 = mtt_t2-(2.0*exp((3.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_3*t_s);
mtt_t2 = mtt_t2+2.0*exp((3.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_2*k_3*t_0;
mtta(2,1) = mtt_t1/(mtt_t2-(2.0*exp((3.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_2*k_3*t_s));
mtt_t1 = -(2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s^2*k_3*t_0);
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s^2*k_3*t_s;
mtt_t1 = mtt_t1-(4.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_2*k_3*t_0);
mtt_t1 = mtt_t1+4.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_2*k_3*t_s;
mtt_t1 = mtt_t1-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2^2*k_3*t_0);
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2^2*k_3*t_s;
mtt_t1 = mtt_t1-(exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))*f_s*h_2*k_1*k_2);
mtt_t1 = mtt_t1-(exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))*h_2*k_1^2*k_2);
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+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);

Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_sspar.r version [5ae7de35e5].
























































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
%% Reduce steady-state parameter file (ReactorTF_sspar.r)
%% as siso_sspar ecxept that inputs/states have different meaning
%% Steady state for constant c_a, c_b and t=t_s and f=f_s

%% Unit volume ReactorTF:
v_r := 1;

%% Do the inputs first -- this avoids problems with reduce not
%% recognising that complicated expressions are zero

%% The exponentials.
e_1 := e^(-q_1/t_s);
e_2 := e^(-q_2/t_s);
e_3 := e^(-q_3/t_s);

%Steady-state input q needed to achieve steady-state t_s
q_s := -( 
        + (t_0-t_s)*c_p*f_s
        + e_1*h_1*k_1*x1
        + e_2*h_2*k_2*x2
        + e_3*h_3*k_3*x1^2
       );

%% The input at steady-state
MTTu1 := q_s;

%States (masses)
x1 := c_a*v_r;
x2 := c_b*v_r;

%Thermal state
x3 := c_p*t_s*v_r;

%Load up the vectors
MTTx1 := x1;
MTTx2 := x2;

MTTy1 := c_b;
%MTTy2 := t_s;

%% Finally, solve for the steady-state concentrations
%% Solve for ca - a quadratic.
a 	:= k_3*e_3;	%ca^2 
b 	:= k_1*e_1 + f_s;	%ca^1 
c 	:= -c_0*f_s;

c_a	:= (-b + sqrt(b^2 - 4*a*c))/(2*a);

%% solve for c_b
c_b 	:= c_a*k_1*e_1/(f_s+k_2*e_2);


END;


Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_state.txt version [c612c2654e].



















































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-octave-*- Put Emacs into octave-mode
# State specification (ReactorTF_state.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (ReactorTF_sspar.r)
## as siso_sspar ecxept that states/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume ReactorTF:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
#x3 = c_p*t_s*v_r;

## Load up the states
mttx(1) = x1;
mttx(2) = x2;
mttx(3) = x3;




Added mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_sympar.m version [971206bf83].









































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function sympar = ReactorTF_sympar();
% sympar = ReactorTF_sympar();
%System ReactorTF, representation sympar, language m;
%File ReactorTF_sympar.m;
%Generated by MTT on Thu Aug 24 14:45:51 BST 2000;
%
global ...
mtt_no_globals ;
  sympar.a 	= 1; # ReactorTF
  sympar.b 	= 2; # ReactorTF
  sympar.c 	= 3; # ReactorTF
  sympar.c_0 	= 4; # ReactorTF
  sympar.c_A 	= 5; # ReactorTF
  sympar.c_B 	= 6; # ReactorTF
  sympar.c_p 	= 7; # ReactorTF
  sympar.e_1 	= 8; # ReactorTF
  sympar.e_2 	= 9; # ReactorTF
  sympar.e_3 	= 10; # ReactorTF
  sympar.f_s 	= 11; # ReactorTF
  sympar.h 	= 12; # Rate
  sympar.h_1 	= 13; # ReactorTF
  sympar.h_2 	= 14; # ReactorTF
  sympar.h_3 	= 15; # ReactorTF
  sympar.k 	= 16; # Rate
  sympar.k_1 	= 17; # ReactorTF
  sympar.k_2 	= 18; # ReactorTF
  sympar.k_3 	= 19; # ReactorTF
  sympar.n 	= 20; # Rate
  sympar.q 	= 21; # Rate
  sympar.q_1 	= 22; # ReactorTF
  sympar.q_2 	= 23; # ReactorTF
  sympar.q_3 	= 24; # ReactorTF
  sympar.q_S 	= 25; # ReactorTF
  sympar.rho 	= 26; # ReactorTF
  sympar.t_0 	= 27; # ReactorTF
  sympar.t_s 	= 28; # ReactorTF
  sympar.v_r 	= 29; # ReactorTF
  sympar.x1 	= 30; # ReactorTF
  sympar.x2 	= 31; # ReactorTF
  sympar.x3 	= 32; # ReactorTF


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