Variable Step Size P&O Algorithms for Coalescing Pump/Deoiling Hydrocyclone Produced Water Treatment System

This paper presents three variable step size P&O algorithms for optimizing the separation efficiency of a coalescing pump/deoiling hydrocyclone produced water treatment system. By continuously adjusting the pumping pressure, and subsequently the coalescing effect, the algorithms are used to minimize the oil concentration downstream the hydrocyclone. Due to the variable step size, the algorithms react rapidly to changes in the upstream produced water characteristics, at the same time as they reduce (or eliminate) steady-state oscillations. Based on both simulation and experimental testing, the study discusses advantages and disadvantages of the algorithms.


Introduction
Oil and gas production usually involves producing significant amounts of water along with the hydrocarbon mixture. This co-produced water, called produced water, contains combinations of organic and inorganic materials which can lead to toxicity. To avoid pollution, produced water must be treated and dispersed oil removed before the water is discharged into the sea or reinjected into a reservoir (Fakhru'l-Razi et al., 2009).
In the North Sea, three-phase separators are often used to separate most of the produced water and gas from the crude oil (Walsh, 2015). In combination with other treatment technologies, hydrocyclones remove the remaining dispersed oil from the produced water. Most of the equipment for removing oil is either based on gravitation, enhanced gravitation, or flotation technologies, where the driving source of separation is droplet buoyancy (Judd et al., 2014). Therefore, the efficiency of these technologies highly depends on the size of the oil droplets, where larger droplets lead to higher treatment efficiency.
In some applications, pumps are used to maintain the process pressure above a certain threshold. Due to the importance of large oil droplets, droplet breakup in process equipment should be kept to a minimum (Ditria and Hoyack, 1994;Thew, 2000). Flanigan et al. (1988) investigated and rated several pump types based on droplet breakup. Even though they published their study in 1988, it is still used as a reference when choosing pumps for produced water treatment applications today.
In 2015, van Teeffelen (2015) introduced a novel coalescing centrifugal pump for produced water applications, where he presented prototype test results. The prototype testing featured, among other investigations, a comparative study including the coalescing pump and doi:10.4173/mic.2020.1.2 c 2020 Norwegian Society of Automatic Control two typical produced water pump types. In the study, all pumps were operated at the best efficiency point (BEP), and the results highlighted how the novel coalescing pump increased, rather than reduced, the volume median droplet diameter (d v50 ). As a continuation of van Teeffelen's work, Husveg et al. (2016Husveg et al. ( , 2018 performed several studies of the pump's coalescing effect when operated outside of BEP. They studied 1) the droplet growth at various pumping pressures and flow rates, 2) how produced water characteristics-including oil type, oil-in-water concentration, and droplet size distribution-affected the droplet growth, and 3) how the enlarged droplets further affected the separation efficiency of a downstream deoiling hydrocyclone.
Based on the findings of Husveg et al. (2016Husveg et al. ( , 2018, Husveg et al. (2019) presented a control routine which continuously optimized the droplet growth according to the downstream separation efficiency. By repeatedly changing the pumping pressure in steps of a fixed size, the routine tracked the optimal point of operation, i.e., the combination of pumping pressure and flow rate, without affecting the overall process plant. The control routine included a perturb and observe (P&O) algorithm and used process measurement feedback to track the optimal pumping pressure. Downstream control valves were used to compensate for the pressure changes. Figure 1 shows the setup considered by Husveg et al. (2019). The figure shows a sketched produced water treatment facility containing the coalescing pump, a hydrocyclone, an oil-in-water analyzer, and downstream control valves. In addition to developing the control routine, Husveg et al. (2019) investigated three different analyzer locations. Placing the oil-in-water analyzer in the downstream position (as shown in the figure) was found to be the most robust approach. In this position, the analyzer measured the concentration of oil exiting the hydrocyclone underflow.
This paper extends the control routine developed by Husveg et al. (2019) by introducing a variable step size to reduce the convergence time and steady-state oscillations. Three alternative algorithms are developed, studied, and discussed based on simulations and experimental testing.
2 Considered system Figure 2 shows a schematic representation of the system used to evaluate the algorithms. The rig is a oncethrough system, where the main test section is made of 1" piping. The pipes for oil injection and sampling are 1/4".
From left to right, the system consists of a feeding  Figure 1: Sketched produced water treatment facility containing the coalescing pump, a hydrocyclone, an oil-in-water analyzer, and downstream control valves.
pump, an oil injection pump, a mixing valve, the coalescing pump, a hydrocyclone and two control valves, referred to as CVo and CVd, respectively. The feeding pump transports heated saltwater to the main test section, keeping the flow rate, Q u , constant. The oil injection pump continuously injects oil into the saltwater stream, thereby creating synthetic produced water with a known oil concentration, C u . The oil enters the center of the pipe through a tube bent in the same direction as the saltwater flow. The manually operated mixing valve ensures proper oil/water mixing. The valve opening, and consequently the pressure drop, is fixed in the position resulting in the desired volume median droplet diameter, d v50,u , upstream the coalescing pump. The rotational speed, and consequently the pumping pressure ∆p = p m − p u , of the coalescing pump is controlled according to a varying set-point, ∆p SP . The investigated control routines determine this setpoint. The coalescing pump used in this investigation is designed according to the principles of Typhonix AS and is the same pump as used by Husveg et al. (2016Husveg et al. ( , 2018Husveg et al. ( , 2019. It is emphasized that the resulting coalescing effect is partly a design parameter and partly process related, and therefore varies from one pump application to another. However, it is assumed that the overall trends presented in this paper are the same for any coalescing centrifugal pump design and size. The produced water stream leaving the coalescing pump flows toward the hydrocyclone. After being separated in the hydrocyclone, the cleaned water exits through the hydrocyclone underflow, flowing toward control valve CVd. CVd is used to adjust the pressure upstream the coalescing pump, p u . The oilenriched water leaving through the overflow flows toward control valve CVo. CVo controls the hydrocyclone pressure drop ratio (PDR), defined as ϕ PDR =  Figure 2: Schematics of the considered system.
A Malvern Insitec is used as the online oil-in-water analyzer. The analyzer identifies droplet size distribution and oil concentration trends in the produced water, accessed by isokinetic sampling. During testing, the analyzer is placed downstream the hydrocyclone. During commissioning, e.g., while adjusting the mixing valve, the analyzer may be placed at either one of the sampling points indicated in Figure 2.
Throughout the testing, the flow rate is kept at Q u = 1.75 m 3 /h, the upstream pressure is p u = 10 bar, the pressure drop ratio is ϕ PDR = 2, and the upstream oil concentration is C u = 400 ppm. The salt concentration is 3.5 % by weight, and the following combination of salts is used: NaCl−95.9 %, CaCl 2 −3.2 % and MgCl 2 − 0.9 %. The water temperature is 50 • C.
Exxsol D140 is used as a substitute for stabilized crude oil. Husveg et al. (2019) validated the use of Exxsol. The oil density is ρ = 824 kg/m 3 and viscosity is µ = 6.14 cP, both measured at 15 • C. When the oil is injected into the saltwater stream, the temperature is 20 • C. Due to the low concentration, it is assumed that the droplets immediately adopt the temperature of the water (van der Zande et al., 1999). For more details of the considered system, see (Husveg et al., 2019).

BVSS P&O algorithm
Perturb and observe (P&O) algorithms are often found in power generation applications as methods for maximum power point tracking (MPPT), used to optimize the power production continuously. Examples of applications are photovoltaic systems (Ram et al., 2017) and wind energy conversion systems (Sachan et al., 2017). The P&O algorithm is characterized by first performing a process variable change (perturb), before measur-ing the effect (observe). Based on the observed effect, the algorithm determines the following process variable change. When the optimal value of the process variable has been found, the algorithm encircles this value until any process changes occur.
If a perturb and observe algorithm is used, a tradeoff must be made when choosing the step size (Peng et al., 2015). On the one hand, the step size should be sufficiently large, making the system react quickly to rapid environmental changes. On the other hand, the step size should be as small as possible, avoiding unnecessary large oscillations during steady-state operations. Introducing a varying step size is one way to tackle this trade-off. Figure 3 shows schematics of the basic variable step size (BVSS) P&O algorithm, which is the first algorithm investigated in this paper.
The main-routine, shown in the upper left corner of Figure 3, consists of an initialization step, two startup steps, and the variable step size P&O-loop. Before the algorithm enters the P&O-loop, the downstream oil concentration, C d , is measured, and the desired pumping pressure, ∆p SP , increased by the smallest step size, δ (min) ∆p . Next, when the algorithm enters the P&O-loop, C d is again measured and the current value compared to the previous. If the oil concentration is found to be lower than before the pumping pressure change, the algorithm further increases ∆p SP . If the oil concentration is found to be higher, ∆p SP is reduced. The algorithm stays within the P&O-loop, stepwise increasing or decreasing ∆p SP to minimize the downstream oil concentration. The varying pumping pressure step size, δ ∆p , is determined for each iteration of the P&Oloop.
A measure sub-routine, shown in the right section of Figure 3, is included to ensure the system reaches steady-state before the downstream oil concentration is determined. When the algorithm enters the mea- sure sub-routine, timer t is set to 0. Then, the standard deviation, σ k , of the last k measurements of C d is determined. Next, σ k is compared to the threshold value, σ th . If σ k > σ th , the timer is reset and σ k recalculated. If σ k < σ th , the measurements are found sufficiently stable and the sub-routine progresses. As long as σ k < σ th , σ k is continuously updated. When t > t th , the algorithm progresses by determining the mean value of C d over the last k measurements,C d,k .
A closed-loop feedback controller, shown in the lower left corner of Figure 3, is used to adjust the rotational speed of the coalescing pump. The set-point of the controller is the desired pumping pressure, ∆p SP,n , determined by the main-routine. n denotes the current iteration number.
During the experimental testing, σ th is 0.2 and t th is 20 s. These values must be determined empirically. σ th should be as low as possible, ensuring stable measurements. However, due to measurement noise, it should not be too low. Also t th should be set as low as possible. t th depends on how quickly the system reacts to process changes, and the time it takes before the oilin-water analyzer can observe the changes. The latter depends on the distance from the coalescing pump to the separation equipment, the distance from the separation equipment to the analyzer, and the flow rate.

Step size, δ ∆p
Ideally, the function determining the step size should be evaluated to 0 when ∆p = ∆p opt , meaning that the amplitude of the change approaches 0 when the pump reaches the optimal point of operation. Husveg et al. (2019) have shown that the coalescing pump and hydrocyclone combination results in a convex function when considering the downstream oil concentration with respect to the pumping pressure. Relating the step size to the relative change in downstream oil concentration should therefore fulfill the requirement, as Numerically, this translates to C d = cst., and subsequently δ ∆p = 0, at the optimal point of operation. Hence, To normalize the function, and to allow for tuning, the following expression for determining the step size is proposed: where K is the tuning parameter (also called algorithm gain) andC Noting that δ ∆p,n-1 = |∆p n − ∆p n-1 |, and introducing N = |C d,n − C d,n-1 | /C d,n , (3) becomes: Next, δ ∆p,n may be saturated, where δ is 2 bar. K must be determined for each specific application and pump. The desired value depends on the pump's turndown ratio, i.e., the width of the operational range, and the expected changes in downstream oil concentration. The algorithm should be tuned according to the two following properties: 1) reduce the amplitude of the pumping pressure changes, stabilizing the system during steady-state operations, and 2) minimize the amount of oil exiting the hydrocyclone underflow by rapidly responding to abrupt changes in the upstream produced water characteristics. These two properties are summarized in (7) to (10), where and where

Results and discussions
Empirical models of the coalescing pump/deoiling hydrocyclone system were made using the experimental setup ( Figure 2). Figure 4 presents the test data used for modeling. In the figure, the x-axis shows the pumping pressure, while the y-axis shows the downstream oil concentration. To gather the experimental data, the pumping pressure was increased from 1 bar to 10 bar in steps of 1 bar. For each step, the system reached steady-state before the oil concentration downstream the hydrocyclone, C d , was measured. The measured oil concentration is indicated in the figure using gray numerals. For the different combinations of upstream droplet size distribution and oil concentration, polynomials were fitted to the experimental data. Figure 4 presents the polynomial equations using the dotted lines.  During simulation and experimental testing, the system initially starts in steady-state operations, encircling the current optimal pumping pressure. Then, a sudden change in the upstream produced water characteristics is introduced in the form of a change in the droplet size distribution, also shifting the optimal pumping pressure. For the simulations, the environmental change is represented by shifting from one polynomial to the other. After the change, the environmental conditions are again kept constant as the system adapts to the new conditions. Figure 4 illustrates the case used throughout this study, where d v50,u is suddenly reduced from 12.5 µm to 7.5 µm while the pump encircles ∆p = 4.5 bar. The figure indicates the modeled downstream oil concentration before and after the environmental change, using black numerals. Due to the reduced size of the droplets entering the pump, the size of the droplets leaving the pump is also reduced, therefore lowering the hydrocyclone efficiency and increasing the downstream oil concentration (Husveg et al., 2018). After the environmental change, the system adapts to the new conditions, increasing the pumping pressure and eventually encircling ∆p = 7.3 bar. Figure 5 shows simulations of the investigated case with algorithm gain K = 0.1 bar 2 (gray line) and K = 10 bar 2 (black line). In the simulations, the mainroutine of the BVSS algorithm is used to minimize the empirically obtained polynomials, representing the relationship between the pumping pressure and the resulting downstream oil concentration. The Measure sub-routine and the Point of operation sub-routine are not included, as the simulations do not include system dynamics or time domain differential equations. The solid lines in the figure show the pumping pressure set-point, ∆p SP . The dotted line shows the model predicted optimal pumping pressure ( Figure 4), ∆p pre , included as a reference. The sudden shift in ∆p pre is a result of changing from one polynomial to the other, representing the sudden environmental change. Step, n (-) With K = 0.1 bar 2 , there were small steps during the first constant period. When the environmental change occurred, the small steps continued, indicating that the gain K = 0.1 bar 2 was too low for this situation. The results with K = 10 bar 2 (black line) show an example of the desired behavior, both during stable environmental conditions as well as during a rapid change. The results show small oscillations throughout the constant periods and a significant pumping pressure change in the following step after the environmental change.

The effect of K
To estimate the minimum gain required for the algorithm to react to the environmental change with the maximum pumping pressure step, δ (max) ∆p , (5) was rearranged as shown in (11), where the previous step δ ∆p,n-1 = δ (min) ∆p , and desired following step δ ∆p,n = δ (max) ∆p . Figure 4 shows that C d,n-1 = 55.7 ppm and C d,n = 90.2 ppm after the change, leading to N = 0.5 and K = 1.1 bar 2 . Therefore, for the studied case, a minimum gain of K = 1.1 bar 2 is required for the algorithm to react with δ (max) ∆p when d v50,u suddenly changes from 12.5 µm to 7.5 µm, assuming the pump encircles ∆p = 4.5 bar with steps of δ (min) ∆p . With the minimum required gain, the algorithm will have the same response to the environmental change as with K = 10 bar 2 (Figure 5), due to the saturations in (6).
To further study the effect of K, the previously described simulation was repeated for values of K ranging from 0.1 bar 2 to 100 bar 2 . To quantify the algorithm's response according to (7) and (9), R 1 and R 2 were rescaled to the range [0, 1]: where R 1 and R 2 are the rescaled value of R 1 and R 2 according to the response of all the investigated values of K, respectively. Figure 6 shows R 1 and R 2 for the studied case. In the figure, the x-axis gives the value of K logarithmically, and the y-axis gives the value of R 1 (gray line) and R 2 (black line) for each K.

Algorithm gain, K (bar 2 )
Value (-) Figure 6: R 1 and R 2 for the studied case, with K ranging from 0.1 bar 2 to 100 bar 2 .
It was previously shown that K = 0.1 bar 2 gave a slow reaction to the environmental change, while K = 10 bar 2 gave a more desirable response. K = 1.1 bar 2 was found to be the minimum value of K required for the algorithm to react to the exemplified environmental change with δ ∆p,n = δ (max) ∆p . Figure 6 shows that R 2 starts off high and decreases as K is increased. The decreasing R 2 is due to the algorithm's increased reaction to the environmental change, shown by the simultaneously raising R 1 . At K = 1.1 bar 2 , R 2 approaches 0, which again shows that this is the minimum gain required for the algorithm to react with δ ∆p,n = δ (max) ∆p when the upstream change occurs. By further increasing K, both R 1 and R 2 reach a plateau. This plateau indicates that even though the algorithm gain is further increased, δ ∆p,n is still δ (min) ∆p during the stable environmental conditions, therefore not introducing higher pressure changes. Hence, the simulated response of K = 1.1 bar 2 and K = 10 bar 2 are identical for this case. Beyond K = 10 bar 2 , R 1 starts to rise again, indicating that the steady-state oscillations increase. The subsequent rise of R 2 shows that the increasing oscillations make the algorithm deviate from the optimal pumping pressure, therefore reducing the hydrocyclone separation efficiency and increasing the downstream oil concentration. For the simulated case, best trade-off between low steady-state oscillations and quick reaction to environmental changes is achieved with K between 1.1 bar 2 and 10 bar 2 .

Experimental testing
Experimental tests were conducted to demonstrate the BVSS algorithm and the effect of the algorithm gain, K. Again, the same case was used where the pump starts by encircling the optimal pumping pressure during d v50,u = 12.5 µm, after which d v50,u is rapidly reduced to 7.5 µm. Figures 7 to 9 show results of the experimental testing. The figures contain two plots each, where plot a) shows the pumping pressure as a function of time, while plot b) shows the downstream oil concentration. Plot a) also shows the predicted optimal pumping pressure, ∆p pre , based on Figure 4. In both plots, the environmental change is indicated by a change in background color. In total, three experimental tests were conducted, only to be distinguished by the value of K. The three algorithm gains were K = 0.1 bar 2 , K = 10 bar 2 and K = 100 bar 2 . According to Figure 6, these values represent a low gain, an adequate gain, and a high gain, respectively. Table 1 lists R 1 and R 2 for the three experimental tests. Note that C d,i in is the lowest oil concentration measured downstream the hydrocyclone in each test, respectively. This modification was done to compensate for experimental differences, ensuring fair comparison between the three tests. C  Table 1 shows that K = 0.1 bar 2 gave the lowest R 1 , meaning that this gain gave the lowest sum of pumping pressure changes. This is comparable to the simulation results in Figure 6. Figure 7 a) shows the controller's reaction to the environmental change. The controller reacted by steadily increasing the pumping pressure toward the predicted optimum in steps of the minimum size, δ Oil Concentration (ppm)

Time (s) b)
Cd Cd (min) dv50,u = 12.5 µm dv50,u = 7.5 µm simulation shown in Figure 5. By having too low gain, the variable step size algorithm acts as a constant step size algorithm, therefore losing the advantages introduced by a variable step size. R 2 (−) 0.52 0.00 1.00 Figure 8 shows results from the experimental testing with K = 10 bar 2 . According to Figure 6, this value should be adequate for the algorithm to react rapidly to the environmental change, while at the same time having low oscillations during steady-state operations. Table 1 shows that K = 10 bar 2 gave a slightly higher R 1 compared to K = 0.1 bar 2 , meaning that bigger pumping pressure steps were introduced. Figure 8 a) shows the controller's reaction to the environmental change. The pumping pressure increased rapidly toward the predicted optimum, reaching it approximately 500 s after the change. The controller then reduced the pumping pressure and started encircling ∆p = 6 bar. As indicated in Figure 8  Oil Concentration (ppm)

Cd
Cd (min) dv50,u = 12.5 µm dv50,u = 7.5 µm deviates somewhat from the model predicted optimum, ∆p pre = 7.3 bar. This behavior is, however, not unexpected as the downstream oil concentration curve, C d vs. ∆p (Figure 4), is very flat around the optimal point of operation. Minor deviations in the separation performance may, therefore, move the optimal pumping pressure substantially. Table 1 shows that K = 10 bar 2 resulted in the lowest R 2 , which is in accordance with the simulation results in Figure 6. Figure 9 shows results of the experimental test when K = 100 bar 2 . According to Table 1, K = 100 bar 2 gave the highest value of both R 1 and R 2 . Figure 9 a) shows that the algorithm did not reach the minimum step size during the first stable period. When the environmental change occurred, the algorithm reacted quickly. However, it continued to oscillate highly for the following stable period, although with declining oscillations. The high pumping pressure changes explain the high R 1 . Figure 9 b) shows that the high pressure changes negatively influenced the downstream separation, indicating that the pumping pressure was swinging far away from the optimal point of operation.

Tracking failure
The previous investigations have shown that a welltuned variable step size algorithm has both low convergence time and low steady-state oscillations. However, variable step size P&O algorithms have a weakness to- Oil Concentration (ppm)
ward rapid environmental changes (Almi et al., 2016;Gupta and Saxena, 2016). As they base the following step size and direction entirely on the observed change, in this case the change in downstream oil concentration, the algorithms cannot distinguish whether the changes occur due to the shifting point of operation, or due to upstream environmental changes. For the studied case, the environmental change reduced the size of the upstream oil droplets, consequently reducing the hydrocyclone separation efficiency. This increased the oil concentration downstream the hydrocyclone, making the P&O algorithm step in the opposite direction of the previous step, regardless of whether it was approaching the new optimum or not. Step, n (-) Hitherto, the results have shown the algorithm stepping in the desired direction. Figure 10 shows two simulated examples where the algorithm steps astray. In the figure, the gray line is simulated with K = 0.1 bar 2 , and the black line with K = 10 bar 2 . These simulations are individually comparable to the responses in Figure 5. In Figure 10, the algorithm puts forward an increase in the set-point when the upstream environmental change occurs, indicating that the algorithm is in the right P&O-loop ( Figure 3). As the environmental change results in an increased downstream oil concentration, making C d,n > C d,n-1 , the algorithm then moves over to the left P&O-loop, reduces the setpoint, ∆p SP , based on the magnitude of the change, and thereby steps astray.
From the two simulated responses in Figure 10, the system with the most desirable behavior was the one with the lowest gain, K = 0.1 bar 2 . Because of the low gain, the algorithm made just a small step astray before turning toward the predicted optimal pumping pressure. With K = 10 bar 2 , the algorithm introduced a significant pressure change, unfortunately away from the new optimum. Figure 11 shows R 1 and R 2 for the algorithm stepping astray. Here, K ranges from 0.1 bar 2 to 100 bar 2 .
The figure shows that R 2 started off low, but then rapidly increased as the gain was increased from 0.1 bar 2 to 1.1 bar 2 . R 2 rose due to the increasing amplitude of the failed step, as also seen when comparing the two simulations in Figure 10. When K reached above 3 bar 2 , R 2 started to decline. R 2 declined as the algorithm got more sensitive, therefore compensating increasingly more rapid for the failed step. The increased sensitivity is also indicated by the rising R 1 . According to Figure 11, the lowest R 2 was achieved with the highest gain, K = 100 bar 2 . However, this high gain also resulted in the highest R 1 . In the event of tracking failure, the best trade-off between low steady-state oscillations and convergence time is, therefore, most likely achieved with a low gain, as this reduces the magnitude of the failed step.
Introducing a second analyzer may be one way to avoid stepping astray. An analyzer located upstream the coalescing pump can detect whether observed changes in the downstream oil concentration have been introduced by upstream environmental changes, or by the pump. In their study of the coalescing pump/deoiling hydrocyclone system, Husveg et al. (2019) developed an empirical model to predict the optimal pumping pressure based on upstream measurements. Similar models, together with an upstream oilin-water analyzer, may be used to direct the controller toward the new optimum.

Alternative algorithms 4.4.1 HVSS P&O algorithm
The hybrid variable step size (HVSS) P&O algorithm is an alternative algorithm developed for the coalescing pump/deoiling hydrocyclone system. The HVSS algorithm avoids stepping astray by first introducing a probe step. Figure 12 shows a simulation of the algorithm's response to the considered case, having K = 10 bar 2 . Step, n (-) The simulation starts off with the algorithm encircling the current optimal pumping pressure, operating within a constant step size (CSS) P&O-loop. The algorithm stays within this loop until a significant change in the downstream oil concentration is detected. When a change is seen, the HVSS algorithm introduces a probe step. The probe step is used to determine whether the new optimal pumping pressure is higher or lower compared to the current pumping pressure. Next, the algorithm introduces a primary step in the direction determined based on the probe step. After the primary step, the HVSS algorithm enters a variable step size (VSS) P&O-loop. The algorithm stays within this loop until it has switched from incrementing to decrementing the pumping pressure, or vice versa, more than a predetermined number of times. When the number of directional changes has been reached, it is assumed that the new optimal point of operation has been found. The algorithm, therefore, returns to the CSS P&O-loop, continuing to encircle the optimal pumping pressure in small steps until a new significant change occurs. Figure 13 shows schematics of the HVSS algorithm. The schematics refer to Measure* and New point of operation**, which are the sub-routines in Figure 3. The HVSS algorithm has the same initialization and startup steps as the BVSS algorithm (Figure 3). After initialization, the algorithm enters the CSS P&O-loop, where the pumping pressure is adjusted by ±δ (min) ∆p . For every iteration of the loop, the algorithm determines how much the downstream oil concentration has changed since last pressure change, ∆C d,n = C d,n − C d,n-1 . If |∆C d,n | > ∆C d,th , the algorithm enters the variable step size sub-routine, where it first determines the size of the primary step, δ (prim) ∆p . Then, the algorithm introduces the probe step. The direction of the probe step is determined based on whether the environmental change increased or reduced the downstream oil concentration, assuming the change happened due to a shift in the upstream droplet size distribution. If the change did not happen due to a shift in the droplet size distribution, the probe step might be introduced in the wrong direction. A probe step stepping astray does not corrupt the directing of the primary step but will increase the convergence time as more steps are required. Next, the directing of the primary step is based on the direction of the probe step, and whether it increased or reduced the downstream oil concentration. After having introduced the primary step, the HVSS algorithm sets m to 0. m is a counter for the number of times the stepping has changed direction. The HVSS algorithm then enters and stays within the VSS P&O-loop until m > m th , at which point the algorithm returns to the CSS P&O-loop, awaiting new environmental changes.

TVSS P&O algorithm
The triggered variable step size (TVSS) P&O algorithm is another alternative to the BVSS P&O algorithm. Similar to the HVSS algorithm, the TVSS algorithm introduces a probe step to determine the direction of the primary step. A constant pumping pressure loop (called dormant-loop) replaces the CSS P&Oloop, and thereby distinguish the TVSS algorithm from the HVSS algorithm. As a result, the TVSS algorithm does not introduce steady-state oscillations. Figure 14 shows a simulation of the algorithm's response to the considered case, where K = 10 bar 2 . Figure 15 shows the schematics of the algorithm. Also here, the schematics refer to Measure* and New point of operation**, i.e., the sub-routines in Figure 3. Step, n (-) The trace sub-routine first determines δ (prim) ∆p , before introducing the probe step and the primary step in the same way as the HVSS algorithm. In order to avoid mathematical errors, the algorithm assumes δ ∆p,n-1 = δ is later used to determine the following dormant pumping pressure, as this is the point of operation resulting in the lowest downstream oil concentration, and hence the optimal point of operation. After having introduced the primary step, the algorithm moves into a VSS P&O-loop. For each iteration of this loop, the algorithm determines whether the current oil concentration is lower than the current C    Figure 15: Schematics of the triggered variable step size (TVSS) P&O algorithm.

Comparison
To compare the three algorithms, Table 2 lists R 1 and R 2 for each algorithm's response to the studied case when K = 10 bar 2 . For the BVSS algorithm, two values are shown for each parameter. The first value represents the algorithm stepping toward the new optimum ( Figure 5). The second value represents the algorithm stepping astray ( Figure 10). According to Table 2, the TVSS algorithm had the lowest R 1 . The HVSS algorithm had the same value of R 1 as the BVSS algorithm, when the latter did not step astray. The highest value of R 1 was for the BVSS algorithm stepping away from the new optimum. These results indicate that the TVSS algorithm significantly reduced the number and magnitude of the pumping pressure changes due to the dormant-loop. The HVSS and BVSS algorithm may introduce similar oscillations, but the BVSS may also step astray, introducing a higher number of large pumping pressure changes.
The BVSS algorithm stepping in the correct direction had the lowest value of R 2 . Even though the HVSS algorithm introduced the same pumping pressure changes as the BVSS algorithm, the order of the changes was different due to the probe step. Therefore, the HVSS algorithm spent more time far away from the new optimal point of operation, as compared to the BVSS algorithm. On the other hand, the highest value of R 2 was for the BVSS algorithm stepping astray. Therefore, the BVSS algorithm may be the algorithm with the lowest convergence time, but it might just as well be the algorithm with the highest convergence time.
In the studied case, the environmental conditions are constant before and after the rapid change. Because of this, the TVSS algorithm has a lower value of R 2 compared to the HVSS algorithm, as the latter oscillates during steady-state operations. However, if the environmental conditions were slightly drifting, the BVSS and the HVSS algorithm may result in the lowest value of R 2 . These algorithms continuously trace the optimal point of operation, while the TVSS algorithm has to wait for ∆C (dorm) d,n > ∆C d,th before it starts tracing. The constant steady-state pumping pressure of the TVSS algorithm must, therefore, be weighed against the continuous tracing BVSS and HVSS algorithms.
To avoid tracking failure during rapid environmental changes, the HVSS and the TVSS algorithm introduce a probe step when the oil concentration changes exceed ∆C d,th . Next, both algorithms enter and stay within a variable step size P&O-loop until the pumping pressure steps have changed direction more than m th times. The HVSS and TVSS algorithm, therefore, introduces two extra parameters which must be set when implementing either one of the algorithms. As mentioned, the BVSS algorithm may also avoid stepping astray if an upstream oil-in-water analyzer is introduced. However, this setup was not investigated in this paper.
For all three algorithms, the algorithm gain K must be determined as the functionality of the algorithms highly depends on this parameter. K relates the following pumping pressure step size to the change in downstream oil concentration and the previous pumping pressure change during variable step size operations. For the algorithms to have the intended properties, the gain needs to be high enough to react to environmental changes, but not too high, as this will introduce oscillations during stable environmental conditions.

Conclusions
This study has introduced three variable step size P&O algorithms for optimizing the separation efficiency of a coalescing pump/deoiling hydrocyclone system. The algorithms are used to minimize the oil concentration downstream the hydrocyclone, at the same time as they 1) reduce the steady-state oscillations and 2) quickly react to rapid environmental changes. Furthermore, the study highlights the importance of choosing a correct algorithm gain K, as the functionality of the algorithms highly depends on the value of this gain. The basic variable step size (BVSS) P&O algorithm has a weakness toward rapid environmental changes, as it possesses the risk of stepping away from the new optimal pumping pressure, rather than toward it. The hybrid variable step size (HVSS) algorithm and the triggered variable step size (TVSS) algorithm include a probe step that eliminates the risk of stepping astray. The HVSS algorithm continuously tracks the optimal point of operation, while the TVSS algorithm stays dormant for most of the time. The constant steadystate pumping pressure of the TVSS algorithm must, therefore, be weighed against the continuous tracking of the HVSS algorithm, depending on whether steady or drifting environmental conditions are expected.