Discrete systems: point to point control
Control problem: Given the states x (0) and x(k), compute the input sequence u (0), . . . , u(k − 1) which stirs the system from the initial state x(0) to the final state x (k) in the time interval [0, k].
b b b b
b b b b
b b b b
u(k) x (0)
x (k)
This control problem can be solved by solving the following equation:
x (k) = A k x (0) + X k−1
j=0
A (k−j−1) Bu (j) with respect to the unknown sequence u(j) for j ∈ [0, k − 1].
Property . The control problem has a solution if and only if:
x(k) − A k x(0) ∈ X + (k)
that is if the vector x(k) − A k x (0) is reachable from the zero state in k steps.
If the problem has a solution, the solution can be determined solving the fol- lowing non homogeneous linear system with respect to the unknown sequence u(j) for j ∈ [0, k − 1]:
x(k) − A k x(0) = [B AB . . . A k−1 B]
u(k − 1) u (k − 2)
...
= R + (k)u
where u denotes the following unknown vector:
u =
u (k − 1) u (k − 2)
...
u(0)
=
u 1 (k − 1) ...
u m (k − 1) ...
u 1 (0) ...
u m (0)
The solution u of the given problem is NOT unique. All the possible solutions u can be obtained adding the kernel v of matrix R + (k) to a particular solution u :
u = ¯ u + ¯ v , v ¯ : R + (k)¯ v = 0 For brevity, in the following we will indicate R + k = R + (k).
Property. It can be proved that among all the possible solutions u, the one that minimizes the Euclidean norm
||u|| = v u u t
X k−1 i=0
u T (i) u(i)
is the following:
u = (R + k ) T [R + k (R + k ) T ] −1 [x(k) − A k x (0)]
This solution requires a perfect knowledge of the system parameters to be controlled (matrices A and B) and no disturbances acting on the system.
Note . If R + k is a full rank matrix, then (R + k ) T [R + k (R + k ) T ] −1 is the speudo-
inverse matrix of the rectangular matrix R + k .
Example. Let us consider the problem of heating steel bars which pass through a oven segmented in n = 5 zones. Let us suppose that the heating cost in each section is proportional to the square of the temperature in the zone itself.
θ
0u
0θ
1u
1θ
2u
2θ
3u
3θ
4u
4θ
5let us consider the i-th zone of the oven, i = 0, 1, . . . , 4, and let:
θ
itemperature of the incoming bar θ
i+1temperature of the exit bar
u
itemperature of the i-th zone of the oven
Let us consider the following model for the i-th zone of the oven (for i = 0, 1, . . . , 4):
θ
i+1= θ
i+ u
i− θ
i2 ↔ θ
i+1= 1
2 θ
i+ 1 2 u
iLet R
5be the reachability matrix of the system in 5 steps (A =
12, B =
12):
R
5=
1 21 4
1 8
1 16
1 32
The sequence u
0, u
1, . . ., u
4of the oven temperatures which heats the steel bars from the room temperature θ
0= 0 C
oto the final temperature θ
5= 1000 C
ominimizing the heating cost function |u| = pP
ni=1
u
2iis the following:
¯
u = R
T5(R
5R
T5)
−11000 =
1 2 1 4 1 8 1 16
1 32
1 − (1/32)
23
−11000 =
1502
751 375 188 94
=
u
4u
3u
2u
1u
0
Temperatures of the steel bars for n ∈ {1, 2, 3, . . . , 6}:
500 600 700 800 900 1000
n=1 n=2 n=3 n=4 n=5 n=6
Temperatures of the steel bars
Optimal temperatures of the oven sections for n ∈ {1, 2, 3, . . . , 6}:
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Optimal temperatures of the oven segments
Temperatures u(i) of the oven segments
Number n of oven segments
Heating cost function |u| for n ∈ {1, 2, 3, . . . , 6}:
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
1700 1750 1800 1850 1900 1950 2000
Heating cost function |u| for n=[ 1 2 3 4 5 6]
Cost function |u|
Number n of oven segments
• Matlab file opt k oven.m:
---
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File: opt_k_oven.m
% Computation of the optimal temperatures of a n-segment oven
% which minimizes the quadratic cost.
x0=0; xf=1000; % Initial and final states
a=1/2; b=1/2; % Difference equation coefficients
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MainString=’opt_k_oven’; Stampa=1;
figure(1); clf; n_max=6;
cost=zeros(1,n_max);
u=zeros(n_max);
for n=(1:n_max); % For n varying from 1 to n_max Rn=[b zeros(1,n-1)];
for ii=(2:n)
Rn(ii)=a*Rn(ii-1); % Reachability matrix end
u(n,1:n)=flipud(Rn’*inv(Rn*Rn’)*(xf-a^n*x0)); % Optimal input sequence xn=[x0 zeros(1,n)];
for ii=(1:n)
xn(ii+1)=a*xn(ii)+b*u(n,ii); % State evolution end
plot(0:n,xn,’*-’); hold on % Data plot text(n-1/2,0.95*xn(n+1),[’n=’ num2str(n)])
cost(n)=norm(u(n,:));
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
title(’Temperatures of the steel bars’) ylabel(’Temperatures th(i) the steel bars’) xlabel(’Number n of oven segments’); grid on
if Stampa; eval([’print -depsc ’ MainString ’_’ num2str(gcf)]); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2); clf;
for n=(1:n_max); % For n varying from 1 to n_max plot(n:n_max,u(n:n_max,n),’*-r’); hold on
end
xlim([1 n_max])
title(’Optimal temperatures of the oven segments’) ylabel(’Temperatures u(i) of the oven segments’) xlabel(’Number n of oven segments’); grid on
if Stampa; eval([’print -depsc ’ MainString ’_’ num2str(gcf)]); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(3); clf
plot((1:n), cost(1:n),’*-m’); % Plot the cost function title(’Heating cost function |u| for n=[ 1 2 3 4 5 6]’) ylabel(’Cost function |u|’)
xlabel(’Number n of oven segments’); grid on
if Stampa; eval([’print -depsc ’ MainString ’_’ num2str(gcf)]); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
---