Difference between revisions of "Double Tank"

From mintOC
Jump to: navigation, search
(Created page with "The two states of the system correspond to the fluid levels of an upper and a lower tank. The output of the upper tank flows into the lower tank, the output of the lower tank...")
 
(Variants)
 
(48 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{Dimensions
 +
|nd        = 1
 +
|nx        = 2
 +
|nw        = 1
 +
|nre      = 2
 +
}}
 +
 +
The double tank problem is a basic example for a switching system. It contains the dynamics of an upper and a lower tank, connected to each other with a pipe. The goal is to minimize the deviation of a certain fluid level <math>k_2</math> in the lower tank. The problem was introduced and discussed in a variety of publications for the optimal control of constrained switched systems, e.g. <bib id="Henrion2014" /> (Link: [http://homepages.laas.fr/henrion/papers/switch.pdf Henrion et al.]) and <bib id="Vasudevan2013" /> (Link: [http://epubs.siam.org/doi/pdf/10.1137/120901507 Vasudevan et al.]).
 +
 +
== Mathematical formulation ==
 +
 +
<math>
 +
\begin{array}{llll}
 +
\displaystyle \min_{\sigma} &  \displaystyle \int_{0}^{T} & k_1(x_2-k_2)^2  \; \text{d}t\\[1.5ex]
 +
\mbox{s.t.} &  \dot{x}_1 & = c_{\sigma(t)}-\sqrt{x_1}, \\[1.5ex]
 +
&  \dot{x}_2 & = \sqrt{x_1}-\sqrt{x_2}, \\[1.5ex]
 +
&  x(0) & = (2,2)^T, \\[1.5ex]
 +
&  \sigma(t) & \in \{1,2\} \qquad &\text{for } t\in[0,T].\\[1.5ex]
 +
\end{array}
 +
</math>
 +
 +
 +
 
The two states of the system correspond to the fluid levels of an upper and a lower tank.
 
The two states of the system correspond to the fluid levels of an upper and a lower tank.
 
The output of the upper tank flows into the lower tank, the output of the lower
 
The output of the upper tank flows into the lower tank, the output of the lower
tank exits the system, and the flow into the upper tank is restricted to either 1[lt/s]
+
tank exits the system, and the flow into the upper tank is restricted to either <math>c_1</math> [lt/s]
or 2[lt/s].  The dynamics in each mode are then derived using Torricelli’s law, as
+
or <math>c_2</math> [lt/s].  The dynamics in each mode are then derived using [https://en.wikipedia.org/wiki/Torricelli's_law Torricelli’s law], as
shown in Table 5.1. The objective of the optimization is to have the fluid level in the
+
shown in constraints 1 and 2. The objective of the optimization is to have the fluid level in the
lower tank equal to 3[m], as reflected in the cost function in Table 5.2
+
lower tank equal to <math>k_2</math> [m], as reflected in the cost function.
 +
 
 +
== Parameters ==
 +
In an exemplary test, the parameters were chosen to be:
 +
 
 +
{| class="wikitable"
 +
|+Parameters
 +
|-
 +
|Symbol
 +
|Value
 +
|-
 +
|<math>k_1</math>
 +
|<math>2</math>
 +
|-
 +
|<math>k_2</math>
 +
|<math>3</math>
 +
|-
 +
|<math>c_1</math>
 +
|<math>1</math>
 +
|-
 +
|<math>c_2</math>
 +
|<math>2</math>
 +
|-
 +
|<math>T</math>
 +
|<math>10</math>
 +
|}
 +
 
 +
== Reference Solution ==
 +
The problem is solved in Python with [[:Category: Gekko | GEKKO]] or Matlab (version 2014b) with [[:Category: switch | Switch]]. The switch codes rely on [http://homepages.laas.fr/henrion/software/gloptipoly3/ GloptiPoly 3] and the solver [http://sedumi.ie.lehigh.edu/ SeDuMi 1.3] (optimization over symmetric cones).
 +
By introducing the lifts <math>l_i=\sqrt{x_i}</math>, algebraically constrained as <math>l_i^2=x_i, \; l_i\geq 0,</math> the problem is recast with polynomial data. In this way way switch in connection with GloptiPoly3 can be applied. GloptiPoly 3 is a Matlab package developed by Didier Henrion for generalized problems of moments and needs polynomial input data. The exact code used to solve the problem can be found under [[Double Tank (switch)]]. The calculated objective is 4.7296 with the following trajectories of states and controls:
 +
<gallery caption="Reference solution plots" widths="180px" heights="140px" perrow="2">
 +
Image:State_sequence_Tank.jpg| State trajectory over time.
 +
Image:Control_sequence_Tank.jpg| Control sequence over time.
 +
</gallery>
 +
 
 +
== Variants ==
 +
 
 +
There are several alternative formulations and variants of the above problem, in particular
 +
 
 +
* different control functions for the two tanks, see [[Double Tank multimode problem]]
 +
* a three tank problem with 3 modes, see [[Three Tank multimode problem]]
 +
 
 +
== Source Code ==
 +
 
 +
Model descriptions are available in
 +
 
 +
* [[:Category:Gekko | GEKKO Python code]] at [[Double Tank (GEKKO)]]
 +
* [[:Category: switch | switch code]] at [[Double Tank (switch)]]
 +
 
 +
== References ==
 +
<biblist />
 +
 
 +
CLAEYS, Mathieu; DAAFOUZ Jamal; HENRION Didier Modal occupation measures and LMI relaxations for nonlinear switched systems control. arXiv preprint arXiv:1404.4699 (2014)
 +
 
 +
VASUDEVAN, Ramanarayan, et al. Consistent Approximations for the Optimal Control of Constrained Switched Systems---Part 2: An Implementable Algorithm. SIAM Journal on Control and Optimization, 2013, 51. Jg., Nr. 6, S. 4484-4503.
 +
 
 +
<!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here -->
 +
[[Category:MIOCP]]
 +
[[Category:ODE model]]
 +
[[Category: Tracking objective]]
 +
[[Category: State dependent switches]]
 +
[[Category:Bang bang]]
 +
[[Category:Path-constrained arcs]]

Latest revision as of 09:34, 14 March 2020

Double Tank
State dimension: 1
Differential states: 2
Discrete control functions: 1
Interior point equalities: 2


The double tank problem is a basic example for a switching system. It contains the dynamics of an upper and a lower tank, connected to each other with a pipe. The goal is to minimize the deviation of a certain fluid level k_2 in the lower tank. The problem was introduced and discussed in a variety of publications for the optimal control of constrained switched systems, e.g. [Henrion2014]The entry doesn't exist yet. (Link: Henrion et al.) and [Vasudevan2013]The entry doesn't exist yet. (Link: Vasudevan et al.).

Mathematical formulation


\begin{array}{llll}
 \displaystyle \min_{\sigma} &  \displaystyle \int_{0}^{T} & k_1(x_2-k_2)^2  \; \text{d}t\\[1.5ex]
 \mbox{s.t.} &  \dot{x}_1 & = c_{\sigma(t)}-\sqrt{x_1}, \\[1.5ex]
 &  \dot{x}_2 & = \sqrt{x_1}-\sqrt{x_2}, \\[1.5ex]
 &  x(0) & = (2,2)^T, \\[1.5ex]
 &  \sigma(t) & \in \{1,2\} \qquad &\text{for } t\in[0,T].\\[1.5ex]
\end{array}


The two states of the system correspond to the fluid levels of an upper and a lower tank. The output of the upper tank flows into the lower tank, the output of the lower tank exits the system, and the flow into the upper tank is restricted to either c_1 [lt/s] or c_2 [lt/s]. The dynamics in each mode are then derived using Torricelli’s law, as shown in constraints 1 and 2. The objective of the optimization is to have the fluid level in the lower tank equal to k_2 [m], as reflected in the cost function.

Parameters

In an exemplary test, the parameters were chosen to be:

Parameters
Symbol Value
k_1 2
k_2 3
c_1 1
c_2 2
T 10

Reference Solution

The problem is solved in Python with GEKKO or Matlab (version 2014b) with Switch. The switch codes rely on GloptiPoly 3 and the solver SeDuMi 1.3 (optimization over symmetric cones). By introducing the lifts l_i=\sqrt{x_i}, algebraically constrained as l_i^2=x_i, \; l_i\geq 0, the problem is recast with polynomial data. In this way way switch in connection with GloptiPoly3 can be applied. GloptiPoly 3 is a Matlab package developed by Didier Henrion for generalized problems of moments and needs polynomial input data. The exact code used to solve the problem can be found under Double Tank (switch). The calculated objective is 4.7296 with the following trajectories of states and controls:

Variants

There are several alternative formulations and variants of the above problem, in particular

Source Code

Model descriptions are available in

References

There were no citations found in the article.

CLAEYS, Mathieu; DAAFOUZ Jamal; HENRION Didier Modal occupation measures and LMI relaxations for nonlinear switched systems control. arXiv preprint arXiv:1404.4699 (2014)
VASUDEVAN, Ramanarayan, et al. Consistent Approximations for the Optimal Control of Constrained Switched Systems---Part 2: An Implementable Algorithm. SIAM Journal on Control and Optimization, 2013, 51. Jg., Nr. 6, S. 4484-4503.