None Notebook

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

< 2.2 Gravity Drained Tank | Contents | Tag Index | 2.4 Continuous Product Blending >

Open in Colab

Download

2.3 Blending Tank Simulation

2.3.1 Summary

This example provides an introduction to the use of python for the simulation of a simple process modeled by a pair of ordinary differential equations. See SEMD textbook example 2.1 for more details on the process.

2.3.2 Basic Simulation of the Blending Tank

\begin{align*} \frac{dV}{dt} & = \frac{1}{\rho}(w_1 + w_2 - w)\\ \frac{dx}{dt} & = \frac{1}{\rho V}(w_1 (x_1 - x) + w_2 (x_2 - x)) \end{align*}

2.3.2.1 Step 1. Initialize Python Workspace

Unlike Matlab, in Python it is always necessary to import the functions and libraries that you intend to use. In this case we import the complete pylab library, and the function odeint for integrating systems of differential equations from the scipy library. The command %matplotlib inline causes graphic commands to produce results directly within the notebook output cells.

2.3.2.2 Step 2. Establish Parameter Values

2.3.2.3 Step 3. Write a function to compute the RHS's of the Differential Equations

2.3.2.4 Step 4. Set the Initial Conditions, Time Grid, and Integrate

2.3.2.5 Step 5. Visualize the Solution

2.3.3 Steady State Analysis

The blending tank is a system with two state variables (volume and composition). Suppose a mechanism is put in place to force the inflow to equal the outflow, that is

$$w = w_1 + w_2$$

The mechanism could involve the installation of an overflow weir, level controller, or some other device to force a balance between the outflow and total inflows. In this case,

$$\frac{dV}{dt} = 0$$

which means volume is at steady state.

In that case there is just one remaining differential equation

$$\frac{dx}{dt} = \frac{1}{\rho V}( w_1(x_1 - x) + w_1(x_2 - x)) = 0$$

Solving for the steady value of $x$,

$$\bar{x} = \frac{w_1x_1 + w_2x_2}{w_1 + w_2}$$

< 2.2 Gravity Drained Tank | Contents | Tag Index | 2.4 Continuous Product Blending >

Open in Colab

Download