Sunteți pe pagina 1din 11

Controller for the pH Control Apparatus

Written by Alma Lincoln


Spring 2007
In the pH control experiment of the chemical engineering senior unit ops laboratory,
streams of aqueous nitric acid (HNO3) and sodium hydroxide (NaOH) are combined in a
continuous stirred tank reactor in order to neutralize the pH of the resulting mixture. The
valves regulating flows are controlled electronically via a LabVIEW interface, which is
equipped with PID controllers to regulate reactor pH and liquid level with respect to
flows, as well as to control flows with respect to valve settings. The purpose of this
experiment is to familiarize the student with the process of automated PID control on a
system exhibiting nonlinear dynamics. This manual is intended to instruct students on
the use of the LabVIEW interface for the experiment.
LabVIEW User Interface
The following paragraph is taken from the document Operation Manual located in the
pH control apparatus computer, which includes a detailed description of the apparatus as
well as in-depth instructions.
The LabVIEW user interface allows the operator to manually, or
automatically control three inlet valves and one outlet valve, while
recording pH, flow, and vessel level. The interface is divided into five
sections responsible for recording and sending the required data. The five
sections are flow diagram, relative time plots, valves, PID controls, and
data logging.
A diagram of the interface is shown on the following page. Sections of the diagram are
numbered in red, and the functions of these sections are described subsequently. The
interface is accessed from the desktop of the apparatus computer. There it appears as an
icon labeled Shortcut to pH Cascade 04.

1. pH and level controllers These sections contain the PID controllers for the
reactor pH and liquid level. The user must select which variables will be used
to control pH and level. Level may be controlled by acid, base, or outlet flow,
while pH may be controlled by acid or base flow. The same flow cannot be
used to control both variables. Once the variables are selected, the user
specifies setpoints and the controller parameters K, I, and D. The user can
also activate data filtering to reduce measurement noise, and activate or
deactivate cascade control. This will be explained in the next section.
2. Flow controllers These sections contain PID controllers for the flow rates of
the acid, base, buffer, and outlet streams. These controllers are used during
cascade control: a setpoint is specified for the reactor pH or level, and the
controller maintains this setpoint by determining a necessary flow rate for a
particular stream. At the same time, another controller regulates the flow of
that stream by varying the valve setting, using the flow rate output of the first
controller as a setpoint. This counteracts the effects of valve sticking and
hysteresis. In these blocks the user may only specify setpoints and control
parameters; the choice of variables is fixed.
3. Valves This block displays the valve settings. These have units of percent
open, ranging from 0% to 100%. These settings may be set manually by the
user when control is inactive, or when a particular valve is not used by a
controller. When a valve is involved in control, its setting is displayed here.

4. Relative time plots Data are plotted in this section. The top plot displays the
setpoint and measured value for the pH over time. Below is a similar plot for
reactor liquid level. The user may adjust the axis scales of both plots.
5. Data logging In this section the user records and saves data. The user must
specify a name for the file and a time interval for recording data. The default
setting is one data point every ten seconds, though the user will likely prefer
to collect data more often. Data may be collected as often as one point per
second. Files are saved in the directory C:\pH data\ as .txt files, and may be
imported to Microsoft Excel for analysis.
6. Shut down This button is used to shut down the interface in order to exit the
program. The button needs to be held down for several seconds in order to
end the program. Manual valves need to be closed before shutting down.
7. Flow diagram In this block, a flow diagram of the system is displayed. It
shows schematically how the acid, base, and buffer tanks are connected to the
reactor, and how the reactor is connected to the waste tank. The flows of the
streams connecting all the vessels are displayed here, along with the liquid
levels and pHs of the reactor and waste tank. Inside the picture of the reactor
are buttons used to plot the reactor pH and level.
The pH of the waste tank must remain within a certain range, between 5 and
9, for safe disposal. If the waste tank pH leaves this range, the waste pH
indicator blinks red as a warning. In this event, the contents of the tank must
be neutralized before disposal.
8. Waste tank warning This area of the interface is where the waste tank
warning appears. This happens when the waste tank becomes too full, around
28 gallons. When this occurs, all flows are shut down until the tank is
drained. The drain is located on the wooden platform, directly in front of the
tank.
LabVIEW User Interface with Frequency Response
In addition to the interface described previously, there is an alternative version of the
interface which may be used to perform a frequency response analysis. In such an
experiment, the setpoint of a controlled variable is not held constant. Instead it is varied
as a sinusoidal function of time. This interface is also located on the desktop, where it
appears as an icon labeled Shortcut to pH Frequency Level 2. This is not to be
confused with Shortcut to pH Frequency Level, which is an earlier version of the
interface that only allows frequency response analysis on the level controller and not the
pH controller. It is displayed below.

This interface has a layout similar to the one previously described. However, it includes
an additional section, outlined here in red. In this section the user selects which setpoint
to vary. The options are pH, tank level, or NONE (meaning frequency response is
inactive.) Thus frequency response analysis may only be performed on one variable at a
time. When frequency response is active, the setpoint value specified in Block 1 is used
as the zero value around which the setpoint of this variable will oscillate. Below the
variable field, the user specifies the frequency of oscillations. Below the frequency the
user specifies the amplitude of oscillation, which has the same units as the controlled
variable. At the bottom of this section, the current value of the setpoint is displayed.
PID Control
This interface includes six PID controllers, all of which implement the positional form of
control:
_

t k
p k p K c ek e j D ek ek 1
I j 1
t

An in-depth discussion of this equation can be found on page 201 of Process Dynamics
and Control, Second Edition, by Seborg, Edgar, and Mellichamp. Note that this equation
is based upon discretely sampled values taken at intervals of t; it is not a continuous
function. Thus, pk is the controller output at time interval k. The proportional term, ek, is
simply the error, or difference between setpoint and measured value, at interval k; the

other two terms. The integral term is defined as the cumulative sum of errors up to
interval k, multiplied by the length of the interval and divided by the appropriate time
constant. The derivative term is defined as the difference between the error at interval k
and that at the previous interval, dividing by the length of the interval, and multiplying by
the appropriate time constant. The PID equation must be defined this way due to the
noncontinuous nature of data measurement.
In the block diagram for this interface is a series of frames, each of which handles a
different task. These tasks include data collection, control, plotting, saving of data, and
other functions. This manual will focus mainly on frames relevant to PID control. The
first two frames handle importing data from the FieldPoint software. The first frame,
frame 0, collects pH data:

The visual interfaces (VIs) that communicate with FieldPoint are seen on the left side of
the diagram, outside the loop. Here, the one on the top sends pH data into the loop, as
shown in this detail:

Note the feature highlighted by the red box: the data streams connect to the loop,
meaning that the data are carried through each loop of the program. This indicates that
the positional form of control is in use, as the looping of data allows the continuous
summation of error in the integral action.
Frame 1 shows the acquisition of level data:

Again, a detail:

Frames 6 and 7 handle control: 6 controls the reactor pH and liquid level, while 7
controls the flow rates. Diagrams of both frames appear below, 6 before 7.

The PID controllers, which appear as blue boxes, are separate VIs. These VIs calculated
the required output based on the positional equation discussed above, using the control
parameters entered into the interface by the user. The outputs from frame 6 are sent as
inputs to frame 7 for cascade control in the lower right of the frame. In frame 8,
controller outputs are defined as valve settings. Outputs from frame 6 are used for
regular control (seen in the lower right corner), outputs from frame 7 for cascade control
(upper right corner). On the following page is a detail of frame 8, in which the acid and
base valve settings can be seen.

The valve settings are then sent to frame 9:

Here, they are sent to a VI, labeled pH Valves, that converts valve settings to electronic
signals. This VI also takes in the current valve settings from a second FieldPoint VI, then
sends the new settings back to FieldPoint. A detail of the valve VI is shown on the next
page.

The block diagram for the frequency response interface is similar to that of the original
interface. However, two major differences exist. First, an additional frame is added to
the frequency response diagram. This frame defines a sinusoidal function to be used as a
setpoint, and lists what variables may use this function: here, reactor pH and level. The
function must take in two inputs, frequency and amplitude, which are supplied by the
user. A detail of the sinusoidal function, which is in frame 6 of the interface, appears
below.

Due to the addition of this frame, the functions of subsequent frames are moved back.
For instance, frame 7 of the frequency response interface does what frame 6 of the
original interface did.
Secondly, in order for the interface to make use of the sinusoidal setpoint, all instances of
the local variables pH Set Point and Level Set Point are set to take in the function.
These variables occur in three frames, shown below for comparison: frame 2 (also frame
2 in the original interface),

vs.
frame 7 (frame 6 in the original interface),

vs.
and frame 10 (frame 9 in the original interface).

vs.

Reference
Seborg, D., Edgar, T., Mellichamp, D. Process Dynamics and Control. 2nd Edition. Wiley
Publications. 2004.
Operation Manual.

S-ar putea să vă placă și