forked from rcandell/tesim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME_ricker_original.txt
217 lines (151 loc) · 9.48 KB
/
README_ricker_original.txt
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
*** NOTE: See updates at end of file ***
Contents of this Zip archive:
temex.c C source code for compiling TEMEX mex file.
teprob.h C header file needed when compiling.
temex.dll Mex file ready for use on a Windows machine. It was compiled
and built using MS Visual C++ and tested in MATLAB release 11.
temex.mex Mex file ready for use on a PowerMac. It was built using
the MPW MrC compiler and tested in MATLAB 5.2.1.
te_test.mdl Simulink model illustrating use of the TE challenge process
simulation.
teplot.m Script that plots the results at the end of a simulation.
System Requirements:
Matlab Version 5.2 or higher, with Simulink version 2 or higher.
Installation:
1) Unzip the archive into a new directory. If you are on a Windows computer, you may
delete temex.mex. If you are on a PowerMac you may delete temex.dll. Otherwise
you may delete both the .mex and .dll files.
2) Start MATLAB and make the new directory the default.
3) If you are using a system other than Windows or PowerMac, you must now compile
and build the code. You will need a C compiler (probably already installed if
you're using a Unix machine). If you have one, type the following
in the MATLAB command window:
mex temex.c
If all goes well, after a short delay the compiled-and-built mex file will be
in the default directory (verify this). You may see a couple of warning messages
during the compile step, but you can ignore them (unless they are errors
rather than warnings).
If you have trouble with the compile & build, make sure you have a C compiler approved
for use with MATLAB c-mex files, and that it is set up properly. See MATLAB's
"Application Program Interface Guide" (available on-line in PDF format) for more details.
Testing the code:
4) In the MATLAB command window type "te_test" to bring up a Simulink window
containing the example. (This assumes that the directory created in step 1 is
still the MATLAB default).
5) Start the simulation. The initial condition is the base case defined in
the Downs and Vogel paper. Since the TE challenge process is open-loop unstable,
however, and the steady state is inexact (due to model complexity) the plant will
eventually exhibit a transient. After approximately 2 hours (simulated time) the
reactor pressure will exceed the upper bound of 3000 kPa and the plant will shut
down. You should see a message to that effect in the MATLAB command window. The
variables will be plotted (the format of this depends on whether or not you
have the MPC Tools).
Using the code:
The code is a standard Simulink s-function. It's easiest to run as a block in
a graphical diagram -- as in the example. You can also run it from the MATLAB
command line, however. See the Simulink documentation for general information
on s-functions and their use.
The block requires the following input data:
A) Parameters
The s-function requires two parameters (double-click on the example temex block to
see how these were defined):
1) Initial states of the TE process. Must be a vector, length 50. If empty
(as in the example), the Downs and Vogel base case values are used.
2) Disturbance codes. Must be a vector, length 20. These are the
20 disturbances IDV(1) ... IDV(20) defined by Downs and Vogel. If a
disturbance code is zero, that disturbance is turned off. Otherwise it is on.
(All were off in the example). You may change these during a simulation if
you wish. Either pause the simulation and change them manually or set up a
MATLAB script to do so at pre-defined times.
B) Input signals. These are the 12 manipulated variables (MVs) defined by Downs
and Vogel. The example has the base-case values in a vector. It adds another
vector which is defined as zero but could be used to introduce a step in one
or more MVs.
The block outputs are the 41 measured variables defined by Downs and Vogel. Note
that the first 22 are measured continuously, and the rest are sampled composition
analyses from chromatographs. The latter will exhibit discrete steps as
a new sample becomes available (at intervals of 0.1 or 0.25 hours, depending
on the signal).
In the example the outputs are being logged to the MATLAB workspace so they can
be plotted when the simulation ends (on a 266 Mh Pentium-II the 2-hour simulation
requires about 6 seconds of computing time). In general you could feed back some
or all of the measurements to MV adjustments. A number of control strategies
have been proposed in the literature.
If you have difficulty with the installation or the mex code doesn't seem to
give correct answers, please send a note to N L Ricker with full details:
ricker@u.washington.edu
========================================
Update 25 February 2002:
Changes to the following files:
temex.c C source code for compiling TEMEX mex file. This is now
compatible with MATLAB 6.5 (Release 13). The main change is
that the input is defined as including a direct feedthrough
to the output. This eliminates segmentation errors that
occurred when using the original.
temex.dll Mex file ready for use on a Windows machine. It is compatible
with MATLAB 6.5 (Release 13).
temex.c.v5 Original version of temex.c (works with earlier Matlab releases)
temex.dll.v5 Original version of temex.dll (works with earlier MATLAB releases).
========================================
Update 2 December 2002:
Added files:
temexd.c As for temex.c, but disturbances are input variables rather than
parameters. See "MultiLoop_mode1.mdl" for an example use.
temexd.dll Mex file version of temexd.c for use on a Windows machine. It is
compatible with MATLAB 6.5 (Release 13).
MultiLoop_mode1.mdl Simulink model of the control strategy described in
"Decentralized control of the Tennessee Eastman Challenge
Process", N. L. Ricker, J. Proc. Cont., Vol. 6, No. 4,
pp. 205-221, 1996. It is set up to initialize and run with
constant setpoints at the "Mode 1" operating condition. NOTE:
override loops are not included.
The .mdl file calls two custom scripts (lines 34 and 35):
PreLoadFcn "Mode_1_Init"
StopFcn "TEplot"
These initialize the simulation variables and plot the results
at the end of the run. See the files "Mode_1_Init.m" and
"TEplot.m" for more details.
MultiLoop_Skoge_mode1.mdl Similar to above, but uses the control strategy
described in "Self-Optimizing control of a large-scale plant:
the Tennessee Eastman process" Larsson, T., et al., Ind. Eng.
Chem. Res., Vol. 40, pp. 4889-4901, 2001.
It automatically runs "Skoge_Mode1_Init.m" and "TEplot.m".
Mode_1_Init.m Script file executed automatically at beginning of
"MultiLoop_mode1.mdl". See above discussion.
Skoge_Mode1_Init.m As above, but for "MultiLoop_Skoge_mode1.mdl".
Mode1xInitial.mat Contains initial conditions for "MultiLoop_model.mdl".
It is loaded by the script file "Mode_1_Init.m", which is
executed automatically when the model is opened.
Mode1SkogeInit.mat As above, but for "MultiLoop_Skoge_mode1.mdl".
TElib.mdl A Simulink library containing two controller blocks. These are
used in the two "MultiLoop" simulations.
Remarks:
1. The simulation uses a fixed step size ODE integration algorithm. I have
found that variable step size methods work poorly in this application.
2. If you get a "file not found" or "variable undefined" error from MATLAB,
make sure the initialization scripts described above are on the MATLAB
path. The simplest approach is to put all of the above files in a
single directory, and make it the MATLAB default directory.
========================================
Update 29 September 2003:
Added files:
R12_ExampleScript.m Shows how to run simulations from the command line.
R12_tesys.mdl Simulink model of the original TE plant. This version
is saved in MATLAB Release 12 (Simulink 4.1)
format. See also tesys.mdl, saved in Release 13 (Simulink 5.0)
format. You will need one of these when running R12_ExampleScript.m.
If you wish to use the older version, rename it to tesys.mdl before
running the script.
========================================
Update 24 February 2005:
Added files:
MultiLoop_mode3.mdl Similar to MultiLoop_mode1.mdl, but designed to run at
Mode 3 conditions. Includes an additional override
that reduces the recycle valve % open when the
separator coolant valve goes above 90%. If this
is not included, the coolant valve saturates and
the system loses control of reactor level.
Mode_3_Init.m Initial model states needed for the above.
Mode3xInitial.mat Contains initial conditions for "MultiLoop_mode3.mdl".
It is loaded by the script file "Mode_3_Init.m", which is
executed automatically when the model is opened.