This example demonstrates how to design a lq-controller or a pole placement controller respectively. Compared with example craneController, the plant is smaller to achieve suitable dynamics for animation. The feedback matrices and a simple pre filter for tracking are save 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 used as a base for control design
function designCraneController import Modelica.Utilities.Streams; import MatricesMSL = Modelica.Math.Matrices; import Modelica.ComplexMath.j; import Modelica_LinearSystems2; import Modelica_LinearSystems2.ComplexMathAdds; import Modelica_LinearSystems2.TransferFunction; import Modelica_LinearSystems2.ZerosAndPoles; 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 poles"; output Real K_lq[:, :] "feedback matrix LQ controller"; output Real K_pa[:, :] "feedback matrix pole assignment controller"; output Real M_lq[:, :] "pre filter LQ controller"; output Real M_pa[:, :] "pre filter pole assignment controller"; end designCraneController;