This example demonstrates how to use pole placement function assignPolesMI to design a pole placement controller and an observer also using assignPolesMI as well. Function assignPoles is based on the Schur form of the state space matrix an also allows partial poles shifting [1].
An observer can be designed by applying assignPolesMI to the dual system (A', C', B'). The results, which are controller feedback matrix, observer feedback matrix, system model for usage in observer and a simple pre filter for tracking are saved to MATLAB files which can be used in ModelicaController library. It is also shown how to linearize a model of a crane trolley system [1]. The linear model is then used as a base for controller design.
function designCraneControllerWithObserver import Modelica.Utilities.Streams; import Modelica.ComplexMath.j; import Modelica_LinearSystems2; import Modelica_LinearSystems2.StateSpace; input String modelName = "Modelica_Controller.Examples.Components.Pendulum_small" "name of the model to linearize"; input Complex pa[4] = {-3.5 + 0*j, -3.5 + 0*j, -3.5 - 0.5*j, -3.5 + 0.5*j} "assigned system poles"; input Complex pob[4] = {-10 + 0*j, -10 + 0*j, -10 + 0*j, -10 + 0*j} "assigned observer poles"; input String fileName = DataDir + "craneController_small.mat" "file name for results"; output Real K_ob[:, :] "feedback matrix pole assignment controller"; output Real K_pa[:, :] "feedback matrix pole assignment controller"; output Real M_pa[:, :] "pre filter LQ controller"; end designCraneControllerWithObserver;