Could you check this implementaion of Controller and observer design?

6 Ansichten (letzte 30 Tage)
I'm trying to solve the system below, Could you check my work if it is correct or not?
close all;
clear all;
clc
%% 1) Set a requirement for step response, like settling time, overshoot
%and static error of output.
A=[0,1,0,0;0,-42.44,212.24,0;0,0,0,1;0,0,0,-42.44];
B=[0;106.12;0;78.6];
C=[1,0,0,0;0,1,0,0;0,0,1,0;0,0,0,1];
D=0;
sys = ss(A, B, C, D)
t=0:0.1:10;
figure;
step(sys,t,'r')
%The parameters including overshoot, settling time and static error.
S = stepinfo(sys)
%% 2)Select the desired poles according to your requirements. If possible,
%calculate the feedback matrix K to place the poles to the desired poles.
eig(sys)
% Now we check the stability
rank(ctrb(sys))
%The desired poles
P = [-1; -2; -3; -3.2850]
K = place(A,B,P)
%% 3) Simulate step response of the feedback system and calculate the parameters
%%including overshoot, settling time and static error. If the system does not satisfy the
%%requirement, go back to step 2).
Acl = A-B*K
syscl = ss(Acl,B,C,D)
figure;
step(syscl,'g')
%The parameters including overshoot, settling time.
S = stepinfo(syscl)
title('Step response of feedback control system')
grid on
%% 4) Design state observer of the system. The magnitude of observer poles must be 2~5
%times of system poles. Select different observer poles and compare the performance
%of observers.
sys=ss(A,B,C,D)
eig(sys)
rank(obsv(sys))
% Observer pole placement at -10 and -9
% This observer will lead to a fast approximation of the states
L_T=place(A',C',[-10,-9,-8,-7])
L=L_T'
% Observer pole placement at -1 and -2
% This observer will lead to a slower approximation of the states
% L_anastrofos=place(a',c',[-1,-2])
% L=L_anastrofos'
% State observer Feedback
sys=ss(A,B,C,D)
eig(sys)
rank(obsv(sys))
rank(ctrb(sys))
K=place(A,B,[-5 -6 -7 -8])
  2 Kommentare
Geoff Hayes
Geoff Hayes am 27 Mai 2019
Haitham - when you run the code/model, do you get unexpected results? Are there errors? Or are you just not sure if this has been implemented properly? Since it is homework, why not discuss with your professor or teaching assistant?
HAITHAM AL SATAI
HAITHAM AL SATAI am 28 Mai 2019
@Geoff Hayes. I'm just not sure from my implmenation if it is correct or not. About my professor, she couldn't give me any answers.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Raj
Raj am 28 Mai 2019
Bearbeitet: Raj am 28 Mai 2019
Pretty good start!!
Now, please note that since you have mentioned that your doubt is in implementation, I have seen only your code.
I have not seen its exact correctness w.r.t the questionare that you have put.
1)" Set a requirement for step response, like settling time, overshoot and static error of output."- What you are doing is computing the step response of your system. Actually in addition to that, you have to set up some desired time domain step response critetia that your closed loop system (system+controller) should satisfy. Something like settling time should be 5 sec, overshoot should be less than 15% of peak value, settling error should be within 10% of final value etc.
2) rank(ctrb(sys)) will give you controllability of system not stability. eig(sys) will give you eigen values of system and if real part of eigen values are negative then system is stable or vice versa. Recommend giving a quick brush up on controllability and stability.
3) %The desired poles P = [-1; -2; -3; -3.2850] It will be good if you show how you arrived at these values.
4) Also in third step where you are simulating step response of the feedback system and calculating the parameters, you may have to go back and find different set of gains (k) if response is not meeting desired criteria set in s/n.1
Good Luck!!
  7 Kommentare
Raj
Raj am 28 Mai 2019
Your sys is a 4x1 state space model, so S = stepinfo(sys) should give you a 4×1 structure array S with required fields. See the section "Step-Response Characteristics of MIMO System" here:
HAITHAM AL SATAI
HAITHAM AL SATAI am 28 Mai 2019
@Raj Thank you so much sir for your help

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Dynamic System Models finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by