None Notebook

This notebook contains material from CBE30338; content is available on Github.

< 3.3 Linear Approximation of a Multivariable Model | Contents | Tag Index | 3.5 One Compartment Pharmacokinetics >

Open in Colab

Download

3.4 Fitting First Order plus Time Delay to Step Response

3.4.1 Summary

Linear first order plus time delay (FOPTD) models are often good approximations to process dynamics for process control applications. This notebook demonstrates the fitting of FOPTD models to step response data.

3.4.2 Initializations

3.4.3 First Order plus Time Delay Models

3.4.3.1 First Order Models

A linear first-order plus time-delay model is a good approximation for many process control applications. Assume the manipulated process input, $u$, and measured process output, $y$, are initially at steady-state $u_0, y_0$.

Without loss of generality, the response of a linear first-order system without time-delay can be written as a differential equation

$$\tau\frac{d(y-y_0)}{dt} + (y-y_0) = K(u-u_0)$$

or

$$\tau\frac{dy}{dt} + (y-y_0) = K(u-u_0)$$

At time $t_0$, the input $u$ is changed to a new constant value $u_\infty$. Provided the system is stable (i.e, $\tau \geq 0$), the new steady state value of $y$ will be

$$y_\infty = y_0 + K(u_\infty - u_0)$$

The solution to the differential equation can be written in a number of useful forms.

\begin{align*} y(t) & = y_0 + K(u_\infty - u_0) (1 - e^{-(t-t_0)/\tau)}) \\ \\ & = y_0 + (y_\infty - y_0) (1 - e^{-(t-t_0)/\tau)}) \\ \\ & = y_\infty + (y_0 - y_\infty)e^{-(t-t_0)/\tau)} \end{align*}

3.4.3.2 Time Delay

Chemical processes are frequently encumbered with time delays associated with the transport of materials, chemical measurement, or simply sluggish response to control inputs. A pure time delay is modeled by a single parameter, $\tau_d$, such that

$$y(t) = u(t-\tau_d)$$

3.4.3.3 First Order plus Time Delay (FOPTD)

If we add the time delay feature to the first order process described above, then

\begin{align*} y(t) & = y_0 + K(u_\infty - u_0) (1 - e^{-(t-\tau_d - t_0)/\tau)}) \\ \\ & = y_0 + (y_\infty - y_0) (1 - e^{-(t-\tau_d-t_0)/\tau)}) \\ \\ & = y_\infty + (y_0 - y_\infty)e^{-(t-\tau_d-t_0)/\tau)} \end{align*}

3.4.3.4 Visualization

First we write a function to compute the response of a first order system with time delay to a unit step input where $u_0 = 0$ and $u_\infty = 1$.

3.4.4 Fitting an FOPTD model

3.4.4.1 Sample Problem Statement

A distillation column is initially at steady state where the cooling water flow to the condensor is 110 kg/hr and the vapor phase mole fraction of the volatile compound is 0.87. At t = 60 min, the steam flow is raised to 120 kg/hr. The vapor phase mole fraction increases as shown in the following chart.

The problem task to fit a FOPTD model to this experimental result.

3.4.4.2 Step 1. Shift and scale the experimental data to correspond to a unit step input at time t = 0.

The first step is to scale the experimental data to fit the framework of an FOPTD model. This generally involves three steps:

$$ t_s = t - t_0$$ $$ y_s = \frac{y(t) - y_0}{u_\infty - u_0}$$

3.4.4.3 Step 2. Create a function to compute the response of an FOPTD model.

For a given list of times $t$ and parameters $K$, $\tau$, and $\tau_d$, the foptd returns the response of an FOPTD system to a unit change in input at $t = 0$.

3.4.4.4 Step 3. Create a function to measure the error between an FOPTD model and the experimental data.

Let's called the step response of the fitted model to be $\hat{y}_s$. We seek to minimize

$$\min_{K,\tau,\tau_d} \int_0^T \|\hat{y}_s - y_s\|\,dt$$

for some suitable norm $\|\cdot\|$. A common choice of norm for process control is the absolute value of the difference called Integral Absolute Error (IAE)

$$\text{IAE} = \min_{K,\tau,\tau_d} \int_0^T |\hat{y}_s - y_s|\,dt$$

The advantage of IAE over other choices of norms is that it tends to be more robust with respect to larger errors.

3.4.4.5 Step 4. Use scipy.optimize.minimize() to find the best fitting FOPTD model.

3.4.4.6 Step 5. Rescale FOPTD output and compare to experimental data.

< 3.3 Linear Approximation of a Multivariable Model | Contents | Tag Index | 3.5 One Compartment Pharmacokinetics >

Open in Colab

Download