Improvement of Ultrasonic Pulse Generator for Automatic Pipeline Inspection

This paper presents the improvement of an ultrasonic pulse generator for a pipeline inspection gauge (PIG), which uses 64 transducers for inspecting distances up to 100 km with an axial resolution fixed at 3 mm and variable speeds between 0 and 2 m/s. An ultrasonic pulse generator is composed of a high-voltage (HV) MOSFETs, driver logic and an HV power supply. We used a DC-HV DC converter device as the HV power supply because it reduces the size of the ultrasound system considerably. However, pipeline geometry and inspection effects such as hammer and shock cause a variable pulse repetition frequency (PRF), producing voltage drops, poor quality of the HV pulse generated, failures in the dimensioning of defects and damage to devices by over-voltage. Our improvement is to implement a control scheme to maintain the high quality of the HV regardless of the variable PRF. To achieve this, we characterized three transfer functions of the DC-HV DC converter, varying the connected load to 10%, 45% and 80%. For the characterization, we used the least squares technique, considering an autoregressive exogenous (ARX) model. Later, we compared three control schemes: (1) proportional-integral-derivative (PID) tuned by simultaneous optimization of several responses (SOSR), (2) PID tuned by a neural network (NN) and (3) PI tuned by the analytical design method (ADM). The metrics used to compare the control schemes were the recovery time, the maximum over-voltage and the excess energy when the shock and hammer effects happen to occur. Finally, to verify the improvement of the HV pulser, we compared the ultrasonic pulses generated for various frequencies and amplitudes using the pulse generator with and without the control scheme.


Introduction
Every specific application of ultrasonic non-destructive testing (NDT) determines the parameters used to design the ultrasonic pulse generator [1,2]. In the case of automatic carbon-steel pipeline inspection, the pipeline inspection gauge (PIG) uses piezoelectric transducers due to their simplicity, sensitivity and cost [3]; but the electrical impedance of these transducers hinders the high-voltage (HV) pulse generator circuit design [4]. The transducers work in a pulse-echo mode, and their excitation voltage is set between −100 V and −20 V to ensure that ultrasound echoes are received with sufficient energy [5]. To comply with international standards [6,7], the PIG must inspect the complete pipeline circumference every 3 mm, and the pulse repetition frequency (PRF) of one transducer must not be higher than 600 Hz. One ultrasonic pulse generator excites several transducers through a multiplexer device; therefore, its PRF is higher than 600 Hz. The PRF is variable and non-controllable because it is related to the PIG speed, which varies for the pipeline geometry and inspection effects such as the hammer and shock. The HV power supply is one of the devices most affected by the mentioned speed changes since it transmits energy to all transducers, and a small change in its output voltage causes a series of problems such as: (a) variable amplification of the signal received, which increases existing noise; (b) damage to the components of the pulse generator circuit by over-voltage; (c) failures in wall thickness estimation [8], because the echoes between the inner and the outer wall of the pipe are related to some internal defects in the material, and the amplitude of these echoes allows the determination of the size of the defect found relative to the beam field [9,10]; and (d) null-control of the delivered power.
PIGs check carbon-steel pipelines used for the distribution of oil and water [11]. If the pipeline is in the order of kilometers in length, the PIG carries out an automatic inspection, where the circumferential inspection is made based on external markers and measurements from odometers and gyroscopes that allow the determination of the displacement of the PIG [12]. The angle beam and straight beam are the ultrasonic nondestructive evaluation (NDE) technologies most commonly used in automatic inspection of pipelines [13]. Many PIGs use the ultrasonic pulse-echo method (straight beam technology) to perform the automatic inspection of the pipeline because it gives better results than manual inspection or other techniques used to determine the safety of the pipeline [14]. The pulse-echo method allows volumetric inspection, which is possible because the mechanical waves are able to travel through the fluid and the walls of the pipeline. These waves allow technicians to detect internal and superficial defects, such as cracks that occur parallel to the surface, as well as corrosion and defects within the body of the pipeline [15]. The echo flight-time from both the inner and outer pipeline walls indicates the wall thickness.
The PIG must be able to inspect distances up to 100 km at speeds of 0-2 m/s [6,7,16]. The speed of the PIG inside the pipeline varies due to the geometry of the pipeline, the pressure of the fluid, girth welds and factors such as the movements of the Earth and other external effects. These factors disfigure the pipeline diameter and cause the PIG to get stuck for short intervals, producing the hammer and shock effects. In the case of the girth welds, there is one between every two adjacent standard pipe segments, so the hammer and shock effects cannot be ignored [17][18][19]. The hammer effect occurs when the pipeline delivers high inspection speeds [20]. Figure 1 shows our PIG in development; its traction system works through cups, which help it to be propelled by the fluid inside the pipeline. The ultrasonic system maps the whole circumference of the pipeline using 64 piezoelectric transducers (PT) of 5 MHz.  Figure 2 shows a typical ultrasound system for NDT, which is composed of an ultrasonic pulse generator or transmitter, a receiver, transducers, a logic-control unit, a storage system and a display unit [2,21,22]. The ultrasonic pulse generator consists of an expander, power MOSFETs, driver logic and an HV power supply. The receiver is composed of a limiter, a variable control amplifier (VCA), and an analog to digital converter (ADC). In our case, one ultrasound system has already been validated to measure thicknesses [23], and it has been used to develop a specialized technique for the on-line reduction of signals [24]. However, performing tests on the laboratory piping circuits, we found that the ultrasonic system has serious problems maintaining the HV excitation at a fixed level due to the changes in speed. The HV control in the ultrasonic pulse generator is necessary considering that our final goal is to use the ultrasonic system for automatic pipeline inspection. We used the DC-HV DC converter device EMCO Q02 (XP Power, Singapore) [25] like the HV power supply with the purpose of reducing the size of the ultrasonic pulse generator. The main advantage of the DC-HV DC converter is the small form factor, which makes it useful not only for our small ultrasonic pulser, but also renders it ideal for use in light sources, printers, capacitor charging and other applications, so the control of this device could be useful in other key research areas. Although some DC-HV DC converters are already commercialized with an internal closed-loop control, the quality of the output voltage can be improved by employing an external control scheme that not only regulates the output voltage, but also works as an element for monitoring. Having a control system that monitors the reflected power is very important when estimating the delivered power in ultrasound systems [26]. Figure 3 shows the behavior of the DC-HV DC converter device EMCO Q02 with the input voltage and the percentage of the connected load. For the characterization of the behavior of the DC-HV DC converter device, we used ten values of fixed voltage, starting at 0.5 V and increasing in units of 0.5 V until reaching an input of 5 V. At each input voltage value, we connected at the output precision resistors that represented 10%, 45% and 80% of the static connected load. We interpreted the load variation as the change in the PRF or the number of connected piezoelectric transducers.
The DC-HV DC converter has a linear behavior of the form V out = mV in + b, where m and b vary according to the connected load. The characterized values of m and b are shown in Figure 3. For example, in the case of shock: If the DC-HV DC converter has an input of 2.7 V and it has a connected load of 80%, which we interpreted as having 64 transducers excited to the maximum PRF, then the DC-HV DC converter generates 100 V. However, if the PIG instantly brakes, then with the same 2.7-V input, the DC-HV DC converter would generate almost 130 V at the output, which could damage the chips in the pulse generator circuit. In the case of the hammer effect, for example: If the DC-HV DC converter has 2 V at the input and it has a load of 10%, which we interpreted as having 64 transducers connected to a low PRF, then the DC-HV DC converter generates 90 V. However, if the PIG is accelerated instantaneously, then with the same 2-V input, the DC-HV DC converter generates almost 70 V at the output, so the ultrasound signals cannot be received clearly.  Different ultrasound systems [2,[27][28][29][30] use HV power supplies to excite the piezoelectric transducers, but these investigations did not focus on the generation of HV because the application they perform does not require a dynamically variable PRF. Some authors [26,[31][32][33] have presented the method of producing the HV power supply for their ultrasound system. However, these customized HV power supplies are too big to be used in a PIG. The DC-HV DC converter device is already used in ultrasound systems to reduce size [23,34]. However, due to the type of application only having portable equipment for manual inspection, no analysis was performed on the effect of HV drop on PRF. Improvements of the HV pulser circuit were focused on the addition of passive elements [8,35], the linearization of the MOSFETs' response utilizing a DC bias-controlled power MOSFET shunt with parallel inductors and capacitors [36] and the activated protection of the ultrasound receiver of the HV spikes [37]. Due to the type of application using a pulse generator circuit, the improvements mentioned above did not require improving the quality of the HV power supply, since they did not have the problem of dynamically variable PRF.
We chose the proportional-integral-derivative (PID) control scheme due to the linearity of the output of the DC-HV DC converter device. The main problem was determining the tuning process and the control law that would produce better results, mitigating the variations in voltage caused by hammer and shock effects. The tuning process should consider the following variables: the number of transducers, variable PRF, average desirable voltage, voltage range and the maximum voltage. Several in-line PID tuning techniques have been developed [38,39], which adjust the control gains according to the dynamic behavior of the system. However, a technique of this type would consume much computational resource owing to the number of operations required. Furthermore, the time between each control action is minimal in a PIG, because of the velocity of pipeline inspection. In this work, we tuned the PID control off-line considering the variables mentioned above, finding the control law and the gains that give a good performance of the ultrasonic pulse generator for automatic pipeline inspection with a dynamically variable PRF. The three discrete control schemes compared were: (1) PID tuned by simultaneous optimization of several responses (SOSR), (2) PID tuned by a neural network (NN) and (3) PI tuned by the analytical design method (ADM). We selected the SOSR technique [40,41] for the comparison because the experimental designs have proved useful for tuning PID systems where the variables that influence the desired output are known [38]. We chose PID tuned by NN with the control law proposed by [39], since it proved to have excellent results for fixed gains of the PID control, which is what we want to achieve at the end of this work. We selected PI control tuned by ADM for the comparison because it allowed us to discard the limitations of electronic components; it also enables us to force the error sequence to become zero when the closed-loop system is subjected to a specific type of time-domain input after a finite number of sampling periods [42].
This paper presents an improvement of the ultrasonic pulse generator via the PID control, which has global gains for the connected load. The load is interpreted as the variable PRF or the amount of connected piezoelectric transducers. The HV-control proposed improves the thickness estimation and protects the circuits used for HV excitation when the PIG changes its velocity dramatically due to the hammer and shock effects. The main advantage of this control is the use of global gains that allow the correct operation of the PIG for automatic pipeline inspection for any value of PRF between 0 and 600 Hz. Section 2 shows the design of the pulse generator circuit. Section 3 presents the materials and methods used. Section 4 describes the experimental methods and the results obtained. Section 5 presents the discussion generated by this project, and Section 6 outlines the conclusions obtained.

Ultrasonic Pulse Generator Design
Figure 4 shows our ultrasound system, proposed for automatic pipeline inspection. The HV multiplexer is the integrated circuit (IC) HV2321. The pulser device is the IC MAX14808, which internally is composed of the limiter an expander, power MOSFETs and the driver logic. The logic-control unit is shared by the FPGA Spartan XC3S500E and the microcontroller M430F2619. The storage system is via the NAND Flash memory chips MT29F128G08 in a RAID-6 architecture [43]. Besides, Figure 4 shows the HV control block proposed; which is composed of the operational amplifiers TL082 and OPA548F. This HV control block improves the thickness estimation and protects the IC MAX14808 when the PRF changes drastically. Although the microcontroller is responsible for computing the control operations, it was already part of the ultrasound system, so it was not considered an added device for the control block of the DC-HV DC converter device.  Figure 5 shows the ultrasonic pulse generator circuit, consisting of the pulser device MAX14808, The MAX14808 has embedded over-voltage-protection diodes and an integrated active return-to-zero clamp. Internally, the MAX14808 also has the T/R switch circuit to reject the HV and to obtain the low input voltage of the transducers for the LVOUT pins. An additional advantage of the device MAX14808 is that it does not need to use control MOSFETs to excite the system since it also has them integrated. Each channel of the MAX14808 is multiplexed by eight, via the multiplexer circuit HV2321, allowing us to work with up to 64 piezoelectric transducers using this system. We duplicate the entire system if more transducers were required for the pipeline inspection. The HV2321 is an analog switch with bleed resistors, compatible with applications requiring a large negative voltage. The bleed resistor eliminates voltage built up on capacitive loads of the piezoelectric transducers. The DC-HV DC converter is the EMCO Q02 device; it supplies the negative HV (VNN) for the 64 transducers through the pulser circuit MAX14808. Figure 6 shows the circuit proposed for controlling the HV DC converter. The digital to analog converter (DAC) output of the Texas Instruments microcontroller MSP430F2619 generates the output signal, which ranges from 0-3.3 V with a resolution of 10 bits. The operational amplifier OPA548F amplifies the analog signal of the DAC output, and its main advantage is that it can supply up to 3 A continuously. It is important to mention that we considered the analog control action type, since the PWM control action type could generate contrary effects on the HV pulse. The control feedback is performed using a voltage divider with precision resistors. Subsequently, a voltage follower and a voltage inverter are connected to read the feedback signal with the analog to digital converter (ADC) input of the microcontroller.

Materials and Methods
We used the development board MAX14808EVKit [44] for the testing. This board can work with different waveforms and adjustable output frequency. Additionally, the MAX14808EVKit has one RC circuit per channel (R = 1 Kohm, and C = 220 pF), the behavior model of which is similar to that of the piezoelectric transducer. The development board also has available connections for HV from an external source, and it is compatible with the development board MAXINT1 [44], which has a SPARTAN-3E FPGA Model XC3S700AN. The FPGA generates the control pulses, and the DC-HV DC converter device EMCO Q02 supplies the HV. The processing unit is the microcontroller M430F2619, manufactured by Texas Instruments. The mixed signal oscilloscope used was the KEYSIGHT Model MSO-X 4154A. The transducers used were the 5-MHz piezoelectric-type.

Characterization of the Transfer Function of the DC-HV DC Converter
For the ultrasonic pulse generator in automatic pipeline inspection, the HV signal has three primordial characteristics: (1) the maximum voltage (maximum overshoot), (2) the average desirable voltage (set point) and (3) the voltage range (allowable tolerance). Figure 7 shows graphically the characteristics mentioned. The first step for the control tuning was the characterization of the DC-HV DC converter device. We performed the test with a 5-V step input and percentages of 10%, 45% and 80% of a connected static load.  For the characterization, we considered an auto regressive exogenous (ARX) model for the simulation of the DC-HV DC device dynamics. Equation (1) shows the ARX model, where V(z) is the discrete measured output voltage of the DC-HV DC converter device, B(z −1 ) is the coefficients vector that considers the effect of voltage input at past moments, vector A(z −1 ) considers the effect of previous DC-HV DC converter outputs on the current, U(z) is the vector of the input voltage and E(z) is the additive noise that appears in the system. The advantage of the ARX model is that it takes into account the input and the additive noise influenced by the A(z − 1), which is the autoregressive operator of the DC-HV DC device [45].
The transfer function was estimated using the least squares technique. We expressed the ARX model as a function of the parameters and measurements. Equation (2) shows this expression, where k is the number of observations, E T (k) is the vector of the error in the measurements, P T is the parameter vector, Z T (k) is the matrix of measurements of (2m + 1)k dimension and m is the order model. The matrix Z T (k) is shown in Equation (3), where u is the input voltage and y is the output voltage.
With the analysis of the mean squared error (MSE) of the ARX model of Equation (2), we obtained the least squares estimate shown in Equation (4). Table 1 shows the transfer functions obtained for the responses of 10%, 45% and 80% of static load connected.

Control Scheme Selection
The second step was to propose three different tuning schemes for the PID control. The three discrete control schemes compared were: (1) PID tuned by simultaneous optimization of several responses (SOSR), (2) PID tuned by a neural network (NN) and (3) PI tuned by analytical the design method (ADM) for pole elimination. For these three discrete control schemes, the following conditions were maintained: (1) The microcontroller M430F2619 generates via an internal DAC module the analog voltage for the operational amplifier OPA548F. (2) The OPA548F supplies the DC-HV DC converter device EMCO Q02. (3) The microcontroller performs an estimation of action control every 224 µs, which is ten-times faster than the converter transient response and the minimal time for the action control computing in the microcontroller. (4) The action control (τ(n)) has an upper value of 1023 digital units and a lower value of 0. (5) If the action control is lower than 0, then the microcontroller generates the value of 0 digital units. (6) If the action control is greater than 1023 digital units, then the microcontroller generates the value of 1023 and is considered saturated.

PID Tuning by Simultaneous Optimization of Several Responses (SOSR)
The first method for tuning was SOSR [40,41]. The advantage of this method is that it considers all factors of the implementation, such as the saturation of the control and the dead zone for the integral action. We proposed a dead zone for the integral action of this tuning method due to problems with overshooting in discrete controllers [46], so we activated the integral action only when the voltage of the DC-HV DC converter device was lower than the absolute value of 5 V to the set point. Equation (5) shows the control law, where Kp is the proportional gain, Kd the derivative gain and Ki the integral gain. n appoints the present moment for the computation; therefore, n − 1 indicates a result of the previous cycle.
τ(n − 1) + Kp e(n) + Kd (e(n) − e(n − 1)), ∑ e(n) = 0 if |e(n)| > 5v (5) For the experiment, we performed a fractional factorial design of 1/2 with four factors. In this way, only half of the possible combinations were tested, decreasing from sixteen to eight. However, there were two repetitions, meaning that we repeated the runs two times; also, we considered four center points in the test, giving a total of twenty runs. The factors were Kp, Kd, Ki and the percentage of the connected load. The Kp gain was between the limiting values of 0.1 and 10.00; the Kd gain was between 0.01 and 3.0; the Ki gain was between 0.0 and 1.0; and the percentage of the connected load was between 10% and 80%. In the center points, we tested the system with the median value of each factor. Table 2 shows the experimental results. The order of the data corresponds to the order in which we performed the tests. The set point was 100 V. The responses considered for the experimental design were the maximum voltage (Vmax), the average set point (Vmean) in steady state and the voltage range (Vrange) in which the DC-HV DC converter voltage output oscillates with the applied control.  In the first run of each factor combination, we carried out the experimental runs without the connection of the pulser device MAX14808, only connecting a static load. In this way, we made sure that the tuning tests would not damage the devices of the ultrasonic system. In the second run of each factor combination, we carried out the runs via simulation tools with Simulink TM and MATLAB TM . For the simulation, we used the three discrete ARX models of the DC-HV DC converter device (showed in Table 1), the control algorithm and a time of 224 µs between each step of the simulation. Figure 8 shows the experimental setup. For the analysis, we used a certainty level of 95%, and we excluded the connected load factor for this analysis. In this way, the analysis only considers the variation of the voltage output as a function of the control gains. Equation (6) shows the approximation for Vmax, which had an R 2 of 87.66, where R 2 is the coefficient of determination (adjustment ability), and it provides a measure of the likely accuracy of future outcomes, predicted by the model [38]. Equation (7) shows the approximation for Vmean, with an R 2 value of 94.14. Equation (8) shows the approximation for Vrange, with an R 2 value of 93.53. It is important to mention that in this work, the discussion is limited to showing the control tuning method for the DC-HV DC converter device, considering all the technical parameters for its implementation. The range of control gains and the effect of interaction between control parameters are essential points that can be analyzed in the future; however, we did not carry out this analysis as a part of this work.V max = 149. 38 For the PID control tuning, we used the technique of Derringer and Suich of simultaneous optimization [40,41]. Technicians recommended using an adjusted R 2 greater than 70% for each model to apply this optimization technique; in addition, each model must fulfill the normality, constant variance and independence of the residuals [47]. Derringer and Suich's method allows us to define a function in the factor space that computes the composite desirability (d G ) of the product at each point. The objective of the method is to maximize d G to find the optimal point. The first step is to transform each predicted response Y into a value within a function of desirability known as d. The transformation for Vmax is shown in Equation (9). Whereas the goal for Vmax was to minimize its value, for d 2 , the goal was to reach a target value of 100 V, with a desirability function between 95 and 105, and for d 3 , the goal was to minimize the voltage range.
Finally, we computed all the possible multiplications of the three desirability functions d 1 , d 2 and d 3 to find d G where it presents the maximum value. The results gave values for Kp = 0.1, Kd = 3.0 and Ki = 0.0606.

PID Tuning by Neural Network
The PID tuning by NN is a nondeterministic method that is useful for all possible scenarios. The algorithm used for the tuning process employs the back-propagation method. For the tuning process, we used the NN and the PID equation proposed by Hernández et al. [39]. The NN topology is shown in Figure 9, where V d (n) and V d (n − 1) are reference inputs of the desired voltage, V(n) and V(n − 1) are reference outputs of the real voltage outputs, w ij is the weight value of the hidden layer and v jk is the weight value of the output layer. The back-propagation algorithm looks for the minimum of the error function in weight space using the method of gradient descent. The combination of weights that minimizes the error function is considered to be a solution to the learning problem. The PID control law is shown in Equation (12), where τ(n) and τ(n − 1) correspond to the control action signals, e(n) represents the voltage error, Kp is the proportional gain, Ki is the integral gain, Kd is the derivative gain and n is the sample time. The experimental setup of the auto-tuning control with NN is shown in Figure 10. The main difference in our application versus that of Hernández et al. [39] was that we found a set of gains that allowed us to achieve the best results for the different load conditions without changing in-line the PID control gains. To achieve this, we used 3 epochs for the training of the NN. At each epoch, we changed the transfer function of the DC-HV DC converter (10%, 45% and 80% of static load connected). The global gains obtained were as follows: Kp = 8, Kd = 8 and Ki = 8.

PID Tuning by Analytical Design Method
The third method for tuning the controller was the ADM for a discrete time [42]. Figure 11 shows the experimental setup for the analytical design method. Equation (13) shows the transfer function of the digital controller. This method aims to eliminate the pole of the G(z) (which is z = 0.9528) and replace it with the pole z = 1, also finding a gain k that allows the system to have the desired response. Equations (14) and (15) show how to calculate the zero value a that eliminates the pole and how to calculate the gain k, respectively. T is the sample period of 224 µs between each step of the simulation. Kp and Ki are the proportional gain and integral gain, respectively.
We selected for the ADM the PI control because it has the advantage of eliminating the error in steady state in response to step type inputs. The transfer function of the digital controller is PI, and it is shown in Equation (16).
The first step for this tuning process was to find Ki. Because the DC-HV DC converter transfer function is of order one, its error in steady state against a step input is e ss = 1 Kv . We considered the additional constraint of the static velocity error constant kv with the value of 900; in this way, the error cannot be higher than de0.11 V for a step input of 100 V. We applied the final value theorem to the function G D (z)G(z) to find Kv. The error in steady state is expressed in Equation (17). Ki gave a value of 19.6893.
The second step was to find Kp through Equation (14), equal to −0.9528, as shown in the Equation (18).
KiT − 2Kp 2Kp + KiT = −0.9528 (18) Solving for this system, Kp gives a value of 0.0911. Once we found Kp and Ki, they were substituted into Equations (14) and (15), giving the values of a and k as −0.9528 and 0.0933, respectively.

Results
We grouped our tests into three stages. The first stage was the selection of the control scheme; this stage was carried out by simulation. In the second stage, we tested the behavior of the control scheme for different step inputs. In the third stage, we tested the behavior of the system for different frequencies and amplitudes. The second and third stages were carried out using the ultrasonic system shown in Figure 12. We tested the eight channels of the pulser circuit, connecting two channels with 5-MHz piezoelectric transducers of the straight beam for immersion and the other six channels with the RC circuit included in the development board MAX14808EVSYS.

Selecting the Control Scheme
We performed two tests for the selection of the control scheme. The first test was for a 10% static connected load and 100-V step input of each control scheme. We chose the transfer function of 10% connected load because it was the function that had the most variation of the output voltage in relation to the input. The second test consisted of analyzing the behavior of the three control schemes when the PIG suffers from the hammer effect and braking. Figure 13 shows the behavior of the three control schemes for a 100-V step input and the transfer function of 10% connected load. Observing that the three control schemes have different behaviors, the PI control is the scheme that best fits the set point; however, it is a control with a slow response compared to the other two schemes. The PID tuned by SOSR is fast and fits the set point, but it has an over-voltage, which is within the established range of Equation (11). The PID tuned by NN is fast and adjusts to a fixed value; however, it presents an offset in relation with the set point. Step response for an input of 100 V.
The second test for the selection of the control scheme was the analysis of the control scheme responses for the shock and hammer effects. The most critical velocity change for the ultrasound system is the instantaneous braking of the PIG, which occurs when the PIG crashes due to a dent or deformation of the pipeline. According to our observations, the DC-HV DC converter (see Figure 3) raises its output voltage immediately, damaging the circuits of the ultrasonic pulser. The hammer effect causes a voltage drop that affects the amplitude of the signals received. This means that the information of a section of the pipeline may be lost until the HV approaches its pre-adjusted value. Figure 14 illustrates the testing of the three control schemes for a shock effect at 1 s and a hammer effect at 1.5 s. The simulation step was every 5 ms, and the resolution in the y axis was 0.0001 V.
For the shock effect at time t of 1 s, the simulation showed the behavior in the moment when the PIG went from being a speed of 2 m/s to practically stationary. The most critical parameter, in this case, is the excess energy when the output voltage is over 105 V (until the voltage is adjusted back to 100 V). In this case, a lower energy is best, since the control scheme should protect the chips of the pulser circuit from an over-voltage. Equation (19) shows how we computed the excess energy [11]. In Equation (19), a is the initial moment from which the summation begins, and b is the final moment for data acquisition. For the shock effect, we changed the transfer function from 80% to 10% of the connected load at 1 s of the simulation. Therefore, for Equation (19), a = 200, and data capture was stopped at 1.5 s, reaching b = 300. For the hammer effect, we changed the transfer function from 10% to 80% of the connected load at 1.5 s of the simulation. For the DC-HV DC converter, this is a drastic change of the load that produces a voltage drop; in this case, the control scheme that has the shortest recovery time (the time to return the voltage to 100 V with a limit of ±5 V) is considered the best. Data capture was stopped when the voltage reached the lower value of 95 V. Table 3 shows the comparison of the three control schemes. In the case of the excess energy generated by the shock effect, the PI control by ADM was the one that generated the most energy, for which reason it was dismissed as a possible control scheme. In the case of the maximum overshoot for the shock effect, the PID control tuned by SOSR generated the highest voltage value, reaching a value of 127.71 V, with an excess of 27.71 V that could damage the chips of the pulse generator circuit. In the case of the recovery time, the control scheme that suffered a voltage drop below 95 V was the PI tuned by ADM; the other two control schemes supported the load change without exceeding the limits for the hammer effect. Based on the results of the two tests, we selected the PID control tuned by NN for our ultrasound system. This scheme showed no excess energy in the response of the shock effect, did not generate any overshoot to the shock effect and did not generate a voltage drop in response to the hammer effect of the PIG. These results show that the PID control tuned by the NN control scheme assures the protection of the chips that are part of the pulse generator circuit against over-voltage for hammer and shock effects.

Control Testing of Step Input
Once the control scheme was selected, the second test stage consisted of recording the behavior of the PID control tuned by NN, fixing a set point of 100 V and varying the connected load to the output of the DC-HV DC converter device. Figure 15 shows the results obtained for the loading percentages of 10%, 45% and 80%, and no overshoot was observed. Figure 15 also shows that there was an offset between the set point and the voltage obtained. We eliminated this offset through a self-adjustment of the set point at 10 ms. Although in the work [39], the authors presented this control scheme as a PID, we detected that the control law did not have an integral action, which is what generated the previously-described offset; however, the tuning method and the structure of the control presented the best results for our application. The second test stage showed the capacity of the PID tuned by NN for controlling and monitoring the delivered power quantity in spite of the variation of the connected load.

Control Testing for Different Frequencies and Amplitudes
For the automatic pipeline inspection by the pulse-echo method in immersion, the estimation of the size of defects that are smaller than the size of the ultrasound beam depends on the amount of energy that is reflected in the defect (see Figure 16, Echo 2). If the defect is small, an echo with a low amplitude appears between the internal and external wall echoes ( Figure 16, Echoes 1 and 3); but if the defect is significant, an echo appears with a higher amplitude. If there is no control of the amount of energy emitted in each ultrasound echo, then when interpreting the post-processing data, it will be difficult to determine the size of the defect found.  Figure 17 shows the third test stage performed with the ultrasound system considering all the conditions for the inspection of the pipeline, which are: 64 transducers with a maximum PRF of 600 Hz and an excitation voltage between −50 V and −100 V. For this test, with the intention of not affecting the response signal obtained and to show the improvement of the ultrasonic pulse generator, we did not consider the backup capacitors for HV, nor rectification diodes. The PRF of 600 Hz shown in Figure 17 considers the excitation of eight transducers at the same time. Therefore, the rate at which the pulser circuit worked to excite the 64 piezoelectric transducers was up to 4.8 kHz, which is eight-times faster due to multiplexing devices HV2321. Figure 17 also shows how with the PID control scheme, the excitation pulse of the transducers reaches the required amplitude value. For example, with the set point of −100 V and without the control (see Figure 17a), the output voltage of the DC-HV DC converter dropped dramatically when the PRF increased (the red line shows the response for a PRF of 100 Hz). The voltage drop approached 20 V for a PRF of 600 Hz (the blue line shows the response for a PRF of 600 Hz). However, with the PID control (see Figure 17b), the output of the DC-HV DC converter was able to supply the −100 V in an instant. Figure 17 also shows the persistence of the HV pulses obtained for the different PRFs. With the control, the HV pulses maintained practically the same amplitude and shape; however, without the control, the amplitude of the HV pulses reached a maximum at a PRF value of 100 Hz, but as the frequency of the PRF was increased to 600 Hz, the amplitude of the HV pulse dropped. This effect was similar for tests from −50 V-−100 V. Figure 17e,f shows the waveforms for −60 V and Figure 17c,d for −80 V. The HV pulse can now be improved by high-frequency passive elements that work at 200-ns intervals of the pulse length to reduce the drop in amplitude. The third stage test showed the capacity of the PID tuned by NN for amplifying the HV to the set point desired and reducing the problems with failures in wall thickness estimation.

Discussion
The linear behavior of the DC-HV DC converter makes the use of a PID controller possible, but the problem that we resolved was determining the tuning process and the control law that would allow us to obtain better results and mitigate the variations of voltage caused by hammer and shock effects. With the improvement implemented in the DC-HV DC converter device, the ultrasonic pulse generator is capable of operating at a variable PRF, within the range of 0-600 Hz and generating pulses at a voltage of −20 V-−100 V.
The inspection of pipelines for oil and water distribution is a task with a high degree of interest in the industrial sector. The development of more compact subsystems to reduce the weight of the PIG is necessary. The researchers are focused on developing more flexible technology for different diameters that is as economical and compact as possible. In this article, we present an alternative method to safely replace the HV power supply used in the ultrasound systems for automatic pipeline inspection. This improvement does not reduce the problems presented by the automatic inspection such as the chattering, nor does it improve the capacities of the straight beam; however, it gives the certainty that the voltage used for the excitation of the transducers is controlled, and it will not damage the chips of the pulse generator.
We grouped our tests into three stages. In the first stage, we proved that the PID control tuned by NN assures the protection of the chips that are part of the pulse generator circuit against over-voltage for hammer and shock effects. In the second stage, we proved that the control scheme is effective in controlling the delivered power quantity in spite of the variation of the connected load, which we interpreted as the dynamically-variable PRF. In the third stage, we proved that the control scheme amplifies the HV to the set point desired and reduces the problems with failures in wall thickness estimation. In this way, the ultrasound system is useful for inspecting pipelines employing the PIG. The control applied to the converter allows a reduction in the size of the ultrasound systems by using only an amplifier encapsulation, which is controlled in order to maintain the parameters of Vmax, Vmean, and Vrange at the desired values. Figure 18 shows the ultrasound system designed for automatic pipeline inspection; the printed circuit boards have a circular shape with a diameter of 150 mm in length due to the cylindrical body shape of the PIG (see Figure 1). Figure 18a shows in the top part the arrangement of the 64 connectors where the 5-MHz immersion transducers are connected. Figure 18b shows the bottom part of the system, where the FPGA, the microcontroller and DC-HV DC converter are. This improvement to the pulse generator circuit gives versatility not only to portable devices, but also to larger devices; since the variation of the PRF can occur in inspection stations, where the technician proposes trajectories for inspection according to the shape of the specimen. Furthermore, as mentioned earlier in the Introduction, this device can also be used for light sources, printers and capacitor charging, where applications can present a constant load variation and control of the DC-HV DC converter is necessary. The next step for our research is to develop new and more compact ultrasound systems, ensuring that the excitation voltage can be controlled efficiently without generating voltages that could damage the prototype chips, therefore reducing the costs of development.

Conclusions
The construction of more robust technology for the sub-systems of the PIG is an area of very recent interest [21], such as the case of the ultrasound systems for inspection, where they not only must ensure measurements are taken correctly, but must also consider the effects that may occur when the pipeline inspection is carried out. In this sense, we present the improvement of an ultrasonic pulse generator that makes it useful for automatic pipeline inspection. To achieve this, we first defined the crucial parameters of the high voltage of a DC-HV DC converter, which was later characterized by the least squares method, and we compared the three control schemes.
To compare the three control schemes, we considered different scenarios in which the HV-DC HV converter was affected by the shock and hammer effects; in this way, we were discarding the control schemes until the final selection of the PID control tuned by NN. Finally, we realized a series of tests for the adjustment of the control scheme, because the original scheme did not consider an effective integral action. The main advantages that our improvement to the ultrasound system presents are: (1) controllable amplification of ultrasound signals during the automatic inspection, (2) protection of the chips that are part of the pulse generator circuit against over-voltage, (3) reduction of the error in the estimation of thicknesses and defects and (4) control and monitoring of the delivered power quantity.