loop-凯发k8网页登录
this example shows how to design a controller by specifying a desired shape for the open-loop response of the plant with the controller. the loopsyn
command designs a controller that shapes the open-loop response to approximately match the target loop shape you provide. loopsyn
lets you adjust the tradeoff between performance and robustness to obtain satisfactory time-domain responses while avoiding fragile designs with plant inversion or flexible mode cancellation.
in this example, you design a controller for an aircraft model.the example shows how varying the balance between performance and robustness affects loop shape and closed-loop response. the example then shows how to reduce the controller order while preserving desirable characteristics of the response.
plant model
this example uses the two-input, two-output nasa himat aircraft model [1]. the aircraft is shown in the following diagram.
the control variables are the elevon and canard actuators ( and ). the output variables are the angle of attack () and attitude angle (). the model has six states, given by
,
where and are the elevator and canard actuator states, respectively. using the following state-space matrices, create a model of this plant.
a = [ -2.2567e-02 -3.6617e 01 -1.8897e 01 -3.2090e 01 3.2509e 00 -7.6257e-01; 9.2572e-05 -1.8997e 00 9.8312e-01 -7.2562e-04 -1.7080e-01 -4.9652e-03; 1.2338e-02 1.1720e 01 -2.6316e 00 8.7582e-04 -3.1604e 01 2.2396e 01; 0 0 1.0000e 00 0 0 0; 0 0 0 0 -3.0000e 01 0; 0 0 0 0 0 -3.0000e 01]; b = [0 0; 0 0; 0 0; 0 0; 30 0; 0 30]; c = [0 1 0 0 0 0; 0 0 0 1 0 0]; d = [0 0; 0 0]; g = ss(a,b,c,d); g.inputname = {'elevon','canard'}; g.outputname = {'attack','attitude'};
examine the singular values of the model.
sigma(g)
this plant is ill-conditioned, in the sense that it has a gap of about 40 db between the largest and smallest singular values in the vicinity of the desired control bandwidth of 8 rad/s. further, as a step plot shows, the open-loop response of this plant is unstable.
step(g)
initial controller design
to design a stabilizing controller for this plant, select a target loop shape. a typical loop shape has low gain at high frequencies for robustness, and high gain at low frequencies for performance. for the desired crossover frequency of 8 rad/s, a simple target loop shape that meets these requirements is .
gd = tf(8,[1 0]);
sigma(gd,{0.1 100})
grid on
design the initial controller with loopsyn
.
[k0,cl0,gamma0,info0] = loopsyn(g,gd); gamma0
gamma0 = 1.2858
the performance gamma
is a measure of how well the loop shape with k0
matches the desired loop shape. values near or below 1 indicate that g*k0
is close to gd
. compare the achieved loop shape with the target.
l0 = g*k0; sigma(l0,"b",gd,"r--",{.1,100}); grid legend("l0 (actual loop shape)","gd (target loop shape)");
the match is not very close at low frequencies, though it improves near crossover. moreover, the two singular values are still somewhat far apart around crossover, such that the system has effectively two crossover frequencies. examine how this open-loop shape affects the closed-loop step response.
step(cl0,5)
the bump in attitude
tracking (lower-right plot) is the result of the separation of the two singular values, leading to a response with two time constants. also, the response shows significant coupling between attack
and attitude
. you can adjust the controller to reduce the bump in attitude
tracking, reduce the coupling, and if possible reduce the overshoot in the attack
response.
design controller for performance
to improve the design, you can try changing the balance that loopsyn
strikes between performance and robustness. to do so, use the alpha
input argument to loopsyn
. by default, loopsyn
uses alpha = 0.5
, which optimizes performance subject to the robustness being no worse than half the maximum achievable robustness. alpha = 0
optimizes for performance (mixsyn
design). setting alpha = 1
uses the robustness-maximizing ncfsyn
design. first, consider the pure mixsyn
design.
alpha = 0; [k_mix,cl_mix,gamma_mix,info_mix] = loopsyn(g,gd,alpha); gamma_mix
gamma_mix = 0.7723
the gamma
value indicates a much closer match to the target loop shape, which you can confirm by plotting the open-loop responses.
l_mix = g*k_mix; sigma(l0,"b",l_mix,"g",gd,"r--",{.1,100}); grid legend("l0 (inital design)","l_mix (mixsyn design)","gd (target loop shape)");
this design roughly inverts the plant. as a result, the singular values of l_mix
converge near the crossover frequency and are generally much closer together than in the original plant. with this plant-inverting controller, the closed-loop response shows good performance, with minimal overshoot and cross-coupling.
step(cl0,cl_mix,5) legend("initial design","mixsyn design","location","southeast")
however, this performance comes at the cost of robustness. compare the stability margins of the system with the initial design and the mixsyn
design.
dm0 = diskmargin(g,k0); dm_mix = diskmargin(g,k_mix); dm0.diskmargin
ans = 0.1222
dm_mix.diskmargin
ans = 0.0517
the plant-inverting design has poor robustness. for instance, if the smallest singular value of the plant model is 1% of the largest singular value, inverting the plant amplifies model errors by a factor of 100 in the direction of the smallest singular value. thus, unless you have a highly accurate model, use a design with better robustness.
design controller for robustness
at the opposite extreme is the pure ncfsyn
design, optimized for robustness. compute such a controller using alpha = 1
, and examine the resulting stability, loop shape, and responses.
alpha = 1; [k_ncf,cl_ncf,gamma_ncf,info_ncf] = loopsyn(g,gd,alpha); gamma_ncf
gamma_ncf = 2.8360
dm_ncf = diskmargin(g,k_ncf); dm_ncf.diskmargin
ans = 0.2201
l_ncf = g*k_ncf; sigma(l0,l_mix,l_ncf,gd,"k--",{.1,100}); grid legend("l0 (inital design)","l_mix (mixsyn design)",... "l_ncf (ncfsyn design)","gd (target loop shape)");
the increased value of gamma
indicates poor performance, though the stability margin is improved, as expected. the singular-value plot shows that this controller inverts the plant even less than the initial design, which is evident in that the separation of the singular values is roughly the same as for the open-loop plant. the separation of crossover frequencies results in slow and fast time constants in the step response, which is even poorer than the initial design. the kick resulting from the wide crossover region is now apparent in all four i/o channels.
step(cl0,cl_mix,cl_ncf,5) legend("initial design","mixsyn design","ncfsyn design","location","southeast")
choosing a satisfactory design
thus, to improve on the default design, slightly favoring the mixsyn
design without throwing away too much stability margin might yield a suitable design for this plant. you can control how much loopsyn
favors performance or robustness by setting alpha
to any value between 0 and 1. the default value used in the initial controller is alpha = 0.5
. try a value that slightly favors performance, and compare the results with the initial design.
alpha = 0.25; [k,cl,gamma,info] = loopsyn(g,gd,alpha); gamma
gamma = 1.0174
l = g*k; sigma(l0,l,gd,"k--",{.1,100}); grid legend("l0 (inital design)","l (final design)","gd (target loop shape)");
dm = diskmargin(g,k); dm.diskmargin
ans = 0.0995
step(cl0,cl,5) legend("initial (alpha = 0.5)","final (alpha = 0.25)","location","southeast")
the alpha = 0.25
design yields reasonably good performance, reducing coupling and eliminating the bump in the attitude
response. it has a slightly smaller stability margin (disk margin of about 0.09, compared to about 0.125 for the initial design). for your application, you can select whatever value of alpha
between 0 and 1 achieves an acceptable balance between performance and robustness.
conclusion
in conclusion, loopsyn
lets you adjust the tradeoff between performance and robustness to strike a suitable balance for your application. you can try different values of alpha
to find a controller that works for your requirements.
in some cases, you might want to find a suitable controller of lower order than that returned by loopsyn
. one option is to use to reduce the controller order. however, reducing the controller in this way can change the balance of performance and robustness. to best preserve the desired performance and robustness characteristics, call loopsyn
again using the ord
input argument to directly synthesize a lower-order controller. use the balred
result to guide your choice of value for ord
.
references
[1] safonov, m., a. laub, and g. hartmann. “feedback properties of multivariable systems: the role and use of the return difference matrix.” ieee transactions on automatic control 26, no. 1 (february 1981): 47–65.