1. Introduction
Since the 21st century, the global trade volume has been rising, which has promoted the rapid prosperity and development of the shipping industry but has also led to rising carbon emissions [
1,
2], which have aggravated the pollution of the environment [
3]. In recent years, with the promotion of energy saving and emission reduction policies around the world, the sustainability of the shipping industry has also received extensive attention from governments and related organizations [
4,
5]. As an important measure to reduce carbon emissions, optimizing the energy efficiency of ships depends on the accurate prediction of ship energy consumption [
6]. Therefore, the key to the problem of efficiency improvement in ship operation is to develop a method to accurately predict ship energy consumption.
In order to accurately establish the mapping relationship between ship operating parameters and energy consumption, a number of scholars have proposed white-box models for predicting ship energy consumption based on physical equations and empirical formulas. Yang et al. [
7] proposed a speed correction model considering the influence of ocean currents based on the influence of ocean currents caused by the operation of the ship under the complex sea state conditions, so as to predict the ship’s fuel consumption. Taking into consideration the influence of the narrow canal in the channel and locks in canals, Xie et al. [
8] proposed a fuel consumption prediction model that integrates environmental factors such as water depth, width, and flow rate. Wang et al. [
9] analyzed the spatial and temporal characteristics of the ship’s navigation environment and predicted the ship’s energy consumption by considering the factors such as wind speed, wind direction, and wave height. However, this white-box model is derived under idealized conditions and is only applicable to the ideal situation where the entire voyage is at a uniform speed and there is no interference from emergencies [
10]. During a complete voyage, however, there are often abrupt changes in the energy consumption of a ship due to the complexity of the environmental conditions, in which case the use of a white-box prediction model suffers from a large bias.
Artificial intelligence technology, as a rapidly developing technology in recent years, has been widely used in research in the field of ships. Lv et al. [
11] used the Bayesian optimization method to optimize the hyper-parameters of the gated recurrent unit, and used the attention mechanism for feature extraction, and proposed a wave energy prediction model based on the network of gated recurrent units. Zhang et al. [
12] performed a cluster analysis on the ship trajectories to construct a set of trajectories in the normal sailing state and established a ship trajectory prediction model based on the BiGRU, so as to detect abnormal states during ship navigation. Sun et al. [
13] used the PCA method to select the feature variables, and at the same time, proposed a BiLSTM network with parameter optimization using the improved slime mold algorithm, which achieved the prediction of the exhaust gas temperature trend of marine diesel engines. In addition, Zhang et al. [
14] proposed a time series prediction model incorporating the improved whale algorithm, attention mechanism, and time convolutional neural network for real-time prediction of a ship’s motion state parameters, such as pitch angle, displacement, etc., and achieved better results. Moreover, Jiang et al. [
15] proposed the method of using the attention mechanism for a ship’s trajectory prediction and compared the prediction performance of different attention mechanisms, which provided new ideas for the application of machine learning technology in ship engineering.
Generally, due to the complexity of the environment and the instability of the ship’s state, the ship’s energy consumption is not a stable time series. To address such a situation, Beşikçi et al. [
16] proposed the artificial neural network (ANN) to predict the ship’s energy consumption. On this basis, Farag et al. [
17] combined the artificial neural network and multiple regression (MR) technique pair to achieve the prediction of ship fuel consumption. Wang et al. [
18] used LASSO to predict ship energy consumption. In addition, Li et al. [
19] introduced the broad learning system into ship energy consumption prediction, and Chen et al. [
20] compared the advantages and disadvantages of the prediction performances of SVR, RF, RR, and ANN models. Otherwise, some deep learning algorithms, such as the LSTM network, have also been applied in energy consumption prediction tasks [
21,
22]. This indicates that the high accuracy prediction of ship energy consumption under complex environmental conditions can be achieved by the artificial intelligence method using the ship’s operating parameters and environmental data.
Although many scholars have studied the prediction of energy consumption of ships, the accuracy of prediction is still a concern. In recent years, the temporal convolutional network (TCN) and the gated recurrent unit (GRU) have been widely used in various tasks with promising results [
23,
24,
25,
26,
27]. In this paper, the advantages of these two models are used to propose a model based on the TCN-GRU and multi-head self-attention mechanism. Among them, the TCN can more accurately capture the effects of different features on ship energy consumption; the GRU can better characterize the cyclical trend of ship energy consumption; and the multi-head self-attention mechanism can further mine the relationship between features and sudden changes in ship energy consumption from different perspectives, and finally output the prediction data through a linear layer, so as to provide high-precision prediction of ship energy consumption.
The remainder of the paper is organized as follows:
Section 2 describes the algorithms and correlation analysis metrics used in this paper. Then, in
Section 3, the basic information about the data used in this paper is presented, and the characteristics of the data are analyzed.
Section 4 establishes an energy consumption prediction model based on TGMA and examines the prediction performance of the model by comparing the algorithm proposed in this paper with five other different prediction algorithms. Finally,
Section 5 concludes the research of this paper. All appearing models and their abbreviations are shown in
Table 1.
3. Data Analysis and Feature Selection
3.1. Data Acquisition and Processing
The energy consumption of a ship is affected by a series of parameters, which mainly include information on the ship’s operation status, such as the speed, direction, shaft power and shaft speed of voyage, as well as factors of the voyage environment. During the voyage, the data acquisition system will use the sensors to capture the corresponding data, which will then be sent and stored in the onboard database and the shore-based database. The onboard energy management system and the shore-based management system can display and monitor this information in real time for energy management during the voyage. The data acquisition process is shown in
Figure 3.
In this paper, data from two voyages were selected for this research. Case 1 selected the data from the route from Caofeidian to St. Louis. Case 2 selected data on the ship’s voyage from 1 August 2016 to 31 August 2016. The bulk carrier ship studied in this paper and the routes are shown schematically in
Figure 4 and
Figure 5, respectively.
Table 2 details the ship’s parameters, engine specifications, and navigation parameters. During the voyage, data on the sailing speed, heading, shaft power, shaft rotational speed, and fuel consumption of the ship’s main engine were collected using onboard sensors. The instruments used to acquire the data are shown in
Table 3. The shaft power sensor is mounted on the main shaft to obtain the ship’s shaft power and shaft speed, the sailing position and speed information can be obtained from the GPS and speed log on the bridge, and the fuel consumption can be obtained from the fuel consumption sensor in the fuel lines. Additionally, the navigational environment information was obtained from the European Centre for Medium-Range Weather Forecasts (ECMWF), and data on real wind speed and real wind direction were derived through vector synthesis operations. During the whole voyage, the ship is under full load conditions without ballast water.
By establishing a predictive model for ship fuel consumption, the relationship between fuel usage and various influencing factors can be examined, enabling effective prediction and evaluation of fuel usage. Due to the different time scales of the collected fuel consumption data and the navigational environment data obtained from the meteorological center, data preprocessing is necessary. Firstly, the data collected every 10 min starting from 00:00 each day were converted into hourly ship fuel consumption data. Concurrently, the frequency of the meteorological data and sea state data, based on GPS and ECMWF data, was aligned with the data collected from the ships using a three-times B-spline interpolation algorithm. Additionally, to address outliers and noise in the collected data, a cleaning process was undertaken. This included handling missing data and anomalies caused by abnormal navigational environments to ensure the accuracy of the predictive model.
After data acquisition, a total of 12 ship operation features and navigation environment information features were obtained, and the features and their abbreviations are shown in
Table 4. In order to eliminate the influence of the magnitude between the feature variables, the data were normalized. The histograms of feature probability density distribution after data cleaning are shown in
Figure 6 and
Figure 7.
3.2. Autocorrelation Analysis of Energy Consumption Data
In order to understand the time series characteristics of ship energy consumption data and to improve the accuracy of the ship fuel use prediction model, the ship energy consumption data were characterized using autocorrelation coefficients and partial autocorrelation coefficients [
33,
34].
Figure 8 and
Figure 9 show the distribution of the autocorrelation function and partial autocorrelation function of fuel consumption data with a lag of 1 to 50 h. From the analysis of
Figure 8a and
Figure 9a, it can be seen that the correlation coefficients decrease almost linearly in the range of the 50 h lag, but overall, they are at a higher level. From the analysis of
Figure 8b and
Figure 9b, it can be seen that the partial autocorrelation coefficients remain high in the lag of 1 h, 2 h, and 3 h, and remain at a lower but recovered to a higher level in the range of the 22 h to 28 h lag, and also had a higher partial autocorrelation coefficient after 45 h. This indicates that the ship energy consumption data have time series characteristics, the ship energy consumption data still have some influence on the previous data within a certain lag range, and the value of the former moment data has a periodic influence on the value of the latter moment data. For this reason, this paper adopts the TCN neural network to extract the implied mapping relationship in the data, then uses the GRU neural network to enhance the fitting effect, and finally, the multi-head self-attention mechanism is employed to further excavate the connection between the before and after input data, so as to predict the ship’s energy consumption.
3.3. Correlation Analysis and Feature Selection
During voyages, ships are subject to wind resistance and water resistance. Among them, the water resistance is divided into two parts: static resistance and wave-adding resistance.
The static resistance and the wave-adding resistance can be obtained, respectively, by Equations (16) and (17):
where
CS is the static resistance, and
CF is the frictional resistance.
k is the viscous resistance factor,
CA is the appendage resistance,
CW is the wave-making resistance,
CB is the bulbous bow additional resistance, and
CSi and
CR are the stern immersion additional resistance and the relevant resistance.
Cwave is the wave-adding resistance,
ζc is the characteristic wave height,
B is the breadth of the ship,
k2 is the block coefficient,
ρ is the density of the sea water, and
L denotes the length of the ship.
Wind resistance can be obtained by Equation (18):
where
Cwave is the wind resistance,
k1 is the air coefficient resistance,
ρa is the density of air,
Vwind is the wind speed, and
As is the area of the ship’s positive projection on the water surface.
The total resistance includes static resistance, wave-adding resistance, and wind resistance:
In order for a ship to continue sailing at a specific speed, the main engine must consume fuel and thus provide a certain amount of power to drive the propeller in order to generate thrust to propel the ship forward. The effective thrust of the propeller should balance the hull resistance, which suggests that the fuel consumption of a ship is affected by environmental factors, and that further analyses of this effect can improve the accuracy of the predictions.
Figure 10a–c and
Figure 11a–c show the distribution of environmental characteristics during ship operation.
Figure 10d and
Figure 11d show the distribution of instantaneous fuel consumption at different moments during the ship’s voyage. It can be seen that both the environmental variables and the fuel consumption have a certain time series characteristic, and the environmental factors have a clearer influence on the fuel consumption of ships. In addition, there are significant differences in those parameters at different times and locations.
To further investigate the relationship between characteristic parameters and ship energy consumption during voyages, to screen characteristic input variables, and to improve prediction accuracy, the correlation analysis of the 12 characteristic variables and the ship fuel consumption rate was carried out. The Pearson correlation coefficient and the maximum information coefficient were selected as the correlation evaluation indexes, and the specific calculation methods of the maximum information coefficient are shown in Equations (14) and (15); the results of the correlation analyses are shown in
Figure 12,
Figure 13,
Figure 14 and
Figure 15. In
Figure 12 and
Figure 14, values larger than 0.5 are shown in white; in
Figure 13 and
Figure 15, values larger than 0.8 are shown in white.
From the results of the correlation analysis, it can be seen that the Pearson correlation coefficient between SS, SP, and FC is larger than the other features, indicating that there is a large linear correlation between these parameters, and the shaft speed and shaft power can directly reflect the changes in fuel consumption. There is a negative correlation between WH, WD, WS, and SOG, and the SOG will be reduced when the wave height and wind speed increase and the wind direction changes, which indicates that the navigational environmental factors have a certain influence on the ship speed, which in turn affects the ship’s fuel consumption, and that there exists a certain non-linear relationship between these characteristics and the fuel consumption. The correlation analysis of ship fuel usage and its multiple influencing parameters is of great significance to establish a prediction model of ship fuel usage.
In addition, since the actual wind speed is obtained by vector synthesis from the ECMWF data, this indicates that there exists a certain mapping relationship between them, which will lead to the endogeneity problem of the model. At the same time, from
Figure 10, the correlation between longitude and latitude and the other characteristic variables is relatively more obvious, taking into account that the strong correlation of the characteristic variables will result in the problem of multiple covariance in the input variables, which can easily cause the overfitting of the model. The four characteristic variables of longitude, latitude, the 10 m u component of wind, and the 10 m v component of wind are eliminated in this paper. The remaining seven variables are selected as feature inputs to predict the ship’s fuel consumption.
4. Energy Consumption Prediction Model Establishment and Analysis
4.1. Prediction Model Establishment
The complex sea conditions during voyages lead to drastic changes in the ship’s energy consumption, and for ship operators, timely and accurate knowledge of the ship’s instantaneous energy consumption and energy consumption distribution characteristics is beneficial to the ship’s energy-saving voyage.
After the data processing process, this paper finds that the ship’s energy consumption data are typical time series data, and the data of a certain moment are affected by the data of the previous moment, and there exists a certain degree of periodicity. For this reason, this paper establishes the ship energy consumption prediction model shown in
Figure 16. In terms of prediction models, this paper proposes a combined prediction model based on the TCN-GRU and multi-head attention mechanism, in which the TCN and GRU modules achieve the extraction of time series features and the mining of mapping relationships between different parameters; the multi-head self-attention mechanism extracts the implicit correlations in the data before and after, and finally realizes the accurate prediction of the ship energy consumption data. In terms of feature selection, this paper uses the self-attention mechanism, which is based on a combination of the TCN and GRU, and the multi-head self-attention mechanism (TGMA model). This paper uses the autocorrelation coefficient and partial autocorrelation coefficient to investigate the time series characteristics of ship energy consumption data, and to initially judge the relationship between the input features and ship energy consumption data through the spatial distribution, and then to further select the features through the maximum information coefficient and feature analysis. The flow of the model is as follows:
Acquisition of general parameters and fuel consumption data during the operation of the ship and the surrounding environmental parameters during the voyage;
Examine the distribution and spatial distribution characteristics of the data and perform a correlation analysis between the input features and the ship energy consumption data in order to select the input features for the model;
The pre-processed features and ship energy consumption data are input into the TGMA model, and the ship energy consumption data at future moments are obtained by learning the features from the training set.
4.2. Validation of the TGMA model
After feature selection and data processing, 1100 and 850 data were obtained for Case 1 and Case 2, respectively, after normalizing the data. This paper divides the dataset into the training set and the test set by an interleaved approach; the input features are SOG, COG, WH, WD, WS, SS, and SP, and the output data are the hourly rate of fuel consumption of the ship. The ship energy consumption prediction model was experimentally validated, and the TGMA prediction results are shown in
Figure 17,
Figure 18,
Figure 19 and
Figure 20.
The ship energy consumption prediction model was built using MATLAB R2023b. All the experiments were conducted on a 64-bit Windows 11 operating system with an Intel Core i5-10200H CPU, and the parameters of the model were set as in
Table 5.
The analysis of the experiments shows that the predicted values of energy consumption using the TGMA model are highly consistent with the actual values. This result not only demonstrates the accuracy of the model in predicting ship fuel consumption, but also reflects the sensitivity of the model to sudden changes in fuel consumption. Through the sensitive responsiveness, the TGMA model could effectively capture the subtle dynamics of changes in speed due to changes in sea state, thus providing strong support for the prediction of fuel consumption during ship navigation. In complex sea conditions, this capability can help ships under navigation to accurately grasp the changes in fuel consumption and provide data support for energy efficiency optimization during ship operation. Therefore, the TGMA model proposed in this paper is not only innovative in theory, but also shows significant value in practical applications, providing new methods and ideas for future applications and research in a wider range of fields.
4.3. Comparison of Different Prediction Models
To objectively evaluate the accuracy of the prediction results, it is essential to select appropriate evaluation metrics that provide a precise and comprehensive description of the predictive performance. In this paper, the metrics used to assess prediction accuracy include mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), mean square error (MSE), and the coefficient of determination (R
2). The specific calculation equations for these metrics are as follows:
where
yi,
,
are the true, predicted, and average values, respectively.
To further verify the predictive performance of the TGMA model, comparative analyses are conducted using BP, SVR, LSTM, and TCN-GRU models. The training and test sets are kept consistent with those used for the TGMA model. The evaluation metrics of the prediction results from each model are compared to assess their accuracy. The prediction results for each energy consumption model are presented in
Figure 21 and
Figure 22, and the scatter plots of the prediction results for each algorithm are shown in
Figure 23,
Figure 24,
Figure 25 and
Figure 26.
The performance evaluation metrics of the various models in the testing phase are presented in
Table 6 and
Table 7. The analysis of the data shows that the TGMA model exhibits the best performance in the prediction task. In Case 1, compared to the BP neural network, SVR, LSTM, and GRU models, the MAE of the TGMA model decreased by 34%, 24%, 28%, and 23%; the RMSE decreased by 34%, 35%, 36%, and 26%; and the MAPE decreased by 35%, 24%, 28%, and 23%; and the MSE decreased by 56%, 57%, 59%, and 46%; while the R
2 increased by 5.08%, 5.31%, 5.8%, and 3.34%, respectively. In Case 2, the MAE of the TGMA model decreased by 18%, 8%, 10%, and 12%; the RMSE decreased by 17%, 12%, 15%, and 14%; the MAPE decreased by 18%, 8%, 10%, and 17%; and the MSE decreased by 32%, 23%, 29%, and 26%; while the R
2 increased by 2.86%, 1.88%, 2.49%, and 2.17%, respectively. It clearly shows that the TGMA model significantly outperforms the other comparative models in terms of accuracy and prediction performance, highlighting its strong capability in handling complex time series prediction tasks, which proves that the TGMA model successfully extracts the high-dimensional nonlinear mapping relationship between various ship operating parameters and environmental parameters and their relationship with ship fuel consumption.
To verify the effectiveness of the MHSA mechanism in predicting fuel consumption under the same conditions, we further compared the prediction performance of the TGMA model with that of the TCN-GRU model. The results show that in Case 1, the MAE, RMSE, MAPE, and MSE of the TCN-GRU model incorporating the MHSA mechanism are reduced by 18%, 20%,18%, and 35%, respectively, while the R2 improves by 2.16% compared to the TCN-GRU. In case 2, the MAE, RMSE, MAPE, and MSE of the TGMA model are reduced by 12%, 9%, 12%, and 18%, respectively, while the R2 improves by 1.33%. This result illustrates the stability and applicability of MHSA in time series prediction. The analysis shows that the proposed TGMA model has outstanding applicability and stability by combining the GRU, TCN, and MHSA algorithms. The model significantly improves the prediction capability of time series data, enabling it to accurately capture the changes in fuel consumption during ship operation, thus ensuring the high accuracy and reliability of the prediction results.
5. Conclusions
In this paper, a ship energy consumption prediction model TCN-GRU-MHSA (TGMA) combining TCN, GRU, and multi-head self-attention algorithms is proposed to solve the problem of low accuracy and poor effect of ship energy consumption prediction. Firstly, the maximum information coefficient and the Pearson coefficient are used to select the input feature parameters of the ship energy consumption prediction model, and at the same time, the redundant feature data are eliminated according to the relationship between the features, so as to reduce the noise interference. After that, the TCN-GRU network is used to extract the time series features of multiple input data, which improves the prediction ability of the model, and finally, the multi-head self-attention mechanism is introduced to further explore the relationship between the features, so as to predict the energy consumption of ships with high accuracy.
The TGMA model was validated using voyage data, and the results demonstrate that the TGMA model outperforms BP, SVR, LSTM, GRU, and TCN-GRU models in prediction accuracy. Specifically, the TGMA model achieved a prediction accuracy of 96.04%, with a prediction error reduced to 0.00931. This indicates that the TGMA model can accurately predict the ship’s energy consumption during operation. Additionally, the model exhibits superior stability and applicability, providing valuable data support for optimizing ship energy efficiency and enabling intelligent control. Consequently, the TGMA model contributes to reducing carbon emissions during ship operations.
In this study, we did not obtain information on the ship’s trim and lateral heel, and at the same time, we did not take into account the effect of fouling on the ship’s operational status. In future research, we will introduce new features and develop additional models to enhance the performance of the model in forecasting energy consumption under various sea states and environmental conditions. We aim to improve the model’s generalization ability, thereby increasing the energy efficiency of ships and promoting the shipping industry in achieving energy savings and emission reductions.