How to design an LQR for a response hold given state-space representation?

1 visualizzazione (ultimi 30 giorni)
Hello I have a state-space model. My task is to design a controller that performs a response hold ('h' in my SS) at 50. It perfoms the hold, but not at the specified values. What can be done to have the desired outcome? Thanks
%%
%%State-Space Model
%%
A=[-1.50751422335033e-08,3.52548269762214e-09,0,1,-9.46140843736929e-05,0.0551110840032079,0,0,0,0,0,0,0;-3.51480738062489e-09,0,0,0,0.999998526321596,0.00171678613575179,0,0,0,0,0,0,0;-2.73955708126990e-07,1.93999071956026e-10,0,0,-0.00171939130533786,1.00151599299531,0,0,0,0,0,0,0;0,0,0,-16.0932819646270,-0.139331847922229,3.36733290152387,0.0641598396789537,-2.82336072789796,0.00341285522192072,2.69406616153976e-09,-2.45351955100017e-09,-0.000305350541915981,-0.0128378125604006;0,0,0,-1.65172001889207e-08,-15.8073729938731,1.24355004881100,1.04836721613721,2.57438297480755e-09,-7.40469649475076,6.77024241611655e-18,-6.16574394871535e-18,-7.67352049543656e-13,-0.0131461492171457;0,0,0,0.514001561383310,-0.711687216963910,-2.77502233193406,0.00584617234727542,1.70151703540306,0.000314102055369548,2.45489133138638e-10,-2.23570005930919e-10,-2.78242015391058e-05,-0.00116980825507169;0,-9.79069403403094,0,1.43545992664239e-10,-0.891229447923704,6.21652488778673e-08,-0.594529283486300,-0.000987234275265911,0.808056371377526,-9.06225232545967e-10,4.17164804179058e-10,5.17480844885052e-05,0.0125985024168087;9.79067960570862,0.000926337551396637,0,0.896756079983010,-9.16020039877139e-11,-16.8189425372007,0.00197447678969550,-0.872591324595571,0.000108887948499265,-2.82301420835160e-11,1.29952571254169e-11,1.61202397721915e-06,0;0.0168085278033517,-0.539575761350963,0,-6.27327562907259e-08,15.7185902206703,-2.67062311933469e-11,-0.736914376495158,-5.44782062565472e-05,-7.55980389894388,1.64435725871518e-08,-7.56951313505699e-09,-0.000938976162094401,0;0.395312240133260,-9.78128996925731e-05,-7.18305449738161,0,0,0,-0.904934576962060,-0.422532019375630,-0.0505974706279828,0,0,0,0;0.847958979377627,4.56109367054647e-05,-15.4079107971907,0,0,0,0.421977923367986,-0.906346376507739,0.0216997241337061,0,0,0,0;0.00160381870241525,-16.9999995467144,0,0,0,0,-0.0550276624535882,-0.00171418491415918,0.998483358871564,0,0,0,0;0,0,0,0,0,0,135.454006056827,5.00659214063162e-07,7.46590165357187,7.28257345721805e-07,-6.63233019810737e-07,-0.0825420616408884,-5.90289647473860];
B=[0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;9.26047920965575,-1.27364611165735e-09,-5.00837350014869,78.2349393764053,-78.2349393824848,33.0131903630656,-33.0131903725349;0,-133.690540958441,-0.00471785949745696,3.00071183120475,2.99600954220069,2.62378754041215,2.62378754041215;0.843834346102451,-1.83787774989711e-10,-82.0410621087847,-5.75214205021288,5.75214204971391,-1.79412039039175,1.79412038961458;0,0.469793876112028,-0.838533246029700,0.650333818652782,-0.185431971381837,0.362057847800989,0.362057847800989;0,1.18222843250280e-09,5.30214133241312,1.06445249410525e-09,-2.02467818136339e-09,-7.47807838950766e-10,-7.47807838950766e-10;0,-2.70276046705527,-0.0462179518289809,-6.55817192749152,-6.60423734391720,-10.2506660290912,-10.2506660290912;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;2503.28376351607,0,0,0,0,0,0];
C=[1.00000000000003,0,0,0,0,0,0,0,0,0,0,0,0;0,0.999999999996788,0,0,0,0,0,0,0,0,0,0,0;0,0,1.00000000000016,0,0,0,0,0,0,0,0,0,0;0,0,0,1,0,0,0,0,0,0,0,0,0;0,0,0,0,1,0,0,0,0,0,0,0,0;0,0,0,0,0,1,0,0,0,0,0,0,0;0,0,0,1.43545992664239e-10,0.0443499288060189,-5.74183970656958e-10,-0.594529283486300,-0.000987237320457372,0.808056097831276,-4.58064245816186e-10,4.17164804179058e-10,5.19178658969408e-05,0.0125985024168087;0,0,0,-0.0388232967467131,-9.16020039877139e-11,0.155293186986852,0.00197447983488696,-0.872591324595571,0.000108828072535587,-1.42693309567565e-11,1.29952571254169e-11,1.61731289402848e-06,0;0,0,0,6.67655779833672e-12,-1.25564550351732,-2.67062311933469e-11,-0.736914102948909,-5.44183302928684e-05,-7.55980389894388,8.31163916675322e-09,-7.56951313505699e-09,-0.000942056865569940,0;0,0,0,0,0,0,0.998484476506201,3.69055495525276e-09,0.0550340822041545,0,0,0,0;0,0,0,0,0,0,-2.16762465542314e-10,0.0588235307163837,-1.19474299582232e-11,0,0,0,0;0,0,0,0,0,0,-0.00323729902531156,0,0.0587343822720373,0,0,0,0;0,0,0,0,0,0,0,0,0,8.82286353462966e-06,-8.03509152338271e-06,-1.00000000000377,0;-9.43422787053401e-05,0.999999995518031,-1.38477181381869e-17,0,0,0,0.00323729426831423,0.000100834408953317,-0.0587342959785575,0,0,0,0];
D=[0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0.469793876112028,-0.838533246029699,0.650333818652782,-0.185431971381836,0.362057847800989,0.362057847800989;0,1.18222843250280e-09,5.30214133241312,1.06445249410525e-09,-2.02467818136339e-09,-7.47807838950766e-10,-7.47807838950766e-10;0,-2.70276046705527,-0.0462179518289809,-6.55817192749152,-6.60423734391720,-10.2506660290912,-10.2506660290912;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0];
%%
%%LQR Design
%%
%Maximum Acceptable Values for X_{a_i}
%where Q_{i,i}=1/(X_{a_i})^2
%(User can change values if specifications are provided)
theta_max=0.174533;u_max=17;Ze_max=50;
Q =5000*diag([0,(1/theta_max)^2,0,0,0,0,(1/u_max)^2,0,0,0,0,(1/Ze_max)^2,0]);
%Maximum Acceptable Values for U_{j}
%where R_{j,j}=1/(U_{j})^2
%(User can change values if specifications are provided)
elev_max=0.436332312998582;th_max=1;r_max=0.436332312998582;aL_max=0.436332312998582;aR_max=0.436332312998582;fL_max=0.436332312998582;fR_max=0.436332312998582;
R=40*diag([(1/th_max)^2,(1/elev_max)^2,(1/r_max)^2,(1/aL_max)^2,(1/aR_max)^2,(1/fL_max)^2,(1/fR_max)^2]);
K=lqr(A,B,Q1,R);
states={'phi' 'theta' 'psi' 'p' 'q' 'r' 'u' 'v' 'w' 'Xe' 'Ye' 'Ze' 'Engine speed Integrator'};
inputs={'\delta_t' '\delta_e' '\delta_r' '\delta_{aL}' '\delta_{aR}' '\delta_{fL}' '\delta_{fR}'};
outputs={'phi'; 'theta';'psi';'p';'q';'r';'ax';'ay';'az';'V';'beta';'alpha';'h';'gamma'};
Gcl = ss(A-B*K,B*-.7,C,D,'statename',states,'inputname',inputs,'outputname',outputs);
t = 0:0.01:50;
r =50*ones(size(t));
r= repmat(r, 7, 1);
[y,t,x]=lsim(Gcl,r,t);
x1 = y(:,13);
figure(1)
plot(t, x1)
grid

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by