# Model equations for batch reactor

A

#### Anonymous

I have available reactor data

I have my model equations

I'm supposed to use a PID controller to optimize a batch reactor for a certain consecutive reaction where temperature is my control variable and coolant flow rate is my manipulated variable

I'm conversant with java and visual basic programming

My predecessor employed Euler's method to simulate his algorithm...I want to use Runge-Kutta cos of accuracy.
I know the basic algorthm for a PID controller but how do I make use of my model equations??

P

#### Pasi Airikka

Hello,

If I haven't misunderstood you, the solution is quite simple...

If you have a set of ordinary differential equations you need to solve, you solve them using whatever ODE solver, e.g Runge-Kutta method. However, you have to fix a control period for PID control to a constant value. That is, your PID control needs to operate at fixed control (sampling) instants. Therefore, during each control period your ODE solver (RK) solves the equations using several steps based on different time instants but the PID controller output is frozen (ZOH = zero order hold) to a value given at the latest control period.

I tried to sketch the procedure below. The tick marks (labelled by A,B,C...) denote the control periods. The control period is to be a constant. During each control period, the ODE solver takes its steps e.g. 5 steps (labelled by 1-5) to solve the equations. For each iterations (1-5) the PID controller output is held constant using its latest value (e.g. at time A) until it is updated (e.g. at time B).

A B C D
---|-1-2-3-4-5-|-1-2-3-4-5-|-1-2-3-4-5-|-1-2-...
<----------->
(control period)

Actually, it does not make difference what ODE solver you use. The procedure is still the same.

With regards,
-P. Airikka

S

#### Scott

Thanks 4 ur response P Ariika.
Please can I have ur email addy so I can reach u personally?

-Scott