|
Calling Sequence
|
|
ControllerObserver(sys, Kc, L, opts)
|
|
Parameters
|
|
sys
|
-
|
System; system object
|
Kc
|
-
|
Matrix; state feedback gain
|
L
|
-
|
Matrix; observer gain
|
opts
|
-
|
(optional) equation(s) of the form option = value; specify options for the ControllerObserver command
|
|
|
|
|
Options
|
|
|
Specify a feedforward gain (reference input). If Kr = 0, there are no reference inputs and the returned closed-loop system is autonomous if there are no measured_inputs or non-controlled inputs specified by the user. The default value is 0.
|
•
|
closedloop = true or false
|
|
True means calculate the closed-loop equations of the state feedback controller, observer, and plant. False means calculate the equations of the state-feedback controller and observer subsystem. The default is false.
|
•
|
stateerror = true or false
|
|
True means return a state vector with the original states and the state errors (difference between each state and its estimate) in the closedloop case with outputtype = ss. False means express the closed-loop state-space equations in terms of the original states and the state estimates . The default is false.
|
•
|
controlled_inputs = all or set(posint)
|
|
Specifies a subset of sys input indices that are controller outputs. The default is all. A controlled input cannot be specified as a measured input.
|
•
|
measured_inputs = none, all or set(posint)
|
|
Specifies a subset of sys input indices that are not controller outputs and are measured to be input to the observer. The default is none. A measured input cannot be specified as a controlled input.
|
•
|
controlled_outputs = all or set(posint)
|
|
Specifies a subset of sys output indices that are regulated by the controller. The default is all. A controlled output may be specified as a measured output.
|
•
|
measured_outputs = all or set(posint)
|
|
Specifies a subset of sys output indices that are measured to be input to the observer. The default is all. A measured output may be specified as a controlled output.
|
•
|
augment_output = true or false
|
|
True means append the controlled_inputs to the output vector in the closedloop case. 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).
|
|
|
Description
|
|
•
|
The ControllerObserver command calculates the equations of the subsystem comprised of a state feedback controller and an observer, where sys is the plant, is the state feedback controller gain, and is the observer gain. In the diagram below, this subsystem corresponds to the blocks enclosed in the solid-line box.
|
•
|
The closed-loop system equations of the state feedback controller, observer and plant can be obtained using the closedloop option. In the diagram below, the closed-loop system corresponds to the blocks enclosed in the dashed-line box.
|
•
|
When the option Kr is specified, the state feedback controller is governed by the control law , where is the estimated state vector, and is the reference vector. The reference vector contains a reference signal for each controlled output, .
|
•
|
The system 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, and , are obtained using the sys representation obtained by DynamicSystems[StateSpace].
|
•
|
The ControllerObserver command returns a system object whose type is the same as the type of sys, unless the option outputtype is specified.
|
•
|
The controller-observer subsystem inputs are
|
–
|
the reference inputs (when a non-zero Kr Matrix is specified)
|
–
|
the measured_outputs (renamed )
|
|
The controller-observer outputs are
|
–
|
the controlled_inputs
|
|
The controller-observer states (in state-space) are
|
–
|
the estimated states (renamed )
|
•
|
The closed-loop system inputs are
|
–
|
the reference inputs (when a non-zero Kr Matrix is specified)
|
–
|
the non-controlled inputs (e.g. disturbances)
|
|
The closed-loop system outputs are
|
–
|
the controlled_outputs
|
–
|
the non-controlled outputs
|
–
|
the controlled_inputs (if augment_output = true)
|
|
The closed-loop system states (in state-space) are
|
–
|
the estimated states (renamed )
|
|
Or when stateerror = true
|
–
|
the state errors (renamed ).
|
|
|
Examples
|
|
>
|
|
>
|
|
|
Example: State feedback control with observer of linear model for the steering of a vehicle with nonslipping wheels
|
|
•
|
The following second order system represents a linear model for the steering of a vehicle with nonslipping wheels:
|
>
|
|
| (1) |
•
|
Checking whether the system is observable with alpha = 1/2.
|
>
|
|
•
|
Defining the characteristic polynomial with damping ratio and natural frequency .
|
•
|
The corresponding poles are:
|
| (4) |
•
|
Designing the state feedback controller gains ( and ) by pole placement:
|
>
|
|
>
|
|
>
|
|
•
|
Designing the state observer with gain by pole placement as well.
|
>
|
|
>
|
|
•
|
The controller-observer subsystem is obtained next. Note that the state, input, and output variables of the returned system object are renamed accordingly.
|
>
|
|
| (8) |
•
|
The closed-loop equations of the state feedback control system with observer are obtained using the closedloop = true option. Using stateerror = true, augment_output = true, and outputtype = de, we obtain the closed-loop equations of sys1 with state feedback controller with Kc and Kr gains and observer with gain L. The returned system object is a set of differential equations, where the differential variables are x1, x2, x1_err and x2_err, and the outputs are y1 and u1 (controller output).
|
>
|
|
| (9) |
|
|
Example: DC motor model state feedback control with observer
|
|
•
|
The following DC motor example demonstrates the use of the parameters, controlled_inputs, measured_inputs, controlled_outputs and measured_outputs options.
|
>
|
|
>
|
|
>
|
|
>
|
|
•
|
The numeric values for the DC motor stator inductance , stator resistance , electromotive force (emf) constant , rotor moment of inertia , and damping ratio are given next:
|
>
|
|
•
|
The input variables are the source voltage , the torque load and the rotor angular speed reference , and the output variables are the stator current , the rotor angular speed and the integral of the rotor speed error .
|
>
|
|
| (10) |
•
|
The state feedback controller and observer gains are given next:
|
>
|
|
>
|
|
>
|
|
•
|
The controlled input is the source voltage . The measured input is . The controlled output is . The measured outputs are and .
|
•
|
The controller-observer subsystem equations are obtained next:
|
>
|
|
•
|
It is also possible to obtain an LQG controller by computing LQR and Kalman gains. First, compute the weighting matrices:
|
>
|
|
| (11) |
>
|
|
| (12) |
Then define the noise matrices and compute the Kalman gain:
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (13) |
Then compute LQG controller by combining the Kalman filter with LQR controller:
>
|
|
|
|
|
|