## MIMO Control System

This example shows how to build a MIMO control system using `connect`

to interconnect Numeric LTI models and
tunable Control Design Blocks.

Consider the following two-input, two-output control system.

The plant *G* is a distillation column with
two inputs and two outputs. The two inputs are the reflux *L* and
boilup *V*. The two outputs are the concentrations
of two chemicals, represented by the vector signal *y* = [*y*_{1},*y*_{2}].
You can represent this plant model as:

$$G\left(s\right)=\frac{1}{75s+1}\left[\begin{array}{cc}87.8& -86.4\\ 108.2& -109.6\end{array}\right].$$

The vector setpoint signal *r* = [*r*_{1},*r*_{2}] specifies
the desired concentrations of the two chemicals. The vector error
signal *e* represents the input to *D*,
a static 2-by-2 decoupling matrix. *C _{L}* and

*C*represent independent PI controllers that control the two inputs of

_{V}*G*.

To create a two-input, two-output model representing this closed-loop control system:

Create a Numeric LTI model representing the 2-by-2 plant

*G*.s = tf('s','TimeUnit','minutes'); G = [87.8 -86.4 ; 108.2 -109.6]/(75*s+1); G.InputName = {'L','V'}; G.OutputName = 'y';

When you construct the closed-loop model,

`connect`

uses the input and output names to form connections between the block diagram components. Therefore, you must assign names to the inputs and outputs of the transfer function`G`

in either of the following ways: .You can assign input and output names to individual signals by specifying signal names in a cell array, as in

`G.InputName = {'L','V'}`

Alternatively, you can use vector signal naming, which the software automatically expands. For example, the command

`G.OutputName = 'y'`

assigns the names`'y(1)'`

and`'y(2)'`

to the outputs of`G`

.

Create tunable Control Design Blocks representing the decoupling matrix

*D*and the PI controllers*C*and_{L}*C*._{V}D = tunableGain('Decoupler',eye(2)); D.u = 'e'; D.y = {'pL','pV'}; C_L = tunablePID('C_L','pi'); C_L.TimeUnit = 'minutes'; C_L.u = 'pL'; C_L.y = 'L'; C_V = tunablePID('C_V','pi'); C_V.TimeUnit = 'minutes'; C_V.u = 'pV'; C_V.y = 'V';

**Note**`u`

and`y`

are shorthand notations for the`InputName`

and`OutputName`

properties, respectively. Thus, for example, entering:D.u = 'e'; D.y = {'pL','pV'};

is equivalent to entering:

D.InputName = 'e'; D.OutputName = {'pL','pV'};

Create the summing junction.

The summing junction produces the error signals

*e*by taking the difference between*r*and*y*.Sum = sumblk('e = r - y',2);

`Sum`

represents the transfer function for the summing junction described by the formula`'e = r - y'`

. The second argument to`sumblk`

specifies that the inputs and outputs of`Sum`

are each vector signals of length 2. The software therefore automatically assigns the signal names`{'r(1)','r(2)','y(1)','y(2)'}`

to`Sum.InputName`

and`{'e(1)','e(2)'}`

to`Sum.OutputName`

.Join all components to build the closed-loop system from

*r*to*y*.CLry = connect(G,D,C_L,C_V,Sum,'r','y');

The arguments to the

`connect`

function include all the components of the closed-loop system, in any order.`connect`

automatically combines the components using the input and output names to join signals.The last two arguments to

`connect`

specify the output and input signals of the closed-loop model, respectively. The resulting`genss`

model`CLry`

has two-inputs and two outputs.

## See Also

## Related Examples

- Control System Model with Both Numeric and Tunable Components
- Multi-Loop Control System
- MIMO Control System