**2.1. Voltage to current converter "V/I" circuit**

A voltage to current converter is basically a circuit which delivers a constant current with a variable voltage. The voltage changes with the change of load. The circuit used here is the XTR105 from Texas Instruments, which converts the 0 to 5 volts to a 4 to 20 milliamperes through the setting of the gain resistor RG. This is the perfect signal to drive the control valve. RG, the gain resistor is given by:

**Figure 5.** Voltage to current circuit

The National Instrument Data Acquisition Toolbox™ provides functions for connecting MATLAB® to data acquisition hardware. The toolbox supports a variety of DAQ hardware.

With it, one could configure data acquisition hardware to read data into MATLAB or SIMULINK for immediate analysis. One can also send out data over analogue or digital output channels provided by data acquisition hardware. Depending on which card is used, one can configure several channels, as input or output, digital or analogue. The card is interfaced to the process through a screw type connectors SCB-68 Quick Reference Label.

Data Acquisition Toolbox lets you make a variety of measurements directly to MATLAB or SIMULINK, without the need to convert the data, so one can directly read the pH from the probe through the signal conditioning circuitry. In our case, only analogue input channel0

A voltage to current converter is basically a circuit which delivers a constant current with a variable voltage. The voltage changes with the change of load. The circuit used here is the XTR105 from Texas Instruments, which converts the 0 to 5 volts to a 4 to 20 milliamperes through the setting of the gain resistor RG. This is the perfect signal to drive the control

**2. Data acquisition** 

Figure(4) shows the real connector board.

**Figure 4.** Interfacing connecting card to PCI 6221

**2.1. Voltage to current converter "V/I" circuit** 

and output channel0 are used.

valve. RG, the gain resistor is given by:

$$\mathbf{R}\_{\mathbf{G}} = \frac{2\mathbf{R}\_1 \left(\mathbf{R}\_2 + \mathbf{R}\_Z\right) \cdot 4\left(\mathbf{R}\_2\mathbf{R}\_Z\right)}{\mathbf{R}\_2 \cdot \mathbf{R}\_1}$$

And the load current I0 is given by:

$$\mathrm{I}\_{\mathrm{O}} = 4 \,\mathrm{mA} + \mathrm{V}\_{\mathrm{IN}} \times \left(40 / \mathrm{R}\_{\mathrm{G}}\right)^{\mathrm{+}}$$

Where VIN is the input differential voltage in volts applied between pin 13 and pin2 and RG is the gain resistor in Ohms. It could be noticed that with no input voltage, the output current is 4mA. Transistor Q1 conducts the majority of the signal dependent4-20mA loop current. Using an external transistor isolates the majority of the power dissipation from the precision input and reference circuitry of the XTR105, maintaining excellent accuracy.

The output current of the XTR105 is directly fed to current to pressure converter (I/P) which in turn controls the opening and closing of the control valve.

### **2.2. Control valve**

The valve is opened and closed according to controlling action according to the added desirable HCL solution. The calibration of the valve opening to the input current is shown in table(1); and Its behavior is shown in figure (6). It is clear that the relationship is linear.


**Table 1.** Output current in terms of input voltage

**Figure 6.** Voltage to current conversion

### **2.3. Software**

After discussing the hardware required and the calibration of the equipment, we devote the rest of this chapter to the software development. In this project we develop the pH control strategy using SIMULINK fuzzy controller and compare it with the PID controller using different currently available tuning techniques. But before going into that, let's see first the behaviour of the pH.

## *2.3.1. PH behaviour*

Before the fuzzy controller is discussed, a major problem inherent into the pH is highlighted. That is the severe non linearity inherent into the pH . Though the PH changes linearly from zero to two and from nine to fourteen, but unfortunately, it oscillates between two and nine. This is known as titration curve. This renders any linear control strategy inefficient, including the three term controller. This explains the complete deficiency of the PID controller, no matter how small is the gain chosen. (See figure (7)).

Figure (8) shows online titration curve. When reagent flow first starts, the pH only changes minimally. This results in a low process gain. But, as more reagent is added, the pH suddenly changes by a large amount, resulting in a high process gain. This titration curve shows the degree of difficulty of controlling the pH . So due to this high non linearity, it is extremely difficult to use any linear technique to control the pH . This has open the door to look at other alternatives, one of them is the use of fuzzy control as it was mentioned earlier.

**Figure 7.** Titration curve obtained experimentally

250 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

After discussing the hardware required and the calibration of the equipment, we devote the rest of this chapter to the software development. In this project we develop the pH control strategy using SIMULINK fuzzy controller and compare it with the PID controller using different currently available tuning techniques. But before going into that, let's see first the

Before the fuzzy controller is discussed, a major problem inherent into the pH is highlighted. That is the severe non linearity inherent into the pH . Though the PH changes linearly from zero to two and from nine to fourteen, but unfortunately, it oscillates between two and nine. This is known as titration curve. This renders any linear control strategy inefficient, including the three term controller. This explains the complete deficiency of the

Figure (8) shows online titration curve. When reagent flow first starts, the pH only changes minimally. This results in a low process gain. But, as more reagent is added, the pH suddenly changes by a large amount, resulting in a high process gain. This titration curve shows the degree of difficulty of controlling the pH . So due to this high non linearity, it is

PID controller, no matter how small is the gain chosen. (See figure (7)).

**Table 1.** Output current in terms of input voltage

**Figure 6.** Voltage to current conversion

**2.3. Software** 

behaviour of the pH.

*2.3.1. PH behaviour* 

**Figure 8.** Titration curve test online

It is also worth mentioning here that the relationship between the output voltage and the pH is linear, where a cretin voltage corresponds to a cretin pH level. This is shown in figure (9). This curve has been obtained experimentally. It shows that the output voltage varies between -0.5V and 0.5V for full pH swing. The relationship is given by:

Y 0.0126X 7.0119

**Figure 9.** PH vs. Voltage
