**Reference**:

This is problem 10 from an article “A Collection of Representative Problems in Chemical Engineering for Solution by Numerical Methods”. These problems came from Session 12 of the ASEE Chemical Engineering Summer School held in Snowbird, Utah in 1997. In this problem, you will be modeling the temperature of a tank heated with a heater controlled with a PI controller.

**Concepts**:

- Solve a system of ordinary differential equations (with a step function) and appropriate initial conditions
- Use Ipython with Scite editor to edit and save files
- Import packages into workspace
- Define constants
- Define functions for the ODE solver
- Use the odeint solver with initial conditions and time span array
- Print the solution

## Problem Description:

A well-mixed tank is being used to continuously heat a solution for further processing. The process set-up is shown below:

Well-mixed Heated Tank with PI Controller

The temperature in the tank is not high enough or changes enough to worry about properties changing with temperature and the feed rate is constant. You want to change the temperature of the outlet stream by changing the setpoint on the controller. The parameters are:

W = Feed rate to tank, kg/min

Cp = Heat capacity of the solution, kj/kg – deg C

rho = Density of the solution, kg/m^{3}

Ti = Inlet temperature, deg C

Tr = Setpoint temperature, deg C

Tm = Measured temperature, deg C

V = Tank volume, m^{3}

q = Heat input, kj/min

Mr. Phelps, your mission, should you decide to accept it, is to figure out how to control the temperature of the outlet stream of the tank by changing the setpoint on the PI controller. This blog will self-destruct in 30 sec….

**Problem Equations and Set-up:**

**Energy Balance for the tank:**

dT/dt = [W*Cp*(Ti – T)/(rho*V*Cp)] + q

**Thermocouple Response First Order plus Dead Time:**

To(t) = T*(t – τ_{d})

t = Time, min

τ_{d} = Dead time constant, min

**Pade Approximation for the Dead Time Effect (connect the temperature input to the thermocouple To):**

dTo/dt = [T – To – (τ_{d}/2)*(dT/dt)]*(2/τ_{d})

**Model the Thermocouple Shield and Electronics:**

dTm/dt = (To – Tm)/τ_{m}

τ_{m} = Thermocouple time constant, min

**Control the Energy Input to the Tank with a PI Controller:**

q = q_{s} + Kc*(Tr – Tm) + (Kc/τ_{i})*∫(Tr – Tm)dt

Kc = Proportional Gain of the Controller

τ_{i} = Integral Time Constant, min

**Energy Required to Maintain Steady-State:**

q_{s} = W*Cp*(Tr – Tis)

**Define the Error Term as a First Order ODE:**

d(errsum)/dt = Tr – Tm errsum = 0 at t = 0 steady-state (before you mess it up by changing something)

**Substitute into PI Controller Equation:**

q = q_{s} + Kc*(Tr – Tm) + (Kc/τ_{i})*(errsum)

**Parameters for Solution:**

rho*V*Cp = 4000 kj/deg C W*Cp = 500 kj/min-deg C

Tis = 60 deg C Tr = 80 deg C

tau_d = 1 min tau_m = 5 min

Kc = 50 kj/min-deg C tau_i = 2 min

**Questions:**

- Caculate the open loop performance (set Kc = 0) of this system when the system is initially operating at design steady state at a temperature of 80°C, and inlet temperature Ti is suddenly changed to 40°C at time t = 10 min (the dreaded ‘step’ change). Plot the temperatures T, T0, and Tm to steady state, and verify that Padé approximation for 1 min of dead time is working properly.
- Calculate the closed loop performance of the system for the conditions of part 1 and the baseline parameters from the Table. Plot temperatures T, T0, and Tm to steady state.
- Repeat part 2 with Kc = 500 kJ/min×°C.
- Repeat part 3 for proportional only control action by setting the term Kc/tI = 0.
- Put limits on q so that the maximum is 2.6 times the baseline steady state value and the minimum is zero. Demonstrate the system response from baseline steady state for a proportional only controller when the set point is changed from 80°C to 90°C at t = 10 min. Kc = 5000 kJ/min×°C. Plot q and qlim versus time to steady state to demonstrate the limits. Also plot the temperatures T, T0, and Tm to steady state to indicate controller performance