## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples

### Package Content

Name | Description
--- | ---
designCraneController | Design pole assignment and LQ controller for an overhead crane
designCraneControllerWithObserver | Design pole assignment controller and observer for an overhead crane
designInverseDoublePendulumController | Design pole assignment for an inverse double pedulum
designInverseDoublePendulumControllerWithObserver | Design pole assignment for an inverse double pedulum
designInversePendulumController | Design pole assignment for an inverse pedulum
designStateSpaceController | Demonstration of controller design for a state space system
analysis2 | Example to check controllability of a state space system
plotBodeSISODiscrete | Plots the Bode diagram of continuous state space system and the corresponding discrete state space system and with automatic determination of the frequency range to plot

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.designCraneController

Design pole assignment and LQ controller for an overhead crane

### Information

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

References

      [1] Föllinger, O. "Regelungstechnik", Hüthig-Verlag

### Inputs

Name | Description
--- | ---
modelName | name of the model to linearize
pa[4] | assigned poles

### Outputs

Name | Description
--- | ---
K_lq[:, :] | feedback matrix LQ controller
K_pa[:, :] | feedback matrix pole assigment controller
M_lq[:, :] | pre filter LQ controller
M_pa[:, :] | pre filter pole assignment controller

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.designCraneControllerWithObserver

Design pole assignment controller and observer for an overhead crane

### Information

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.

References

      [1] Varga A., "A Schur method for pole assignment",
          IEEE Trans. Autom. Control, Vol. AC-26, pp. 517-519, 1981.

### Inputs

Name | Description
--- | ---
modelName | name of the model to linearize
pa[4] | assigned system poles
pob[4] | assigned observer poles
fileName | file name for results

### Outputs

Name | Description
--- | ---
K_ob[:, :] | feedback matrix pole assigment controller
K_pa[:, :] | feedback matrix pole assigment controller
M_pa[:, :] | pre filter LQ controller

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.designInverseDoublePendulumController

Design pole assignment for an inverse double pedulum

### Information

This example demonstrates how to design pole placement controller to balance an inverted double pendulum. For controller design a linearized model of a (simple) physical system model is used. The controller is applied to the physical model in Moldelica_Controller library.
It is also shown how to linearize a modelica model. The linear model is used as a base for control design

### Inputs

Name | Description
--- | ---
modelName | name of the model to linearize
pa[6] | assigned poles
fileName | file name for results

### Outputs

Name | Description
--- | ---
K_pa[:, :] | feedback matrix pole assigment controller
M_pa[:, :] | pre filter LQ controller

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.designInverseDoublePendulumControllerWithObserver

Design pole assignment for an inverse double pedulum

### Information

This example demonstrates how to design pole placement controller to balance an inverted double pendulum. For controller design a linearized model of a (simple) physical system model is used. The controller is applied to the physical model in Moldelica_Controller library.
It is also shown how to linearize a modelica model. The linear model is used as a base for control design

### Inputs

Name | Description
--- | ---
modelName | name of the model to linearize
pa[6] | assigned poles
pob[6] | assigned observer poles
fileName | file name for results
makeAnalysis |

### Outputs

Name | Description
--- | ---
K_pa[:, :] | feedback matrix pole assigment controller
M_pa[:, :] | pre filter LQ controller
K_ob[:, :] | feedback matrix pole assigment controller

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.designInversePendulumController

Design pole assignment for an inverse pedulum

### Information

This example demonstrates how to design pole placement controller to balance an inverted pendulum. For controller design a linearized model of a (simple) physical system model is used. The controller is applied to the physical model in Moldelica_Controller library.
It is also shown how to linearize a modelica model. The linear model is used as a base for control design

### Inputs

Name | Description
--- | ---
modelName | name of the model to linearize
pa[4] | assigned poles
fileName | file name for results

### Outputs

Name | Description
--- | ---
K_pa[:, :] | feedback matrix pole assigment controller
M_pa[:, :] | pre filter LQ controller

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.designStateSpaceController

Demonstration of controller design for a state space system

### Information

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

References

      [1] Föllinger, O. "Regelungstechnik", Hüthig-Verlag

### Inputs

Name | Description
--- | ---
ss |
pa[:] | assigned poles

### Outputs

Name | Description
--- | ---
K_pa[:, :] | feedback matrix pole assigment controller
M_pa[:, :] | pre filter pole assignment controller
po[size(ss.A, 1)] |

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.analysis2

Example to check controllability of a state space system

### Information

This example shows the usage of function Modelica_LinearSystems2.StateSpace.Analysis.isControllable which is to check whether a system is controllable or not.

### Inputs

Name | Description
--- | ---
ssi |
analyseOptions |
system data definition
systemOnFile | true, if state space system is defined on file
fileName | file where matrix [A, B; C, D] is stored
matrixName | Name of the state space system matrix

### Outputs

Name | Description
--- | ---
ok |

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Examples.plotBodeSISODiscrete

Plots the Bode diagram of continuous state space system and the corresponding discrete state space system and with automatic determination of the frequency range to plot

### Inputs

Name | Description
--- | ---
systemOnFile | true, if state space system is defined on file
fileName | file where matrix [A, B; C, D] is stored
A[:, size(A, 1)] |
B[size(A, 2), :] |
C[:, size(A, 1)] |
D[size(C, 1), size(B, 2)] |
Ts | Sample time [s]
method | Discretization method
iu | index of inout
iy | index of output

### Outputs

Name | Description
--- | ---
ok |