# Optimization of Buoy Shape for Wave Energy Converter Based on Particle Swarm Algorithm
## 2 Theory and Methodology
### Optimization Methods  
In this study, a multi-degree of freedom time domain model was jointly developed using AQWA/WEC-Sim. AQWA is a dedicated simulation tool for the marine and offshore engineering industry and is commonly used to calculate hydrodynamic problems related to ships and offshore engineering. The classical interface of AQWA requires parametric modeling in APDL to provide the input files for AQWA. WEC-Sim is an open-source code  
Figure 3: The torque composition analysis of the swing-arm WEC. for simulating WECs, developed in MATLAB/SIMULINK using the multibody dynamics solver Simscape Multibody. WEC-Sim is capable of modeling devices consisting of hydrodynamic rigid bodies, articulations and constraints, PTO systems, and mooring systems. Simulations are performed in the time domain by solving the equations of motion of a controlled WEC with six rigid Cartesian degrees of freedom. The optimization method can be divided into the following steps:  
1. Generate shape vectors by the buoy shape definition method. 2. Input the variables into ANSYS APDL for parametric modeling, generate the hydrodynamic suffix dat file, put the dat file into AQWA for calculation, and obtain the suffix ah1 file and his file. (These two files are the hydrodynamic input files of WEC-Sim, generated by the internal Bemio function with the suffix h5 file, and the h5 file is the final WEC-Sim calculation file.) Calculate the target function fitness values by WEC-Sim. 3. Introduce the optimal PSO, compare the objective function fitness values, generate new variables, and then repeat steps (1) and (2). When the fitness value, which is the within-iteration best value of the population, remains unchanged or changes by less than a certain threshold, and the maximum number of iterations set has been reached, the algorithm is considered to have converged. Optimization algorithms are divided into traditional and intelligent algorithms. Traditional optimization algorithms are deterministic algorithms with fast convergence and a definite termination criterion, but the solution results are strongly dependent on the initial values and only locally optimal solutions can be obtained, such as linear programming and constraint methods. In order to avoid getting trapped in a local optimum, it is recommended to use intelligent optimization algorithms that can search for the global optimum, such as PSO and simulated annealing methods. This paper focuses on the optimization of buoy parameters using PSO because of their simplicity and ease of implementation with few parameters. A simplified algorithmic model was first proposed by [PERSON] and [PERSON] in 1995 [38]. This model focused on bird foraging behavior, where flocks of birds shared information about the group to find the best foraging site. PSO has been refined over the years. In buoy shape optimization, the position of each particle not only represents a candidate solution but also contains information about the shape of the buoy. Specifically, each candidate solution can be represented as a vector, where each element represents the shape characteristics of the buoy in different dimensions, such as length, diameter, etc. In the PSO algorithm, the position of each particle is the shape vector of a buoy, and the update process is adapted to update the elements of the shape vector accordingly. In the PSO algorithm, the velocity and position of each particle can be updated using the following equations:  
\[\left\{ \begin{array}{l}v_{id}^{k+1}=wv_{id}^{k}+c_{1}r_{1}(p_{id,pbest}^{k} -x_{id}^{k})+c_{2}r_{2}(p_{d,gbest}^{k}-x_{id}^{k})\\ x_{id}^{k+1}=x_{id}^{k}+v_{id}^{k+1}\end{array} \right.