# Position Control of Heave Compensation for Offshore Cranes Based on a Particle Swarm Optimized Model Predictive Trajectory Path Controller

Hao Chen, Jinke Xie, Jingang Han, Weifeng Shi, Jean-Frédéric Charpentier, Mohamed Benbouzid

► To cite this version:

Hao Chen, Jinke Xie, Jingang Han, Weifeng Shi, Jean-Frédéric Charpentier, et al., Position Control of Heave Compensation for Offshore Cranes Based on a Particle Swarm Optimized Model Predictive Trajectory Path Controller. Journal of Marine Science and Engineering, 2022, 10 (10), pp.1427-1439. http://jmse10101427 hal-05038079

HAL Id: hal-05038079

https://hal.univ-brest.fr/hal-05038079v1

Submitted on 17 Apr 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Article

# Position Control of Heave Compensation for Offshore Cranes Based on a Particle Swarm Optimized Model Predictive Trajectory Path Controller

Hao Chen<sup>1, ID</sup>, Jinke Xie<sup>1</sup>, Jingang Han<sup>1,* ID</sup>, Weifeng Shi<sup>1</sup>, Jean-Frédéric Charpentier<sup>2,* ID</sup>
and Mohamed Benbouzid<sup>1,3 ID</sup>

**Abstract:** The wave compensation system can be very useful in several naval applications. It can greatly reduce the relative irregular motion between the two ships when replenishment operations are performed, or between the ship and the offshore platform, which is caused by the waves. It is widely used in offshore operations, offshore cargo transfer, oil and gas exploitation, deep-sea mining, the hoisting and recovery of submersibles, etc. However, when a crane is used in a ship or moving platform, due to the influence of the hull, the crane load movement is similar to a space ball pendulum, which causes the heave displacement to show significant nonlinear motion characteristics. Moreover, the time delay of the detection mechanism and control error could result in untimely compensation, which deteriorates the performance. Consequently, this paper proposes one advanced prediction compensation method, namely Particle Swarm Optimized Model Predictive Trajectory Path controller (PSO-MPTP), which can improve the heave compensation performance. This method, which is based on Model Predictive Control (MPC), is firstly applied to the position servo system and takes into account the heave prediction and control effects simultaneously. The heave displacement of the crane load could be predicted in multiple steps in advance and used as the input of the position loop of the compensation machine. The achieved simulations show that the proposed controller has better prediction ability, higher control accuracy, and stronger robustness.

**Keywords:** active heave compensation; floating crane; model predictive trajectory path; servo position control; permanent magnet synchronous motor

<figure><img src="image_2.png" /></figure>

check for
updates

**Citation:** Chen, H.; Xie, J.; Han, J.; Shi, W.; Charpentier, J.-F.; Benbouzid, M. Position Control of Heave Compensation for Offshore Cranes Based on a Particle Swarm Optimized Model Predictive Trajectory Path Controller. *J. Mar. Sci. Eng.* **2022**, *10*, 1427. https://doi.org/10.3390/jmse10101427

Academic Editor: Unai
Fernandez-Gamiz

Received: 10 September 2022

Accepted: 30 September 2022

Published: 4 October 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

<figure><img src="image_3.png" /></figure>

**Copyright:** © 2022 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## 1. Introduction

Human maritime industrial activities have become more and more significant in recent years. Consequently, crane operation, an essential part of the offshore industry and offshore facility supply chain, becomes more and more important. However, the interference of waves will make the ship move with 6-Degrees of Freedom (DOF) (sway, surge, heave, roll, pitch, and yaw) and seriously affect offshore lifting and cargo shifting operations on ships due to the complicated ocean environment [1]. In particular, the heave motion and yaw motion have the most significant impact on the crane load during the operation process [2]. Due to other relatively small motions compared to the heave motion, heave compensation is the more crucial motion for the offshore work of cranes.

Normally, the basic principle of heave compensation is to use sensors to detect and record the relative distance of ship and crane load and produce a compensation signal to the crane to make the load swing at the opposite speed. In this way, a collision between the cargo and ship deck caused by waves can be avoided, and the safety of cargo operators during lifting work can be improved. If the heave motion of cranes could be predicted in

<footnote n="1">¹ The Research Institute of Power Drive and Control, Shanghai Maritime University, Shanghai 201306, China</footnote>

<footnote n="2">² Institut de Recherche de l'Ecole Navale (EA 3634 IRENav), French Naval Academy, 29240 Brest, France</footnote>

<footnote n="3">³ Institut de Recherche Dupuy de Lôme (UMR CNRS 6027 IRDL), University of Brest, 29240 Brest, France</footnote>

<footnote>* Correspondence: jghan@shmtu.edu.cn (J.H.); jean-frederic.charpentier@ecole-navale.fr (J.-F.C.)</footnote>
advance and the servo system can effectively compensate over time, the unnecessary heave movement of the load can be significantly reduced [3].

The wave compensation system is generally divided into the Passive Heave Compensation system (PHC), Active Heave Compensation system (AHC), and Semi-Active Heave Compensation system (SAHC) [4]. In principle, the PHC device is located between the offshore crane and the crane load and can be represented by a parallel spring damping system. It does not require energy and is generally used with heavy loads and low accuracy requirements. PHC cannot compensate for the relative motion between the effective load and the ship in real-time, which has a specific time delay. To summarize, PHC has limitations in compensating for relative motion. The compensation efficiency of PHC in decoupling ship heave motion and load motion does not exceed 80% [5], while for AHC, the performance largely depends on the reliability of the control system. The relative compensated speed is much faster and the compensation accuracy is much higher. It can adjust the overcompensation more actively and significantly suppress the coupling of the heave motion of the payload [6]. However, this system consumes energy and is more suitable for small and medium-sized systems. SAHC combines the advantages of PHC and AHC, which can achieve satisfactory compensation accuracy with lower energy consumption [7]. Nevertheless, due to the combination of the two systems, SAHC is more complicated and expensive.

Huang et al. designed an AHC that satisfies the good control characteristics of the wave compensation system and obtains higher compensation accuracy [8]. The Motion Reference Unit (MRU) measures the actual ship motion. The AHC controller then calculates the motion of the actuator to counteract the ups and downs. The efficiency of the system can reach more than 90% [9,10]. The primary actuation of most AHCs is delivered by either hydraulic or electric drive systems. The electric drive system-based AHC has more advantages than the hydraulic system-based AHC in terms of compensation accuracy and speed. The efficiency of the electric heave compensation systems is between 70% and 80%. Compared with hydraulic systems, the characteristics of no oil reservoir and low motor noise have attracted more and more consumers. Moreover, for hydraulic systems in general, the biggest disadvantage is low efficiency with likely as low as 10% to 35% average efficiency of some open-loop systems [11].

As shown in Figures 1–3, AHCs are mainly divided into the draw-works retractable type, the hydraulic cylinder telescopic type, and the boom luffing type [12]. This paper will mainly focus on the draw-works retractable type, which is shown in Figure 1.

<figure><img src="image_4.png" /><figcaption>Figure 1. Draw-works retractable type [12].</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>Figure 2. Hydraulic cylinder telescopic type [12].</figcaption></figure>
<figure><img src="image_6.png" /><figcaption>**Figure 3.** Boom luffing type [12].</figcaption></figure>

A number of papers have investigated AHC with the aim of reducing compensation errors. The most commonly used method is predicting the movement of the crane load and compensating for the prediction result. Lin et al. compensated for the heave motion of a crane based on motion prediction and fuzzy PID control [13]. Due to the hysteresis of the hydraulic system, it is difficult to respond quickly and accurately to the control signal. The compensation action and wave motion are out of step, which affects the compensation effect. The method proposed in Ref. [13] can not only solve the hysteresis, which has always existed in hydraulic actuators, but also uses motion prediction and fuzzy PID to avoid overshoot and instability. Chu et al. proposed a neural network-based ship motion prediction method to apply to offshore crane operations and implemented the proposed AHC algorithm [14]. They trained a multi-layer perceptron model to predict the ship's motion and used the ship's future motion information as the controller's input to compensate for the shaking of the crane load. This method used predictive data for control and helped to overcome the signal delay of measuring sensor data. Longer forecasts can also provide on-board support and early warnings to prevent system failures. Neupert et al. used the prediction of heave motion as part of the AHC crane control method [15]. A crane dynamics-based linear model and a pole-assignment control method to set the load position were adopted. Shi et al. proposed a Kalman filter-based using Kalman Filter Particle Swarm Optimization to improve the prediction performance of a Support Vector Regression (KPSO-SVR) advanced statistical machine learning algorithm to analyze and research deep-sea fishing vessels [16]. Unlike the previous neural network algorithm, it can avoid the neural network over-fitting phenomenon that may occur due to the minimization of the Structural Risk Minimization (SRM) structure risk to accurately predict the heave motion of the ship crane to compensate for the crane load. The proposed prediction model can overcome the increasing lag of the Autoregressive Moving Average Model (ARMA) prediction model over time. Küchler et al. proposed a prediction algorithm for the heave movement of crane load [17]. The Fast Fourier Transform (FFT) analyzes the motion caused by waves in the frequency domain. A peak detection algorithm extracts the amplitude, frequency, and other signals from the frequency domain signal, which is then processed by a Kalman filter. After the identification, the heave movement of the crane load is estimated. Using the controller and prediction method, which can significantly reduce the heave movement of the crane load, compensates for the dead time in the system.

High-precision compensation for the heave of the crane load is carried out using the control algorithm in the compensation mechanism. Cai, Zheng, and Liu proposed an adaptive robust dual-loop control scheme and proposed a multi-degree-of-freedom velocity feedforward compensator to decouple motion disturbances from the basic platform [18]. The original dynamic model was transformed into a linear parameterized form, and the adaptive law was used to estimate the basic parameters. A command-filter-based adaptive robust controller was developed to solve the problem that the uncertainty from the load and hydraulic system may reduce the system performance. Woodacre, Bauer, and Irani designed a Model Predictive Control (MPC) controller to drive a hydraulic test system for unloading and compared the experimental results of the PID controller [19]. It was found that the MPC controller can track various test cases and references and is better than the PID controller in all experiments. The decoupling of the transmitted movement by the MPC-PI controller can reduce the percentage by 99.6%. Johansen et al. combined the traditional AHC with the feedforward control strategy [20]. It reduced the impact
force and effectively improved the stability of the crane load. Messineo and Serrani proposed an adaptive controller for heavy cranes [21]. It used an adaptive observer and two adaptive external interference models to make the closed-loop system adaptive in terms of equipment parameters and harmonic disturbance frequencies. Yang et al. designed a neural network-based adaptive control method to control the driving and non-driving state variables without any linearization operation [22]. In particular, the proposed rule could effectively compensate for the uncertainty of parameters and crane system structure. The manipulator and rope can reach the preset position within a limited time, and the payload swing can be suppressed entirely. Arnold et al. proposed a nonlinear control strategy combined with a model-based optimal trajectory generation method [23]. The trajectory tracking and anti-interference of crane load transportation were studied. The optimal control problem solved online considers the linearized system including state feedback, input, and state constraints. The generated optimal trajectory and straightness pitch motion control were applied to the measurement of the mobile port crane. The movement of the load was greatly compensated. Richter et al. proposed a real-time model predictive trajectory planner [24]. By predicting the vertical position and speed of the crane apex, the optimal control problem with the state constraints for each time step was solved online. A repetitive polynomial-based trajectory planner was used as a fallback strategy if the best control solution could not be found within the available time. If the optimization algorithm fails to find an efficient solution within the available time, continuity of control can be guaranteed.

According to the literature, indeed, these references propose different methods, which could improve the compensation performance, using either feed-forward control to predict the heave motion or feedback control to compensate for the displacement of the crane load. However, these methods mainly focus on only one part and hardly discuss the hybrid control, which takes into account the prediction and control effects simultaneously to improve the performance. This paper proposes a Particle Swarm Optimized Model Predictive Trajectory Path (PSO-MPTP) controller, which combines the feed-forward and feedback controls. It uses the heave displacement trajectory signal of the crane load as an input to the compensation mechanism. Furthermore, according to this method, it can use future set-points to respond to changes in trajectory tracking in advance. This should be a good method to solve the above problems. For simplification, only the heave direction displacement of the crane load is considered. The trajectory of the crane load is tracked in the Northeast Down (NED) frame. The required reference trajectory is calculated, the actuator and measuring unit of the heave compensation system must be independent units of the modular platform. This paper adopts the Permanent Magnet Synchronous Motor (PMSM) servo system as the actuator in Figure 1, which is an important part of the offshore crane system. The PSO-MPTP is introduced into the wave compensation system for the first time, which replaces the conventional PI of the position loop in the three-phase closed-loop control of the traditional PMSM for real-time position compensation.

Consequently, this paper is structured as follows. In Section 2, the mathematical model of wave disturbance force and crane system is established. The overall system uses coordinate movement to obtain the displacement and velocity of the crane load in the heave direction. In Section 3, a mathematical model of PMSM is developed. In Section 4, the state equation is established for the motion equation of the crane system. Subsequently, PSO-MPTP for the position loop is designed and constrains the control quantity and control increment. Finally, the three-phase closed-loop control of the PMSM is presented and implemented in Matlab/Simulink. The analysis of the simulation results proves the feasibility of PSO-MPTP in the heave displacement compensation of the crane load.

## 2. System Model and Dynamic Equation

When the ship is traveling in the sea, it is affected by the wind and waves, which will cause the hull to shake and produce 6-DOF movement. The wave disturbance force is transmitted to the crane load through the hull, making the crane load heave and move.
The overall process of the displacement compensation system of the crane load is shown in Figure 4.

<figure><img src="image_7.png" /><figcaption>Figure 4. The overall flow chart of the system.</figcaption></figure>

The work in this article is based on some reasonable assumptions, which are as follows:

1. Assuming that the shape of the crane ship is a square barge, the hull is regarded as a rigid body during operation and will not be deformed by the impact of waves. Moreover, during the lifting process, it is assumed that the sling is not deformed too much.

2. The sling quality occupies a small proportion of the entire compensation system with negligible impact.

3. Only the heave displacement of the crane load in the Z-axis direction is considered for compensation.

Firstly, the wave disturbance force is modeled. Waves on the sea surface are generated by the sea wind. The wind speed determines the height and period of each wave. The waves impact the hull, and the force is transmitted from the hull to the crane load subsequently.

According to the linear regression formula based on the data in the paper of Price and Bishop, the wave mathematical model is obtained in Formula (1) [25].

$$ egin{cases} a = 0.015U_T^2 + 1.5 \\ T_w = -0.0014U_T^3 + 0.042U_T^2 + 5.6 \\ k = \omega_k^2/g \end{cases} \quad (1) $$

where a is the wave height (m); $U_T$ is the wind speed (m/s); $T_w$ is the wave period (s); k is the wave number; $\omega_k$ is the reciprocal of $T_w$.

Thus, the wave impact force and the corresponding torque can be calculated with Formulas (2) and (3) based on the hypothesis of Froude-Krylov [26].

$$ egin{cases} F_x = 2\rho g a \frac{\sin[(kB/2) \sin \varphi]}{(kB/2) \sin \varphi} e^{-kd} B_d \sin[(kL_{ship}/2) \cos \varphi] \sin \omega_n t \\ F_y = -2\rho g a \frac{\sin[(kB/2) \cos \varphi]}{(kB/2) \cos \varphi} e^{-kd} L_{ship} \sin[(kB/2) \sin \varphi] \sin \omega_n t \\ F_z = \rho g a k \frac{\sin[(kB/2) \sin \varphi]}{(kB/2) \sin \varphi} e^{-kd} B_d L_{ship} \frac{\sin[(kB/2) \cos \varphi]}{(kB/2) \cos \varphi} \cos \omega_n t \end{cases} \quad (2) $$
$$
\left\{
\begin{aligned}
M_x &= \rho g a \frac{\sin[(kB/2) \sin \varphi]}{(kB/2) \sin \varphi} e^{-kd} \sin \varphi \frac{d^2 \sin[(kL_{ship}/2) \cos \varphi]}{\cos \varphi} \sin \omega_n t \\
M_y &= \rho g a \frac{\sin[(kB/2) \sin \varphi]}{(kB/2) \sin \varphi} e^{-kd} d_n \cdot \\
    &\quad \frac{2 \sin[(kL_{ship}/2) \cos \varphi] - kL_{ship} \cos \varphi \cos[(kL_{ship}/2) \cos \varphi]}{k^2 \cos^2 \varphi} \sin \omega_n t \\
M_z &= \rho g a \frac{\sin[(kB/2) \sin \varphi]}{(kB/2) \sin \varphi} e^{-kd} \sin \varphi \cdot \\
    &\quad \frac{2 \sin[(kL_{ship}/2) \cos \varphi] - kL_{ship} \cos \varphi \cos[(kL_{ship}/2) \cos \varphi]}{k^2 \cos^2 \varphi} \cos \omega_n t
\end{aligned}
\right.
\quad (3)
$$

where $F_x$, $F_y$, and $F_z$ are the wave force in x, y, and z directions of the hull (N); $M_x$, $M_y$, and $M_z$ are the torque corresponding to the wave force in x, y, and z directions of the hull (N·m); $\rho$ is the density of seawater (kg/m³); $g$ is the gravitational acceleration (m²/s); $d$ is the draft (m); $B$ is the width of the ship (m); $L_{ship}$ is the length of the ship's waterline (m); $\varphi$ is the wave encounter angle (rad); and $\omega_n$ is the encounter frequency (Hz). $t$ is time and the above formula changes with time.

Figure 5 presents the ship crane system model. From this figure, A is the hoisting point, $L_0$ is the initial rope length of the hoisting rope, L is the rope length after the lifting and sinking displacement of the hoisting object, and $\alpha$ and $\beta$ are the inner and outer angles of the plane. $O-X_b Y_b Z_b$ is the BODY (Body-axis coordinate system) frame, and $O-X_N Y_N Z_N$ is the NED (Northeast Down) frame. $F_x$, $F_y$, and $F_z$ are wave forces. $\Delta Z$ is the heave displacement of the crane load.

<figure><img src="image_8.png" /><figcaption>Figure 5. Ship crane system model.</figcaption></figure>

The movement formula of the crane load in the system can be obtained in Formula (4).

$$
\left\{
\begin{aligned}
x_G(t) &= x_A(t) + L \cos \alpha \cos \beta \\
y_G(t) &= y_A(t) - L \sin \beta \\
z_G(t) &= z_A(t) + L \cos \alpha \cos \beta
\end{aligned}
\right.
\qquad (4)
$$

Taking the first derivative of Formula (4), the speed of the crane load in three directions can be obtained in the following Formula (5).

$$
\left\{
\begin{aligned}
\dot{x}_G(t) &= \dot{x}_A(t) + \dot{L} \sin \alpha \cos \beta + \dot{\alpha} L \cos \alpha \cos \beta - \dot{\beta} L \sin \alpha \cos \beta \\
\dot{y}_G(t) &= \dot{y}_A(t) - \dot{L} \sin \beta + \dot{\beta} L \cos \beta \\
\dot{z}_G(t) &= \dot{z}_A(t) + \dot{L} \cos \alpha \cos \beta - \dot{\alpha} L \sin \alpha \cos \beta - \dot{\beta} L \cos \alpha \cos \beta
\end{aligned}
\right.
\qquad (5)
$$
According to Figure 5, when the crane load swings from the point G to point G₁, the potential energy of the Y_NOZ_N surface is set to 0 at this time, and the total kinetic energy and potential energy of the crane system can be deduced in Formula (6).

$$ \left\{ \begin{array}{l} T = \frac{1}{2} m x_G^{\bullet 2}(t) + \frac{1}{2} m y_G^{\bullet 2}(t) + \frac{1}{2} m z_G^{\bullet 2}(t) \\ V = -mgl \cos \alpha \cos \beta \end{array} \right. \qquad (6) $$

Then, the Lagrangian function L_a of the crane load can be developed in Formula (7).

$$ \begin{aligned} L_a &= T - V \\ &= \frac{1}{2} m_G (x_A^{\bullet 2} + y_A^{\bullet 2} + z_A^{\bullet 2} + L^2 + L^2 \alpha^2 \cos^2 \beta + L^2 \beta^2) + \\ &m_G x_p^{\bullet} (L \sin \alpha \sin \beta + \alpha L \cos \alpha \cos \beta - \beta L \sin \alpha \sin \beta) - \\ &m_G y_p^{\bullet} (L \sin \beta + \beta L \cos \alpha) + \\ &m_G z_p^{\bullet} (L \cos \alpha \cos \beta - \alpha L \sin \alpha \cos \beta - \beta L \cos \alpha \sin \beta) + \\ &m_G g L \cos \alpha \cos \beta \end{aligned} \qquad (7) $$

where m_G is the weight of the crane load (kg).

Using Formulas (2) and (3), combined with Newton's second law, the acceleration of the wave force on the hull in the x, y, and z directions can be obtained. Then, according to the Lagrangian Equation (8), the second-order multivariate dynamic differential equation of the crane system can be obtained in Formula (9). The inner angle α and the outer angle β can be obtained by Formula (9).

$$ \begin{aligned} \frac{d}{dt} \left( \frac{\partial L_a}{\partial \alpha} \right) - \left( \frac{\partial L_a}{\partial \alpha} \right) &= 0 \\ \frac{d}{dt} \left( \frac{\partial L_a}{\partial \beta} \right) - \left( \frac{\partial L_a}{\partial \beta} \right) &= 0 \end{aligned} \qquad (8) $$

$$ \begin{aligned} \ddot{\alpha} \cos \beta - 2\dot{\alpha}\dot{\beta} \sin \beta + \frac{g}{L} \sin \alpha + \frac{\ddot{x}_p}{L} \cos \alpha - \frac{\ddot{z}_p}{L} \sin \alpha + \frac{2\dot{\alpha}\dot{L}}{L} &= 0 \\ \ddot{\beta} + \alpha^2 \sin \beta \cos \beta + \frac{g}{L} \cos \alpha \sin \beta - \frac{\ddot{x}_p}{L} \sin \alpha \sin \beta - \frac{\ddot{y}_p}{L} \cos \beta - \frac{\ddot{z}_p}{L} \cos \alpha \sin \beta + \frac{2\dot{\beta}L}{L} &= 0 \end{aligned} \qquad (9) $$

Finally, the heave displacement ΔZ of the crane load in the heave direction can be obtained in Formula (10) in accordance with the inner and outer angles and Figure 5.

$$ \Delta Z = L \cos \alpha \cos \beta - L \qquad (10) $$

ΔZ is the reference trajectory given by the heave motion of the crane load. The input is ΔZ to PSO-MPTP. Through PMSM three-phase closed-loop control, using the idea of trajectory tracking, with the help of the servo mechanism, PMSM can reverse track the heave displacement of ΔZ to maintain the position of the crane load.

### 3. Mathematical Model of PMSM

Due to the high torque-to-current ratio, high power-to-weight ratio, high efficiency, high power factor, and robustness, PMSM is adopted as the actuator of the servo mechanism in this paper, and the accuracy of motor control directly affects the efficiency of system compensation.

The voltage and flux expressions of PMSM in the dq axis are given in Formulas (11) and (12).

$$ \left\{ \begin{array}{l} u_d = L_d \frac{di_d}{dt} + R_s i_d - \omega_e \psi_q \\ u_q = L_q \frac{di_q}{dt} + R_s i_q + \omega_e \psi_d \end{array} \right. \qquad (11) $$

$$ \left\{ \begin{array}{l} \psi_d = L_d i_d + \psi_f \\ \psi_q = L_q i_q \end{array} \right. \qquad (12) $$
where $u_d$ and $u_q$ are the d and q-axis voltages (V); and $i_d$ and $i_q$ are the d and q-axis currents (A); $L_d$ and $L_q$ are the d and q-axis inductances (mH); $\psi_d$ and $\psi_q$ are the flux linkage components (Wb); $R_s$ is the stator equivalent resistance (Ω), $\omega_e$ is the electrical angular velocity of the motor (rad/s); $\psi_f$ is the permanent magnet flux of the rotor (Wb).

The torque equation is shown in Formula (13).

$$T_e = \frac{3}{2} p_n (\psi_d i_q - \psi_q i_d) \qquad (13)$$

The mechanical equation of the motor is given in Formula (14)

$$J \frac{d\omega_m}{dt} = T_e - T_L \qquad (14)$$

where $T_e$ is the electromagnetic torque (N·m); $p_n$ is the number of pole pairs; $J$ is the moment of inertia (kg·m²); $\omega_m$ is the mechanical angular velocity (rad/s); and $T_L$ is the load torque (N·m).

## 4. Application of PSO-MPTP in Motor Position Control

The PID controller plays a leading role in industrial process control. However, because of the complicated working condition on the sea, the conventional PID controller has poor robustness and control performance to the parameters' variation in the PMSM position servo system [27]. Moreover, the PID controller has other problems such as error selection, side effects of integral feedback, extraction of differential terms, and so on [28]. In order to overcome these disadvantages, Active Disturbance Rejection Control (ADRC) is proposed. They are all error-based controllers to eliminate error and do not need an accurate mathematical model. Although the performance of ADRC is better than PID [29], the traditional ADRC also has some problems in the PMSM position servo system, such as a slow positioning response, poor positioning accuracy, and difficult parameter setting [30]. For the sake of solving the defects of the above controllers, MPTP, which is developed from MPC, is proposed. The only difference is the initial state. For MPC, the initial state of the optimal control problem is the current feedback value of the control system. Based on the research background of this paper, the initial state of the optimal control problem for MPTP is the value calculated in advance. Thus, this section uses the PSO algorithm to increase the accuracy and speed of MPTP quadratic programming.

The PSO-MPTP is adopted in the position loop of three-phase closed-loop control of PMSM. In principle, the crane load position signal is used as the input of the position loop of the three-phase closed-loop of PMSM. After comparing it with the feedback position, the predicted desired speed can be obtained through PSO-MPTP and tracked by classical speed and current loops. According to this basic process, the compensated motor could rotate to drag the hoisting rope and compensate for the crane load in the heave direction, which can significantly reduce the wave disturbance and keep the crane load and the ship relatively static. In order to achieve this result, several steps should be followed.

### 4.1. Forecast Model Heading

To establish the relationship between heave displacement and the motor, the heave displacement $\Delta Z$ caused by the shaking of the crane load should be transformed into the rotation angle of the compensated motor in Formula (15). It means that the heave displacement can be controlled by the rotation of the compensated motor.

$$\theta = \frac{180}{\pi r} \Delta Z \qquad (15)$$

where $r$ is the radius of the roll (m).
The kinematic equation of the crane load at point G in the NED frame is presented in Formula (16).

$$ \dot{\theta} = \omega \cos \alpha \cos \beta \qquad (16) $$

The expected displacement of the crane load is $\theta_r$, the subscript $r$ represents the reference quantity, and the actual displacement of the crane load is $\theta_m$. The expected displacement error of the crane system can be summarized in Formula (17).

$$ e(t) = \theta_r(t) - \theta_m(t) \qquad (17) $$

The desired displacement error should be as small as possible. Therefore, the limitation of $e(t)$ is zero in Formula (18).

$$ \lim_{t \to \infty} e(t) = 0 \qquad (18) $$

It can be seen from Formula (16) that the entire crane system can be regarded as a control system with a state quantity of $\theta = [\theta_m]$ and a control quantity of $W = [\omega_m]$. Its general form can be represented by Formula (19).

$$ \dot{\theta} = f(\theta, W) \qquad (19) $$

At each moment, the jitter caused by the wave disturbance force on the crane load satisfies the above kinematic equation. It can be summarized in Formula (20).

$$ \dot{\theta}_r = f(\theta_r, W_r) \qquad (20) $$

After the Taylor series expansion of Formula (19), it can be rewritten in Formula (21) if the higher-order terms are ignored.

$$ \dot{\theta} = f(\theta_r, W_r) + \left. \frac{\partial f(\theta, W)}{\partial \theta} \right|_{\substack{\theta = \theta_r \\ W = W_r}} (\theta - \theta_r) + \left. \frac{\partial f(\theta, W)}{\partial W} \right|_{\substack{\theta = \theta_r \\ W = W_r}} (W - W_r) \qquad (21) $$

The state quantity deviation and control quantity deviation of the crane system are assumed to be represented by Formula (22).

$$ \begin{aligned} \tilde{\theta} &= [\dot{\theta}_m - \dot{\theta}_r] \\ \tilde{W} &= [\omega_m - \omega_r] \end{aligned} \qquad (22) $$

The combination of Formulas (21) and (20) gives Formula (23).

$$ \tilde{\theta} = [\dot{\theta}_m - \dot{\theta}_r] = \cos \alpha \cos \beta [\omega_m - \omega_r] \qquad (23) $$

Formula (23), based on the kinematics model, needs to be discretized to obtain the discrete state space Formula (24).

$$ \tilde{\theta}(k+1) = [1] \tilde{\theta}(k) + [T \cos \alpha \cos \beta] \tilde{W}(k) \qquad (24) $$

Formula (24) can be written in the form of Formula (25).

$$ \tilde{\theta}(k+1) = a_k \tilde{\theta}(k) + b_k \tilde{W}(k) \qquad (25) $$

With:

$$ a_k = [1], b_k = [T \cos \alpha \cos \beta] $$
In the value function, it is necessary to constrain the control increment to calculate the system's output for a period of time in the future. Formula (25) is transformed into Formula (26).

$$ \vartheta(k) = \begin{bmatrix} \tilde{\theta}(k) \\ \tilde{W}(k-1) \end{bmatrix} \qquad (26) $$

Formula (26) can be developed into expression Formulas (27) and (28) by recursion.

$$ \vartheta(k+1) = \tilde{a}_k \vartheta(k) + \tilde{b}_k \Delta \tilde{W}(k) \qquad (27) $$

$$ \theta(k) = \tilde{c}_k \theta(k) \qquad (28) $$

With:

$$ \tilde{a}_k = \begin{bmatrix} a_k & b_k \\ 0_{m \times n} & I_m \end{bmatrix}, \tilde{b}_k = \begin{bmatrix} b_k \\ I_m \end{bmatrix}, \tilde{c}_k = \begin{bmatrix} I_m & 0_{n \times n} \end{bmatrix} $$

where m is the dimension of the state quantity; n is the dimension of the control quantity.

## 4.2. Rolling Optimization

From the calculation of (22)–(28), it can be seen that the prediction output expression of the system is Formula (29).

$$ Y(k) = \Psi_k \vartheta(k) + \Phi_k \Delta W(k) \qquad (29) $$

With:

$$ Y(k) = \begin{bmatrix} \tilde{\theta}(k+1) \\ \tilde{\theta}(k+2) \\ \vdots \\ \tilde{\theta}(k+N_c) \\ \vdots \\ \tilde{\theta}(k+N_p) \end{bmatrix} $$

$$ \Phi_k = \begin{bmatrix} \tilde{c}_k \tilde{b}_k & 0 & \cdots & 0 \\ \tilde{c}_k \tilde{a}_k \tilde{b}_k & \tilde{c}_k \tilde{b}_k & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ \tilde{c}_k \tilde{a}_k^{N_c-1} \tilde{b}_k & \tilde{c}_k \tilde{a}_k^{N_c-2} \tilde{b}_k & \cdots & \tilde{c}_k \tilde{a}_k \\ \vdots & \vdots & \ddots & \vdots \\ \tilde{c}_k \tilde{a}_k^{N_p-1} \tilde{b}_k & \tilde{c}_k \tilde{a}_k^{N_p-2} \tilde{b}_k & \cdots & \tilde{c}_k \tilde{a}_k^{N_p-N_c} \tilde{b}_k \end{bmatrix} $$

$$ \Delta W(k) = \begin{bmatrix} \Delta \tilde{W}(k) \\ \Delta \tilde{W}(k+1) \\ \vdots \\ \Delta \tilde{W}(k+N_c-1) \end{bmatrix} $$

where $N_p$ is the prediction time domain; $N_c$ is the control time domain. Therefore, if the current state quantity and the control increment in the control time domain $N_c$ are known, the system output in the future forecast time domain $N_p$ can be predicted.

## 4.3. Rolling Optimization

For the value function to ensure that the suspension rope of the compensation motor can quickly and smoothly track the expected displacement of the crane load, it is necessary to optimize the deviation of the system state quantity and the control increment. This paper uses a value function of the form Formula (30) [31]:

$$ J(k) = \sum_{j=1}^{N} \tilde{\theta}^{T}(k+j) Q \tilde{\theta}(k+j) + \Delta \tilde{W}^{T}(k+j-1) R \Delta \tilde{W}(k+j-1) \qquad (30) $$
where Q and R are symmetric positive definite weight matrices.

In Formula (30), the control quantity is used as the state quantity in the value function. The structure is simple and easy to realize, but it also has some shortcomings. It cannot accurately constrain the control increment, and the phenomenon of sudden changes in the control quantity of the controlled system is unavoidable. It seriously affects the continuity of the control amount. In this case, the control increment is selected as the state quantity of the value function, and Formula (31) is selected as the value function.

$$J(k) = \sum_{i=1}^{N_p} \|\theta_m(k + i) - \theta_r(k + i)\|_{\bar{Q}}^2 + \sum_{i=1}^{N_c-1} \|\Delta \tilde{W}(k + i)\|_{\bar{R}}^2 \quad (31)$$

The first item of the value function represents the error between the output value and the reference value, reflecting the system's ability to track the displacement of the reference crane load stably. The last item reflects the stability of the system's control of the crane load. The whole function minimization will lead the system to track the expected displacement of the crane load quickly and stably. This will be performed acting in the compensation motor. The value optimization function problem shown in Formula (31) can be transformed into a quadratic programming problem through some processing.

At the same time, in the actual crane system, the speed and speed increment of the lifting and lowering of the crane load can only be limited within a specific range, and it cannot be increased infinitely. It is not only necessary to select the optimal value function but also to meet some constraints related to the state quantity and control quantity of the crane system, such as Formulas (32) and (33).

Control constraint:

$$W_{\min}(k + T) \le W(k + T) \le W_{\max}(k + T) \text{ with: } T = 0, 1, \dots, N_c - 1 \quad (32)$$

Control increment constraint:

$$\Delta W_{\min}(k + T) \le \Delta W(k + T) \le \Delta W_{\max}(k + T) \text{ with: } T = 0, 1, \dots, N_c - 1 \quad (33)$$

## 4.4. MPTP Optimal Solution Problem Based on PSO

In the value function, the control increment is a variable requiring solution, and the control increment constraint must be added to it. Therefore, the control constraint must be converted into the control increment constraint. The control quantity and control increment are given in the recursive Formula (34).

$$\begin{aligned}
\tilde{W}(k) &= \tilde{W}(k-1) + \Delta \tilde{W}(k) \\
\tilde{W}(k+1) &= \tilde{W}(k) + \Delta \tilde{W}(k+1) \\
&= \tilde{W}(k-1) + \Delta \tilde{W}(k) + \Delta \tilde{W}(k+1) \\
&\vdots \\
\tilde{W}(k+N_c-1) &= \tilde{W}(k+N_c-2) + \Delta \tilde{W}(k+N_c-1) \\
&= \tilde{W}(k-1) + \Delta \tilde{W}(k) + \Delta \tilde{W}(k+1) + \cdots + \Delta \tilde{W}(k+N_c-1)
\end{aligned}
\quad (34)$$

The above formula can be rewritten as Formula (35).

$$\begin{bmatrix} \tilde{W}(k) \\ \tilde{W}(k+1) \\ \tilde{W}(k+2) \\ \vdots \\ \tilde{W}(k+N_c-1) \end{bmatrix} = \begin{bmatrix} \tilde{W}(k-1) \\ \tilde{W}(k-1) \\ \tilde{W}(k-1) \\ \vdots \\ \tilde{W}(k-1) \end{bmatrix} + M \begin{bmatrix} \Delta \tilde{W}(k) \\ \Delta \tilde{W}(k+1) \\ \Delta \tilde{W}(k+2) \\ \vdots \\ \Delta \tilde{W}(k+N_c-1) \end{bmatrix} \quad (35)$$
With:

$$M = \begin{bmatrix} 1 & 0 & \cdots & \cdots & 0 \\ 1 & 1 & 0 & \cdots & 0 \\ 1 & 1 & 1 & \ddots & 0 \\ \vdots & \vdots & \ddots & \ddots & 0 \\ 1 & 1 & \cdots & 1 & 1 \end{bmatrix}_{N_c \times N_c} \otimes I_{N_u}$$

where $I_{N_u}$ represents the unit matrix with dimension $N_u$, and $\otimes$ represents the Kroenecker product.

In summary, we convert Formula (35) into Formula (36):

$$W_{\min} = \begin{bmatrix} \tilde{W}_{\min} \\ \tilde{W}_{\min} \\ \tilde{W}_{\min} \\ \vdots \\ \tilde{W}_{\min} \end{bmatrix} \le \begin{bmatrix} \tilde{W}(k) \\ \tilde{W}(k+1) \\ \tilde{W}(k+2) \\ \vdots \\ \tilde{W}(k+N_c-1) \end{bmatrix} \le \begin{bmatrix} \tilde{W}_{\max} \\ \tilde{W}_{\max} \\ \tilde{W}_{\max} \\ \vdots \\ \tilde{W}_{\max} \end{bmatrix} = W_{\max} \quad (36) \\ \Rightarrow W_{\min} \le W_k + M\Delta\tilde{W}(k) \le W_{\max}$$

In the actual situation, the constraint amount should be defined clearly and given in Formula (37). In this paper, the set amount is selected only to verify the feasibility of the algorithm to constrain the control amount and control variable, it can be adjusted according to the actual situation.

$$\begin{cases} -1m/s \le W \le 1m/s \\ -0.5m/s \le \Delta W \le 0.5m/s \end{cases} \quad (37)$$

Combining the Formulas (29) and (31), the complete value function can be achieved in Formula (38).

$$J(k) = \Delta W(k)^T H_k \Delta W(k) + 2G_k^T \Delta W(k) \quad (38)$$

where $H_k = \Phi_k^T Q \Phi_k + R$; $E = \Psi_k \theta(k)$; $G_k = E^T Q \Phi_k$; $H_k$ and $G_k$ are positive definite matrices.

Finally, the MPTP optimal solution problem could be solved by PSO as in Formula (39). In fact, there may be other meta-heuristic optimization algorithms that are effective or better for MPTP, such as Firefly Algorithm (FA), the Genetic Algorithm (GA), and Ant Colony Optimization (ACO), etc. [32–34].

$$\begin{array}{l} \min_{\Delta W} \frac{1}{2} \Delta W(k)^T H_k \Delta W(k) + G_k^T \Delta W(k) \\ \text{s.t.} \left\{ \begin{array}{l} W_{\min} \le W_k + M \Delta W(k) \le W_{\max} \\ \Delta W_{\min} \le \Delta W \le \Delta W_{\max} \end{array} \right. \end{array} \quad (39)$$

This basic optimization process is shown in Figure 6. Formula (39), as the value function of PSO, calculates the solution of the MPTP value function corresponding to each particle, and takes the particle with the smallest value function to obtain the global optimal solution.

According to Figure 6, after solving each control cycle, a series of control input increments $\Delta W^*(k) = [\Delta\omega^*(k) \ \Delta\omega^*(k+1) \ \dots \ \Delta\omega^*(k+N_c-1)]$ can be obtained. The first element of the control sequence is the input in the inner loop of the motor control as the actual increment. Finally, the predicted angular velocity output value of the compensation motor at time k can be expressed as Formula (40).

$$\omega(k) = \omega(k-1) + \Delta\omega^*(k) \quad (40)$$
<figure><img src="image_9.png" /><figcaption>Figure 6. PSO optimizes MPTP process.</figcaption></figure>

At each moment, the predicted angular velocity is cyclically input into the PI controller of the motor speed loop, and then input into the current loop. Finally, the actual output value of the compensation motor angle can be obtained, which will be fed back to the position loop PSO-MPTP. The system will continue to start the prediction work at the next moment. The three-phase closed-loop control of the motor is shown in Figure 7.

<figure><img src="image_10.png" /><figcaption>Figure 7. Three-phase closed-loop control diagram of the motor.</figcaption></figure>

## 5. Simulation Result Heading

In order to compare and analyze the results objectively, the evaluation coefficient should be defined. According to the literature and applicable situation, the evaluation coefficient Compensation Efficiency (CE), used for evaluating the compensation effect, is finally selected and defined in Formula (41) [35–37].

$$CE = [1 - \text{std}(d)/\text{std}(h)] \times 100\% \quad (41)$$

where d is the error after compensation, h is the displacement in the heave direction of the ship, and std is the standard deviation.
The prediction time domain $N_p = 20$ and the control time domain $N_c = 1$ are chosen for multi-step prediction of the crane load's position. All the simulation results are compared with that of conventional PI and ADRC, which are achieved according to [38,39]. In this paper, the compensation displacement is inverted in Simulink to facilitate comparison with $\Delta Z$.

The background of this article is that regular waves are in a level 4 sea state: $U_T = 8$ m/s, and $\varphi = 45^{\circ}$. Wave force simulation results are shown in Figure 8.

<figure><img src="image_11.png" /><figcaption>Figure 8. Wave force.</figcaption></figure>

### 5.1. Simulation under Ideal Conditions

Case 1: $L = 25$ m and $V = 0$ m/s

In this case, the crane load hovers. It can be seen from Figure 9 that the inner and outer angles are not large, and the maximum displacement of the crane load in the heave direction is approximately 2.5 m. The CE of PI is 95.7%, the CE of ADRC is 98.1%, the CE of MPTP is 99.3%, and the CE of PSO-MPTP is 99.7%. Consequently, the displacement of the crane load in the heave direction is significantly reduced, and PSO-MPTP has a better performance.

<figure><img src="image_12.png" /><figcaption>Figure 9. (a) Inner and outer angles, Case 1. (b) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 1; (c) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 1.</figcaption></figure>

Case 2: $L = 25$ m and $V = 0.2$ m/s

In this case, the crane load decreases at a constant speed of $V = 0.2$ m/s. In Figure 10, the inner and outer angles are larger and larger, and the shaking is more serious. The swing amplitude of the inner and the outer angles are bigger than that in case 1, and the heave displacement of the crane load is significantly increased in this working condition. It can
be seen from Figure 10 that the maximum displacement of the crane load in the heave direction is approximately 10.5 m. The CE of PI is 94.3%, the CE of ADRC is 95.3%, the CE of MPTP is 99%, and the CE of PSO-MPTP is 99.8%.

<figure><img src="image_13.png" /><figcaption>Figure 10. (a) Inner and outer angles, Case 2. (b) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 2. (c) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 2.</figcaption></figure>

Case 3: $L = 25$ m and $V = -0.2$ m/s

In this case, the crane load increases at a constant speed of $V = -0.2$ m/s. From Figure 11, the inner and outer angles are smaller than that in the other two cases and the maximum displacement in the heave direction is bigger, up to approximately 1.8 m. The CE of PI is 95.4%, the CE of ADRC is 98.1%, the CE of MPTP is 99.2%, and the CE of PSO-MPTP is 99.9%; the heave displacement is significantly reduced.

<figure><img src="image_14.png" /><figcaption>Figure 11. (a) Inner and outer angles, Case 3. (b) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 3. (c) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 3.</figcaption></figure>

In order to test ΔW and W of PSO-MPTP and ADRC, the most severe working conditions, Case 2, are selected for testing. The simulation results are shown in Figure 12. According to this figure, ΔW and W of ADRC exceed the constraint, while ΔW and W of PSO-MPTP are within the constraint, ensuring the smooth operation of machinery and equipment and personal safety.
<figure><img src="image_15.png" /><figcaption>**Figure 12.** Control constraint and Control increment constraint of crane load, Case 2.</figcaption></figure>

In this section, three different working conditions are introduced when the crane is working. Under the same impact of sea waves, CE of PSO-MPTP is better than that of ADRC, and the control effect is relatively smooth and stable in all three cases. Whether lifting or lowering the crane load, the compensation system can compensate well in poor sea conditions.

## 5.2. Robustness Analysis

### 5.2.1. White Noise

In actual work, unexpected disturbance is inevitable. The compensation system and ship would be interfered with by the harsh environment. In order to analyze the anti-interference ability of PSO-MPTP, white noise is used as the actual noise interference, and white noise and $\Delta Z$ superposition are used as the input signal of the position loop. In this section, three cases, as in the previous part, are simulated for the analysis (Case 4: With noise, $L = 25 m, V = 0 m/s$; Case 5: With noise, $L = 25 m, V = 0.2 m/s$; Case 6: With noise, $L = 25 m, V = -0.2 m/s$).

From Figures 13–15, even the noise is added to the system, PSO-MPTP always presents better performances than that of ADRC. For these three cases, CEs of PSO-MPTP are 94.1%, 94.8%, and 94.2%, respectively; CEs of MPTP are 93.3%, 92.9%, and 93%, respectively: CEs of ADRC are 91.3%, 91.9%, and 91%; CEs of PI are 85.3%, 85.9%, and 87%, respectively. Although these values are relatively smaller than that in the ideal conditions, the compensation effect is still excellent and can be accepted.

<figure><img src="image_16.png" /><figcaption>**Figure 13.** (a) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 4. (b) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 4.</figcaption></figure>
<figure><img src="image_17.png" /><figcaption>**Figure 14.** (a) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 5. (b) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 5.</figcaption></figure>

<figure><img src="image_18.png" /><figcaption>**Figure 15.** (a) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 6. (b) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 6.</figcaption></figure>

### 5.2.2. Parameter Variation

In actual work, system parameters may change due to the working conditions. For example, the wave encounter angle may change when the hull encounters a wave, and the parameters of PMSM may also be verified due to the high humidity and salt fog. Therefore, in this section, the working condition $L = 25$ m, $V = 0.2$ m/s and a level 4 sea state are selected to analyze these two problems (Case 7: $L = 25$ m, $V = 0.2$ m/s, wave encounter angle changes; Case 8: $L = 25$ m, $V = 0.2$ m/s, parameters of PMSM change).

For Case 7, the wave encounter angle $\varphi$ changes from $\pi/4$ to $\pi/3$ and impacts the hull at $t = 30$ s. As shown in Figure 16, when the angle $\varphi$ changes, the heave displacement greatly increases and ca reach approximately 12.5 m. After the compensation under this condition, the CE of PSO-MPTP is still as high as 99.7% with only a 0.1% reduction compared with Case 2. The CE of MPTP is 98.3%, while for ADRC and PI, CEs are reduced by nearly 1–5% and equal to 94.1% and 89%.
<figure><img src="image_19.png" /><figcaption>**Figure 16.** (a) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 7. (b) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 7.</figcaption></figure>

For Case 8, to verify the robustness of the PSO-MPTP, the PMSM parameters also change at $t = 30$ s, $R_s$ changes from 4 Ω to 5 Ω, and $L_d$ and $L_q$ change from 0.07 mH to 0.08 mH. As shown in Figure 17, the track performance of PI becomes worse after $t = 30$ s, while the track performance of PSO-MPTP is still excellent. Although the compensation errors of PSO-MPTP and MPTP are slightly worse than that in Case 2, the CEs of PSO-MPTP and MPTP are still as high as 99.7% and 98.8%, respectively, while for ADRC and PI, CEs are only 94.3% and 90.1%, respectively.

<figure><img src="image_20.png" /><figcaption>**Figure 17.** (a) Compensation displacement of PI, ADRC, MPTP, and PSO-MPTP, Case 8. (b) Compensation error of PI, ADRC, MPTP, and PSO-MPTP, Case 8.</figcaption></figure>

## 6. Conclusions

This paper firstly introduced the principle of heave compensation and modeled the wave disturbance force and the ship crane system. Second, the displacement of the crane load in the heave direction was obtained through the Lagrangian equation and the differential equation of the system. Then, the PSO-MPTP was established through the motion state equation of the crane load and firstly added to the position loop. PSO was used to solve the quadratic programming in MPTP, which further improves CE and the operation speed of MPTP. PSO-MPTP provides a solid foundation for future hardware experiments. The system uses the multi-step predicted position signal of the crane load, which finishes the three-phase closed-loop of the PMSM. Finally, the compensation problem of crane load
heave and displacement under the action of waves under three different working conditions was analyzed. The results show that displacement compensation can be performed well under different working conditions with a CE of more than 99%. Robustness analysis was also carried out in this paper. In the simulation, whether the system is disturbed by white noise or motor parameter variations, the CE of PSO-MPTP far exceeds the CEs of PI and ADRC and can reach more than 94%.

It can be seen that PSO-MPTP has strong robustness to disturbances for nonlinear systems and relatively smooth control effects compared to PI and ADRC. Whether lifting or lowering the crane load, the compensation system can compensate well in poor sea conditions, which guarantees the safety of the crane load and personnel to a great extent. However, as this paper only considers the heave displacement of the crane load and ignores the wind disturbance to the sling, it simplifies the system model and makes the PSO-MPTP compensation efficient. Subsequent research needs to decouple and compensate for the sway of the crane load in other directions and the wind disturbance.

**Author Contributions:** Conceptualization, H.C., J.X., M.B., J.H., and J.-F.C.; methodology, H.C.; software, J.X.; validation, H.C. and J.X.; writing—original draft preparation, J.X.; writing—review and editing, H.C., M.B., J.H., J.-F.C., and W.S.; visualization, J.X.; supervision, H.C., M.B., J.H., W.S., and J.-F.C.; project administration, H.C.; funding acquisition, H.C., W.S., and J.-F.C. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was supported by (a) The National Natural Science Foundation of China, China (Grant No. 61503242, 61673260); (b) The Shanghai Science and Technology Commission project (Grant No. 20040501200); and (c) The Science & Technology Commission of Shanghai Municipality and Shanghai Engineering Research Center of Ship Intelligent Maintenance and Energy Efficiency under Grant 20DZ2252300.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** The data that support the findings of this study are available within the article.

**Conflicts of Interest:** The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analysis, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

## References

1. Xianliang, N.; Jiawen, Z.; Jianan, X. The heave motion estimation for active heave compensation system in offshore crane. In Proceedings of the 2016 IEEE International Conference on Mechatronics and Automation, Harbin, China, 7–10 August 2016; pp. 1327–1332.

2. Driscoll, F.; Lueck, R.; Nahon, M. The motion of a deep-sea remotely operated vehicle system: Part 1: Motion observations. *Ocean Eng.* **2000**, *27*, 29–56. [CrossRef]

3. Yu, H.; Chen, Y.; Shi, W.; Xiong, Y.; Wei, J. State constrained variable structure control for active heave compensators. *IEEE Access* **2019**, *7*, 54770–54779. [CrossRef]

4. Robichaux, L.R.; Hatleskog, J.T. Semi-Active Heave Compensation System for Marine Vessels. U.S. Patent 5,209,302, 11 May 1993.

5. Hatleskog, J.; Dunnigan, M. Heave compensation simulation for non-contact operations in deep water. In Proceedings of the OCEANS 2006, Boston, MA, USA, 18–21 September 2006; pp. 1–6.

6. Huang, X.; Wang, J.; Xu, Y.; Zhu, Y.; Tang, T.; Lv, M. Research on heave compensation control of floating crane based on permanent magnet synchronous motor. In Proceedings of the 2018 International Conference on Control, Automation and Information Sciences (ICCAIS), Hangzhou, China, 24–27 October 2018; pp. 331–336.

7. Woodacre, J.; Bauer, R.; Irani, R. A review of vertical motion heave compensation systems. *Ocean Eng.* **2015**, *104*, 140–154. [CrossRef]

8. Huang, L.; Zhang, Y.; Zhang, L.; Liu, M. Semi-active drilling drawworks heave compensation system. *Pet. Explor. Dev.* **2013**, *40*, 665–670. [CrossRef]

9. Niu, W.; Gu, W.; Yan, Y.; Cheng, X. Design and full-scale experimental results of a semi-active heave compensation system for a 200 T winch. *IEEE Access* **2019**, *7*, 60626–60633. [CrossRef]

10. Hatleskog, J.; Dunnigan, M. Active heave crown compensation sub-system. In Proceedings of the OCEANS 2007-Europe, Aberdeen, UK, 18–21 June 2007; pp. 1–6.
11. Woodacre, J. Model-Predictive Control of a Hydraulic Active Heave Compensation System with Heave Prediction. Master's Thesis, Dalhousie University, Halifax, NS, Canada, 2015.

12. Eikeland, F.N. Compensation of Wave-Induced Motion for Marine Crane Operations. Master's Thesis, Institutt for Teknisk Kybernetikk, Trondheim, Norway, 2008.

13. Lin, F.; Xinfu, Z.; Xingquan, Z.; Haibo, H. The application study of heave compensation control Based on motion prediction and Fuzzy-PID for intelligence crane. In Proceedings of the 2011 IEEE International Conference on Mechatronics and Automation, Beijing, China, 7-10 August 2011; pp. 2370-2374.

14. Chu, Y.; Li, G.; Zhang, H. Incorporation of ship motion prediction into active heave compensation for offshore crane operation. In Proceedings of the 2020 15th IEEE Conference on Industrial Electronics and Applications (ICIEA), Kristiansand, Norway, 9-13 November 2020; pp. 1444-1449.

15. Neupert, J.; Mahl, T.; Haessig, B.; Sawodny, O.; Schneider, K. A heave compensation approach for offshore cranes. In Proceedings of the 2008 American Control Conference, Seattle, WA, USA, 11-13 June 2008; pp. 538-543.

16. Shi, B.-H.; Xian, L.; Wu, Q.-P.; Zhang, Y.-L. Active heave compensation prediction research for deep sea homework crane based on KPSO-SVR. In Proceedings of the 33rd Chinese Control Conference, Nanjing, China, 28-30 July 2014; pp. 7637-7642.

17. Küchler, S.; Mahl, T.; Neupert, J.; Schneider, K.; Sawodny, O. Active control for an offshore crane using prediction of the vessel's motion. *IEEE/ASME Trans. Mechatron.* **2010**, *16*, 297-309. [CrossRef]

18. Cai, Y.; Zheng, S.; Liu, W.; Qu, Z.; Zhu, J.; Han, J. Adaptive robust dual-loop control scheme of ship-mounted Stewart platforms for wave compensation. *Mech. Mach. Theory* **2021**, *164*, 104406. [CrossRef]

19. Woodacre, J.; Bauer, R.; Irani, R. Hydraulic valve-based active-heave compensation using a model-predictive controller with non-linear valve compensations. *Ocean Eng.* **2018**, *152*, 47-56. [CrossRef]

20. Johansen, T.A.; Fossen, T.I.; Sagatun, S.I.; Nielsen, F.G. Wave synchronizing crane control during water entry in offshore moonpool operations-experimental results. *IEEE J. Ocean. Eng.* **2003**, *28*, 720-728. [CrossRef]

21. Messineo, S.; Serrani, A. Offshore crane control based on adaptive external models. *Automatica* **2009**, *45*, 2546-2556. [CrossRef]

22. Yang, T.; Sun, N.; Chen, H.; Fang, Y. Neural network-based adaptive antiswing control of an underactuated ship-mounted crane with roll motions and input dead zones. *IEEE Trans. Neural Netw. Learn. Syst.* **2019**, *31*, 901-914. [CrossRef] [PubMed]

23. Arnold, E.; Neupert, J.; Sawodny, O.; Schneider, K. Trajectory tracking for boom cranes based on nonlinear control and optimal trajectory generation. In Proceedings of the 2007 IEEE International Conference on Control Applications, Singapore, 1-3 October 2007; pp. 1444-1449.

24. Richter, M.; Arnold, E.; Schneider, K.; Eberharter, J.K.; Sawodny, O. Model predictive trajectory planning with fallback-strategy for an active heave compensation system. In Proceedings of the 2014 American Control Conference, Portland, OR, USA, 4-6 June 2014; pp. 1919-1924.

25. Price, W.G. *Probabilistic Theory of Ship Dynamics*; Chapman & Hall Ltd.: London, UK, 1974; ISBN 0 412 12430 0.

26. Williams, A. Froude-Krylov force coefficients for bodies of rectangular section in the vicinity of the free-surface and sea-bed. *Ocean Eng.* **1994**, *21*, 663-682. [CrossRef]

27. Huang, Y.; Zou, J.; Wang, M.; Xu, Y.; Zou, J. Active disturbances rejection controller for position servo control of PMSM. In Proceedings of the 2019 22nd International Conference on Electrical Machines and Systems (ICEMS), Harbin, China, 11-14 August 2019; pp. 1-4.

28. Jingqing, H. From PID technology to "auto-disturbance control" technology. *Control Eng. China* **2002**, *9*, 13-18.

29. Li, M.; Gao, P.; Zhang, J.; Gu, J.; Zhang, Y. Study on the system design and control method of a semi-active heave compensation system. *Ships Offshore Struct.* **2018**, *13*, 43-55. [CrossRef]

30. Lu, W.; Li, Q.; Lu, K.; Lu, Y.; Guo, L.; Yan, W.; Xu, F. Load adaptive PMSM drive system based on an improved ADRC for manipulator joint. *IEEE Access* **2021**, *9*, 33369-33384. [CrossRef]

31. Kuhne, F.; Lages, W.F.; da Silva, J.G., Jr. Model predictive control of a mobile robot using linearization. In Proceedings of the Mechatronics and Robotics, Aachen, Germany, 13-15 September 2004; pp. 525-530.

32. Zhou, W.; Zhu, D.; Yan, X. The Tracking control of Autonomous Underwater Vehicle Based on FA-Model Predictive Control. In Proceedings of the 2021 2nd International Conference on Artificial Intelligence and Computer Engineering (ICAICE), Hangzhou, China, 5-7 November 2021; pp. 435-439.

33. Bouchekara, H.; Chaib, A.; Abido, M. Optimal power flow using GA with a new multi-parent crossover considering: Prohibited zones, valve-point effect, multi-fuels and emission. *Electr. Eng.* **2018**, *100*, 151-165. [CrossRef]

34. Kashyap, A.K.; Parhi, D.R. Optimization of stability of humanoid robot NAO using ant colony optimization tuned MPC controller for uneven path. *Soft Comput.* **2021**, *25*, 5131-5150. [CrossRef]

35. Shi, M.; Guo, S.; Jiang, L.; Huang, Z. Active-passive combined control system in crane type for heave compensation. *IEEE Access* **2019**, *7*, 159960-159970. [CrossRef]

36. Liu, T.; Iturrino, G.; Goldberg, D.; Meissner, E.; Swain, K.; Furman, C.; Fitzgerald, P.; Frisbee, N.; Chlimoun, J.; Van Hyfte, J.; et al. Performance evaluation of active wireline heave compensation systems in marine well logging environments. *Geo-Mar. Lett.* **2013**, *33*, 83-93. [CrossRef]

37. Iturrino, G.; Liu, T.; Goldberg, D.; Anderson, L.; Evans, H.; Fehr, A.; Guerin, G.; Inwood, J.; Lofi, J.; Malinverno, A.; et al. Performance of the wireline heave compensation system onboard D/V JOIDES resolution. *Sci. Drill.* **2013**, *15*, 46-50. [CrossRef]
38. Ang, K.H.; Chong, G.; Li, Y. PID control system analysis, design, and technology. *IEEE Trans. Control Syst. Technol.* **2005**, *13*, 559–576. [CrossRef]

39. Li, Z.; Ma, X.; Li, Y.; Meng, Q.; Li, J. ADRC-ESMPC active heave compensation control strategy for offshore cranes. *Ships Offshore Struct.* **2020**, *15*, 1098–1106. [CrossRef]