Optimal Controller

The optimal controller design for the stochastic systems is based on the separation principle, which states that if the optimal estimate for the state vector in the presence of noise is available, the optimal control law can be obtained as if there were no noise in the system. The idea is implemented in the function Controller. Again, if the process and measurement noise have a Gaussian distribution, Controller forms the LQG controller. 
To use this function one must first determine both the estimator gain matrix "L" (using, say, the optimal procedure in LQEstimatorGains) and the regulator matrix "K" (with, say, LQRegulatorGains). The figures below show the structure of the controller for continuous- and discrete-time systems, respectively. Note that only the part of the system related to the sensor outputs is shown in these diagrams. For the discrete-time case, the controller is based on the current estimator, and thus can be called the current controller.

Once constructed, the controller can be connected to the system according to the block diagram shown in the figure below. It is a state-space object whose inputs are "additional deterministic inputs" and the sensor outputs of the system to be controlled. The outputs of the controller are typically connected to control inputs of the system to close the negative feedback loop. Inside the controller, the feedback loop for control inputs is already closed.

Load the application.

<< ControlSystems`

Consider a three-input, two-output system. Suppose that the first input is the control input and the second and third are, respectively, deterministic and stochastic inputs. Suppose further that we wish to use first output of the system to close the feedback loop. Therefore, estimator and controller gain matrices should both be 1×1.

StateSpace[{{a}}, {{(Subscript[b, 1]), (Subscript[b, 2]), (Subscript[b, 3])}}, {{(Subscript[c, 1])}, {(Subscript[c, 2])}}, {{(Subscript[d, 11]), 
          (Subscript[d, 12]), (Subscript[d, 13])}, {(Subscript[d, 21]), (Subscript[d, 22]), (Subscript[d, 23])}}]

This sets the estimator and controller gains.

L = {{l}}; K = {{k}};

This designs the controller. We can see that the interconnections correspond to the diagram of the continuous-time controller above.

Controller[%%, L, K, {1}, {2}, {1}]

This is the discrete-time system with the same state-space matrices as in the preceding example.

StateSpace[{{a}}, {{(Subscript[b, 1]), (Subscript[b, 2]), (Subscript[b, 3])}}, {{(Subscript[c, 1])}, {(Subscript[c, 2])}}, {{(Subscript[d, 11]), 
          (Subscript[d, 12]), (Subscript[d, 13])}, {(Subscript[d, 21]), (Subscript[d, 22]), (Subscript[d, 23])}}, 
      Sampled -> True]

The discrete-time controller is designed.

Controller[%, L, K, {1}, {2}, {1}] // Simplify

As yet another example, consider again the discrete-time model for a satellite control system. The sampling period is T.

satellite = 
      ToDiscreteTime[StateSpace[{{0, 1}, {0, 0}}, {{0}, {1}}, {{1, 0}}], 
        Sampled -> Period[T]]

This sets the estimator and controller gains symbolically.

K = {{(Subscript[k, 1]), (Subscript[k, 2])}}; L = {{(Subscript[l, 1])}, {(Subscript[l, 2])}};

This finds the controller.

Controller[satellite, L, K]