# PID control of Batch process

Hello, I am a graduate student in process control field. I want to control batch process using PID controller.
I want to apply PID on batch system to make it follow certain
trajectory of controlled variable. In PID, based on the error Ysp - Ymeasured, I am calculating required change in manipulated variable, deltaU. [e.g for P only controller, deltaU = Kc*(Ysp - Ymeasured)]
My problem is how to calculate actual value of manipulated variable to plant. In continuous process case, we can add this deltaU to steady state value of manipulated variable. (e.g.: if at steady state %opening of valve is 30% and calculated deltaU is 10% then we make actual opening = 30% + 10%). But in batch process we don't have any steady state so I don't know How to calculate actual input to plant.
Rahul Gandhi
PS: I don't know to define batch process mathematically. These are the processes, which don't have steady state. Its model varies with the value of state. In linear case, it can be defined as dx/dt A(x).x(t) + B(x) u(t). Example of batch process is batch type fed batch reactor.
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
snipped-for-privacy@gmail.com wrote:

You shouldn't have a problem doing this. For a PID controller you should expect to have some nonzero error between your commanded and actual value because of the changing trajectory, but you may find that you can follow the trajectory more than closely enough.

I assume that your control is U + deltaU, where you have selected the 'U' initially. Given this, if you start each batch with deltaU = 0 and select a best value of U by design then you'll be doing as well as you can with a PID.

I have a book on control systems (see the link in my signature line). Its focus is on embedded software, so it probably has some content that's unnecessary for someone who wants to buy PLC's or other process control building blocks and apply them -- but then maybe not.
At any rate, you are asking questions that can be at least partially answered by a 3rd-year course in controls as taught to electronics or mechanical engineers. The books that I have on my shelf are:
"Design of Feedback Control Systems" by Hostetter, Savant & Stefani, "Feedback Control of Dynamic Systems" by Franklin, Powell & Emami-Naeini, and of course "Applied Control Theory for Embedded Systems" by me.

If the process dynamics are linear you can define them exactly with a transfer function, or with the state-space model you've given. You just need to define the starting state, which is easier to do in state-space, but can be done with a transfer function.

In the general case it is dx/dt = f(x, u, t), and you define some starting condition x(0) = x0. This accounts for anything from a linear time-invariant system to a fully nonlinear time-varying system (but not for states that experience discrete jumps).
Were I doing this I would certainly start by checking to see if I could model the system as a linear one, even if I had to treat it as time-varying linear (which would be appropriate either if the dynamics of the system changed with scheduled addition of reagents or if the dynamics changed gradually in response to the reaction). This keeps the analysis tractable.
Linear or not, you may find that a simple PID loop isn't the best answer. You may find that the best control rule is one that has a scheduled nominal drive to the plant, U(t), that is just what would drive the process correctly if everything went exactly right. Then you back this up with your PID loop, that only has to take out the errors in the process. This means the loop only has to respond to unanticipated dynamics, not compensate for predicted dynamics.
You _could_ go a step further and try to automatically update your U(t) from run to run; assuming that you have good repeatability from run to run this should give you good results. I have done this, with limited success -- we found out after we did it that the plant varied too much from one run to the next, and we did so at a point in the project that we couldn't take the time to fix the plant. None the less, this approach has a lot of promise _if_ you have time to play with it and _if_ your plant is repeatable. I wouldn't try it unless your need for precision is extreme, and is matched by a very repeatable plant.
--

Tim Wescott
Wescott Design Services
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Although your Kc*(Ysp - Ymeasured) is not wrong, it's actually easier to use the incremental algorithm.
Using the incremental algorithm, you don't actually calculate the value of the manipulated variable, but you calculate a delta, and then add it to the previous value of the manipulated variable. So using this incremental algorithm you'll get: new manipulated variable = old manipulated variable + delta, with delta = proportional control action + integral control action, with proportional control action = Kc [ error(now) - error(last cycle) ] and integral control action = Kc/Tint * error(now) the error is of course your (Ysp - Ymeasured)
Ysp must follow the required batch sequence trajectory.
Just be caerful about the units of the integral control time constant Tint which is in terms of cycle time. I.e. if your algorithm executes every 2.5 ms, the units of Tint is in (2.5 ms). Very short integral time constants will make the loop unstable. A rough guess for the Tint for a temperature loop might be 2 minutes. So with a scan time of 2.5 ms, the value for Tint = 2 * 60 * 1000 / 2.5 (or something like this, how many 2.5ms goes into 2 minutes again?)
The accuracy of your calculation could become a problem if you have very fast processing cycle and a very long integral time constant, because the delta might become smaller than the accuracy of your controller. Then it might be worthwhile to put a delay in so that your cycle time is longer.
Pieter Steenekamp
Tim Wescott wrote:

<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Thank you Tim and Pieter for valuable suggestions. Your comments has help me solve my problem.
As suggest by Tim, I started with some reasonable value of U(t=0) and then started PID algorithm (velocity algorithm as suggested by Pieter) and the PID is preforming satisfactorily. Tim, I will try to find U(t) which makes y(t) follow trajectory and then add PID to make correction, if needed. It seems logically efficient.
Thank you very much. Regards, Rahul Gandhi
pieter steenekamp wrote:

<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
wrote:

With LT time must be zero - but state value at t=0 may not be zero
With State Space system - time and initial values can be varied