Compressor Surge Control Using Lyapunov Neural Networks

In this paper surge control in a compression system using a close-coupled valve (CCV) is proposed. The control design is based on Lyapunov control theory in combination with neural networks (NNs) and focuses on minimization of loss of energy in the compressor system. The approach allows for control design with guaranteed region of attraction when considering saturated controls. The CCV modifies the characteristics of the compressor and thus stabilizes the equilibrium beyond the original surge line at the expense of a pressure drop over the valve. Two control laws for the compression system are proposed. The first control law provides a global asymptotically stable equilibrium. The second control law focuses on minimization of the pressure drop over the valve, and local asymptotically stability is proven.


Introduction
Compressor surge represents undesired oscillations in mass flow and pressure, and can cause a reduction in performance or even damage the compressor (Gravdahl and Egeland, 2012). Surge occurs if the system is operated below a certain mass flow limit, referred to as the surge line. If surge occurs, the noise level will increase, and the piping around the compressor can begin to vibrate. This will influence the chemical process connected to the compression system as both the mechanical and thermal load correlated with the surge can damage the system. Since surge limits the range of mass flow for which the compressor can be used, it is preferred to implement an anti-surge controller in order to stabilize the equilibrium beyond the original surge line.
One way to avoid surge is to add a close-coupled valve (CCV) in combination with the compression system, which was introduced by Simon and Valavani (1991). The CCV modifies the characteristics of the compressor which results in a stable equilibrium point beyond the original surge line. A schematic representation of a compressor in combination with a CCV can be seen in Figure 1. The pressure rise in the system is the sum of the pressure rise over the compressor and the pressure drop over the valve. As the term close-coupled implies, there is no significant mass storage between the compressor outlet and the valve as the distance between them is too small. Gravdahl and Egeland (1997) developed an anti-surge controller using backstepping, which uses feedback from the mass flow, to derive a control law for the CCV ensuring global uniform asymptotic stability beyond the original surge line. Liaw et al. (2002) investigate surge control in compression systems with uncertain characteristics. System robustness is ensured with Lyapunov control theory, and asymptotically stability of the equilibrium point is proven. As feedback from real-time measurement of mass flow can be dificult to realise, Backi et al. (2013) develop an anti-surge controller based on Lyapunov control theory, and provides a full state observer with local stability results for the Moore-Greitzer compressor model, defined in equations (1) and (2). Backi et al. (2016) propose an anti-surge controller based on feedback linearization for a close-coupled Figure 1: Schematic representation of a compressor in combination with a close-coupled valve, adopted from Gravdahl and Egeland (1997). Ψ c (Φ) and Ψ v (Φ) are the compressor pressure rise and valve pressure drop, respectively, and Φ is the axial mass flow coefficient.
valve in a compression system. In order to stabilize surge in a compression system, the feedback linearization methodology is implemented by showing that the system is feedback linearizable, and then ensuring absolute stability by using circle criterion analysis.
In this paper Lyapunov control theory is combined with neural networks (NNs) in order to derive an anti-surge controller for the Moore-Greitzer compressor in combination with a CCV, defined in equations (1) and (2). By combining Lyapunov control theory with NNs, the paper focuses on developing a method in order to minimize the loss of energy in the compressor system. The use of a NN Lyapunov function for nonlinear systems was introduced by Richards et al. (2018). Lyapunov control theory is useful in order to determine and construct a safe region for closed-loop dynamical systems (Khalil, 2015). While Traditional Lyapunov function candidates do not readjust to the dynamics, which can lead to a proposed safe level set much smaller than the largest safe level set, NNs have shown to be great nonlinear learners, and can be used to adapt the Lyapunov function candidate to the shape of the largest possible safe region in the state space. By adding the CCV to the system, a pressure drop over the valve is introduced, represented by a control variable u, and it is considered a loss of energy in the compressor system. It is therefore beneficial to keep the control variable as low as possible. Since the control variable is constrained to be a particular value, it is possible to minimize the pressure drop across the CCV, but as a consequence, the system will only be locally asymptotically stable. In practise, the equilibrium does not necessarily need to be globally asymptotically stable (GAS) as long as the area in the compressor map for which the system is most likely operated within is covered. With the approach presented in this paper, the control input can be minimized for a locally asymptotic stable equilibrium, and thus, the loss in the system will be reduced. More details can be found in Neverlien (2019).
The paper is organized as follows. Section 2 describes the Moore-Greitzer compressor system. Section 3 presents the essentials of the NN Lyapunov function implemented by Richards et al. (2018). The results of the NN Lyapunov function candidate for the Moore-Greitzer compressor system are presented in Section 4. Section 5 contains the discussion regarding the results, and Section 6 describes suggestions for future work and concluding remarks.

MATHEMATICAL MODEL
The Moore-Greitzer compressor model in combination with a CCV is given by the following equations: where φ is the mass flow coefficient (annulus averaged, axial velocity divided by wheel speed (Moore and Greitzer, 1986)), ψ is the plenum pressure coefficient (pressure divided by density and the square of wheel speed (Moore and Greitzer, 1986)), Φ(ψ) is the throttle characteristics, Ψ c (φ ) is the characteristics of the compressor and the constant B > 0 is Greitzer's B-parameter defined as Here, U is the compressor blade tip speed, a s is the speed of sound, A c is the flow area, V p is the plenum volume and L c is the length of ducts and compressor. The characteristics of the compressor can be modeled as Here, the parameters H > 0 is the semi-height of cubic axisymmetric characteristics, W > 0 is the semi-width of cubic characteristics and ψ c0 > 0 is the shut-off value of axisymmetric characteristic (Moore and Greitzer, 1986). The throttle characteristics and the CCV characteristics are given by where γ is the throttle gain and γ v > 0 is proportional to the valve opening. Without loss of generality, the system is transformed such that the equilibrium point is at the origin and the control u is introduced: whereΦ Equation (10) represents the compressor characteristics in transformed coordinates where 2W 2 ( φ 0 W − 1) and k 3 = H 2W 3 are constants. u is the control variable, and represents the pressure drop over the CCV. The operation point of mass flow and plenum pressure are φ 0 and ψ 0 , respectively. By definingψ = x 1 ,φ = x 2 and ψ 0 = x 1 0 , the system given by eq. (7) and (8) can be written as:ẋ whereẋ = f (x) represents the dynamical system. The state equations in this new local coordinate system will be used in the remainder of this paper.
In Figure 2 the compressor and throttle characteristics are shown. Ψ c (φ ) and Ψ v (φ ) are the compressor pressure rise and valve pressure drop, respectively. The equivalent compressor characteristic is defined as Without the CCV, the equilibrium of the system is at the intersection between the compressor characteristic Ψ c (φ ) and the throttle characteristic Φ T −1 (φ ), and the intersection is at a point of positive slope. Consequently, in a positive slope, if the mass flow decreases, so will the pressure. When the pressure upstream of the throttle falls below the compressor delivery pressure, the mass flow will begin to increase and result in a limit cycle (Gravdahl and Egeland (2012)). In such case, the equilibrium is unstable. By introducing the CCV, the throttle line Ψ v (φ ) crosses the equivalent characteristic in an area of negative slope. In this case, if the mass flow for some reason decreased, then the pressure will rise, forcing the mass flow to increase again. The system is self-compensating, and surge will be avoided. This new equilibrium is stable.

Open-loop control
In an open-loop control system there is no feedback, and the control action is independent from the output of the system. In Table 1, the operating point for pressure ψ and mass flow φ has two given values, with corresponding throttle gain γ. For the first value of each parameter, the equilibrium point for the linearized system in eq. (11) is asymptotically stable since: and the real part of the system's eigenvalues are located in the left half-plane (Khalil, 2015).The eigenvalues are λ 1,2 = −0.7265 ± 0.9907i for the stable system. In comparison, if considering the second value of each parameter, then the system is unstable as: and the real part of the eigenvalues, γ 1,2 = 0.262 ± 0.7996i, are located in the right half-plane. In an open-loop control system, the equilibrium point will be stable for a throttle gain γ greater than a critical value γ c , and unstable for a throttle gain γ less than the same critical value.

Closed-loop control
In a closed-loop control system, the feedback between the outputs and inputs of the system can be used to stabilize an unstable system. The equilibrium point will be stable for a throttle gain γ greater than a critical value, and in such case, there would be no need to create an anti-surge controller. However, without feedback, the equilibrium point is unstable for a throttle gain γ less than the same critical value γ c , and an anti-surge controller can be implemented in order to stabilize the equilibrium.

LYAPUNOV NEURAL NETWORK
In this Section the controller design based on the principle of Lyapunov control theory combined with neural networks will be presented. The Lyapunov neural network methodology was proposed by Richards et al. (2018), and only the essentials of their paper will be presented here.
Consider now the discrete-time, time-invariant, deterministic dynamical system of the form is the resulting closed-loop dynamical system. It is assumed that the policy π is given and that it is safe to use within a subset S π of the state-space χ, where S π is defined as the region of attraction (ROA) for f π . In this particular case, every trajectory of f π with initial condition x ∈ S π remains in S π and will converge to the equilibrium point x e ∈ S π , where f π (x e ) = x e , as time approaches infinity. Without loss of generality, it is assumed that the equilibrium point is at the origin, x e = 0. From now on, S π represents the true largest ROA in χ under the policy π. The control policy π determines, given the current state, the appropriate control action that drives the system to some goal state, which in this case is the equilibrium point.

Construction of Safe Level Sets
The Lyapunov direct method is used to determine and construct a safe region S for the closed-loop dynamical system x t+1 = f π (x t ). The Lyapunov direct method can determine if an equilibrium point is asymptotically stable or even GAS. In order to find a Lyapunov function V for f π and determine a decrease region D V for V, the Lyapunov Stability Theorem (Khalil, 2015) is used.
If the Lyapunov function candidate V (x) fulfills the criteria of a strict Lyapunov function, then the equilibrium point x e = 0 is asymptotically stable. One of the criteria for a strict Lyapunov function is that the derivative of V (x) is negative definite, except at 0 whereV (x) = 0. This is challenging to verify throughout entire trajectories. It is easier to instead verify the one-step decrease condition ∆V (x) = V ( f π (x)) −V (x) < 0 for every state x in the level set of the Lyapunov function candidate V. This is achieved with: Corollary 1 (Safe level sets (Kalman and Bertram, 1959) contained within the decrease region D V is invariant under f π . That is, f π (x) ∈ V(c), ∀x ∈ V(c). Furthermore, lim t→∞ x t = 0 for every x t in these level sets, so each one is a ROA for f π and x e = 0.

Neural Network Lyapunov Function
There are several Lyapunov function candidates that can be chosen in order to provide a stable equilibrium for the Moore-Greitzer compressor model, such as the Lyapunov quadratic function or the Lyapunov sum-of-squares function. The limitation of such traditional Lyapunov functions is their restrictions on the dynamics, which can lead to a mismatch between the proposed safe level set and the largest safe level set, so the ROA could be much more extensive than what is included. The objective of using neural networks is to maximize the region of the state-space χ where it is possible to apply a policy π without necessarily knowing the true ROA beforehand.
In order to construct safe sets, the Lyapunov Stability Theorem (Khalil, 2015), must be satisfied. It is also important to ensure that the NN Lyapunov function candidate is positive definite and satisfies the Lipschitz continuity requirements. This is achieved with Theorem 1.
The last thing required in order for the NN Lyapunov function candidate V θ to be a Lyapunov function for the closed-loop dynamical system f π , is to implement a training algorithm. The training algorithm will adapt the parameters θ , so V θ satisfies the one-step decrease condition for the largest possible ROA of D V θ .
Lyapunov stability theory is used in order to verify that a level set V θ (c) := {x | V (x) ≤ c}, c ∈ R >0 is safe, and this is done by checking the tightened certificate ∆V θ (x) < −L ∆V θ τ at a finite set of states that cover D V ⊆ χ. The Lipschitz constant L ∆V ∈ R >0 of ∆V and τ ∈ R >0 is a measure of the density of the states that cover D V . After a level set V θ (c) is established as safe, V θ (c) is used to estimate labels y from S π . As long as the dynamical system f π is known, the iterative Algorithm 1, which will iteratively "grow" an estimate of S π , can be implemented.
The first step is to choose some initialization of the parameters data θ and use the one-step decrease condition, as it is positive definite, to verify the current safe level set V θ (c). After a level set V θ (c) is verified as safe, V θ (c) is used to estimate labels y from S π . The next step is to sample states inside this set and slightly around it, and with the dynamical model, it is possible to forward-simulate the samples with some horizon. That is, at iteration k ∈ N ≥0 , there will be a safe level set V θ (c k ) and an expanded level set V θ (αc k ) for some α ∈ R >1 . The states V θ (αc k ) \ V θ (c k ) are forward simulated with the system dynamics f π for T ∈ N ≥1 time steps. Any states that are already inside the safe level set S π or have mapped inside must lie within the true ROA, and those outside do not. The estimates of the true ROA, S π , are used to find the labels y, and then these labels are used with the Lagrangian relaxation defined as where the state-space χ b = {x i } i is re-sampled after every gradient step, and λ is the Lagrangian multiplier. Equation (16) is combined with stochastic gradient descent(SGD), a interative method in order to optimize the parameter data θ . These steps are repeated and the safe level set S π grows until some stopping criterion is satisfied. The method can be seen in Algorithm 1.

6:
Update θ with (16) via batch SGD on χ b and labels

Globally Asymptotically Stable Equilibrium Point
If a large upper limit, u max , and the control is allowed, the equilibrium can be shown to be GAS, with saturation constraints for the state variables and control input defined as follows:ψ whereψ is the plenum pressure coefficient,φ is the mass flow coefficient and the control input u is the pressure drop across the valve. The control u is given by u = −Kx, where x = [ψ,φ ] T and K is the LQR control gain. A discrete grid on which to evaluate the Lyapunov function and thus the safe level set S π is defined as: where the number of states along each dimension in x are 251. The result can be seen in Figure 3 and Figure 4. With a high-pressure drop across the CCV, achieved with a high maximum value of the control input u, the equilibrium point is globally asymptotically stable. Figure 3: Safe region S π for a GAS equilibrium point. All trajectories converge towards the equilibrium point and S π covers the entire grid.
As one can see in Figure 3, the ROA S π for the closedloop system f π given the fixed policy π covers the entire grid, and, as can be seen from Figure 4(a) so does the NN Lyapunov candidate. It can also be seen that all trajectories converge towards the equilibrium point. This also illustrates that no surge-cycle exists in this case, as surge is a nonlinear limit cycle. In Figure 4(b), the NN fraction of S π , is 100% of the ROA. It can be seen that the safe set size is already 100% at the first iteration, and stays that way for all of the 20 iterations. Training behaviour of the NN candidate. Maximum state variables and control input defined in Equation (17). The NN Lyapunov candidate covers the entire grid. The training behaviour of the neural network stays constant since the safe set size is already 100% at the first iteration. Figure 5 shows that the safe set size is 63001 in the initial state, and hence, covers the entire grid, defined in eq. (18), and that the NN Lyapunov function covers 100.00% of S π .
The current safe level c k is only 0.1569 initially, and, as can be seen in Figure 4(b), c k remains constant for all of the iterations and does not converge to the fixed boundary c S = 1. Figure 5: Initial safe level and safe set size for the GAS equilibrium.

Locally Asymptotically Stable Equilibrium Point
With a low-pressure drop across the CCV, achieved with a low maximum value of u, the equilibrium point is locally asymptotically stable. This is motivated by minimizing the loss connected with the CCV pressure drop. For the AS control law, the saturation constraints for the state variables and control input are defined as follows: The result can be seen in Figure 6, where, in (a), the true ROA S π is represented with the green color, the NN Lyapunov function with orange and the LQR Lyapunov function with blue. The NN Lyapunov function V θ performs much better than the traditional Lyapunov approach and covers approximately 81% of the true ROA at its best iteration. However, Figure 6(b) shows that the current safe level c k of V θ grows non-monotonically (where k is the iteration k ∈ N ≥0 ) and does not converge to the fixed boundary c S = 1. The safe level set V θ (c k ) also grows nonmonotonically to cover a significant part of S π . For this example, the safe set size is only 2.46% of the grid defined in eq. (18), while in Figure 3, the safe set size is 100% of the grid for the GAS equilibrium point. As such, minimization of the pressure drop over the valve decreases the safe set size for which the equilibrium is stable, which makes sense; with little control authority it is more difficult to stabilize the system. What can also be seen in Figure 6 is that all trajectories starting outside the ROA are converging to the surge limit cycle.  (19). The control law resulted in an asymptotically stable equilibrium. The true ROA S π is represented with the green color, the NN Lyapunov function with orange and the LQR Lyapunov function with blue. Both the current safe level c k and the safe level set V θ (c k ) grow nonmonotonically.
In Figure 7 it is shown that the NN Lyapunov function covers 26.16% of S π before the first iteration, and that the safe set size is only 0.79% of the grid defined in Eq. (18). The results from the twentieth iteration are shown in Figure  8, where the safe set size is 2.46% of the grid and the NN Lyapunov function covers 81.77% of S π .  In Figure 9, 40 more iterations have been run, and by comparing Figure 6(b) and Figure 9(b), several observations can be made. First of all, the safe level c k continues to grow, non-monotonically, towards the fixed boundary c S = 1 and at iteration 60, c k = 0.876. Secondly, V θ (c k ) continues to grow non-monotonically, but does not improve much during the 40 new iterations, except that the difference between low and large values decreases. Figure 9: (a) Safe Lyapunov candidate level sets.
(b) Training behaviour of the NN candidate. This is the same control law as in Figure 6, only that 40 more iterations have been run.

Globally Asymptotically Stable Equilibrium Point
The first control law for the CCV resulted in a GAS equilibrium beyond the original surge line. This can be seen from Figure 3, where the ROA S π for the closed-loop system f π , given the fixed policy π, covers the entire grid. In Figure  4(a) it can be seen that the result of the NN Lyapunov function covers the entire grid, and in (b) the NN fraction of S π , is 100% of the ROA. It can also be seen that the safe set size is already 100% at the first iteration. Since the policy is fixed to the LQR solution, and, with the given policy, the system is globally asymptotically stable, the NN Lyapunov candidate and the LQR Lyapunov candidate provide the same result, and there is no need for the NN to explore safe states. This confirms previous findings in the literature, where in Gravdahl and Egeland (1997), a control law was derived for the CCV that resulted in a global uniform asymptotic stable equilibrium point.
In the code that accompanies the NN Lyapunov function, the maximum value of state and action have to be chosen. Given these saturation constraints, the policy is fixed to the LQR solution for the linearized, discretized system. For the GAS control law, the maximum state variables and control input are defined in eq. (17). These values were chosen given intersection point of the compressor and throttle characteristics in Figure 2. With the chosen state and action values, the throttle line crosses Ψ e (φ ) where the slope is negative, and the equilibrium is stable.

Locally Asymptotically Stable Equilibrium Point
The result of the second control law can be seen in Figure 6. For the locally asymptotically stable control law, the maximum state variables and control input are defined in eq. (19). These values were chosen with the objective to see how low the control input could be and still provide a stable equilibrium. With a low pressure drop across the CCV, the loss in the system is reduced, and the equilibrium point is locally asymptotically stable. The NN Lyapunov function V θ performs much better than the traditional Lyapunov approach, and covers approximately 81% of the true ROA. However, Figure 6 (b) shows that the safe level c k of V θ grows non-monotonically, and does not converge to the fixed boundary c S = 1. The safe level set V θ (c k ) also grows non-monotonically to cover a significant part of S π .
There are several factors with the code created by Richards et al. (2018) that have to be taken into consideration. First, it is not guaranteed that the safe level set V θ (c) will monotonically grow in volume, nor is the convergence of V θ (c) to S π . In Figure 9 it can be seen that the safe level set V θ (c) oscillates considerably for the compressor system, but also that the fraction of the true ROA S π does improve. Furthermore, the safe level c k is not guaranteed to go to the safe level c S . In Figure 9(b), it can be seen that c k continues to grow, non-monotonically, towards c S as the number of iterations increases, and at iteration 60, c k = 0.876. In comparison, Figure 4(b) shows that c k remains constant for all iterations. The reason for this can be that since the GAS control law initially covers the entire grid, there is no need for the Algorithm 1 to iteratively adapt safe level sets to the shape of S π .

Conclusion
These results indicate the feasibility of using the method of combining traditional control theory with machine learning approaches for this particular nonlinear system. Simulations providing evidence of differences between a traditional Lyapunov function and a Lyapunov function based on NNs were presented. Although the model performances were not ideal, as the safe level set V θ (c k ) grows nonmonotonically, it is believed that the results presented encourage further research. With the method presented only knowledge of inputs and outputs of the dynamics is required, and the system does not need to have a specific model structure. It allows for control design with only restrictions on the control variable.