ControlDesign
StateFeedbackClosedLoop
determine the closed-loop equations of a system with state feedback controller
Calling Sequence
Parameters
Options
Description
Examples
StateFeedbackClosedLoop(sys, Kc, opts)
sys
-
System; system object
Kc
Matrix; state feedback gain
opts
(optional) equation(s) of the form option = value; specify options for the StateFeedbackClosedLoop command
Kr = Matrix or 0
Specify a feedforward gain Kr (reference input). If Kr = 0, there are no reference inputs r and the returned closed-loop system is autonomous. The default value is 0.
augment_output = true or false
True means append the sys inputs to the output vector of the closed-loop system. The default is false.
outputtype = tf, coeff, zpk, ss, or de
Determines the subtype of the returned system object. The default return type is based on the type of the system object specified in the sys parameter.
parameters = {list, set}(name = complexcons)
Specifies numeric values for the parameters of sys. These values override any parameters previously specified for sys. The numeric value on the right-hand side of each equation is substituted for the name on the left-hand side in the sys equations. The default is the value of sys given by DynamicSystems:-SystemOptions(parameters).
The StateFeedbackClosedLoop command calculates the closed-loop system equations of the state feedback controller with Kc gain and plant sys.
When the option Kr is specified, the state feedback controller is governed by the control law uc=−Kc·x+Kr·r, where x is the state vector of sys, r is the reference vector, Kc is the feedback gain and Kr is the direct or feedforward gain.
The sys is a SISO (single input, single output) or MIMO (multiple input, multiple output) linear system object created using the DynamicSystems package. The system object can be of types: transfer function (TF), zero-pole-gain (ZPK), coefficients (Coeff), state-space (SS), and diff-equation (DE). It is assumed that the state feedback controller gains are obtained using the sys representation obtained by DynamicSystems[StateSpace].
The StateFeedbackClosedLoop command returns a system object whose type is the same as the type of sys, unless the option outputtype is specified.
The closed-loop system inputs are
the reference inputs r=y_ref (when a non-zero Kr Matrix is specified)
The reference vector r contains a reference signal for each sys output y.
The closed-loop system outputs are
the outputs y of sys
the controller outputs uc (if augment_output = true)
with⁡ControlDesign:
with⁡DynamicSystems:
A DC motor with stator inductance L, stator resistance R, electromotive force (emf) constant K, rotor moment of inertia J, and damping ratio b is modeled using the following differential equations.
eqs≔L⁢diff⁡i⁡t,t+R⁢i⁡t=V⁡t−K⁢w⁡t,J⁢diff⁡w⁡t,t+b⁢w⁡t=K⁢i⁡t−T⁡t:
The input variables are the source voltage V⁡t and the torque load T⁡t, and the output variables are the rotor angular speed w⁡t and the stator current i⁡t.
sysde≔DiffEquation⁡eqs,:-inputvariable=V⁡t,T⁡t,:-outputvariable=w⁡t,i⁡t:
In state-space form:
sys≔StateSpace⁡sysde:
PrintSystem⁡sys
State Spacecontinuous2 output(s); 2 input(s); 2 state(s)inputvariable=V⁡t,T⁡toutputvariable=w⁡t,i⁡tstatevariable=x1⁡t,x2⁡ta=−RL−KLKJ−bJb=1L00−1Jc=0110d=0000
For control, the controlled input is the voltage V⁡t and the controlled output is the DC motor speed w⁡t. The corresponding subsystem is obtained.
sys≔Subsystem⁡sys,1,1:
State Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable=V⁡toutputvariable=w⁡tstatevariable=x1⁡t,x2⁡ta=−RL−KLKJ−bJb=1L0c=01d=0
Designing the state feedback controller with gains Kc and Kr (u=−Kc·x+Kr⁢r) by pole placement with desired poles p1 and p2.
Obtaining the feedback gain Kc:
Kc,Kr≔StateFeedback:-PolePlacement⁡sys,p1,p2,return_Kr
Kc,Kr≔−J⁢L⁢p1+J⁢L⁢p2+J⁢R+L⁢bJJ2⁢L⁢p1⁢p2+J⁢L⁢b⁢p1+J⁢L⁢b⁢p2−J⁢K2+L⁢b2J⁢K,L⁢J⁢p1⁢p2K
The closed-loop equations of the state feedback control system are obtained next.
clsys≔StateFeedbackClosedLoop⁡sys,Kc,:-Kr=Kr:
PrintSystem⁡clsys
State Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable=w_ref⁡toutputvariable=w⁡tstatevariable=x1⁡t,x2⁡ta=−RL+J⁢L⁢p1+J⁢L⁢p2+J⁢R+L⁢bL⁢J−KL−J2⁢L⁢p1⁢p2+J⁢L⁢b⁢p1+J⁢L⁢b⁢p2−J⁢K2+L⁢b2L⁢J⁢KKJ−bJb=J⁢p1⁢p2K0c=01d=0
Using outputtype and augment_output, the transfer function of closed-loop system is obtained. The output vector will contain the controller output V⁡t.
clsys1≔StateFeedbackClosedLoop⁡sys,Kc,:-Kr=Kr,:-outputtype=tf,:-augment_output=true:
PrintSystem⁡clsys1
Transfer Functioncontinuous2 output(s); 1 input(s)inputvariable=w_ref⁡soutputvariable=w⁡s,V⁡stf1,1=p1⁢p2s2+−p1−p2⁢s+p1⁢p2tf2,1=L⁢J⁢p1⁢p2⁢s2+p1⁢p2⁢J⁢R+L⁢b⁢s+p1⁢p2⁢K2+R⁢bK⁢s2+K⁢−p1−p2⁢s+K⁢p1⁢p2
Assign numerical values for the parameters:
params≔J=0.01,K=0.01,L=0.5,R=1,b=0.1:
Next, the numeric values for the desired poles are obtained. For 0.1% overshoot, settling time of about 1 sec, the damping ratio Z and the natural frequency ω are defined as follows:
Z≔0.98:ω≔5Z:
poles≔solve⁡s2+2⁢Z⁢ω⁢s+ω2,s:
p1≔poles1;p2≔poles2
p1≔−4.999999998+1.015293305⁢I
p2≔−4.999999998−1.015293305⁢I
Then, the numeric values for the feedback gain Kc and the feed-forward gain Kr are:
Kc≔map⁡simplify,eval⁡Kc,params,zero
Kc≔−1.00000000213.00541026
Kr≔map⁡simplify,eval⁡Kr,params,zero
Kr≔13.01541024
clsys≔StateFeedbackClosedLoop⁡sys,Kc,:-Kr=Kr,:-parameters=params:
Plotting the closed-loop system step response:
ResponsePlot⁡clsys,8⁢Step⁡,duration=10,numpoints=200,labels=t,DC Motor Rotational Speed,labeldirections=horizontal,vertical,gridlines=true,view=0..10,0..10
Obtain the properties of the step response such as steady-state value and settling-point.
prop≔StepProperties⁡clsys
prop≔1.,0.103866687817983,0.100000000000000,0.231175892242102,0.333333333333333,0.441908334624695,0.666666666666667,0.742737847117827,0.900000000000000,undefined,undefined,1.09872655595021,0.980000000000000
plots:-display⁡plot⁡prop2..7,style=point,symbol=cross,color=blue,symbolsize=30,plot⁡0,prop1,10,prop1,color=gray,ResponsePlot⁡clsys,Step⁡,duration=10,numpoints=200,gridlines=true,title=Step response,labels=t,DC Motor Rotational Speed,labeldirections=horizontal,vertical,view=0..10,0..1.2
See Also
ControlDesign[LQR]
ControlDesign[StateFeedback]
ControlDesign[StateFeedback][Ackermann]
ControlDesign[StateFeedback][PolePlacement]
Download Help Document