Optimization of battery energy storage system size and power allocation strategy for fuel cell ship

The fuel cell system (FCS) is commonly combined with an energy storage system (ESS) for enhancing the performance of the ship. Consequently, the battery ESS size and power allocation strategy are critical for the hybrid energy system. This paper focuses on designing a method to solve these two problems. First, a battery degradation model is employed to assess the ESS lifetime. Subsequently, the sizing problem and the optimal power allocation are integrated into a cost‐minimization problem, which is solved by a double‐loop optimization approach. The inside loop utilizes the battery degradation model to calculate ESS lifetime. In the outside loop, a power allocation strategy based on the hybrid Particle Swarm Optimization algorithm and Gray Wolf Optimization algorithm is presented. Finally, the power allocation strategy is extended to real‐time implementation by the equivalent consumption minimization strategy (ECMS) and an improved ECMS is proposed to make the FCS operates near the maximal efficiency point. Compared with ECMS, the operating cost reduces by 0.26%. The result indicates that the proposed method can optimize the ESS size efficiently, and the power allocation strategy can assure the stable operation of the fuel cell ship.


| INTRODUCTION
The data show that international shipping accounted for 2.89% of global anthropogenic greenhouse gas emissions in 2018, and without stringent regulations, this percentage will rise. Therefore, the International Maritime Organization has developed regulations to reduce CO 2 from the ship. 1 In consequence, ship manufacturers are working to incorporate fuel cells, ammonia fuel, and renewable energy into ship power systems due to their high efficiency and pollution-free characteristics. [2][3][4] Liu et al. 4 explore the application of ammonia fuel in ships and propose an ammonia/diesel stratified injection strategy. Simulation results show that this strategy can increase the output power of the system and reduce CO 2 emissions. However, it does not achieve zero emissions. The fuel cell system (FCS) suffers from a slow dynamic response and requires a couple with energy storage system (ESS) for the application. The battery ESS is mostly utilized to store surplus solar or wind energy in the power grid. 5,6 To reduce energy curtailment, a two-part framework is proposed to optimize the placement and size of battery ESS. 5 In Metwaly and Teh, 6 a multiobjective framework is applied to determine the battery ESS size of a wind farm. The object is against network aging risk. In contrast, the ship power system can be regarded as an islanded microgrid, and the battery ESS is applied as the auxiliary power source for covering the fast load variations. 7 Therefore, the power allocation strategy and the ESS size are critical for the hybrid energy system.
For ESS sizing optimization, the factors such as cost and battery degradation need to be considered. The methods for assessing battery degradation can be classified into three categories: (1) a physical model-based approach to study the physical and chemical reactions occurring within the battery to assess its performance 8 ; (2) a data-driven method to predict battery performance 9,10 ; (3) calculate battery losses by fitting the experimental data. Yang et al. 8 present the mechanism and modeling approaches for battery degradation. Carbon deposition, sulfide, and particle coarsening can damage the catalyst. Internal impurities, such as silicon and boron, can harm the cell's electrodes. The battery degradation process can be analyzed using density flooding theory, molecular dynamics, kinetic Monte Carlo, and so forth. In Lu et al., 9 to improve the prediction accuracy of the battery lifetime, an asymmetric encoder-decoder model is designed and the hyperparameters in the model are optimized using a Bayesian optimization method. The results show that the prediction error rate is minimized with the proposed method. Furthermore, Dang et al. propose a fusion prediction method based on Gaussian process regression and an improved encoder-decoder model. This method can reduce the cumulative error of the encoder-decoder model and improve prediction accuracy. 10 Although physical model-based methods have high prediction accuracy, it requires knowledge of the physical structure of the battery. The data-driven approach requires large amounts of data to study battery degradation trends. However, the depth of discharge (DOD)-based battery degradation model can calculate the battery loss according to the battery state of charge (SOC) profile and it is more suitable for global optimization.
The power allocation strategy can be classified into rule based and optimization based. For instance, the rulebased method includes the support vector machine, frequency control, and droop control. [11][12][13] In Chen et al., 11 a power allocation strategy based on the support vector machine and frequency control is suggested for the fuel cell ship. The FCS output power keeps stable and the high-frequency load power is supplied by the ESS. In addition, to reduce fuel consumption, Wang et al. 12 propose P-V-based droop control for medium-voltage direct current (DC) power systems. In Park and Zadeh, 13 the inverse droop control is used to achieve load sharing and make the DC voltage more stable.
Although the rule-based methods have a low computational burden and are easily implemented to practical, they cannot get the global optimal solution. Intelligent algorithms such as the sine cosine algorithm, deep reinforcement learning, and model predictive control are utilized to design the optimization-based power allocation strategy. For example, Rafiei et al. 14 developed a hybrid energy system containing fuel cells and batteries for a ferry boat, and the improved sine cosine algorithm is utilized to share the power among the fuel cell and battery. Hasanvand et al. 15 corporate the fuel cell, battery, and cold ironing to ship the power system. Deep reinforcement learning is employed to deal with the problem of power allocation among the different power sources. In contrast to the common system including the diesel engine, the proposed system achieves zero emissions, but the operation cost is slightly higher. Furthermore, the optimal power allocation of an emission-free ship with fuel cells and ESSs is settled in Banaei et al. 16 by stochastic model predictive control for reducing the total operation cost.
The efficiency of a hybrid energy system is highly dependent on the power allocation strategy and the ESS size. Some researchers focus on solving these problems with a decoupled method. The whole problem has been divided into two subproblems: sizing optimization and energy management. 17 The energy management problem and ESS sizing problem are addressed with fmincon solver and CPLEX, respectively. To reduce the computational burden, a two-stage-based optimization method is proposed by Accetta and Pucci, 18 the size of the ESS is determined according to the load power in the first stage. An optimization-based power allocation strategy is suggested to minimize fuel consumption and power fluctuation of the diesel engine in the second stage.
Other authors argued that the sizing problem and power allocation problem are coupled with each other and they tried to optimal the two problems simultaneously. To take some examples, Haseltalab et al. 19 proposed an optimization-based power allocation strategy. The optimal sizing problem is solved by maximum FCS efficiency considering ESS weight and available space. In Letafat et al., 20 a multiobjective optimization method is presented to solve the two problems, where the two objectives of operation cost and investment cost are considered. Similar results are obtained by Bao et al., 21 who integrated the ESS sizing problem and optimal power allocation problem into a mathematical model.
The impact of the lifetime, investment cost, and current rate on ESS size is discussed. Moreover, with the multiobjective optimization method, the optimal ESS size is obtained by a minimum of the annual system cost and the battery loss. 22 Valera-Garcia and Atutxa-Lekue 23 established a multiobjective nonlinear optimization problem is established to optimal the ESS size and power allocation strategy. The nondominated sorting genetic algorithm II is utilized to address the problem.
The ESS sizing problem and power allocation problem are solved with coupled or decoupled methods according to the previous analysis. Although these decoupled methods are simpler, the optimal solutions are hard to obtain. Multiobjective optimization is widely used as a coupled method, but the weight factors are generally assigned based on personal experience, which has significant limitations.
In response to the deficiencies of the previous studies, an optimization method based on a dual-loop framework is proposed in this paper, and the sizing problem and the optimal power allocation are integrated into a costminimization problem. The redundancy of the ship power system is considered when designing the power allocation strategy.
The main contributions of this article are given below. First, a dual-loop optimization method is proposed to solve the ESS sizing problem and power allocation problem simultaneously. Second, the parameter of the hybrid Particle Swarm Optimization algorithm and Gray Wolf Optimization algorithm (PSOGWO) is optimized to improve the accuracy. Third, the proposed power allocation strategy is extended to real-time implementation through the equivalent consumption minimization strategy (ECMS). An improved ECMS (IECMS) is proposed to reduce hydrogen consumption.
This article is organized as follows. Section 2 describes the dual-loop optimization method, as well as, the FCS model and the battery ESS model. In Section 3, the simulation results are analyzed. In Section 4, the power allocation strategy is extended to real-time implementation based on optimal ESS size, and an IECMS is proposed. Finally, the conclusions are presented in Section 5.

| METHODOLOGY
In this section, the system component models as well as the dual-loop optimization method are given. The proton exchange membrane fuel cell is used in this paper. The ship power system model is shown in Figure 1. The hybrid energy system includes two FCSs and two ESSs, and the ESSs are used to ensure the stable operation of the ship power system. 24 The sizing problem is strongly related to the power allocation strategy. Therefore, a dual-loop optimization method is proposed to solve these two problems simultaneously.

| Fuel cell system
The characteristic curves of FCS are shown in Figure 2. The FCS output power at the maximum efficiency (ME) is P 1 (28 kW). P 2 denotes the maximum power (MP) of FCS. The parameters of the FCS are shown in Table 1. The relationship between the output power and the efficiency of the FCS is shown in Equation (1).
where P fcs and η fcs are the output power and efficiency of FCS, respectively.
F I G U R E 1 Ship power system model. AC, alternating current; DC, direct current; ESS, energy storage system; FCS, fuel cell system.
F I G U R E 2 Fuel cell system characteristic. ME, maximum efficiency; MP, maximum power.

| Battery ESS
The range of ESS size is determined based on the load power, and the ESS lifetime is calculated utilizing the DOD-based battery degradation model.

| ESS size limitation
The ESS size is constrained to the maximum load power demand and the total energy requirement. The maximum DOD of ESS is 90%. The range of the ESS size is shown in Equation (2). The rated size and the rated power of the ESS are linked by the current rate, as shown in Equation (3) where P load max represents the maximum load power, N ESS and N fcs are the numbers of ESS and FCS, respectively, P rate is the rated power of ESS, P fcs min is the minimum output power of the FCS (27 kW), T is the total time (min), P load is the load power, and E rate is the rated size of ESS, C rate is the battery current rate, and the value of C rate is 2C in this paper.

| Battery degradation model
The energy stored in the ESS at time t is shown in Equation (4), and the SOC of the ESS at time t can be expressed in Equation (6). [25][26][27] The parameters of ESS are shown in Table 2.
In these equations Δt is the time step (min), P ESS is the output power of the ESS, and η ESS is the efficiency of the ESS.
The battery lifetime is defined as the number of charge/discharge cycles in this paper. The battery degradation model based on the charge/discharge cycles and DOD is adopted to calculate the battery lifetime. The rain-flow counting method is considered to be an effective approach for mechanical fault diagnosis. 28 The battery does not discharge to a specific DOD level throughout operation but many various levels, so the rain-flow counting method is used to extract the cycle number from the SOC profile in this paper. This process consists of three stages: data reconstruction, extracting the cycle number, and calculating the DOD of each cycle.
The equivalent cycle life of the battery is given below: where b is the cycle number, N(1) is the cycle life at DOD of 1, DOD m is the DOD in cycle m, and N(DOD m ) is the cycle life at the DOD m . The battery lifetime loss can be defined as Equation (8). The battery needs to be replaced when L equals 1.
The LiFePO 4 battery is used in this paper, and the rated cycle life under different DOD is shown in Table 3

| 2113
The rated cycle life versus the DOD can be written as Equation (9). The fitted curve is shown in Figure 3.

| Dual-loop optimization
A dual-loop optimization method is suggested to optimize ESS size and power allocation simultaneously. The inner loop calculates the lifetime of the ESS according to the battery degradation model. The outer loop aims at designing a PSOGWO-based power allocation strategy. The flowchart for the dual-loop optimization is shown in Figure 4. The steps are shown as follows: (1) A possible ESS size as input.
(2) Define the range of control variables P fcs and P ESS .

| Hybrid PSOGWO algorithm
The Gray Wolf Optimization algorithm (GWO) is a metaheuristic optimization algorithm. It is based on the social behavior and leadership hierarchy of gray wolves, and the wolves are segregated into four types α, β, δ, and ω. α represents the best solution, β is the second-best solution, δ is the third-best solution, and the rest of the solutions are ω. 29 Furthermore, the GWO is based on three hunting steps: searching for the prey, encircling the prey, and attacking prey. 30 The mathematical model of the GWO is given as follows.
In these equations D represents the movement vector, A and C are the coefficient vectors, Y p is the prey position vectors, and Y denotes the gray wolf position vectors. A and C are calculated according to Equations (13) and (14), respectively.
where z is the current iteration, Z represents the total iteration number, and r 1 and r 2 are the random vectors in [0, 1]. The α, β, and δ are responsible for searching for the optimal solution. The rest of the wolves adjust their position based on α, β, and δ. The position is updated with the following equations.
The hybrid PSOGWO can minimize the possibility of falling into a local optimum, and the exploitation and exploration capability is improved compared with Particle Swarm Optimization algorithm (PSO) and GWO.
The position vectors of α, β, and δ are updated with the following equations:  γ = 0.5 + rand(0, 1) 0.5, where γ is the inertia weight. After combining PSO with GWO, the velocity and position update equations are given below: The nonlinear control parameter is used in PSOGWO. Therefore, the parameter a is calculated by Equation (23) instead of Equation (12).
where a I and a F is the initial and final value of a, respectively. The flowchart of PSOGWO is shown in Figure 5.

| Power allocation strategy
The FCS is the primary power source and the ESS is the auxiliary power source. The output power of FCSs and ESSs is determined by the minimization of operating costs. The range of FCS output power is defined as Equation (24), and the hydrogen consumption J 1 can be computed according to Equation (25). hydrogen (120 MJ/kg), and C H represents the price of hydrogen ($4.5/kg).
To increase the redundancy of the ship power system, the ESS2 is used as a backup power source. In case of a fault of other power sources or overload, the ESS2 compensates for the power missing. The output power of ESS is obtained according to Equation (26).
The output power of ESS1 and ESS2 can be computed as where P ESS1 max represents the maximum output power of ESS1.
The operation cost consists of hydrogen consumption and ESS loss. The initial cost of the ESS is calculated by the Equation (28). In this paper, both ESSs have the same rated size and rated power.
power rate size rate (28) where C power is the unit cost of power ($200/kW). C size is the unit cost of size ($125/kWh). The lifetime of the ESS is computed according to Equation (8), and the ESS loss cost can be written as Equation (29).
where L 1 and L 2 are the lifetimes of ESS1 and ESS2, respectively. The operation cost is shown in Equation (30). The output power of FCS and ESS is determined by minimizing the operation cost J.
In these equations SOC f represents the final SOC at the end of the voyage. Equations (31) and (32) limit the output power of the FCS and ESS. Equation (33) limits the variation of ESS SOC. Equation (34) indicates that the final SOC must equal to the initial SOC.

| SIMULATION RESULT
In this section, the performance of the proposed method is assessed. This paper takes the hydrogen fuel cell passenger ship as the research object. The load profile of the hydrogen fuel cell passenger ship is shown in Figure 6, and there are four operation states during the voyage, namely, cruising (A), docking (B), anchoring (C), and sailing (D). 31 The ship works at cruising condition initially, at t = 90 min the operation condition turns to dock. The load power reduces to 0 while anchoring. At t = 159 min the operation condition turns to sail, and finally, at t = 197 min it turns to cruise.
According to the load profile, the maximum load power is 270 kW and the total energy demand is 616 kWh. On the basis of Equation (2), the minimum value of the rated power of ESS is 108 kW and the maximum value of ESS size is 342 kWh. According to Equation (3), the minimum rate power versus ESS size is 54 kWh. Therefore, the optimal ESS size lies in the range [50,350]. The expanded range is to ensure accuracy.
Since the slow dynamic response of FCS, the output power of FCS and ESS cannot meet the load demand when the ESS size is less than 90 kWh. The total power missing with different ESS sizes is shown in Figure 7.
The optimum global solution of different algorithms is provided in Figure 8A and Table 4. The minimum operating cost of $252 with the ESS size of F I G U R E 6 Load power. A, cruising; B, docking; C, anchoring; D, sailing. 120 kWh is obtained by PSOGWO. In contrast to PSO and GWO, the operation cost reduces by 3.2% and 2.28%, respectively, and the size of the ESS decreases by 14.2% and 25%. The ESS takes up less space with a smaller size.
From Figure 8B,C, the performance of the PSOGWO is better compared with the PSO and GWO. The PSOGWO converges to the optimum global solution with the highest speed and fewer iterations. The initial solution with the PSOGWO is the minimum among the three algorithms.
The output power of FCS and ESS is shown in Figure 9A,B. Due to the slow dynamic response of FCS, the ESS1 provides power to the ship power system in the initial stage. During the docking, the ESS1 is utilized to reduce peak load power, so there are large fluctuations in the ESS1 output power. The output power of FCS is not reduced to 0 in anchoring but operates at the ME point to recharge the ESS. During the sailing, the ESS1 output power reaches maximum to follow the fast load transients and the ESS2 starts to compensate for the power missing. As the output power of FCS increases, the output power of ESS decreases to 0. The load power remains constant for 197-360 min, but the FCS output power continues to increase to recharge the ESS to the initial SOC. CAO ET AL.

| 2117
The variation of ESS SOC is shown in Figure 9C. The ESS2 will start when the ESS1 SOC decreases to 30%. Both the SOCs of ESS1 and ESS2 stay within the desired range.

| REAL-TIME IMPLEMENTATION
To calculate the ESS loss by the battery degradation model based on the charge/discharge cycles and DOD, the SOC profile over the entire operation cycle needs to be known. However, in the real-time simulation, only the ESS SOC at present can be obtained. To solve this problem, a new objective function is established with ECMS, and the PSOGWO-based power allocation strategy is applied in real-time. This new objective function only contains the hydrogen consumption, and the ESS loss is calculated at the end of the voyage. The flowchart for real-time implementation is shown in Figure 10.

| ECMS
The ECMS is a local optimization strategy that aims to minimize the total hydrogen consumption by minimizing the hydrogen consumption at each sample time. The core idea of the ECMS is to equate the energy consumption of ESS with the same amount of hydrogen consumption, which is treated as indirect hydrogen consumption. The energy consumption of FCS is direct hydrogen  consumption. The model is solved to minimize the total hydrogen consumption. 27,32 The new objective function is shown in Equation (35).
subject to (31)-(34), where n(t) is the equivalent factor, which limits the variation of ESS SOC. μ is the equilibrium coefficient (0.6). 33 The n decreases with the increase of SOC, so the final SOC may be lower than the initial value.

| IECMS
The IECMS is proposed by adding the penalty factors, as shown in Equation (36), and the hydrogen consumption is calculated according to Equation (37). The IECMS can make the FCS operates near the maximal efficiency point, which reduces the hydrogen consumption.
subject to (31)-(34). The simulation result is presented in Figure 11. The FCS output power with ECMS is shown in Figure 11A, the maximum output power of FCS1 and FCS2 is 103.2 and 108.2 kW, respectively. From Figure 11B, the maximum output power of FCS1 and FCS2 with IECMS is 76.2 and 76.1 kW. Compared with ECMS, the maximum output power of FCS1 and FCS2 reduces by 26.2% and 29.3%, respectively.
The variation of ESS SOC is shown in Figure 11C,D. Both the SOC of ESS1 and ESS2 stay within the desired range. The ESS loss with ECMS is $50.37 and the ESS loss with IECMS is $50.5. From Figure 11D, the DOD of the ESS is larger with IECMS compared with ECMS. Therefore, the ESS loss is slightly higher, however, the final SOC of ESS1 obtained by the IECMS and ECMS are almost equal.
Hydrogen consumption consists of two parts. The first part is the hydrogen consumed (HC1) in the course of ship operation. The FCSs operate at MP with an efficiency of 40.02% to recharge the ESS to its initial charge after the voyage, which is the second part of the hydrogen consumption (HC2). From Table 5, the total hydrogen consumption with ECMS is $178.02. The total hydrogen consumption with IECMS is $177.3, which is a 0.4% reduction compared with the ECMS. The operation cost with ECMS is $228.39. The operation cost with IECMS is $227.8, which is a 0.26% reduction compared with the ECMS. However, it is worth noting that the hydrogen consumption efficiency increase is very small because only the operation state of the FCS is constrained. In addition, the new objective function only limits the SOC variation without including ESS loss, resulting in a small increase in operating cost efficiency.

| CONCLUSION
In this paper, a dual-loop optimization method is proposed to optimize the ESS size and power allocation simultaneously for a fuel cell ship.
In the inside loop, a battery degradation model based on the charge/discharge cycles and DOD is adopted to calculate ESS lifetime. A PSOGWO-based power allocation strategy is designed in the outside loop. The minimum operating cost is $252 for an ESS size of 120 kWh with PSOGWO. In contrast to PSO and GWO, the operation cost reduces by 3.2% and 2.28%, respectively, and the size of the ESS decreases by 14.2% and 25%, respectively.
Lastly, based on the optimal ESS size, the PSOGWObased power allocation strategy is extended to real-time implementation through ECMS and an IECMS is proposed to reduce hydrogen consumption. Compared with ECMS, the maximum output power of FCS1 and FCS2 reduces by 26.2% and 29.3%, respectively, and the hydrogen consumption and operating costs are reduced by 0.4% and 0.26%, respectively.
Collectively, the results demonstrate that the proposed method can optimize the ESS size effectively and the PSOGWO-based power allocation strategy can ensure the stable operation of the system. In the real-time simulation, although hydrogen consumption and operation costs can be reduced with IECMS, the efficiency increase is small. Future work will further optimize the ECMS or explore other methods to reduce operation cost and adopt other battery degradation models to calculate ESS loss in real-time simulation.