Difference between revisions of "Batch reactor"

From mintOC
Jump to: navigation, search
(<math> </math> rendering appears to be broken)
 
(26 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|nx        = 2
 
|nx        = 2
 
|nu        = 1
 
|nu        = 1
|nw       = 0
+
|nc       = 2
 
|nre      = 2
 
|nre      = 2
 
}}
 
}}
  
This batch reactor problem describes the consecutive reaction of some substance A via substance B into a desired product C (A <math> \rightarrow </math> B <math> \rightarrow </math> C).
+
This batch reactor problem describes the consecutive reaction of some substance A via substance B into a desired product C.
  
 
The system is interacted with via the control function <math> T(t) </math> which stands for the temperature.
 
The system is interacted with via the control function <math> T(t) </math> which stands for the temperature.
Line 20: Line 20:
 
\begin{array}{llcl}
 
\begin{array}{llcl}
 
  \displaystyle \max_{x, u} & x_2(t_f)  \\[1.5ex]
 
  \displaystyle \max_{x, u} & x_2(t_f)  \\[1.5ex]
  \mbox{s.t.} & \dot{x}_1(t) & = & -k_1 x_1^2, \\
+
  \mbox{s.t.} & \dot{x}_1 & = & -k_1 x_1^2.\\
  & \dot{x}_2(t) & = & k_1 x_1^2 - k_2 x_2, \\
+
  & \dot{x}_2 & = & k_1 x_1^2 - k_2 x_2,\\
  & k_1 & = & 4000 \; e^{(-2500/T)}, \\
+
  & k_1 & = & 4000 \; e^{(-2500/T(t))}, \\
  & k_2 & = & 620000 \; e^{(-5000/T)}, \\[1.5ex]
+
  & k_2 & = & 620000 \; e^{(-5000/T(t))}, \\[1.5ex]
 
  & x(0) &=& (1, 0)^T, \\
 
  & x(0) &=& (1, 0)^T, \\
 
  & T(t) &\in&  [298, 398].
 
  & T(t) &\in&  [298, 398].
Line 30: Line 30:
 
</p>
 
</p>
  
<math> x_1(t) </math> and <math> x_2(t) </math> stand for the concentrations of A and B at timepoint <math> t </math> respectively. The control function <math> T(t) </math> represents the temperature.
+
<math> x_1(t) </math> and <math> x_2(t) </math> represent the concentrations of A and B at timepoint <math> t </math> respectively. The control function <math> T(t) </math> represents the temperature.
  
 
== Parameters ==
 
== Parameters ==
Line 40: Line 40:
 
This solution was computed using JuMP with a collocation method and 300 discretization points. The differential equations were solved using the explicit Euler Method. The source code can be found at [[Batch reactor (JuMP)]].
 
This solution was computed using JuMP with a collocation method and 300 discretization points. The differential equations were solved using the explicit Euler Method. The source code can be found at [[Batch reactor (JuMP)]].
  
The optimal objective value of the problem is <math> x_2(t_f) = -0.611715 </math>.
+
The optimal objective value of the problem is x2(tf) = 0.611715.
  
[pictures coming]
+
<gallery caption="Reference solution plots" widths="180px" heights="140px" perrow="2">
<!-- <gallery caption="Reference solution plots" widths="180px" heights="140px" perrow="2">
+
  File:batch_reactor_states_plot.png| Optimal states <math> x_1(t)</math> and <math>x_2(t)</math>.
  Image:lotkaRelaxedControls.png| Optimal relaxed control determined by an indirect approach and by a direct approach on different control discretization grids.
+
  File:batch_reactor_control_plot.png| Optimal control <math>u(t)</math>.
Image:lotkaindirektStates.png| Differential states and corresponding adjoint variables in the indirect approach.
+
  Image:lotka2Switches.png| Control and differential states with only two switches.
+
Image:lotka56Switches.png| Control and differential states with 56 switches.
+
 
</gallery>
 
</gallery>
-->
 
  
 
== Source Code ==
 
== Source Code ==
  
 
Model descriptions are available in
 
Model descriptions are available in
* [[:Category: JuMP | JuMP code]] at [[Batch reactor (JuMP)]]
+
* [[:Category:Gekko | GEKKO Python code]] at [[Batch reactor (GEKKO)]]
 +
* [[:Category: Julia/JuMP | JuMP code]] at [[Batch reactor (JuMP)]]
  
 
== References ==
 
== References ==
Line 62: Line 59:
 
[[Category:MIOCP]]
 
[[Category:MIOCP]]
 
[[Category:ODE model]]
 
[[Category:ODE model]]
 +
[[Category:Chemical engineering]]

Latest revision as of 14:42, 11 April 2019

Batch reactor
State dimension: 1
Differential states: 2
Continuous control functions: 1
Path constraints: 2
Interior point equalities: 2


This batch reactor problem describes the consecutive reaction of some substance A via substance B into a desired product C.

The system is interacted with via the control function  T(t) which stands for the temperature. The goal is to produce as much of substance B (which can then be converted into product C) as possible within the time limit.

Mathematical formulation

The optimal control problem is given by


\begin{array}{llcl}
 \displaystyle \max_{x, u} & x_2(t_f)   \\[1.5ex]
 \mbox{s.t.} & \dot{x}_1 & = & -k_1 x_1^2.\\
 & \dot{x}_2 & = & k_1 x_1^2 - k_2 x_2,\\
 & k_1 & = & 4000 \; e^{(-2500/T(t))}, \\
 & k_2 & = & 620000 \; e^{(-5000/T(t))}, \\[1.5ex]
 & x(0) &=& (1, 0)^T, \\
 & T(t) &\in&  [298, 398].
\end{array}

 x_1(t) and  x_2(t) represent the concentrations of A and B at timepoint  t respectively. The control function  T(t) represents the temperature.

Parameters

The starting time and end time are given by  [t_0, t_f] = [0, 1] .

Reference Solutions

This solution was computed using JuMP with a collocation method and 300 discretization points. The differential equations were solved using the explicit Euler Method. The source code can be found at Batch reactor (JuMP).

The optimal objective value of the problem is x2(tf) = 0.611715.

Source Code

Model descriptions are available in

References

The problem can be found in the Tomlab PROPT guide or in the Dynopt guide.