## Modelica_LinearSystems2.WorkInProgress.MPC

Model Predictive Control

### Package Content

Name | Description
--- | ---
predictionMatrices | Compute the matrices and vectors to predict stae x and output y
predictionMatrices2 | Compute the matrices and vectors to predict state x and output y. Feedthrough matrix D i also considered
yp | Fixed part of the systemoutput. Depends on past inputs.
Examples |
Utilities |
constrainMatrices |

## Modelica_LinearSystems2.WorkInProgress.MPC.predictionMatrices

Compute the matrices and vectors to predict stae x and output y

### Information

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
dss | Linear system model
hp | Prediction horizon
hu | Control horizon

### Outputs

Name | Description
--- | ---
F[hp*size(dss.C, 1), hu*size(dss.B, 2)] | Output predition matrix F: y(k+hp) = F*delta_u + y_p, yp=CA_p*x(k) + CB_p*u(k-1)
CA_p[hp*size(dss.C, 1), size(dss.A, 1)] | Matrix CA_p=CC*A_p, CC=diag with hp C as diagonal elements
CB_p[hp*size(dss.C, 1), size(dss.B, 2)] | Matrix CA_p=CC*B_p, CC=diag with hp C as diagonal elements

## Modelica_LinearSystems2.WorkInProgress.MPC.predictionMatrices2

Compute the matrices and vectors to predict state x and output y. Feedthrough matrix D i also considered

### Information

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
dss | Linear system model
hp | Prediction horizon
hu | Control horizon

### Outputs

Name | Description
--- | ---
F[hp*size(dss.C, 1), hu*size(dss.B, 2)] | Output predition matrix F: y(k+hp) = (F1 + DD_p)*delta_u + y_p, yp=CA_p*x(k) + (CB_p1 + D_p)*u(k-1)
CA_p[hp*size(dss.C, 1), size(dss.A, 1)] | Matrix CA_p=CC*A_p, CC=diag with hp C as diagonal elements
CB_p[hp*size(dss.C, 1), size(dss.B, 2)] | Matrix CA_p=CC*B_p, CC=diag with hp C as diagonal elements

## Modelica_LinearSystems2.WorkInProgress.MPC.yp

Fixed part of the systemoutput. Depends on past inputs.

### Information

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Name | Description
--- | ---
CA_p[:, :] | Matrix CA_p=CC*A_p, CC=diag with hp C as diagonal elements
CB_p[size(CA_p, 1), :] | Matrix CA_p=CC*B_p, CC=diag with hp C as diagonal elements
xk[size(CA_p, 1)] | Current state
u_pre[size(CB_p, 2)] | Preciding input

### Outputs

Name | Description
--- | ---
y_p[size(CA_p, 1)] | Output predition matrix F: y(k+hp) = F*delta_u + y_p

## Modelica_LinearSystems2.WorkInProgress.MPC.constrainMatrices

### Inputs

Name | Description
--- | ---
hu | Control prediction
m | number of inputs
delta_u_min[m] |
delta_u_max[m] |
u_min[m] |
u_max[m] |

### Outputs

Name | Description
--- | ---
delta_u_min_total[hu*m] |
delta_u_max_total[hu*m] |
u_min_total[hu*m] |
u_max_total[hu*m] |
G_u_min[hu*m, hu*m] |
G_u_max[hu*m, hu*m] |
F1[hu*m, m] |