This example demonstrates the computatrion of a LQG controllerr by calling function StateSpace.Design.lqg.
function designLQG extends Modelica.Icons.Function; import Modelica_LinearSystems2.StateSpace; input StateSpace ssi = StateSpace(A = [-0.02, 0.005, 2.4, -32; -0.14, 0.44, -1.3, -30; 0, 0.018, -1.6, 1.2; 0, 0, 1, 0], B = [0.14, -0.12; 0.36, -8.6; 0.35, 0.009; 0, 0], C = [0, 1, 0, 0; 0, 0, 0, 57.3], D = [0, 0; 0, 0]); input Boolean systemOnFile = false "True, if state space system is defined on file" annotation( Dialog(group = "system data definition"), choices(checkBox = true)); input String fileName = "NoName" "file where matrix [A, B; C, D] is stored" annotation( Dialog(group = "system data definition", loadSelector(filter = "MAT files (*.mat);; All files (*.*)", caption = "state space system data file"), enable = systemOnFile)); input String matrixName = "ABCD" "Name of the state space system matrix" annotation( Dialog(group = "system data definition", enable = systemOnFile)); output Boolean ok; end designLQG;