An Automated Method for Testing Process Parameters
Author: Monroe Weber-Shirk mw24@cornell.edu
Sensors, Signal Conditioning, and Calibration
Monitoring sensors requires conversion of the measured voltage into a physically meaningful unit. The data acquisition module of the Process Controller software uses conversion files to implement a variety of conversion algorithms including polynomials and correspondence tables as well as the calibration algorithms required for pH and dissolved oxygen. The pressure sensor conversion files make it easy to use pressure sensors to measure pressures in various physical units, to measure reactor volumes (of known cross sectional area), and flow rates (through devices with known relationships between flow and pressure drop). In addition to the application of a conversion to a physical unit it is possible to calibrate the pressure sensor output to a specific value by changing an offset.
pH Sensors
pH sensors produce a voltage output in the range that would normally be easy to measure using standard data acquisition hardware. Unfortunately, the impedance requirement for a pH sensor is orders of magnitude higher than the inputs of standard data acquisition hardware and thus a signal conditioning circuit must be used to amplify the pH sensor output. The circuit consists of unity gain amplifiers that have less than 0.1 pA input leakage current (anonymous , 1993). A circuit diagram is available at http://ceeserver.cee.cornell.edu/mw24/Labdocumentation/pH%20Circuit.pdf. The Process Control software includes automatic pH buffer recognition and piecewise linear calibration between buffers.
Pressure sensors
We use 1 psi (7 kPa) and 30 psi (200 kPa) pressure sensors (Omega sensor models PX26-001DV, and PX26-030DV) in our laboratory to measure water depth, reactor volumes, flow rates, and head loss. These sensors have maximum output voltages of 16.7 mV and 100 mV respectively with a power supply of 10 V. We use the differential pressure model since the sensors can be used to measure gage pressure or differential pressure. The sensors can directly measure water pressure although the electrical connections must be kept dry.
The Process Control software converts the voltage output from the pressure sensors into the physical units of water column height or pressure using linear conversion algorithms. The sensors can also be zeroed or set to a measured value using a one point calibration.
Dissolved Oxygen
Dissolved oxygen probes produce a current in the pA range that is proportional to the oxygen concentration in the bulk solution. The signal conditioning circuit is designed to convert this very small current into a measurable voltage and to isolate the probe from the effects of fluctuations in the voltage level of the solution containing the probe. This isolation is critical if the solution is monitored with additional probes or if the solution is electrically connected to a building plumbing system or to any other voltage source. The circuit design is available at (http://ceeserver.cee.cornell.edu/mw24/Labdocumentation/Dissolved_oxygen/circuit.pdf)
Temperature
We use a linear temperature sensor coupled with a simple voltage dividing circuit such as the Omega sensor model OL703. The voltage output is converted to a temperature using a linear equation.
Controls
An #output control box designed and fabricated around the Basic Stamp® Microprocessors (Parallax 16 port BS2sx and 40 port BS2p BASIC Stamp® modules) is used for on/off control of up to six devices and for variable control of up to six peristaltic pumps. The Basic Stamp® microprocessor receives commands through the serial port from the Process Control software and then sets the values of its output ports.
Basic Stamp® microprocessor control box with ports for 6 on/off devices and 6 variable speed peristaltic pumps. |
We initially used the pulse width modulation capability of the Stamp® microprocessor to create an analog voltage output on one of the ports and then used that voltage to control a 4-20 mA output that could be used to control MasterFlex Peristaltic pumps. That approach continues to work well when we only need to control one pump, but our filtration experiments require computer control of 6 variable speed pumps. The pulse width modulation commands take too much time to execute and when we switched to six pumps the slow response of the Stamp® microprocessor caused a series of control and communication problems. We resolved that issue by adding analog output circuitry. The Stamp® microprocessor sets the values of the analog voltages by sending digital commands to three MAXIM MAX518 2-wire Serial 8-Bit Digital to Analog Converters. The peristaltic pump controls include start/stop and clockwise/counterclockwise rotation in addition to the 4-20 mA speed control.
Software for the Basic Stamp® microprocessor takes the command that it receives across the serial port from the Process Control software to set the output values of the I/O ports. Serial commands are sent one character at a time to the Stamp® microprocessor and each character received is acknowledged. The software controls information flow to overcome the lack of a serial buffer on the Stamp® microprocessor. We currently use both a single pump and a six pump version of the control box and they require different sequences of commands from the Process Control software. The software on the Basic Stamp® sends a version code to the Process Control software as the first response in a communication burst and that version code automatically configures the subsequent communication. The communication interface was designed to handle live connection of the control box to the Process Control software. The Process Control software reports status of the connection with the Basic Stamp® microprocessor and communication begins as soon as the physical connection is made.
The Stamp microprocessor control boxes have six 24 V outputs that can be used to control solenoid valves, pinch valves, relays, or other low current devices. The 24 V circuits include a pulse width modulation chip that reduces the voltage to the device to reduce power consumption and heating. This feature works well for solenoid valves since they can be held open with a relatively low voltage once open. The circuit design for the Stamp microprocessor controls is available at http://ceeserver.cee.cornell.edu/mw24/Labdocumentation/StampBox.pdf.
Process Control Software
The Process Control software runs five parallel processes during normal operation. The five processes are
- Data acquisition from the Data Server software using TCP-IP
- Calculation of output values, processing of rules to determine state changes, sending commands to the Stamp microprocessor, and logging of state changes and the rule that caused the state to change
- Data logging of sensor data as well as all user defined variables
- Graphical display of all sensor data as well as all user defined variables
- An event loop that responds to 20 user events to initiate processes such as sensor configuration, rule editing, pump calibration, and data server selection.
The parallel processes are asynchronous and share data through the use of code objects (LabVIEW SubVIs) that contain both data and methods.
A core feature of the Process Control software is the user programmable feature that facilitates customization of the control logic for specific tasks. The rule editor provides a programming environment for setting up states, control logic, set points, variables defined by links to external code, and selecting which user defined parameter controls each output in each state.
States
States represent different control configurations. For example, rapid sand filters could have several operating states including normal down flow operation, backwash, and filter to waste. Each of these states has different control settings (valves are in different positions) and each of the states has different rules determining when the state ends and which state is next. The Process Control software has independent #control settings for each state. The rule editor is used to set the value of each output control. Outputs can be set either to 0 or 1 or they can be set to intermediate values. If a fractional value between 0 and 1 is assigned to a Boolean output (such as solenoid valves) the Process Control software will toggle between 0 and 1 to attain the target value. If a fractional value is assigned to a pump speed control the pump will operate at the fractional value of its maximum speed. The parameters that are assigned to each output can be either constants or variables.
View of the controls used to set all of the Stamp® Microprocessor outputs. These controls can have different values for every state. The "output settings" in the middle column are drop down menus containing a list of all the defined constants and variables. |
Rules
Rules are used to set the exit conditions for states. A common #exit rule might be based on elapsed time in the current state, but it could also be based on sensor values or on a parameter that is calculated from a combination of sensors and other parameters. At a water treatment plant, backwash might be automatically initiated after 72 hours in the down-flow state, when pressure drop across the filter exceeds 1 m, or when the filtered turbidity exceeds 0.05 NTU. Each state can have multiple exit rules and the rules can have multiple conditions. The rules are executed and the output settings are updated approximately 20 times per second with the execution speed controlled by the software running on the Stamp microprocessor. Rules with multiple conditions are used when both conditions must be true simultaneously and thus create a logical "and" condition. Multiple rules are executed sequentially and the first rule that is true will cause the state to change to the state selected by that rule. Thus, multiple rules create the logical "or" condition, but with the added feature that each condition can have a different outcome. This feature is useful for handling emergency conditions that then cause the process to shutdown or for creating programs that cycle through different states depending on measured process values.
Rule that ends the state named "BW filter after challenge" when the time in that state exceeds the set point "backwash (filter) time". The rule also indicates that the next state will be "Acid wash". |
External logic
LabVIEW executables can be enabled to connect to external code. This capability makes it possible to easily extend the capabilities of the Process Control software. The external code must be designed to meet specific requirements for the data types of inputs and outputs. An external code interface has been created to take a variable number of numeric inputs and produce a single numeric output. The external code can be used for a wide variety of functions including simple #math functions, a specialized function (such as one which sets a #coagulant dose based on raw water turbidity proportional-integral-derivative control that can be used to force a controlled parameter to a desired set point, and data acquisition functions that acquire digital data from instruments.
LabVIEW block diagram showing the external code that adds two variables or set points and returns the result. |
Screen shot from the Process Controller showing how inputs are sent to external code. In this case the external code estimates an alum dose based on measured raw water turbidity and a simple model that relates turbidity and alum dose. |
The programming environment for creating rules that determine exit conditions for states and which state to go to readily facilitates setting up the algorithms for controlling simple repetitive processes such as a sequencing batch reactors or rapid sand filters. For experimental purposes it is desirable to have the capability to systematically vary a parameter to test the performance of the process over a range of input values. This is accomplished via an external code that compares the number of specified replicates to a parameter that increments when the process controller enters a specified state. The output parameter can be used to control pump speeds, times, or can be an input to subsequent calculations.
Incrementing functions that increment linearly and that increment following a power law relationship are as follow:
The parameter, x, is an integer that increments from zero to a maximum value set by the user. The output parameters, ylinear and ypower could be used to vary a flow rate, a chemical dose, or any other parameter.
The two #increment functions are dependent on the state cycles. The state was set to cycle between states 1, 2, and 3 with the exception of a manual reset to state 0 and then to state 1 to illustrate how the increment function is reset. The power law function is useful when it is desirable to explore a larger parameter space. However, care must be taken to ensure that the controlled processes have the ability to deliver the desired range of the varied parameter.
Increment functions showing how the parameter varies as a function of the state. In this example the state cycled between states 1, 2, and 3. The increment state was 2, the number of replicates was 2, the reset state was 0, the y intercept was 200, the slope was 50, and the maximum value of x was 4. The power law relationship used a coefficient of 100 and a base of 1.5. |
The Process Controller can be configured to stop an experiment after the reaching the maximum value of the parameter. Otherwise it will reset the parameter to its initial value and begin the increment process again. It is also possible to systematically vary more than one parameter.
Data and process logging
The Process Controller creates two types of data files. The first column in both files is a time stamp and new files are created automatically at midnight. The datalog file contains a column for each sensor and for each variable. The datalog accumulates data at the rate set by the user. Sensor data is averaged over the data interval, but the instantaneous values are recorded for variables. The statelog file contains a row for every time the state changes. The row contains the state ID number and the name of the rule that caused the state to change. If the user caused the state to change that is indicated as well.
By using both the data and state logs it is possible to reconstruct the events that occurred during an experiment and correlate sensor and variable values with the state of the Process Controller. The data can be analyzed to troubleshoot and to determine what event caused the Process Controller to perform unexpectedly.
The Process Control software is designed to minimize control failures. If a sensor voltage goes out of range for a data acquisition channel or if communication with the Data Server is lost, all control outputs are turned off. The software responds to a power outage or Microsoft Windows restart by automatically opening up Process Control and Data Server software and returning the software to the same state as when it was shut down. Returning to the previous state requires opening up configuration files and then opening up the state log file to determine the state that the software was in when the computer was shut down.
Example application: Filter Test Apparatus
Results from operation of an experimental assembly (#photo and #schematic) designed for research on water filtration is provided here as an example of the Process Controller's use. The filter test apparatus (FTA) consists of 6 variable speed peristaltic pumps (Cole-Parmer, L/S series Masterflex pumps with remote control capabilities), 2 on-line turbidimeters (HF scientific, MicroTol 20053 and 20055), a 15 cm long by 2.5 cm diameter filter cell containing 0.4 mm to 0.5 mm sand, 4 solenoid valves (Farmington Engineering Series 6605), the Basic Stamp® microprocessor control box, the data acquisition system, a pH sensor (Oakton* pH Electrode model WD-35801-00), pressure sensors (Omega, model PX26-001DV), and a computer running the Process Control software.
A second computer running Process Control software is used to control the temperature of a tap water supply reservoir. The reservoir is instrumented with a temperature sensor and a pressure sensor. The temperature sensor is used to determine whether hot tap water or cold tap water should be added and the pressure sensor is used to determine if water needs to be added to keep the reservoir full. The reservoir contains an aeration stone and is constantly aerated to remove any supersaturated gases that are commonly found in cold surface waters and prevent evolution of gas bubbles in the filter column.
Schematic of the filter test apparatus showing the valve and pump configuration for pretreatment with aluminum sulfate. |
The experimental objective of the FTA is to test the effect of various chemical treatments of the filter media on the particle removal efficiency. The Process Controller is used to cycle through the following states for each test.
- A chemical treatment (for example application of alum) can be metered into the filter using different combinations of concentration, filter approach velocity, and duration.
- Clean water feed – A clean water feed follows the pretreatment step and is used to flush the residual pretreatment chemicals from the column and turbidity sensors.
- Particle Challenge – The particle removal efficiency is measured by applying a turbid water containing a clay suspension to the filter.
- Backwash – The accumulated particles and the chemical from the pretreatment step are removed from the porous media. Additional states can be used to flush the turbidimeter cells with clean water to remove any settled clay or to pump an acidic solution through the filter to ensure complete removal of the surface coatings created by pretreatment of the filter media.