# Documentation

## CSTR Model

The linearized model of a continuous stirred-tank reactor (CSTR) involving an exothermic (heat-generating) reaction is represented by the following differential equations:[9]

$\frac{d{{C}^{\prime }}_{A}}{dt}={a}_{11}{{C}^{\prime }}_{A}+{a}_{12}{T}^{\prime }+{b}_{11}{{T}^{\prime }}_{c}+{b}_{12}{{C}^{\prime }}_{Ai}$

$\frac{d{T}^{\prime }}{dt}={a}_{21}{{C}^{\prime }}_{A}+{a}_{22}{T}^{\prime }+{b}_{21}{{T}^{\prime }}_{c}+{b}_{22}{{C}^{\prime }}_{Ai}$

where CA is the concentration of a key reactant, T is the temperature in the reactor, Tc is the coolant temperature, CAi is the reactant concentration in the reactor feed, and aij and bij are constants. The primes (e.g., CA) denote a deviation from the nominal steady-state condition at which the model has been linearized.

Measurement of reactant concentrations is often difficult, if not impossible. Let us assume that T is a measured output, CA is an unmeasured output, Tc is a manipulated variable, and CAi is an unmeasured disturbance.

The model fits the general state-space format

$\frac{dx}{dt}=Ax+Bu$

$y=Cx+Du$

where

The following code shows how to define such a model for some specific values of the aij and bij constants:

```A = [-0.0285 -0.0014 -0.0371 -0.1476]; B = [-0.0850 0.0238 0.0802 0.4462]; C = [0 1 1 0]; D = zeros(2,2); CSTR = ss(A,B,C,D); ```

The following code sets some of the `CSTR` model's optional properties:

```CSTR.InputName = {'T_c', 'C_A_i'}; CSTR.OutputName = {'T', 'C_A'}; CSTR.StateName = {'C_A', 'T'}; CSTR.InputGroup.MV = 1; CSTR.InputGroup.UD = 2; CSTR.OutputGroup.MO = 1; CSTR.OutputGroup.UO = 2; ```

To view the properties of `CSTR`, enter:

`CSTR`