A Prediction Method of Ship Motion Based on LSTM Neural Network with Variable Step-Variable Sampling Frequency Characteristics

<jats:p>In active heave compensation, in order to realize the smooth control of the heave compensation platform, it is necessary to use the ship motion measurement system to accurately obtain the ship displacement signal, invert the ship displacement signal, and then control the expansion and contraction of the electric cylinder so that the compensation platform remains horizontal. The ship displacement measurement system generally adopts the second integral of the acceleration sensor to obtain the ship displacement signal. During the acquisition process of the ship displacement signal, the quadratic integration process of the acceleration, and the communication process of the output control command, there is a processing lag which makes the error accumulate, resulting in a delay in the measurement of the ship motion. In order to collect the ship motion more accurately and control the heave compensation platform more precisely, this paper proposes a ship motion prediction method based on a variable step-variable sampling frequency characteristic LSTM (Long Short-Term Memory) neural network. First, we use the autocorrelation function algorithm to calculate the inherent delay of the lag in the process of signal acquisition by the measurement system. Secondly, the LSTM neural network is used to predict the inherent delay step of the lagging ship displacement signal. During the prediction process, it is found that the difference in the sampling frequency of the displacement signal will lead to a change in the step of the inherent delay—experiment in the laboratory to verify. By controlling the motion platform to simulate the motion of the ship and using the ship motion measurement system and the laser sensor system to measure the displacement signal of the motion platform synchronously, it is verified that the ship motion measurement system does have an inherent delay. Thirdly, on a sailing ship, ship displacement signals are collected by setting multiple sets of ship motion measurement systems. Finally, multiple sets of sampling frequency and multiple steps are set, and the ship motion is predicted based on the variable step-variable sampling frequency LSTM neural network. It is verified that the prediction accuracy is related to the sampling frequency of the signal collector and the prediction step of the LSTM neural network, which improves the prediction accuracy of the model and the timeliness of ship motion acquisition.</jats:p>

section_content: Heave compensation technologies are currently mainly divided into two categories: passive heave compensation and active heave compensation [1]. Passive heave compensation generally belongs to an open-loop system, and the system input is the ship motion while the output is a reduced amplitude motion of the attached object. At the same time, passive wave compensation does not require additional energy input, and mainly relies on elastic elements, such as dampers, to reduce the vibration amplitude of the ship. A paper by Hatleskog and Dunnigan (2006) concludes by stating that a passive compensator can be no more than roughly 80% effective, which the authors support through field experience and simulation [2]. Compared with passive heave compensation, active heave compensation is generally a closed-loop system that requires an external energy input. In the active heave compensation system, it is first necessary to measure the ship motion signal; secondly, the displacement command is deciphered according to the ship motion signal to control the load against the heave motion. So, if a ship heaves upward, the controller commands the load to move downward that same amount [3]. 

Active heave compensation systems currently use inertial measurement units and gyroscopes to measure ship motion, and the processing time of the inertial units will lead to the accumulation of time errors in the measurement process. At the same time, when controlling the drive unit, the problem of inherent delay will also be introduced due to slow communication. Therefore, how to eliminate the time delay generated by the motion measurement module in the active heave compensation system is still one of the difficult problems in engineering testing [4]. A system by Kyllingstad (2012), for example, applied transfer function filters to correct for time/phase lag in their overall system [5]. Alternatively, Kuchler et al. (2011) used heave-prediction algorithms to predict vessel heave motion based on previous measurements and then applied control action based on these predicted motions [6]. Now, as more advanced algorithms and better sensors are included in AHC systems, control quality improves; however, there are disadvantages to the inclusion of more advanced components [7] [8] [9] [10] [11]. In order to eliminate the effect of the delay inherent in active heave compensation, Jorg Neupert proposed a heave compensation system based on heave motion prediction and an inversion-based control strategy, and then a prediction algorithm is presented and evaluated with simulation and measurement results [12]. Woodacre J K used the MPC controller to track a variety of test cases and references while outperforming the tuned PID controller for all experiments [13]. Shi B presents an active heave prediction modeling method based on a support vector machine for regression (SVR) using the particle swarm algorithm (KPSO), improved by Kalman filter, to train the parameters of the SVR and predict control [14]. At the same time, with the neural network algorithm proposed, its prediction function is more and more applied to the prediction of active wave compensation [15] [16] [17] [18]. For example, neural networks used for time series prediction, such as LSTM (Long Short-Term Memory), have also been gradually applied to ship motion prediction in recent years [19] [20] [21] [22] [23] [24]. Su Y proposed a real-time ship vertical acceleration prediction algorithm based on the long short-term memory (LSTM) and gated recurrent units (GRU) models of a recurrent neural network. The prediction results revealed that the proposed algorithm could accurately predict the acceleration time history data of the large-scale ship model, and the root mean square error between the predicted and real values was no greater than 0. 1 [25]. Aiming at the problem of the low accuracy of ship roll angle prediction by traditional prediction algorithms and the single neural network model, Wang Y proposed a ship roll angle prediction method based on a bidirectional long short-term memory network (Bi-LSTM) and a temporal pattern attention mechanism (TPA) combined deep learning model; temporal pattern attention mechanism extracts the time patterns from the deep features of a bidirectional long shortterm memory network output state that are beneficial to ship roll angle prediction and ignores other features that contribute less to the prediction [26]. For the prediction of ship heave motion, the prediction time step is particularly important, so calculating the delay in the ship motion acquisition system is also a top priority [27] [28] [29]. Hu T developed an adaptive time delay compensation algorithm based on thorough analysis of the integrated information transmission platform and the composition and characteristics of the time delay in channel, during which forward and reverse transmission channels have been developed properly [30]. The neural network algorithm is gradually widely used in the field of ship motion signal prediction [31, 32]. Kaklis D examines how a predictive FOC scheme can be coupled with WR optimization algorithms in order to reduce the vessel's FOC, emissions, and the overall cost of a voyage [33]. Kaklis D presents a holistic approach to continuously monitor and estimate the emissions of a vessel as well as to assess and improve the efficiency of scrubbers [34]. Kaklis D presents an online learning framework that employs a custom encoding-decoding Neural Network scheme and real-time data from various on-board sensors to appropriately update FOC estimation models [35]. 

In this paper, in order to further improve the accuracy of active heave compensation and eliminate the time delay problem in the active heave compensation control system, a prediction method of ship motion based on LSTM neural network with variable stepvariable sampling frequency characteristics is proposed. First of all, in the process of ship motion measurement, there are problems of integral calculation and slow communication between the hardware modules of the measurement system, resulting in a time delay between the measured ship motion and the real motion of the ship. Secondly, according to the autocorrelation function algorithm, the cross-correlation analysis of the measured ship motion signal and the real motion signal is used to calculate the inherent time of the measurement system delay. Then, the sampling frequency of the ship motion signal is changed to determine the time step that needs to be predicted through the obtained inherent time. Next, we build the LSTM neural network model with variable step-variable sampling frequency characteristics. At the same time, a data set is built according to the low-frequency time characteristics of the ship motion, and the model weights are trained. Finally, the ship motion signal is predicted using the trained neural network model, eliminating the inherent delay in active heave compensation measurement systems. 

In order to verify the prediction effect of the proposed LSTM neural network with variable step-variable sampling frequency characteristics, we conducted experimental verification. The existing heave motion platform in the laboratory was used to simulate the motion of the ship, and a laser sensor measurement point and a ship motion measurement system were built on the platform. The laser sensor and the ship motion measurement system were used to collect displacement signals at the same time, and the cross-correlation analysis of the two signals was used to solve the inherent delay in the ship motion measurement system. The ship motion signal was predicted by eight groups of LSTM neural networks with variable step-variable sampling frequency characteristics. The experiments proved that the LSTM neural network with variable step-variable sampling frequency characteristics can accurately predict the heave displacement value of the ship, and is more suitable for the prediction of low-frequency motion of the ship. 

The main contributions of this paper are summarized as follows:

1. 

An algorithm to eliminate the inherent time delay in the active heave compensation measurement system was proposed. Using the autocorrelation function, the inherent delay in the measurement system was solved by performing a cross-correlation analysis on the actual motion signal of the ship and the signal collected by the ship measurement system. According to the obtained inherent delay, the LSTM neural network with variable step-variable sampling frequency characteristics was built to predict the ship heave signal.
section_name: Introduction

section_content: According to the obtained inherent delay, a ship motion prediction method based on an LSTM neural network with variable step-variable sampling frequency characteristics was proposed to predict the ship heave signal. The formulation of the training set was improved according to the characteristics of the low-frequency motion of the ship. The training set not only included the short-term period characteristics of the low-frequency ship motion, but also included the long-term characteristics of the ship under the influence of the wave force. It made the predicted waveform signal more suitable for the prediction of ship movement. 

The subsequent sections of this manuscript are organized as follows: Section 2 presents the preliminary work. Section 3 describes in detail the solution to the inherent delay of the measurement system and the proposed LSTM neural network with variable step-variable sampling frequency characteristics. Section 4 designs experimental validation for the proposed algorithms. Section 5 presents the conclusion and provides suggestions for future work.
section_name: 2.

section_content: The time delay generated by the ship motion measurement system is mainly composed of two parts: the calculation time of the inertial sensor unit integration, and the communication time between the signal collector and the host computer. The time delay generated by these two parts is determined by the hardware device properties of the system, so the delay in the ship motion measurement system is an inherent time. In order to eliminate the inherent delay, the inherent delay of the system is obtained by the autocorrelation function algorithm, and the LSTM neural network with variable step-variable sampling frequency characteristics is used to predict the ship motion signal in the inherent delay stage.
section_name: Preliminary Work

section_content: Under actual sea conditions, the ship motion signal collected through the integral calculation of the inertial sensor unit will inevitably be disturbed by noise, and the signal data may be completely lost in severe cases. The autocorrelation function describes the degree of correlation between a random signal at different times. It can find repetitive information from the ship motion signal and identify the fundamental frequency implied in the harmonic frequency of the signal. Its definition is:

For continuous signals, the definition is:

For discrete signals, the definition is:
section_name: Autocorrelation Function

section_content: The input and output of many neural networks are independent of each other, such as the BP neural network, convolutional neural network (CNN), etc. However, in the time series prediction of ship heave displacement, the prediction at the later time is related to the data at the previous time. Recurrent Neural Networks (RNN) introduce the concept of "memory", which allows information to be persisted. The RNN structure diagram is shown in Figure 1. 

the proposed algorithms. Section 5 presents the conclusion and provides suggestions for future work.
section_name: LSTM Neural Network

section_content: Under actual sea conditions, the ship motion signal collected through the integral calculation of the inertial sensor unit will inevitably be disturbed by noise, and the signal data may be completely lost in severe cases. The autocorrelation function describes the degree of correlation between a random signal at different times. It can find repetitive information from the ship motion signal and identify the fundamental frequency implied in the harmonic frequency of the signal. Its definition is:

( ( ), ( ))

For continuous signals, the definition is:

For discrete signals, the definition is:
section_name: Autocorrelation Function

section_content: The input and output of many neural networks are independent of each other, such as the BP neural network, convolutional neural network (CNN), etc. However, in the time series prediction of ship heave displacement, the prediction at the later time is related to the data at the previous time. Recurrent Neural Networks (RNN) introduce the concept of "memory", which allows information to be persisted. The RNN structure diagram is shown in Figure 1. The heave motion of the ship is affected by the wave force, which belongs to the same low-frequency motion as the sea wave. Therefore, short time series training cannot guarantee that the model learns the long-term characteristic knowledge of ship heave motion. However, the RNN does not work well in long-term dependent problems. An RNN will remember all the previous information in the long-term sequence, the newly added input information will reduce the weight ratio of the previous information, and the last retained information may be worthless information. Therefore, when the prediction needs to rely on earlier long-term information, with the continuous increase of the time dimension, it is difficult for an RNN to retain the information at an earlier time and cannot guarantee the accuracy of the ship heave displacement prediction. The long short-term memory network (LSTM) solves the problem of long-term dependence of an RNN very well. LSTM is a special case of RNNs, and an algorithm improved on RNNs. It can filter out useful information and save it, which solves the problem of an RNN gradient disappearance and gradient explosion. The structural situation diagram of the LSTM neural network is shown in Figure 2. The heave motion of the ship is affected by the wave force, which belongs to the same low-frequency motion as the sea wave. Therefore, short time series training cannot guarantee that the model learns the long-term characteristic knowledge of ship heave motion. However, the RNN does not work well in long-term dependent problems. An RNN will remember all the previous information in the long-term sequence, the newly added input information will reduce the weight ratio of the previous information, and the last retained information may be worthless information. Therefore, when the prediction needs to rely on earlier long-term information, with the continuous increase of the time dimension, it is difficult for an RNN to retain the information at an earlier time and cannot guarantee the accuracy of the ship heave displacement prediction. The long short-term memory network (LSTM) solves the problem of long-term dependence of an RNN very well. LSTM is a special case of RNNs, and an algorithm improved on RNNs. It can filter out useful information and save it, which solves the problem of an RNN gradient disappearance and gradient explosion. The structural situation diagram of the LSTM neural network is shown in Figure 2. The core part of the LSTM neural network is the cell state of the LSTM unit. The LSTM controls the increase or decrease of information through the "gate" structure, and selectively allows information to pass through, thereby realizing the functions of memory and forgetting. A cell contains an input gate, a forget gate, and an output gate. 

Forget gate: The forget gate t f can save the ship movement signal from a long time ago, and determines how much "knowledge" of the unit state at the last moment can be retained to the current moment. It is a sigmoid function whose input is the output of the previous unit 1 t h -and the input of this unit t

x. The output range is 0~1, which is as- signed to the current cell state, and its calculation formula is:

Among them, The core part of the LSTM neural network is the cell state of the LSTM unit. The LSTM controls the increase or decrease of information through the "gate" structure, and selectively allows information to pass through, thereby realizing the functions of memory and forgetting. A cell contains an input gate, a forget gate, and an output gate. 

Forget gate: The forget gate f t can save the ship movement signal from a long time ago, and determines how much "knowledge" of the unit state at the last moment can be retained to the current moment. It is a sigmoid function whose input is the output of the previous unit h t-1 and the input of this unit x t. The output range is 0~1, which is assigned to the current cell state, and its calculation formula is:

Among them, [h t-1, x t ] means to connect the current input vector and the output vector at the previous moment to form a vector with a larger dimension, W f is the weight matrix, and σ is the sigmoid function. 

Input gate: The input gate i t can prevent unimportant ship motion signals from entering the memory cells at the current moment. It works with the tanh function to control the addition of new ship motion signals. The tanh function generates a candidate C t, which is multiplied by the sigmoid function to control the addition of new ship displacement signals. Its calculation formula is:

Update the memory unit: update the old cell state C t-1. Its calculation formula is:

Output gate: The output gate o t is used to determine the value of the next hidden state, which contains the previous information. First, we use the Sigmoid layer to get an initial part of the output. Then, we use the tanh function to scale the value of C t to [-1, 1]. Then, we multiply the output results obtained by the previous sigmoid layer in turn to obtain the final output h t. Its calculation formula is:
section_name: LSTM Neural Network

section_content: The function of the Sigmoid function is to map the input to [0, 1], and its function expression is:

The function of the Tanh function is to map the input to [-1, 1], and its function expression is:
section_name: ) Activation function:

section_name: The Proposed Method

section_content: In order to accurately measure the inherent delay produced by the ship motion measurement system, it is necessary to determine the reference signal first. In this paper, the ship motion signal collected by a high-sensitivity laser sensor is used as the reference signal. The timing signal of the ship displacement collected by the ship motion measurement system is defined as x(t), the timing reference signal collected by the laser sensor is defined as y(t), and the cross-correlation analysis is carried out. Cross-correlation can be considered as a special case of autocorrelation function, which is used to describe the degree of correlation between the values of ship displacement signal x(t) and laser reference signal y(t) at any two different moments t 1 and t 2. According to the cross-correlation analysis, it reflects the physical meaning of the similarity of the two displacement signals involved in the operation: when the value of the coordinate variable of the laser reference signal x(t) changes in the discrete domain, there will always be a discrete coordinate value n * that makes the reference signal most similar to the echo signal of the ship motion measurement system with delay information. At this time, the value of the autocorrelation function reaches the peak point, and the abscissa n * corresponding to the peak point is the estimated value of the discrete time delay obtained by this method. Its calculation formula is:

The calculation formula of discrete time series signal is:

Peak retrieval is performed on the discrete domain for this cross-correlation function. The inherent delay of the ship motion measurement system is obtained as:

Among them, τ is the inherent delay, arg{•} means to get the independent variable value of the function, and max{•} means to get the maximum value of the function. The structural process for solving the inherent delay is shown in Figure 3. 

Peak retrieval is performed on the discrete domain for this cross-correlation function. The inherent delay of the ship motion measurement system is obtained as:

Among them, τ is the inherent delay, arg{ }  means to get the independent variable value of the function, and max{ }  means to get the maximum value of the function. The structural process for solving the inherent delay is shown in Figure 3.
section_name: Solution of Inherent Delay in Ship Motion Measurement System

section_name: Inertial Sensing Unit

section_content: Variable step-variable sampling frequency: In order to predict the inherent delay generated in the heave compensation system, it is necessary to determine the prediction time step of the LSTM neural network. The LSTM neural network prediction time step is related to the prediction accuracy. With a certain inherent delay, the prediction time step is determined by the sampling frequency of the ship heave motion signal. When the sampling frequency of the signal changes, the prediction time step also changes accordingly. The formula for calculating the forecast time step is:

Among them, n is the prediction time step, τ is the inherent delay obtained by cross-correlation analysis, and s f is the sampling frequency of the ship motion signal. 

The flow chart of the ship motion signal prediction method is shown in Figure 4, and the schematic diagram of the LSTM neural network with variable step-variable sampling frequency characteristics is shown in Figure 5.
section_name: LSTM Neural Network with Variable Step-Variable Sampling Frequency Characteristics

section_content: Variable step-variable sampling frequency: In order to predict the inherent delay generated in the heave compensation system, it is necessary to determine the prediction time step of the LSTM neural network. The LSTM neural network prediction time step is related to the prediction accuracy. With a certain inherent delay, the prediction time step is determined by the sampling frequency of the ship heave motion signal. When the sampling frequency of the signal changes, the prediction time step also changes accordingly. The formula for calculating the forecast time step is:

Among them, n is the prediction time step, τ is the inherent delay obtained by crosscorrelation analysis, and f s is the sampling frequency of the ship motion signal. 

The flow chart of the ship motion signal prediction method is shown in Figure 4, and the schematic diagram of the LSTM neural network with variable step-variable sampling frequency characteristics is shown in Figure 5.
section_name: LSTM Neural Network with Variable Step-Variable Sampling Frequency Characteristics

section_content: We designed an experiment to verify the prediction accuracy of the LSTM neural network with variable step-variable sampling frequency characteristics for ship motion signals. The experiment is divided into two parts: 1. use the cross-correlation analysis of the reference signal and the displacement signal to calculate the inherent delay of the ship motion measurement system; 2. use the LSTM neural network with variable step-variable sampling frequency characteristics to predict the ship motion signal within the inherent delay of the measurement system.
section_name: Experimental Results and Analysis

section_content: The existing ship motion measurement system currently used in the laboratory is mainly composed of an acceleration sensor and a secondary integration box. The acceleration sensor is responsible for inputting acceleration signals for the system, and the secondary integration box is for the system to output ship displacement. The acceleration sensor in the ship motion measurement system is installed on a six-degree-of-freedom platform to collect heave motion signals. At the same time, the laser sensor is used to collect the reference heave signal, which is also installed on the six-degree-of-freedom platform. In the following text, the acceleration sensor and the ship motion measurement system represents the same concept. The placement of the two sensors is shown in Figure 6.
section_name: Calculation of Inherent Delay in Ship Motion Measurement System

section_content: Laser sensor Using the six-free platform to imitate the irregular vertical heave motion of the ship, we collected and analyzed the displacement signal of the laser sensor and the integral signal of the acceleration sensor. We observed whether there was a time delay in the integral signal of the acceleration sensor and the displacement signal of the laser sensor. We set the signal sampling frequency of the signal collector to 100 Hz, the collection time to 200 s, and we collected 4 groups of motion signals. The real-time waveforms output by Using the six-free platform to imitate the irregular vertical heave motion of the ship, we collected and analyzed the displacement signal of the laser sensor and the integral signal of the acceleration sensor. We observed whether there was a time delay in the integral signal of the acceleration sensor and the displacement signal of the laser sensor. We set the signal sampling frequency of the signal collector to 100 Hz, the collection time to 200 s, and we collected 4 groups of motion signals. The real-time waveforms output by the acceleration sensor and the laser sensor were displayed in the host computer, as shown in Figure 7. After analysis, it was found that when the laser sensor collects the motion signal of the six-degree-of-freedom platform, it could respond to the heave motion of the platform in real time, which meets the conditions of the reference signal. The acceleration signal collected by the acceleration sensor is integrated into the displacement signal, and the laser signal had an obvious phase lag, which verified that the integral calculation time in the acquisition module of the active wave compensation system will cause the lag of the acquisition signal. The acceleration sensor displacement signal and the laser sensor displacement signal were processed for cross-correlation analysis, and the results are shown in Figure 8. It can also be seen from the cross-correlation analysis that there was a hysteresis relationship between the displacement signal integrated by the acceleration sensor and the displacement signal collected by the laser sensor. According to the results of the crosscorrelation analysis, the displacement sequence collected by the acceleration sensor and the displacement sequence collected by the laser sensor have a dislocation in the range of [-199, -202]. At the average dislocation point of 200, the matching degree of the two displacement signal sequences was the highest. Since the sampling frequency of the signal collector was 100 Hz, it was calculated that the average inherent delay of the ship motion measurement system was about 2 s. Therefore, it is only necessary to predict the heave signal of the ship within the inherent delay of 2 s, and the accurate collection of the heave displacement of the ship can be realized.
section_name: Acceleration sensor

section_name: Ship Motion Simulation Platform

section_content: We set up a ship motion measurement system on a catamaran in a dock in Guangdong Province. The system mainly included four acceleration sensors, a secondary integration box, a signal collector, and other hardware equipment. The system had a total of 12 acquisition channels, setting a variety of different sampling frequencies, and the sampling time is 1000 s. The acceleration sensor was installed on the deck plane of the ship, and the specific collection position is shown in Figure 9. 

It can also be seen from the cross-correlation analysis that there was a hysteresis relationship between the displacement signal integrated by the acceleration sensor and the displacement signal collected by the laser sensor. According to the results of the crosscorrelation analysis, the displacement sequence collected by the acceleration sensor and the displacement sequence collected by the laser sensor have a dislocation in the range of [-199, -202]. At the average dislocation point of 200, the matching degree of the two displacement signal sequences was the highest. Since the sampling frequency of the signal collector was 100 Hz, it was calculated that the average inherent delay of the ship motion measurement system was about 2 s. Therefore, it is only necessary to predict the heave signal of the ship within the inherent delay of 2 s, and the accurate collection of the heave displacement of the ship can be realized.
section_name: Calculation of Inherent Delay in Ship Motion Measurement System

section_content: We set up a ship motion measurement system on a catamaran in a dock in Guangdong Province. The system mainly included four acceleration sensors, a secondary integration box, a signal collector, and other hardware equipment. The system had a total of 12 acquisition channels, setting a variety of different sampling frequencies, and the sampling time is 1000 s. The acceleration sensor was installed on the deck plane of the ship, and the specific collection position is shown in Figure 9. The acceleration signal collected by the acceleration sensor was used as the input of the secondary integrator. Each integrator outputs a filtered acceleration signal, an integrated velocity signal, and a second-integrated displacement signal. Each sensor occupied 3 channels, for a total of 12 channels. The analog signals of 12 channels were converted into digital signals by the signal collector and displayed on the host computer. Finally, the ship heave displacement signals of the 4 channels are obtained, as shown in Figure 10. The acceleration signal collected by the acceleration sensor was used as the input of the secondary integrator. Each integrator outputs a filtered acceleration signal, an integrated velocity signal, and a second-integrated displacement signal. Each sensor occupied 3 channels, for a total of 12 channels. The analog signals of 12 channels were converted into digital signals by the signal collector and displayed on the host computer. Finally, the ship heave displacement signals of the 4 channels are obtained, as shown in Figure 10. 

In the actual measurement process, the integration of the acceleration sensor will produce a trend term. At the same time, the low-frequency characteristics of ship motion will cause serious low-frequency baseline drift of the integral displacement signal (the so-called baseline drift refers to the non-zero offset, oscillation and other distortions of the center line axis obtained from the acceleration integration to obtain the velocity and displacement). The generated trend items will accumulate over time, causing the error to gradually increase. Therefore, a reset step is generally added to the acceleration sensor integration step to eliminate the influence of the trend items. This trend item leads to a long-term characteristic of the signal collected by the acceleration sensor. Therefore, in the training data of the LSTM neural network, it is necessary to include the long-term integration of the acceleration sensor characteristics, but to also include the short-term period characteristics of ship motion. In Section 4. 1, we have calculated that the inherent delay of the ship motion measurement system used in this experiment is 2 s. According to the inherent delay, eight groups of LSTM neural networks with variable step-variable sampling frequency characteristics were constructed to compensate the signal lost by the ship motion acquisition system within 2 s. The characteristic parameters of the network are shown in Table 1. Corresponding to the different sampling frequencies in Table 1, the LSTM neural network was trained separately. The number of neuron nodes in the input layer of the network was 4, the number of neuron nodes in the hidden layer was 100, and the number of neuron nodes in the output layer was 4. The network training results are shown in Figure 11. 

After the training of the LSTM neural network with variable step-variable sampling frequency characteristics is completed, the prediction effect is checked on the test set. The results of the eight groups of predictions and the errors of the predictions are shown in Figure 12. 

the training set data dimension size. In the output results predicted by the LSTM model, different sampling frequencies correspond to different prediction steps. By constructing the test set with an interval of 100 s, the ship motion information of [101 s-400 s] can be retained, which allows the cell state of LSTM to be updated better. At the same time, [401 s-500 s] was new ship motion data, which makes the predicted results more reliable. 

In Section 4. 1, we have calculated that the inherent delay of the ship motion measurement system used in this experiment is 2 s. According to the inherent delay, eight groups of LSTM neural networks with variable step-variable sampling frequency characteristics were constructed to compensate the signal lost by the ship motion acquisition system within 2 s. The characteristic parameters of the network are shown in Table 1. Corresponding to the different sampling frequencies in Table 1, the LSTM neural network was trained separately. The number of neuron nodes in the input layer of the network was 4, the number of neuron nodes in the hidden layer was 100, and the number of neuron nodes in the output layer was 4. The network training results are shown in Figure 11. After the training of the LSTM neural network with variable step-variable sampling frequency characteristics is completed, the prediction effect is checked on the test set. The results of the eight groups of predictions and the errors of the predictions are shown in Figure 12. Summarizing the above results, it can be obtained that the accuracy of predicting ship motion signals using the LSTM neural network with variable step-variable sampling frequency characteristics is [72. 66-96. 75%], which verifies that the prediction accuracy is related to the sampling frequency and the prediction step of the LSTM neural network.
section_name: Calculation of Inherent Delay in Ship Motion Measurement System

section_content: Through these experiments, it can be concluded that the motion of the ship was simulated by the heave platform in the laboratory, and the displacement signal of the motion platform was measured simultaneously by the ship motion measurement system and the laser sensor system, which verifies that the ship motion measurement system does have an inherent delay. Secondly, on the marine ship, the ship displacement signal was collected by setting up four sets of ship motion measurement systems. Finally, different parameters were set, and the LSTM neural network with variable step-variable sampling frequency characteristics was used to predict the motion of the ship, which verifies that the prediction accuracy is related to the sampling frequency of the signal collector and the prediction step of the LSTM neural network. 

When the sampling frequency of the ship motion signal was low, the training speed of the LSTM neural network model was fast, the convergence effect was better, and the model could learn well the short-term characteristics of the ship motion cycle in the training samples. However, due to the low sampling frequency, the number of training samples was relatively small, the time steps for the prediction of the inherent delay were small, and the learning of the long-term characteristics of the acceleration sensor was poor, which ultimately made the prediction error for the inherent delay larger. 

When the sampling frequency of the ship motion signal was high, the model could learn well the long-term characteristics of the acceleration sensor in the training samples. However, due to the high sampling frequency, the number of training samples was so large that the training speed of the LSTM neural network model was slow and the convergence effect was poor. In addition, there were many time steps in the prediction of the inherent delay, and the learning of the short-term characteristics of the ship's motion cycle was poor, which ultimately made the prediction error of the inherent delay larger. Therefore, choosing an appropriate sampling frequency and time step can balance the learning effect of long and short time characteristics in the ship motion signal, and improve the prediction accuracy of the model and the timeliness of ship motion acquisition. 

Predicting ship movements through an LSTM neural network with variable stepvariable sampling frequency characteristics can help crews better plan routes, avoid potentially dangerous situations, and reduce fuel consumption. In addition, the model can also monitor the power usage of the ship in real time, thereby optimizing the energy utilization efficiency of the ship and reducing operating costs. In conclusion, using an LSTM neural network with variable step-variable sampling frequency characteristics to predict ship motion has broad application prospects and can bring many advantages to ship operations.
section_name: Experimental Discussion

section_content: This paper proposed a ship motion signal prediction method based on an LSTM neural network with variable step-variable sampling frequency characteristics. At the same time, the autocorrelation function was used to conduct cross-correlation analysis on the ship motion collected by the ship motion measurement system and the laser sensor, and the inherent delay of the ship motion measurement system could be accurately obtained. Based on multiple sets of sampling frequencies and multiple sets of prediction steps, the LSTM neural network was built to predict the ship motion signal within the inherent delay time and realize the prediction of the ship motion signal within the inherent delay time. 

The advantage of this method was that the inherent time delay of the ship motion measurement system could be accurately calculated according to the cross-correlation analysis, and the ship motion signal could be measured more accurately. During the transportation of the wind power generation equipment, the hidden danger caused by the delay problem of the measurement system was eliminated, and the real-time performance of the measurement of the ship motion signal could be improved. The results showed that the sampling frequency and prediction step have an impact on the prediction accuracy, and balancing the long-term integral characteristics of acceleration and the short-term period characteristics of ship motion can improve the prediction accuracy. 

The disadvantage of this method was that it only solved the inherent delay for the ship motion measurement system in the laboratory and does not accurately balance the long and short time characteristics in the ship motion signal data. 

In the current work, the ship motion measurement system we built was only for the heave displacement of the ship. In future work, we will further study the delay problem in the process of ship displacement signal measurement, seeking the system lag from the whole active heave compensation system. At the same time, in order to solve the measurement lag and control lag of the system, we will focus on lag control, fuzzy control, and other technologies.
section_name: Conclusions

section_name: Institutional Review Board Statement: Not applicable.

section_content: Funding: This research was funded by the National Natural Science Foundation of China grant number 31300783.

section_content: Informed Consent Statement: Not applicable.
section_name: Institutional Review Board Statement: Not applicable.

section_name: Data Availability Statement:

section_content: The original data contributions presented in the study are included in the article; further inquiries can be directed to the corresponding authors.
section_name: Data Availability Statement:

section_name: Conflicts of Interest:

section_content: The authors declare no conflict of interest.
section_name: Conflicts of Interest: