linearization of simulink models with uncertainty -凯发k8网页登录
this example shows how to compute uncertain linearizations using robust control toolbox™ and simulink® control design™. there are two convenient workflows offered depending on how simulink is used. the resulting uncertain linearizations are in the form of the uncertain state space (uss) data structure in the robust control toolbox, which can be used by the analysis functions in robust control toolbox.
introduction
the graphical user interface in simulink is a natural environment to model and simulate control systems. using the linearization capabilities in simulink control design and the uncertainty elements in robust control toolbox, you can specify uncertainty on specific blocks in a simulink model and then extract an uncertain linearized model.
in this example, the performance of a pid controller is examined in the presence of uncertainty. there are two approaches available to compute linearizations of uncertain systems. each of the approaches is designed to meet different needs when working in simulink. these approaches are summarized in the following sections.
approach #1: using uncertain state space blocks
this first approach is most applicable when you are already using uncertain state space blocks as part of your control system design process in simulink. as shown in the example robustness analysis in simulink, the uncertain state space block in robust control toolbox lets you specify uncertainty in a simulink model.
in the following example, both the plant and sensor dynamics are uncertain. the uncertainty on the plant dynamics includes:
real pole
unc_pole
whose location varies between -10 and -4unmodeled dynamics
input_unc
(25% relative uncertainty at low frequency rising to 100% uncertainty at 130 rad/s).
unc_pole = ureal('unc_pole',-5,'range',[-10 -4]); plant = ss(unc_pole,5,1,0); wt = makeweight(0.25,130,2.5); input_unc = ultidyn('input_unc',[1 1]);
the uncertain sensor dynamics are defined to be
sensor_pole = ureal('sensor_pole',-20,'range',[-30 -10]); sensor = tf(1,[1/(-sensor_pole) 1]);
the rct_ulinearize_uss
model uses uncertain state space blocks (highlighted in blue) to model this uncertainty:
mdl = 'rct_ulinearize_uss'; open_system('rct_ulinearize_uss')
this simulink model is ready to compute an uncertain linearization. the linear model has an input at the reference block rct_ulinearize_uss/reference
and an output of the plant rct_ulinearize_uss/uncertain plant
. these linearization input and output points are specified using simulink control design. the linearization points are found using the following command:
io = getlinio(mdl);
the uncertain linearization is computed using the command ulinearize
. this command returns an uncertain state space (uss) object that depends on the uncertain variables input_unc
, sensor_pole
, and unc_pole
:
sys_ulinearize = ulinearize(mdl,io)
uncertain continuous-time state-space model with 1 outputs, 1 inputs, 5 states. the model uncertainty consists of the following blocks: input_unc: uncertain 1x1 lti, peak gain = 1, 1 occurrences sensor_pole: uncertain real, nominal = -20, range = [-30,-10], 1 occurrences unc_pole: uncertain real, nominal = -5, range = [-10,-4], 1 occurrences type "sys_ulinearize.nominalvalue" to see the nominal value and "sys_ulinearize.uncertainty" to interact with the uncertain elements.
this concludes the first approach. close the simulink model:
bdclose(mdl)
approach #2: using built-in simulink blocks
the second approach uses the simulink control design user interface for block linearization specification to specify uncertainty for linearization. the block linearization specification feature in simulink control design allows any simulink block to be replaced by either a gain, an lti object, or a robust control toolbox uncertain variable. this approach is best suited when working with models that do not use the uncertain state space block. the primary advantage of this approach is that the specification of the uncertainty does not impact any other operation in simulink such as simulation.
a modified version of the original model using only built-in simulink blocks is shown below.
mdl = 'rct_ulinearize_builtin';
open_system(mdl);
by right clicking on the rct_ulinearize_builtin/plant
block and selecting the menu item linear analysis->specify linearization, you can specify what value this block should linearize to. if you enter the expression plant*(1 wt*input_unc)
in the dialog box shown below, the "plant" block will linearize to the corresponding uncertain state-space model (uss object).
similarly, you can assign the uncertain model sensor
as linearization for the block rct_ulinearize_builtin/sensor gain
.
you can now linearize rct_ulinearize_builtin
using the simulink control design command linearize
:
io = getlinio(mdl); sys_linearize = linearize(mdl,io)
uncertain continuous-time state-space model with 1 outputs, 1 inputs, 5 states. the model uncertainty consists of the following blocks: input_unc: uncertain 1x1 lti, peak gain = 1, 1 occurrences sensor_pole: uncertain real, nominal = -20, range = [-30,-10], 1 occurrences unc_pole: uncertain real, nominal = -5, range = [-10,-4], 1 occurrences type "sys_linearize.nominalvalue" to see the nominal value and "sys_linearize.uncertainty" to interact with the uncertain elements.
the resulting model is an uncertain state-space (uss) model equivalent to the uncertain linearization computed using the first approach.
leveraging the uncertain linearization result
both linearization approaches produce an uncertain state-space (uss) object which can be analyzed with standard robust control toolbox commands. in this example, this uss model is used to find the worst-case gain of the linearized closed-loop response.
[maxg,worstun] = wcgain(sys_linearize);
the resulting worst-case values for the uncertain variables can then be used to compare against the nominal response. this comparison indicates that the pid performance is not robust to the plant and sensor uncertainty.
sys_worst = usubs(sys_linearize,worstun); step(sys_linearize.nominalvalue,sys_worst) legend('nominal','worst-case');
this concludes the example. close the simulink model:
bdclose(mdl);