.
11 |
12 | ## 1. Table of Contents
13 |
14 | - [Sim3Tanks Plant Description](#2-sim3tanks-plant-description)
15 | - [Fault Description and Symbols](#3-fault-description-and-symbols)
16 | - [How to Create and Configure a Sim3Tanks Object](#4-how-to-create-and-configure-a-sim3tanks-object)
17 | - [Contributions](#5-contributions)
18 | - [Citation](#6-citation)
19 | - [License](#7-license)
20 |
21 |
22 | ## 2. Sim3Tanks Plant Description
23 | Sim3Tanks simulates the dynamic behavior of the following plant:
24 |
25 |
26 |
27 |
28 | Figure 1: Sim3Tanks plant.
29 |
30 |
31 | - The plant consists of three cylindrical tanks interconnected by four pipes, allowing fluid exchange between the lateral tanks (T1 and T2) and the central tank (T3) in both directions. The dashed arrows indicate the reference direction of each flow. Negative values indicate that the flow is opposite to this reference.
32 |
33 | - The upper pipes and valves that connect the lateral tanks to the central tank are located at the same height h0 and are called transmission pipes and valves. The lower pipes and valves are aligned with the base of the tanks and are called connection pipes and valves. At the bottom of each tank are the output pipes and valves.
34 |
35 | - The pumps P1, P2, and P3 share the same minimum and maximum flow rate constraints, but they work independently and can provide different flow rates QP1, QP2, and QP3 to the tanks T1, T2, and T3, respectively.
36 |
37 | - The tanks are identical and have the same radius and maximum height. Similarly, all pipes are also identical and have the same radius value. The system has three level sensors (one per tank) and ten flow sensors (one per valve), and any valve can be configured as an actuator.
38 |
39 | - When a valve is enabled to be controlled, it becomes an actuator and, consequently, Sim3Tanks simulates an actuator fault (loss of effectiveness). Otherwise, a plant fault is simulated, which could be a clogging if the valve operation mode is defined as 'Open', or leakage if its operation mode is set to 'Closed'.
40 |
41 | ## 3. Fault Description and Symbols
42 | Sim3Tanks allows the user to define different scenarios for case studies with as many actuators and sensors as necessary, in addition to simulating different kinds of perturbations, faults, and noises. The following table briefly describes the faults modeled in Sim3Tanks.
43 |
44 | | Symbol | Description |
45 | | --- | --- |
46 | | `f1` | Blocking/Clogging in pump 1, if `ValveSettings.Kp1.OperationMode = 'Open'`. |
47 | | | Disturbance in tank 1, if `ValveSettings.Kp1.OperationMode = 'Closed'`. |
48 | | `f2` | Blocking/Clogging in pump 2, if `ValveSettings.Kp2.OperationMode = 'Open'`. |
49 | | | Disturbance in tank 2, if `ValveSettings.Kp2.OperationMode = 'Closed'`. |
50 | | `f3` | Blocking/Clogging in pump 3, if `ValveSettings.Kp3.OperationMode = 'Open'`. |
51 | | | Disturbance in tank 3, if `ValveSettings.Kp3.OperationMode = 'Closed'`. |
52 | | `f4` | Clogging in the transmission pipe from tank 1 to tank 3, if `ValveSettings.Ka.OperationMode = 'Open'`. |
53 | | | Leakage through the transmission pipe from tank 1 to tank 3, if `ValveSettings.Ka.OperationMode = 'Closed'`. |
54 | | `f5` | Clogging in the transmission pipe from tank 2 to tank 3, if `ValveSettings.Kb.OperationMode = 'Open'`. |
55 | | | Leakage through the transmission pipe from tank 2 to tank 3, if `ValveSettings.Kb.OperationMode = 'Closed'`. |
56 | | `f6` | Clogging in the connection pipe from tank 1 to tank 3, if `ValveSettings.K13.OperationMode = 'Open'`. |
57 | | | Leakage through the connection pipe from tank 1 to tank 3, if `ValveSettings.K13.OperationMode = 'Closed'`. |
58 | | `f7` | Clogging in the connection pipe from tank 2 to tank 3, if `ValveSettings.K23.OperationMode = 'Open'`. |
59 | | | Leakage through the connection pipe from tank 2 to tank 3, if `ValveSettings.K23.OperationMode = 'Closed'`. |
60 | | `f8` | Clogging in output pipe of the tank 1, if `ValveSettings.K1.OperationMode = 'Open'`. |
61 | | | Leakage in tank 1, if `ValveSettings.K1.OperationMode = 'Closed'`. |
62 | | `f9` | Clogging in output pipe of the tank 2, if `ValveSettings.K2.OperationMode = 'Open'`. |
63 | | | Leakage in tank 2, if `ValveSettings.K2.OperationMode = 'Closed'`. |
64 | | `f10` | Clogging in output pipe of the tank 3, if `ValveSettings.K3.OperationMode = 'Open'`. |
65 | | | Leakage in tank 3, if `ValveSettings.K3.OperationMode = 'Closed'`. |
66 | | `f11` | Fault in level sensor `h1`. |
67 | | `f12` | Fault in level sensor `h2`. |
68 | | `f13` | Fault in level sensor `h3`. |
69 | | `f14` | Fault in flow sensor `Q1in`. |
70 | | `f15` | Fault in flow sensor `Q2in`. |
71 | | `f16` | Fault in flow sensor `Q3in`. |
72 | | `f17` | Fault in flow sensor `Qa`. |
73 | | `f18` | Fault in flow sensor `Qb`. |
74 | | `f19` | Fault in flow sensor `Q13`. |
75 | | `f20` | Fault in flow sensor `Q23`. |
76 | | `f21` | Fault in flow sensor `Q1`. |
77 | | `f22` | Fault in flow sensor `Q2`. |
78 | | `f23` | Fault in flow sensor `Q3`. |
79 |
80 | ## 4. How to Create and Configure a Sim3Tanks Object
81 | A Sim3Tanks object is created using the `createSim3Tanks()` function.
82 |
83 | ```sh
84 | tts = createSim3Tanks();
85 | ```
86 |
87 | This function does not have an input argument and returns an object with the following fields:
88 |
89 | - [**Model**](#41-the-model-attribute) : [attribute]
90 | - [**simulateModel**](#42-the-simulatemodel-method) : [method]
91 | - [**displayFields**](#43-the-displayfields-method) : [method]
92 | - [**clearModel**](#44-the-clearmodel-method) : [method]
93 | - [**clearVariables**](#45-the-clearvariables-method) : [method]
94 | - [**setDefaultModel**](#46-the-setdefaultmodel-method) : [method]
95 | - [**getDefaultLinearModel**](#47-the-getdefaultlinearmodel-method) : [method]
96 | - [**getStateVariables**](#48-the-getstatevariables-method) : [method]
97 | - [**getFlowVariables**](#49-the-getflowvariables-method) : [method]
98 | - [**getSensorMeasurements**](#410-the-getsensormeasurements-method) : [method]
99 | - [**getValveSignals**](#411-the-getvalvesignals-method) : [method]
100 | - [**getFaultSignals**](#412-the-getfaultsignals-method) : [method]
101 |
102 | ---
103 | ### 4.1. The `Model` attribute
104 | This attribute is used to define the system configurations. It is divided into the following subfields:
105 |
106 | - **PhysicalParam**: used to define the system's physical structure.
107 | - **TankRadius**: must be real and greater than 0.
108 | ```
109 | tts.Model.PhysicalParam.TankRadius = 5;
110 | ```
111 | - **TankHeight**: must be real and greater than 0.
112 | ```
113 | tts.Model.PhysicalParam.TankHeight = 50;
114 | ```
115 | - **PipeRadius**: must be real, greater than 0, and less than TankRadius.
116 | ```
117 | tts.Model.PhysicalParam.PipeRadius = 0.6;
118 | ```
119 | - **TransPipeHeight**: must be real, greater than 0, and less than TankHeight.
120 | ```
121 | tts.Model.PhysicalParam.TransPipeHeight = 30;
122 | ```
123 | - **CorrectionTerm**: must be real and greater than 0.
124 | ```
125 | tts.Model.PhysicalParam.CorrectionTerm = 1;
126 | ```
127 | - **GravityConstant**: must be real and greater than 0.
128 | ```
129 | tts.Model.PhysicalParam.GravityConstant = 981;
130 | ```
131 | - **PumpMinFlow**: must be real and greater than or equal to 0.
132 | ```
133 | tts.Model.PhysicalParam.PumpMinFlow = 0;
134 | ```
135 | - **PumpMaxFlow**: must be real and greater than PumpMinFlow.
136 | ```
137 | tts.Model.PhysicalParam.PumpMaxFlow = 120;
138 | ```
139 |
140 | - **ValveSettings**: used to define the system valve settings. It is divided into ten subfields, one per valve (Kp1, Kp2, Kp3, Ka, Kb, K13, K23, K1, K2, K3), and each one has the following settings:
141 | - **OperationMode**: must be set to ‘Open’ or ‘Closed’.
142 | ```
143 | tts.Model.ValveSettings.Kp1.OperationMode = 'Open';
144 | ```
145 | - **EnableControl**: must be set to a logical value (true or false).
146 | ```
147 | tts.Model.ValveSettings.Kp1.EnableControl = true;
148 | ```
149 | - **OpeningRate**: must be real and belong to the range [0,1].
150 | ```
151 | tts.Model.ValveSettings.Kp1.OpeningRate = 0.9;
152 | ```
153 |
154 | - **FaultSettings**: used to define the system fault settings. It is divided into twenty-three subfields, one per fault (f1, f2, …, f23), and each one has the following settings:
155 | - **EnableSignal**: must be set to a logical value (true or false).
156 | ```
157 | tts.Model.FaultSettings.f1.EnableSignal = true;
158 | ```
159 | - **Magnitude**: must be real and belong to the range [0,1].
160 | ```
161 | tts.Model.FaultSettings.f1.Magnitude = 0.3;
162 | ```
163 |
164 | - **ProcessNoise**: used to set the system process noise.
165 | - **EnableSignal**: must be set to a logical value (true or false).
166 | ```
167 | tts.Model.ProcessNoise.EnableSignal = true;
168 | ```
169 | - **Magnitude**: must be a row or a column vector with three real and finite elements ([h1 h2 h3]).
170 | ```
171 | tts.Model.ProcessNoise.Magnitude = [-0.05 0.06 -0.02];
172 | ```
173 |
174 | - **MeasurementNoise**: used to set the system process noise.
175 | - **EnableSignal**: must be set to a logical value (true or false).
176 | ```
177 | tts.Model.MeasurementNoise.EnableSignal = true;
178 | ```
179 | - **Magnitude**: must be a row or a column vector with thirteen real and finite elements ([h1, h2, h3, Q1in, Q2in, Q3in, Qa, Qb, Q13, Q23, Q1, Q2, Q3]).
180 | ```
181 | tts.Model.MeasurementNoise.Magnitude = [0.26 -0.12 -0.18 0.39 -0.66 -0.96 0.81 0.71 -0.42 0.68 0.44 0.61 -0.45];
182 | ```
183 |
184 | - **InitialCondition**: used to define the system's initial condition and must be filled with a row vector of three elements.
185 | ```
186 | tts.Model.InitialCondition = [40 25 20];
187 | ```
188 | ---
189 | ### 4.2. The `simulateModel()` method
190 | This method simulates the dynamic behavior of the three-tank system.
191 | ```
192 | [y,x,q] = tts.simulateModel('Qp1',VALUE1,'Qp2',VALUE2,'Qp3',VALUE3,'Tspan',VALUE4);
193 | ```
194 | > [!IMPORTANT]
195 | > Sim3Tanks uses the ode45 solver to solve the system differential equations numerically, and it is highly recommended to use simulation time increment as Tspan.
196 |
197 | ---
198 | ### 4.3. The `displayFields()` method
199 | This method does not have an input argument. It displays all fields and subfields of an object on the command line.
200 | ```
201 | tts.displayFields();
202 | ```
203 |
204 | ---
205 | ### 4.4. The `clearModel()` method
206 | This method does not have an input argument. It clears all variables and restores an object's settings.
207 | ```
208 | tts.clearModel();
209 | ```
210 |
211 | ---
212 | ### 4.5. The `clearVariables()` method
213 | This method does not have an input argument. It clears all state variables, valve, fault, flow signals, and sensor measurement data.
214 | ```
215 | tts.clearVariables();
216 | ```
217 |
218 | ---
219 | ### 4.6. The `setDefaultModel()` method
220 | This method does not have an input argument. It configures a Sim3Tanks object to the default model.
221 | ```
222 | tts.setDefaultModel();
223 | ```
224 |
225 |
226 | ---
227 | ### 4.7. The `getDefaultLinearModel()` method
228 | This method returns a linear model of the default scenario.
229 | ```
230 | [SYS,OP] = tts.getDefaultLinearModel(x1op,METHOD,TSPAN);
231 | ```
232 |
233 | Input arguments:
234 | - `x1op>0` (mandatory): define the operating point of T1. The remaining variables are found as follows:
235 | > x2op = x1op;
236 | >
237 | > x3op = (4/5)*x1op;
238 | >
239 | > u1op = (Beta/Qp)*sqrt(x1op/5);
240 | >
241 | > u2op = u1op;
242 | >
243 | > Q13op = Beta*sign(x1op - x3op)*sqrt(abs(x1op - x3op));
244 | >
245 | > Q23op = Beta*sign(x2op - x3op)*sqrt(abs(x2op - x3op));
246 | >
247 | > Q3op = Beta*sqrt(x3op);
248 | >
249 | > x_op = [x1op; x2op; x3op];
250 | >
251 | > u_op = [u1op; u2op];
252 | >
253 | > y_op = [x1op; x2op; Q13op; Q23op; Q3op];
254 |
255 | - `METHOD`(optional): define the discretization method. The following options are valid:
256 | - 'zoh';
257 | - 'foh';
258 | - 'impulse';
259 | - 'tustin';
260 | - 'matched';
261 | - 'euler';
262 |
263 | - `TSPAN`(optional): define the sampling time of the discretization method. If `METHOD` is passed as input, then `TSPAN` becomes mandatory.
264 |
265 | > [!NOTE]
266 | > A continuous model is returned if `METHOD` and `TSPAN` are omitted.
267 |
268 | ---
269 | ### 4.8. The `getStateVariables()` method
270 | This method does not have an input argument. It returns a data table with the values of the state variables.
271 | ```
272 | tts.getStateVariables();
273 | ```
274 |
275 | ---
276 | ### 4.9. The `getFlowVariables()` method
277 | This method does not have an input argument. It returns a data table with the values of the flow variables.
278 | ```
279 | tts.getFlowVariables();
280 | ```
281 |
282 | ---
283 | ### 4.10. The `getSensorMeasurements()` method
284 | This method does not have an input argument. It returns a data table with the values of the measured variables.
285 | ```
286 | tts.getSensorMeasurements();
287 | ```
288 |
289 | ---
290 | ### 4.11. The `getValveSignals()` method
291 | This method does not have an input argument. It returns a data table with the values of the valve signals.
292 | ```
293 | tts.getValveSignals();
294 | ```
295 |
296 | ---
297 | ### 4.12. The `getFaultSignals()` method
298 | This method does not have an input argument. It returns a data table with the values of the fault signals.
299 | ```
300 | tts.getFaultSignals();
301 | ```
302 |
303 | ## 5. Contributions
304 | Contributions are welcome! Please follow these steps:
305 |
306 | 1. Fork this repository.
307 | 2. Create a branch with your feature:
308 | ```
309 | git checkout -b my-feature
310 | ```
311 | 3. Commit your changes:
312 | ```
313 | git commit -m 'feat: add my feature to do something'
314 | ```
315 | 4. Push to the branch:
316 | ```
317 | git push origin my-feature
318 | ```
319 |
320 | 5. Open a Pull Request.
321 |
322 | ## 6. Citation
323 | If this project has helped you in your research, please consider citing:
324 |
325 | ```
326 | @article{farias2018sim3tanks,
327 | title={Sim3Tanks: A benchmark model simulator for process control and monitoring},
328 | author={Farias, Arllem O. and Queiroz, Gabriel Alisson C. and Bessa, Iury V. and Medeiros, Renan Landau P. and Cordeiro, Lucas C. and Palhares, Reinaldo M.},
329 | journal={IEEE Access},
330 | volume={6},
331 | pages={62234--62254},
332 | year={2018},
333 | publisher={IEEE},
334 | doi={10.1109/ACCESS.2018.2874752}
335 | }
336 | ```
337 |
338 | ## 7. License
339 | This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
340 |
--------------------------------------------------------------------------------