state feedback control and observer

165 次查看(过去 30 天)
Can you explain how to design a state feedback control and an observer for a DC motor with the following specifications? If you could provide instructions for both MATLAB and Simulink, I would greatly appreciate it.
Rs = 0.47;
Ld = 1.23e-3;
B = 0.0002;
Kb = 0.42;
Kt = 0.73;
J = 6.5e-4;
% Second-order State Matrix
A1 = [-B/J Kt/J;
-Kb/Lq -Rs/Lq];
B1 = [0;
1/Lq];
C1 = [1 0];
D1 = 0;

采纳的回答

Sam Chak
Sam Chak 2023-4-5
Since no requirement is provided, we follow the design criteria given in the example:
  • Settling time less than 2 seconds
  • Overshoot less than 5%
  • Steady-stage error less than 1%
Like many collaborative robot arms and autonoumous vehicles, it is necessary to design the desired reference trajectory so that the control systems can follow. In this exercise, a reference model (transfer function) is designed to satisfy the design criteria.
From the reference model, one can obtain the desired closed-loop pole and the pole placement technique (solving algebraic equations) can be applied. The rest of the controller and observer design are procedural steps. So, the key is the reference model design!
% Parameters
Rs = 0.47;
Lq = 1.23e-3;
B = 0.0002;
Kb = 0.42;
Kt = 0.73;
J = 6.5e-4;
% State-space Matrices of the Uncompensated Plant
A = [-B/J Kt/J;
-Kb/Lq -Rs/Lq];
B = [0;
1/Lq];
C = [1 0];
D = 0;
% Reference trajectory design
wr = 3; % reference omega, ω
zr = 0.7; % reference zeta, ζ
nr = wr^2;
dr = [1 2*zr*wr wr^2]; % x" + 2·ζ·ω·x' + ω²·x
Gr = tf(nr, dr) % reference model
Gr = 9 --------------- s^2 + 4.2 s + 9 Continuous-time transfer function.
stepinfo(Gr)
ans = struct with fields:
RiseTime: 0.7089 TransientTime: 1.9930 SettlingTime: 1.9930 SettlingMin: 0.9001 SettlingMax: 1.0460 Overshoot: 4.5986 Undershoot: 0 Peak: 1.0460 PeakTime: 1.4693
% Controller design
cp = pole(Gr) % controller poles
cp =
-2.1000 + 2.1424i -2.1000 - 2.1424i
K = place(A, B, cp) % controller gains
K = 1×2
-0.4200 -0.4652
% Closed-loop control system without observer
sys = ss(A-B*K, B, C, D);
Nbar = 1/dcgain(sys); % Normalizer (to rescale the reference input)
cls = ss(A-B*K, B*Nbar, C, D)
cls = A = x1 x2 x1 -0.3077 1123 x2 -0.006947 -3.892 B = u1 x1 0 x2 0.008014 C = x1 x2 y1 1 0 D = u1 y1 0 Continuous-time state-space model.
stepinfo(cls)
ans = struct with fields:
RiseTime: 0.7089 TransientTime: 1.9930 SettlingTime: 1.9930 SettlingMin: 0.9001 SettlingMax: 1.0460 Overshoot: 4.5986 Undershoot: 0 Peak: 1.0460 PeakTime: 1.4693
% Observer design
or = 10*real(cp(1)); % make the observer response 10 times faster
op = [or+1 or-1] % observer poles (make op ≪ cp but no repeated poles)
op = 1×2
-20.0000 -22.0000
L = place(A', C', op)' % observer gains
L = 2×1
-340.4215 -225.3519
% Combine state-feedback controller and observer
Aco = [A-B*K B*K;
zeros(size(A)) A-L*C];
Bco = [B*Nbar;
zeros(size(B))];
Cco = [C zeros(size(C))];
Dco = 0;
% Closed-loop observer-based control system
clco = ss(Aco, Bco, Cco, Dco)
clco = A = x1 x2 x3 x4 x1 -0.3077 1123 0 0 x2 -0.006947 -3.892 -341.5 -378.2 x3 0 0 340.1 1123 x4 0 0 -116.1 -382.1 B = u1 x1 0 x2 0.008014 x3 0 x4 0 C = x1 x2 x3 x4 y1 1 0 0 0 D = u1 y1 0 Continuous-time state-space model.
step(clco, 6), grid on
stepinfo(clco)
ans = struct with fields:
RiseTime: 0.7089 TransientTime: 1.9930 SettlingTime: 1.9930 SettlingMin: 0.9001 SettlingMax: 1.0460 Overshoot: 4.5986 Undershoot: 0 Peak: 1.0460 PeakTime: 1.4693
sse = fix(1 - dcgain(clco)) % steady-state error
sse = 0
As shown, all three design criteria are satisfied.
  3 个评论
Sam Chak
Sam Chak 2023-11-18
I'm glad to hear that. If you found the explanation on the design of the integrated full-state feedback controller and observer helpful, please consider voting 👍 as a token of appreciation. Thank you!
Siddharth Jawahar
Siddharth Jawahar 2024-11-29
Great answer by Sam! I am commenting on how you could implement the controller design in Simulink. Please look at the final model attached and the script to setup the variables.
%% Step 1: Define Plant Dynamics
% Parameters
Rs = 0.47;
Lq = 1.23e-3;
B = 0.0002;
Kb = 0.42;
Kt = 0.73;
J = 6.5e-4;
% State-space matrices of the plant
A = [-B/J, Kt/J;
-Kb/Lq, -Rs/Lq];
B = [0;
1/Lq];
C = [1, 0];
D = 0;
% Reference trajectory design
wr = 3; % reference omega, ω
zr = 0.7; % reference zeta, ζ
nr = wr^2;
dr = [1 2*zr*wr wr^2]; % x" + 2·ζ·ω·x' + ω²·x
Gr = tf(nr, dr) % reference model
% Export to workspace
assignin('base', 'A', A);
assignin('base', 'B', B);
assignin('base', 'C', C);
assignin('base', 'D', D);
%% Step 2: Design State Feedback Controller
% Desired closed-loop poles for the state feedback
desired_poles = [-30, -40];
% Calculate state feedback gain (K)
K = place(A, B, desired_poles);
% Feedforward gain for tracking
N = -1 / (C * inv(A - B * K) * B);
% Export to workspace
assignin('base', 'K', K);
assignin('base', 'N', N);
%% Step 3: Design the Observer
% Desired poles for the observer
observer_poles = [-50, -60];
% Calculate observer gain (L)
L = place(A', C', observer_poles)';
% Export to workspace
assignin('base', 'L', L);
%% Step 4: Display Calculated Variables
disp('State-space matrices and gains calculated for Simulink:');
disp('A, B, C, D (Plant Dynamics)');
disp('K (State Feedback Gain)');
disp('N (Feedforward Gain)');
disp('L (Observer Gain)');
Please follow the steps below on constructing the Simulink model:
  • Plant Dynamics: Add a State-Space block with matrices A, B, C, D for the plant.
  • Reference Input: Add a Step block to generate the desired tracking signal.
  • State Feedback: Use a Gain block with K to implement feedback and a Gain block with N for feedforward.
  • Observer: Add another State-Space block for the observer with:
A - L * C for A
[B, L] for B
eye(2) for C
zeros(2, 2) for D
  • Feedback Integration: Connect the observer states to the feedback gain (K).
  • Sum Block: Combine scaled reference signal (N * r) and feedback signal (-K * observer states).
  • Control Signal: Feed the combined signal to the plant input and observer.
Once you run the simulation the tracking performance is below:
HTH,
Sid

请先登录,再进行评论。

更多回答(1 个)

Oguz Kaan Hancioglu
移动:Sabin 2023-4-4

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by