Real Time Implementation of Incremental Fuzzy Logic Controller for Gas Pipeline Corrosion Control

A robust virtual instrumentation based fuzzy incremental corrosion controller is presented to protect metallic gas pipelines. Controller output depends on error and change in error of the controlled variable. For corrosion control purpose pipe to soil potential is considered as process variable. The proposed fuzzy incremental controller is designed using a very simple control rule base and the most natural and unbiased membership functions. The proposed scheme is tested for a wide range of pipe to soil potential control. Performance comparison between the conventional proportional integral type and proposed fuzzy incremental controller is made in terms of several performance criteria such as peak overshoot, settling time, and rise time. Result shows that the proposed controller outperforms its conventional counterpart in each case. Designed controller can be taken in automode without waiting for initial polarization to stabilize. Initial startup curve of proportional integral controller and fuzzy incremental controller is reported. This controller can be used to protect any metallic structures such as pipelines, tanks, concrete structures, ship, and offshore structures.


Introduction
Natural gas (NG) transportation pipeline network systems are similar to national power transmission networks and are used for transporting natural gas (NG) across a country for thousands of miles from different source stations to multiple destinations.This underground insulation coated iron pipeline network is operating at a high pressure of 90 bars.Corrosion is a phenomenon by which metal is oxidized and etched away naturally contributing to material loss.Corrosion of this pipeline leads to reduction of wall thickness and the design life of the pipelines, gas leakages, environmental pollution, fire hazards, and gas supply disruption.This may lead to major manmade disasters like gas transportation pipeline explosions.Corrosion reduces the life of metal structures, oil and gas transmission underground and undersea pipelines, storage tanks, offshore platforms, and so forth.
Corrosion is an electrochemical process.It can be controlled by impressing current in gas pipeline (which acts as cathode of corrosion cell).Basics on pipe to soil potential measurement (PSP) and design details on pipeline corrosion control by impressed current cathodic protection (ICCP) method are available in [1].Conventional transformer rectifier (TR) units which are used in cathodic protection (CP) system uses multitapped secondary transformer [2].Precision regulation at output is not possible with this conventional system and normally it demands more human intervention.ICCP Anode bed design details are explained in [3].Pipe to soil potential (PSP) is the corrosion healthiness indicator of the pipeline.To measure PSP, half-cell [4] is required.Criteria for cathodic protection are given in [5,6].Experimental setup for corrosion studies with liquid electrolyte is illustrated in [7].Pipeline corrosion control can be represented as electrical equivalent circuit [8].ICCP can be applied for gas insulated cables as well [9].There will be wide variation in pipeline coating resistance, soil pH value, soil resistance [10], and so forth, along the pipeline.Accurate modeling of pipeline corrosion process is difficult with these many affecting factors [11].ICCP prolongs the life of pipelines [12].
Proportional integral (PI) controller based corrosion control is reported in [13].Autotuning [14] can be implemented in PI controlled ICCP systems.PI controller works well once initial polarization process is completed.In pipeline CP corrosion control system, for initial polarization it takes 24-72 hours.A Corrosion controller is required to be put in automode even during the initial polarization period.Transformer rectifier (TR) tap changing process is automated using computer [15] unit; due to inherent characteristic of tap change, it does not deliver smooth output change.
Corrosion prevention decreases environmental pollution and improves economics [16].Underground metallic pipelines are primarily protected by coatings.Even in good quality coatings, coating defects may exist.Impressed current cathodic protection is used to protect pipelines from coating defects [17].When pipeline is laid underground, soil acts as electrolyte in a corrosion cell and corrosion occurs in metal pipeline primarily due to differential corrosion cell.By impressing current to the pipeline, the entire structure is made to become a cathode of the corrosion cell [18].Impressed current corrosion controller should be dynamic enough to protect pipelines from variation in coating defects [19].The main objectives and requirements of cathodic protection (CP) systems are to prevent external corrosion throughout the design life [12] of the pipeline by impressing sufficient current to the pipeline.Optimum impressed current has to be maintained.Under current will result in corrosion and over current will affect coating bonding [13].
Fuzzy incremental controller is reported here to control the corrosion in underground metallic pipelines and its performance is compared with conventional proportionalintegral (PI) controller.This controller can be taken in automode from zero hours of initial polarization process.For corrosion process control, when the set point and process value (PSP) become equal, output should not become zero and it should be in its previous value in a stay put condition.Fuzzy incremental controller output varies the single phase AC.Varied AC is rectified, filtered, and fed to pipeline for corrosion control purpose.

Impressed Current Cathodic Protection
Corrosion of most common engineering materials at nearambient temperatures occurs in aqueous environments (electrolyte).A galvanic series [1] is a list of metals and alloys arranged according to their relative corrosion potentials in a given environment.When two metals are electrically coupled in an environment, the more negative (active) member of the couple will become the anode in the differential corrosion cell, and the other one becomes the cathode.Figure 1 shows the simple corrosion control using impressed current cathodic protection method.
The electrochemical nature of the corrosion process provides opportunities to detect and mitigate corrosion of underground structures.When a piece of metal is placed in an electrolyte, a voltage will develop across the metal electrolyte interface.Voltage difference between a metal and a reference electrode is called pipe to soil potential (PSP).This pipe to soil potential measurements can be used to estimate the relative resistance of different metals to corrosion, in a given environment.For soil environments copper-copper Sulfate reference electrode (CSE) is widely used to measure PSP.Cathodic protection is a technique to reduce the corrosion rate of a metal surface by making it the cathode of an electrochemical cell [20].This is accomplished by shifting the potential of the metal in the negative direction by the use of an external power source (referred to as impressed current CP).Protection current density of 0.03 mA/M 2 [4] is applied in the three layer polyethylene coated pipelines.An impressed current cathodic protection (ICCP) system applies a negative (conventional current flow) potential to the metal structure to be protected and a positive potential to the anode to be sacrificed as shown in Figure 2. When protection current ( cp ) just equals or exceeds corrosion current ( corr ), then the corrosion rate becomes negligible; that is, corrosion process stops.
Impressed current system use semi-inert (semi soluble) anodes to supply protective current.Since these anodes are relatively inert, they exhibit relatively noble electrochemical potentials.To produce charge flow in the direction to cathodically polarize a steel structure, it is necessary to connect an external power supply in series between the semi-inert anode and steel structure.Cathodic protection criteria [5,6] are as mentioned below: (i) metal-to-electrolyte potential chosen for a corrosion rate less than 0.01 mm/year (0.39 mils/year), (ii) polarized potential more negative than −850 mV CSE, (iii) limiting critical potential not more negative than −1,200 mV CSE.
Natural PSP of steel pipe is around −0.55 Volts (when Cu-CuSO 4 reference electrode is used).If PSP is less than −1.5 Volts (say −1.6 Volts), then the pipeline enters into over protection zone and it leads to coatings disbandment.If the PSP is more than −0.85 Volts (say −0.8 Volts) then it will enter into under protection zone, which will lead to corrosion.

Fuzzy Incremental Controller
Fuzzy logic deals with reasoning that is approximate rather than fixed and exact [21].Compared to traditional binary sets (where variables may take on true or false values), fuzzy logic variables may have a truth value that ranges in degree between 0 and 1.To implement fuzzy logic technique to a real application, it requires the following three steps.Fuzzification: convert classical data or crisp data into fuzzy data or Membership Functions (MFs).All machines can process crisp or classical data such as either "0" or "1." In order to enable machines to handle vague language input such as "SLIGHT, " "MEDIUM, " and "BIG, " the crisp input and output must be converted to linguistic variables with fuzzy components.To control corrosion in pipeline, error, change in error, and the output control variables must be converted to the associated linguistic variables.
Fuzzy inference process: combine membership functions with the control rules to derive the fuzzy output.To begin the fuzzy inference process, one needs to combine the membership functions with the control rules to derive the control output and arrange those outputs into a table called the lookup table.Table 1 shows the fuzzy rule designed for corrosion control.The control rule is the core of the fuzzy inference process, and those rules are directly related to a human being's intuition and feeling.
Fuzzy rule may be read as given below: Mamdani type of inference and centroid type of defuzzification is used in this work.Here error (difference between set point and actual process value) and change in error (difference between current error and past error) are the inputs to the fuzzy system.In fuzzy rule case, the conditions can be also partially satisfied to some degree (opposed to crisp rules), which has the nice effect to be able to interpolate between two rule conditions and there to achieve smooth transition from one state to the other in the induced fuzzy control surface.
Pipe to soil potential is the process variable.Input and output signal range is moderated to ±1 in Figure 3.If the error is say positive small (PS) (for instance set point is −1.2 Volts and actual process value is −0.9 Volts, then the error is 0.3)  and change in error is positive small (PS), the output should increase to small extent, that is, positive small.Error shows the magnitude of the difference between set value and process value, whereas change in error shows the error direction.Method of improving performance of PI type fuzzy controller is given in [22].Fuzzy logic controller with resetting action is discussed in [23].Fuzzy logic controller basic is discussed in [24].Theoretical analysis of a fuzzy controller with unequally spaced triangular membership function is available in [25].PID controller using a simplified Takagi-Sugeno rule scheme is tried in [26].Here fuzzy incremental controller is developed and implemented to control underground metallic gas pipeline.Performance of fuzzy incremental controller is compared with conventional PI controller.Various types of PID controllers available are reported in [27].Defuzzification criteria and classification are discussed in [28].Theoretical aspects and fuzzy modeling is discussed in [21,[29][30][31][32].
The error signal is defined as () = Set point (th sample time) − Output (th sample time).The change in error is defined as Δ() = () − ( − 1).The operation of PI type fuzzy logic controller (FLC) can be described by () = ( − 1) + Δ(), where  is the sampling instant and Δ is the incremental change in controller output.Each of the rules of fuzzy logic controller is characterized with an "IF" part called antecedent and "THEN" part called consequent.If the conditions of antecedents are satisfied, then consequents are applied.Error "()" and its change "()" are the inputs or antecedents and change of control "Δ()" as the output or consequent of rule base.Scaling factors in fuzzy controller are very similar to controller gain in a conventional controller which describes the particular input normalization and output denormalization.Hence, these scaling factors are very important with respect to controller stability and performance.A set of rules are defined using the available expertise for input and output relationship of fuzzy controller.These rules are defined using the linguistic variables.If there is a sustained error in steady state, integral action is necessary for a conventional control system.The integral action will increase the control signal if there is a small positive error, no matter how small the error is; the integral action will decrease it if the error is negative.A controller with integral action will always return to zero error in the steady state.
Problems with integrator windup have to be dealt with.Integral windup occurs when final control element saturates in a close loop control system, the control action stays constant, but the error will continue to be integrated, and the integrator winds up.The integral term may become very large and it will take a long time to wind it down when the error changes sign.Large overshoots may be the consequence.
It is often a better solution to configure the controller as an incremental controller [33].An incremental controller adds a change in control signal Δ to the current control signal The controller output is an increment to the control signal.It is an advantage that the controller output is driven directly from the integrator, and then it is easy to deal with windup and noise.A disadvantage is that it cannot include differential action well.The output from the rule base is therefore called change in output (  ) and the gain on the output has changed name accordingly to GCU.The control signal   is the sum of all previous increments: In ideal continuous PI controller, where  is controller output,   is proportional gain,   is integral time, and  is the error between the reference and the process output.
In digital control, and for small sampling periods   , the equation may be approximated by a discrete approximation.Replacing the integral by a sum using rectangular integration, an approximation is Index  refers to the time constant.Signals are written in lower case before gains and upper case after gains.The gains are mainly for tuning the response, but since there are two gains, they can also be used for scaling the input signal.The controller output is an increment to the control signal.It is an advantage that the controller output is driven directly from an integrator, and then it is easy to deal with windup and noise.The block diagram of fuzzy incremental (FInc) controller is shown in Figure 4.The output from the rule base is called change in output (  ) and the gain on the output has changed name to GCU.
The control signal   is the sum of all previous increments: where   is the sampling period.
The linear approximation to this controller is By comparing equations it is clear that the gains are related in the following way: Fuzzy incremental controller removes steady state error and gives smooth control signal.

Realization of Fuzzy Incremental Controller through Virtual Instrumentation. Modern virtual instrument (VI)
requires the most sophisticated hardware and software solutions to fulfill the requirements of the industrial, educational, and scientific applications [34].Virtual instrument (VI) is technique with which user designs and test function to meet their requirements through software [35].Fault diagnosis is easy with VI [36].What the Virtual Instrument emphasizes is not that every module is a piece of instrument, but through transferring the different software it can expand or constitute all kinds of instrument or systems with dissimilar systems.Monitoring of corrosion stray current using VI is reported in [37].
PSP of structure under protection is measured using half cell.It is fed as input signal to analog input module of the data acquisition card (DAQ).Desired set point (normally between −0.85 and −1.5 Volts) is entered manually.Controller module gives output based on the set point (SP), measured value (PV), and the fuzzy logic rules written.This controller operates in direct acting mode, that is, increase in error increases the controller output.
Fuzzy Controller module output is assigned to analog output module of DAQ.Output of the controller dynamically varies the triggering angle of TRIAC.Single phase AC power supply is fed to the TRIAC.Step down transformer (230/24 Volts) is connected as load to the Thyristor.Step down transformer output is rectified, filtered, and then fed to the pipeline.Purpose of the step down transformer is to reduce the voltage to nonobjectionable level and to meet the load side current requirement.
A newly designed and developed virtual instrumentation based fuzzy incremental controller front panel is presented in Figure 5(a).Block diagram (program written in LabVIEW) is shown in Figure 5(b).Over protection window will become red in color when PSP is less than −1.5 Volts (say −1.6 volts); under protection window will become red if the PSP is greater than −0.85 Volts (say −0.8 Volts).When the controller is set in Manual mode, set point will directly go as output.In manual mode if the set point is 1.5 then controller output will also be 1.5 Volts.Under the Auto PSP mode, it will try to maintain the PSP as per the set point.
In the block diagram, cp8.fs is the controller fuzzy logic link in which fuzzification and defuzzification [28] membership functions are assigned as shown in Figure 3.Here two fuzzy inputs (error and change in error) are used and one single output (controller output) is used.For corrosion control purpose, PSP is used as process value.Here formula blocks are used to convert the sign.In this design, PSP, controller output voltage, and controller output current are measured through DAQ input channels.Controller output is sent through DAQ output channel.
Experimental setup developed is shown in Figure 6.In this prototype, five-meter length, 10 mm diameter iron rod is used as specimen.It is coated with polyvinyl chloride (to make it similar to coated gas pipelines).It is buried in soil at a depth of one meter.Anode bed is placed five meters away from the specimen under protection.PSP is measured using copper copper sulphate electrode.Negative side of rectified and filtered DC is connected to the specimen under protection and positive side is connected to the anode bed.

Results and Discussions
Fuzzy incremental controller response is shown in Figure 7.When the set point is changed, process value tracks the set point without any error.From the figure it can be observed that when the set point is changed from −1.5 V to −1.7 Volts, it took much fewer seconds to reach the set point.Moreover there is no major overshoot or undershoot observed.Once the set point and process value matche, there is no oscillation or steady state error.Controller output is used to vary the firing angle of the thyrister (AC phase control).If the error is more, conduction angle will be more and vice versa.In the case of simple fuzzy controller, if the set point and process value (PSP) matche, it will give zero output.If it is the case here then it would have firing angle near to 180 ∘ in the phase control unit, which result in zero output.Then process value (PSP) will enter into under protection zone.By this time error will increase drastically which will give high value output to the phase control unit, which will result in over protection.Process value would be oscillating and never settle, whereas in fuzzy incremental controller, fuzzy controller output is added to the current output.In this case when the process value matches with the set point, output will not become zero.
Startup curve of the PI controller is given as Figure 8(a) and fuzzy controller is given as Figure 8(b).With the conventional controller, it has to be kept in manual mode during initial polarization period and it can be taken on automode only after two days of complete polarization, whereas it is not the case with fuzzy incremental controller.It can be put in automode from day one.This fact is substantiated with the initial startup curve (Figures 8(a) and 8(b)) of PI controller and fuzzy controller.Oscillation is observed in the output of PI controller during initial polarization process.When PI controller is used, it requires different set of proportional and integral constants during initial polarization and after polarization [38], but it is not the case with fuzzy incremental controller.Performance of fuzzy incremental controller and PI controller for step change input is shown in Figures 9(a performance comparison between fuzzy and PI controller is given in Table 2. Designing of PI virtual instrumentation corrosion controller is reported in [13].It requires the expertise to select the "" and "" constants.It is possible to select "" and "" constants using autorelay tuning [14].However, tuning process has to be started manually.Virtual Instrument based fuzzy controller for gas pipelines simulation is reported in [11].A closed loop control system incorporating fuzzy logic has been developed for Iraq-Turkey crude oil pipeline [38]; output of this controller is varying in steps.Design optimization of cathodic protection system is reported in [17]; controller performance optimization part is not touched.In computer controlled cathodic protection transformer rectifier [15], tap changing is controlled remotely using computer.Inherent disadvantages available with transformer rectifier Advances in Fuzzy Systems 7    unit are not eliminated.ICCP logic can be implemented in distributed control system (DCS) or programmable logic controller (PLC) [39].Designed controller outperformed in all aspects of time domain specifications such as settling time and under/overshoots transient behavior.Designed fuzzy incremental controller reaches the set point earlier than conventional PI controller.In the designed controller no oscillation is observed.Moreover startup (during initial polarization) curve of fuzzy incremental controller outperforms the conventional PI controller.Designed fuzzy incremental controller can be put in automode without waiting for initial polarization whereas it is not the case with PI controller.

Conclusion
Fuzzy logic controllers seem to be the most suitable controllers over the other conventional controllers for gas pipeline corrosion control system because of quick response to achieve steady state condition for any kind of disturbances; it is very flexible and easy to operate.Design and development of virtual instrumentation based fuzzy incremental corrosion controller has been implemented for underground gas pipeline.It prevents the pipeline corrosion by precisely controlling the pipe to soil potential at the desired level.In this paper, conventional PI and fuzzy logic incremental controller are compared; better time domain response is

Figure 1 :
Figure 1: Schematic diagram of impressed current cathodic protection.

Figure 2 :
Figure 2: Schematic diagram of impressed current cathodic protection.

Figure 5 :
Figure 5: (a) Front panel of VI fuzzy incremental corrosion controller.(b) Block diagram of VI based fuzzy incremental corrosion controller.

Figure 7 :
Figure 7: Controller performances when operated in Auto PSP control mode.

Table 2 :
Time domain specifications comparison.