Combined model-based dynamic prediction method and system for power conversion demand of electric ship
Through the combination of LSTM and XGBoost models, the time series and environmental data of electric ships are processed in real time, and the battery swap demand forecast is dynamically adjusted, which solves the problems of inaccurate prediction and energy waste in the existing technology, and improves the operational efficiency and safety of electric ships. sex.
Patent Information
- Application Number
- CN202411174915.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-10
AI Technical Summary
The prior art is difficult to accurately predict the battery swap demand of electric ships, especially due to the dependence of historical data and the complexity of multiple factors that lead to inaccurate predictions and lack of dynamic prediction and real-time adjustment capabilities, resulting in waste of energy and inefficient management.
A combined model based on LSTM and XGBoost models is adopted to collect ship status and external environment data in real time, process time series and non-time series data, dynamically adjust the prediction results, and issue early warnings in a timely manner through threshold settings.
It improves the accuracy and real-timeness of battery swap demand forecasts, adapts to changes in navigation conditions, enhances navigation safety, and optimizes energy management and operational efficiency.
Smart Images

Figure CN119106868A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of transportation technology, and in particular to a method and system for dynamically predicting power replacement demand of electric ships based on a combined model. Background Art
[0002] With the improvement of environmental awareness and the rapid development of new energy technologies, the shipping industry is gradually transforming towards electrification and intelligence. As a clean and efficient mode of transportation, electric ships are gaining more and more attention and application. However, the widespread use of electric ships has also brought new challenges, especially in the prediction and management of battery swapping demand. The existing predictions of battery swapping demand are all based on the research on the battery swapping demand of new energy electric vehicles, but the battery swapping habits of new energy electric vehicles are irregular, such as: the scheduled battery swapping is temporarily unavailable; the battery swapping is not carried out due to weather reasons; the battery swapping is changed to charging when there is plenty of time, etc. These uncertain factors may lead to inaccurate prediction results, and then lead to energy waste, etc. Secondly, the current predictions of battery swapping demand are based on historical data training models, so as to predict the battery swapping demand in the future time period and provide support for the preparation of battery packs in advance for the battery swapping station, but such predictions are too dependent on historical data, which may be mixed with data composed of users who make temporary appointments for battery swapping, resulting in inaccurate predictions, and then energy waste, etc. The forecast of battery swapping demand for electric-powered ships depends not only on the judgment of historical data, but also on multiple factors such as waterways and weather. Therefore, the forecast of battery swapping demand based on new energy electric vehicles is not applicable to the forecast of battery swapping demand for electric-powered ships.
[0003] In addition, the lack of dynamic prediction and real-time adjustment capabilities also limits the application effect of existing technologies in the management of battery swapping demand for electric ships. Therefore, developing a battery swapping demand prediction method specifically for electric ships that can comprehensively consider multiple factors and make dynamic predictions has become one of the key needs to promote the electrification of the ship industry. Summary of the invention
[0004] In view of the problems existing in the existing method for dynamically predicting the battery replacement demand of electric ships based on a combined model, the present invention is proposed.
[0005] Therefore, the problem to be solved by the present invention is how to provide a method for predicting battery replacement demand specifically for electric ships, which comprehensively considers multiple factors and performs dynamic prediction.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In the first aspect, an embodiment of the present invention provides a method for dynamically predicting the battery replacement demand of electric ships based on a combined model, which includes: collecting ship status and external environment data in real time, building a combined model based on an LSTM model and an XGBoost model, and performing instant prediction through the combined model; dynamically adjusting the prediction results based on real-time data and new navigation plan changes to provide the latest battery replacement demand forecast; setting a threshold value, and issuing a warning when the predicted value of the battery replacement demand exceeds the threshold value.
[0008] As a preferred solution of the method for dynamic prediction of electric ship battery replacement demand based on the combined model of the present invention, the LSTM model is used as the first layer of the combined model to process time series data. The construction of the LSTM model includes: setting T time steps of data, each time step of data contains a feature x t , the target variable is y t , where t = 1, 2, ..., T;
[0009] X=[x1,x2,...,x T ],Y=[y1,y2,...,y T ]
[0010] Standardize or normalize the data, expressed as:
[0011]
[0012] Where μ is the mean of the feature and σ is the standard deviation;
[0013] The LSTM unit consists of four gates: input gate i t 、Forget gate t , output gate o t and the cell state update gate g t , the LSTM unit also includes the cell state c t and the hidden state h t The update rules are:
[0014] Input Gate:
[0015] i t =σ(W xi x t +W hi h t-1 +b i )
[0016] Forget Gate:
[0017] f t =σ(W xf x t +W hf h t-1+b f )
[0018] Cell status update:
[0019] g t =tanh(W xc x t +W hc h t-1 +b c )
[0020] c t =f t ⊙c t-1 +i t ⊙g t
[0021] Output Gate
[0022] o t =σ(W xo x t +W ho h t-1 +b o )
[0023] Hide status updates:
[0024] h t =o t ⊙tanh(c t )
[0025] Where W* represents the weight matrix, b represents the bias term, σ is the sigmoid activation function, tanh is the hyperbolic tangent function, and ⊙ represents element multiplication. If it is a single-step prediction, the hidden state h is used in the last time step. t Prediction target If it is a multi-step prediction, the hidden state h is used at each time step t Prediction target It is expressed as:
[0026]
[0027] Among them, W h is the weight matrix from the hidden layer to the output layer, b y is the bias term of the output layer, h t is the hidden state at the tth time step, is the target variable for prediction, which represents the predicted value of power consumption at the next time step or the binary label of needing to replace the battery; the mean square error is used as the loss function to measure the predicted value The difference between the actual value y is expressed as:
[0028]
[0029] Use gradient descent to minimize the loss function L, expressed as:
[0030]
[0031] Among them, θ represents all the parameters of the model, including weights and bias terms, and θ* represents the optimal parameter set for the binary label of power consumption or whether the battery needs to be replaced predicted by the model to be close to the true value.
[0032] As a preferred solution of the method for dynamic prediction of electric ship battery replacement demand based on the combined model of the present invention, the XGBoost model serves as the second layer of the combined model, receives the output of the LSTM model as one of the features, and performs prediction in combination with other non-time series features; the training of the XGBoost model includes: setting x i is the feature vector of the i-th ship, including power consumption, time, weather and channel information; y i It is represented as the label of the battery replacement demand of the i-th ship at a certain time point; the logistic loss function L is used as the objective function, which is expressed as:
[0033]
[0034] Among them, p i is the predicted probability after the sigmoid function conversion, that is, the probability that the i-th sample needs to be replaced. t-1 (x i ) means that in the t-1th iteration, the model predicts the i-th ship x i The predicted value of ; Calculate the average value of the target variable of all samples in the training data set and set it as the initial prediction, that is, the average label of all samples as the baseline, expressed as For each iteration t=1,2,3,...,T, the gradient, i.e. the first-order derivative of the objective function, is calculated and expressed as:
[0035]
[0036]
[0037] Among them, F t-1 (x i ) means that in the t-1th iteration, the model predicts the i-th ship x i The predicted value, g i t and h i t Represent the gradient of the i-th sample in the t-th round and the diagonal elements of the Hessian matrix; Find q j * and j* , so that the following formula is minimized:
[0038]
[0039] Among them, q j * is the output value of the leaf node, s j * is the splitting threshold of feature j on the node, Ij is the set of samples assigned to the node, T j ′ is the number of leaf nodes, γ and λ are regularization terms that control the complexity of the model; and then find the best split point of the decision tree, at which the loss function is reduced to the maximum.
[0040] As a preferred solution of the method for dynamic prediction of electric ship power replacement demand based on the combined model of the present invention, the prediction result is updated based on the optimal splitting point, which is expressed as:
[0041]
[0042] Among them, Jt is the number of leaf nodes in the t-th round tree, wi j is the weight of the jth leaf node, R jt is the area corresponding to the leaf node, η is the learning rate; iterates continuously until the predetermined number of trees T is reached; after training, for any given ship feature x, the final battery replacement demand prediction It is determined by the cumulative predictions of all trees and is expressed as:
[0043]
[0044] Where T represents the number of iterations, x is the sample, represents the final predicted value of battery replacement demand, and σ is the sigmoid activation function.
[0045] As a preferred solution of the method for dynamic prediction of electric ship battery replacement demand based on the combined model described in the present invention, wherein: the LSTM model processes time series data, including ship power consumption data, timestamps, historical battery replacement records and ship operation status data; the XGBoost model processes non-time series environmental factor data, including weather data, waterway information, cargo information and sailing plan information; the weather data includes temperature, humidity, wind speed, wind direction angle and rainfall; the waterway information includes waterway width, waterway congestion level and water depth; the cargo information includes cargo capacity and cargo type; the sailing plan information includes expected sailing distance and speed plan.
[0046] As a preferred solution of the method for dynamic prediction of electric ship battery replacement demand based on the combined model of the present invention, the dynamic adjustment is to select branches to reach leaf nodes for each decision tree from the root node according to the new feature value, obtain the predicted value of the tree, and calculate the sum of the predicted values of all trees, which is expressed as:
[0047]
[0048] Among them, η is the learning rate, F t is the prediction function of the t-th tree.
[0049] As a preferred solution of the method for dynamically predicting the demand for power replacement of electric ships based on the combined model described in the present invention, wherein: the influencing factors of the threshold include the remaining power situation, weather impact, and sailing distance factor; the remaining power impact is set as the first warning impact, the weather impact is set as the second warning impact, and the sailing distance impact is set as the third warning impact; the first warning impact includes the first level warning, the second level warning, and the third level warning, and the impact degree is the first level warning < the second level warning < the third level warning; if the remaining power percentage continues to decrease, and the decrease exceeds the preset threshold A, the first influencing factor warning is triggered, the speed is reduced, non-essential electrical equipment is turned off, and a distress signal is prepared to be sent; if the current wind speed continues to rise and exceeds the preset threshold B, The first influencing factor warning will be corrected, the threshold of the power warning will be increased, and the speed will be further reduced. If the current wind speed exceeds n times the preset threshold and the first influencing factor warning has been triggered, the warning level of the first influencing factor will be increased by one level; if the estimated sailing distance exceeds the preset threshold C of the original plan, the threshold of the power warning will be increased, the route will be re-evaluated, and additional battery swap stations will be found. If the warning of the first influencing factor has not reached the third level warning, it will be immediately upgraded to the third level warning; if multiple warnings are triggered at the same time, the first correction will be made based on the warning of the first influencing factor, according to the warning level of the second influencing factor, and the second correction will be made according to the warning level of the third influencing factor, and the operation corresponding to the corrected highest level warning will be executed.
[0050] In the second aspect, an embodiment of the present invention provides a dynamic prediction system for the battery replacement demand of electric ships based on a combined model, which includes: a construction module for collecting ship status and external environment data in real time, building a combined model based on the LSTM model and the XGBoost model, and performing instant prediction through the combined model; a prediction module for dynamically adjusting the prediction results according to real-time data and new navigation plan changes, and providing the latest battery replacement demand prediction; an early warning module for setting a threshold value, and issuing an early warning in time when the battery replacement demand exceeds the threshold value
[0051] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the processor executes the computer program, it implements any step of the above-mentioned method for dynamic prediction of electric ship battery replacement demand based on the combined model.
[0052] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the above-mentioned method for dynamically predicting the battery replacement demand of electric ships based on a combined model is implemented.
[0053] The beneficial effect of the present invention is that the present invention constructs a combined model by combining LSTM and XGBoost models, which can process time series data and non-time series data at the same time, improve the accuracy of battery replacement demand prediction, and through real-time collection of ship status and external environment data, can dynamically adjust the prediction results to adapt to changing navigation conditions. Taking into account various factors such as ship power consumption, timestamps, historical battery replacement records, ship operating status, weather data, channel information, cargo information, and navigation plans, the prediction results are more comprehensive and accurate. Through timely warnings and multi-level warning mechanisms, timely measures can be taken in emergency situations such as insufficient power to enhance navigation safety. In actual operation, it can help ship charging and battery replacement operators plan battery replacement in advance, optimize energy management, and improve overall battery replacement efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0055] Figure 1 is a flow chart of the present invention;
[0056] Figure 2 This is the flow chart of the LSTM model;
[0057] Figure 3 This is the XGBoost model flow chart. DETAILED DESCRIPTION
[0058] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0059] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0060] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0061] Example 1
[0062] Reference Figure 1 to Figure 3 , which is the first embodiment of the present invention, and provides a method for dynamically predicting the battery replacement demand of electric ships based on a combined model, comprising:
[0063] S1: Collect ship status and external environment data in real time, build a combined model based on LSTM model and XGBoost model, and make instant predictions through the combined model.
[0064] Collect the power consumption data of the vessel, including but not limited to the vessel's speed, deadweight, weather conditions, sea conditions, vessel type, battery status, etc.
[0065] Build feature engineering, including:
[0066] Time features: Extract time-related features, including timestamp, week, and month.
[0067] Ship characteristics: Extract ship-related features, including ship type, cargo capacity, and sailing speed.
[0068] Environmental characteristics: Extract environmental related features, including temperature, humidity, wind speed, wind direction, wind angle, and rainfall.
[0069] Power consumption characteristics: Extract historical data on power consumption as sequence data input.
[0070] Shared features: Timestamp, used as index to ensure time alignment.
[0071] The unique features of the LSTM model are processed, including:
[0072] Power consumption sequence: directly used as input sequence;
[0073] Operation state sequence: After the operation state is encoded, it is also input as a sequence to reflect the changes of the operation state over time.
[0074] The processing of XGBoost model-specific features is shown in Table 1:
[0075] Table 1 XGBoost model specific feature processing table
[0076]
[0077] Combine the collected data to build a data set, targeting two types of data collected: one is time series data for LSTM model, and the other is non-time series environmental factor data for XGBoost model. Table 2 gives examples of the data required for each model training:
[0078] Table 2 Model training data classification table
[0079]
[0080] The above data types are integrated into a suitable data structure, the time series data is sorted by time, the environmental factor data is aligned with the corresponding power consumption data, and a structured data set is constructed, as shown in Table 3:
[0081] Table 3 Structured dataset instance table
[0082] Timestamp Power consumption (kWh) Operational Status 2024-06-1808:00 120 1 Temperature(℃) humidity(%) Wind direction angle (cos) 20 60 cos(270) Wind direction angle (sin) Rainfall (mm) Channel width (m) sin(270) 0 100 Congestion level (unblocked) Congestion level (mild) Congestion level (moderate) 1 0 0 Water depth(m) Cargo capacity (tons) Cargo Type (Heavy Cargo) 10 2000 0 Cargo Type (Light Cargo) Estimated sailing distance (km) Speed plan (km / h) 1 1000 15
[0083] The data format of Table 3 integrates time series data, including power consumption, timestamp, operating status, and environmental factor data including weather, channel information, cargo information, and sailing plan. It also performs necessary feature engineering processing, including data encoding, normalization, and periodic representation of wind direction, providing a structured data set for the training of LSTM and XGBoost models.
[0084] The LSTM model is used as the first layer to process time series data. The construction of the LSTM model includes:
[0085] Set T time steps of data, each time step contains a feature x t , the target variable is y t , where t = 1, 2, ..., T;
[0086] X=[x1,x2,...,x T ],Y=[y1,y2,...,y T ]
[0087] Standardize or normalize the data, expressed as:
[0088]
[0089] Where μ is the mean of the feature and σ is the standard deviation;
[0090] The LSTM unit consists of four gates: input gate i t 、Forget gate t , output gate o t and the cell state update gate g t , the LSTM unit also includes the cell state c t and the hidden state h t The update rules are:
[0091] Input Gate:
[0092] i t =σ(W xi x t +W hi h t-1 +b i )
[0093] Forget Gate:
[0094] f t =σ(W xf x t +W hf h t-1 +b f )
[0095] Cell status update:
[0096] g t =tanh(W xc x t +W hc h t-1 +b c )
[0097] c t =f t ⊙c t-1 +i t ⊙g t
[0098] Output Gate
[0099] o t =σ(W xo x t +W ho h t-1 +b o )
[0100] Hide status updates:
[0101] h t =o t ⊙tanh(ct )
[0102] Among them, W* represents the weight matrix, b represents the bias term, σ is the sigmoid activation function, tanh is the hyperbolic tangent function, and ⊙ represents element multiplication;
[0103] If it is a single-step prediction, then at the last time step, the hidden state h is used t Prediction target
[0104] If it is a multi-step prediction, the hidden state h is used at each time step t Prediction target It is expressed as:
[0105]
[0106] Among them, W h is the weight matrix from the hidden layer to the output layer, b y is the bias term of the output layer, h t is the hidden state at the tth time step, is the target variable for prediction, which represents the predicted value of power consumption at the next time step or the binary label that the battery needs to be replaced;
[0107] The mean square error is used as the loss function to measure the predicted value. The difference between the actual value y is expressed as:
[0108]
[0109] Use gradient descent to minimize the loss function L, expressed as:
[0110]
[0111] Among them, θ represents all the parameters of the model, including weights and bias terms, and θ* represents the optimal parameter set for the binary label of power consumption or whether the battery needs to be replaced predicted by the model to be close to the true value.
[0112] The XGBoost model, as the second layer, receives the output of the LSTM model as one of the features and combines it with other non-time series features for prediction;
[0113] The training of the XGBoost model includes:
[0114] Set x i is the feature vector of the i-th ship, including power consumption, time, weather and channel information; y i It is represented as the label of the battery replacement demand of the i-th ship at a certain time point; the logistic loss function L is used as the objective function, which is expressed as:
[0115]
[0116] Among them, p i is the predicted probability after the sigmoid function conversion, that is, the probability that the i-th sample needs to be replaced. t-1 (x i ) means that in the t-1th iteration, the model predicts the i-th ship x i The predicted value of .
[0117] Calculate the average value of the target variable for all samples in the training dataset and set it as the initial prediction, that is, the average label of all samples as the baseline, expressed as
[0118] For each iteration t=1,2,3,...,T, the gradient, i.e. the first-order derivative of the objective function, is calculated and expressed as:
[0119]
[0120] Among them, F t-1 (x i ) means that in the t-1th iteration, the model predicts the i-th ship x i The predicted value, g i t and h i t Represent the diagonal elements of the gradient and Hessian matrix of the i-th sample in the t-th round respectively;
[0121] Find q j * and j * , so that the following formula is minimized:
[0122]
[0123] Among them, q j * is the output value of the leaf node, s j * is the splitting threshold of feature j on the node, Ij is the set of samples assigned to the node, T j ′ is the number of leaf nodes, γ and λ are regularization terms that control the model complexity;
[0124] Then find the best split point of the decision tree, at which the loss function is reduced to the maximum.
[0125] Update the prediction result based on the best split point, expressed as:
[0126]
[0127] Among them, Jt is the number of leaf nodes in the t-th round tree, wi j is the weight of the jth leaf node, R jt is the area corresponding to the leaf node, η is the learning rate;
[0128] Iterate until the predetermined number of trees T is reached or the performance on the validation set no longer improves significantly.
[0129] After training, for any given vessel feature x, the final battery swap demand prediction is It is determined by the cumulative predictions of all trees and is expressed as:
[0130]
[0131] Where T represents the number of iterations, x is the sample, represents the final predicted value of battery replacement demand, and σ is the sigmoid activation function.
[0132] S2: Dynamically adjust the forecast results based on real-time data and new sailing plan changes to provide the latest battery replacement demand forecast.
[0133] For each decision tree, starting from the root node, select branches to reach leaf nodes according to the new feature value, obtain the predicted value of the tree, and calculate the sum of the predicted values of all trees, expressed as:
[0134]
[0135] Among them, η is the learning rate, F t is the prediction function of the t-th tree.
[0136] The prediction results are converted into probabilities using the sigmoid function, expressed as:
[0137]
[0138] If a new forecast is completed, the battery replacement time will be re-estimated. Based on the current position, speed and predicted probability of battery replacement demand, the time when battery replacement is most likely to be needed is estimated. Combined with the expected battery replacement time and ship route, the nearest suitable battery replacement station is determined; and the required charging amount is calculated based on the current power, expected consumption and safety margin.
[0139] The predicted value is combined with other non-time series feature data and the XGBoost model is reused for prediction. The training is iterative and the predicted value of battery replacement demand is output.
[0140] S3: Setting a threshold value, and issuing an early warning when the predicted value of the battery replacement demand exceeds the threshold value.
[0141] Set the remaining power impact as the first warning impact, the weather impact as the second warning impact, and the navigation distance impact as the third warning impact;
[0142] The first warning impact includes first-level warning, second-level warning, and third-level warning, and the impact degree is first-level warning < second-level warning < third-level warning;
[0143] Similarly, the second warning impact and the third warning impact also include three levels; the warning level of the second level impact is set as the fourth level warning, the fifth level warning and the sixth level warning, and the warning level of the third level impact is set as the seventh level warning, the eighth level warning and the ninth level warning;
[0144] It should be noted that the warning levels of different influencing factors are not compared, and the warning levels of the second-level and third-level influencing factors are used to correct the warning levels of the first-level influencing factors;
[0145] If the remaining battery percentage is less than 30%, the first level warning will be triggered, and the speed will be reduced by 10% to save power;
[0146] If the remaining power percentage is less than 20%, the second level warning will be triggered, the speed will be reduced by 20%, the nearest battery swap station will be found, and non-essential power equipment will be turned off;
[0147] If the remaining power percentage is less than 10%, the third level warning will be triggered, the speed will be reduced to the minimum safe speed, the emergency power supply will be activated, and the ship will sail to the nearest safe port or battery swap station, and prepare to send a distress signal;
[0148] Further determine the second influencing factor:
[0149] If the current wind speed exceeds level 6 or the wave height exceeds 3 meters, the fourth level warning will be triggered, and the first influencing factor warning will be corrected, including increasing the threshold of the power warning by 5 percentage points and further reducing the speed by 5%.
[0150] If the current wind speed exceeds level 8 or the wave height exceeds 5 meters, the fifth level warning will be triggered to modify the first influencing factor warning, including increasing the threshold of the power warning by 10 percentage points. If the first influencing factor warning has been triggered, its level will be raised by one level;
[0151] If the current wind speed exceeds level 10 or the wave height exceeds 7 meters, the sixth level warning will be triggered to modify the first influencing factor warning, including increasing the threshold of power warning by 15 percentage points. If the warning of the first influencing factor has not reached the third level warning, it will be immediately upgraded to the third level warning;
[0152] Going further, determine the third influencing factor:
[0153] If the estimated sailing distance exceeds 110% of the original plan, the seventh level warning will be triggered, and the warning of the first influencing factor will be revised, including increasing the threshold of the power warning by 2 percentage points and re-evaluating the route;
[0154] If the estimated sailing distance exceeds 120% of the original plan, the eighth level warning will be triggered, and the warning of the first influencing factor will be revised, including increasing the threshold of the power warning by 5 percentage points and replanning the route. If the warning of the first influencing factor has been triggered, its level will be raised by one level;
[0155] If the estimated voyage distance exceeds 130% of the original plan, the ninth warning will be triggered to revise the warning of the first influencing factor, including increasing the threshold of the power warning by 8 percentage points and finding additional battery swap stations. If the warning of the first influencing factor has not yet reached the third level warning, it will be immediately upgraded to the third level warning;
[0156] If multiple warnings are triggered at the same time, the warning of the first influencing factor is used as the basis, the first correction is made according to the warning level of the second influencing factor, and the second correction is made according to the warning level of the third influencing factor, and the operation corresponding to the highest level warning after correction is executed.
[0157] If multiple warnings are triggered at the same time, the warning of the first influencing factor is used as the basis, and the first correction is made according to the level of the warning of the second influencing factor. Then, the second correction is made according to the level of the warning of the third influencing factor. The operation corresponding to the highest level of the corrected warning is executed, and all warning states are re-evaluated every 15 minutes.
[0158] If any warning reaches the third level of the current influencing factor warning, namely the third level warning, the sixth level warning and the ninth level warning, the fleet management center will be notified immediately to request support and further instructions.
[0159] In summary, the present invention realizes high-precision dynamic prediction of the battery replacement demand of electric ships by combining LSTM and XGBoost models. It comprehensively considers various influencing factors such as ship status and environmental data, and can dynamically adjust the prediction results according to real-time information. And by setting thresholds and multi-level early warning mechanisms, timely warnings can be issued when necessary, effectively enhancing navigation safety. It not only improves the prediction accuracy, but also optimizes the ship's operating efficiency, reduces unnecessary battery replacement operations, and improves energy utilization efficiency. In addition, it has strong adaptability and is suitable for various types of electric ships and different navigation environments. It significantly improves the operating efficiency and safety of electric ships, and makes important contributions to promoting the development of the shipbuilding industry towards electrification and intelligence.
[0160] Example 2
[0161] Reference Figure 1Based on the first embodiment, this embodiment further provides a dynamic prediction system for electric ship battery replacement demand based on a combined model, including:
[0162] This embodiment also provides a computer device, which is suitable for the case of a dynamic prediction method for the battery replacement demand of electric ships based on a combined model, including a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the dynamic prediction method for the battery replacement demand of electric ships based on a combined model as proposed in the above embodiment.
[0163] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0164] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for dynamically predicting the battery replacement demand of electric ships based on a combined model as proposed in the above embodiment is implemented.
[0165] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0166] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A dynamic prediction method for electric ship battery replacement demand based on a combined model, characterized by: include, Collect ship status and external environment data in real time, build a combined model based on LSTM model and XGBoost model, and make instant predictions through the combined model; Dynamically adjust forecast results based on real-time data and new sailing plan changes to provide the latest forecast of battery replacement demand; A threshold is set, and an early warning is issued when the predicted value of the battery replacement demand exceeds the threshold.
2. The method for dynamic prediction of battery replacement demand of electric ships based on a combined model according to claim 1, characterized in that: The LSTM model serves as the first layer of the combined model to process time series data. The construction of the LSTM model includes: Set T time steps of data, each time step contains a feature x t , the target variable is y t , where t = 1, 2, ..., T; X=[x1,x2,...,x T ],Y=[y1,y2,...,y T ] Standardize or normalize the data, expressed as: Where μ is the mean of the feature and σ is the standard deviation; The LSTM unit consists of four gates, namely input gate i t 、Forget gate t , output gate o t and the cell state update gate g t , the LSTM unit also includes the cell state c t and the hidden state h t The update rules are: Input Gate: i t =σ(W xi x t +W hi h t-1 +b i ) Forget Gate: f t =σ(W xf x t +W hf h t-1 +b f ) Cell status update: g t =tanh(W xc x t +W hc h t-1 +b c ) c t =f t ⊙c t-1 +i t ⊙g t Output Gate o t =σ(W xo x t +W ho h t-1 +b o ) Hide status updates: h t =o t ⊙tanh(c t ) Among them, W* represents the weight matrix, b represents the bias term, σ is the sigmoid activation function, tanh is the hyperbolic tangent function, and ⊙ represents element multiplication; If it is a single-step prediction, then at the last time step, the hidden state h is used t Prediction target If it is a multi-step prediction, the hidden state h is used at each time step t Prediction target It is expressed as: Among them, W h is the weight matrix from the hidden layer to the output layer, b y is the bias term of the output layer, h t is the hidden state at the tth time step, is the target variable for prediction; The mean square error is used as the loss function to measure the predicted value The difference between the actual value y is expressed as: Use gradient descent to minimize the loss function L, expressed as: Among them, θ represents all the parameters of the model, including weights and bias terms, and θ* represents the optimal parameter set predicted by the model.
3. The method for dynamic prediction of electric ship battery replacement demand based on a combined model according to claim 2, characterized in that: The XGBoost model, as the second layer of the combined model, receives the output of the LSTM model as one of the features and performs prediction in combination with other non-time series features; The training of the XGBoost model includes: Set x i is the feature vector of the i-th ship, including power consumption, time, weather and channel information; y i It is the label representing the battery replacement demand of the i-th ship at a certain time point; Use the logistic loss function L as the objective function, expressed as: Among them, p i is the predicted probability after sigmoid function conversion, that is, the probability that the i-th sample needs to be replaced. t-1 (x i ) means that in the t-1th iteration, the model predicts the i-th ship x i The predicted value of Calculate the average value of the target variable for all samples in the training dataset and set it as the initial prediction, that is, the average label of all samples as the baseline, expressed as For each iteration t=1,2,3,...,T, the gradient, i.e. the first-order derivative of the objective function, is calculated and expressed as: Among them, F t-1 (x i ) means that in the t-1th iteration, the model predicts the i-th ship x i The predicted value, g i t and h i t Represent the diagonal elements of the gradient and Hessian matrix of the i-th sample in the t-th round respectively; Find q j * and j * , so that the following formula is minimized: Among them, q j * is the output value of the leaf node, s j * is the splitting threshold of feature j on the node, Ij is the set of samples assigned to the node, T j ′ is the number of leaf nodes, γ and λ are regularization terms that control the model complexity; Then find the best split point of the decision tree, at which the loss function is reduced to the maximum.
4. The method for dynamic prediction of battery replacement demand of electric ships based on a combined model according to claim 3, characterized in that: The prediction result is updated based on the optimal splitting point, which is expressed as: Among them, Jt is the number of leaf nodes in the t-th round tree, wi j is the weight of the jth leaf node, R jt is the area corresponding to the leaf node, η is the learning rate; Continue to iterate until the predetermined number of trees T is reached; After training, for any given vessel feature x, the final battery swap demand prediction is It is determined by the cumulative predictions of all trees and is expressed as: Where T represents the number of iterations, x is the sample, represents the final predicted value of battery replacement demand, and σ is the sigmoid activation function.
5. The method for dynamic prediction of electric ship battery replacement demand based on a combined model according to claim 4, characterized in that: The LSTM model processes time series data, including ship power consumption data, timestamps, historical power replacement records, and ship operation status data; The XGBoost model processes non-time series environmental factor data, including weather data, waterway information, cargo information, and sailing plan information; The weather data includes temperature, humidity, wind speed, wind direction and rainfall; The waterway information includes waterway width, waterway congestion level and water depth; The cargo information, including cargo volume and cargo type; The navigation plan information includes the estimated navigation distance and speed plan.
6. The method for dynamic prediction of electric ship battery replacement demand based on a combined model according to claim 5, characterized in that: The dynamic adjustment is to start from the root node of each decision tree, select branches to reach leaf nodes according to the new feature value, obtain the predicted value of the tree, and calculate the sum of the predicted values of all trees, which is expressed as: Among them, η is the learning rate, F t is the prediction function of the tth tree.
7. The method for dynamic prediction of electric ship battery replacement demand based on a combined model according to claim 6, characterized in that: Factors affecting the threshold include remaining power, weather conditions, and sailing distance. Set the remaining power impact as the first warning impact, the weather impact as the second warning impact, and the navigation distance impact as the third warning impact; The first warning impact includes first-level warning, second-level warning, and third-level warning, and the impact degree is first-level warning < second-level warning < third-level warning; If the remaining power percentage continues to decrease, and the decrease exceeds the preset threshold value A, the first influencing factor warning will be triggered, the speed will be reduced, non-essential electrical equipment will be turned off, and a distress signal will be prepared; If the current wind speed continues to rise and exceeds the preset threshold value B, the first influencing factor warning will be revised, the threshold of the power warning will be increased, and the speed will be further reduced. If the current wind speed exceeds n times the preset threshold value and the first influencing factor warning has been triggered, the first influencing factor warning level will be increased by one level; If the estimated voyage distance exceeds the preset threshold C of the original plan, the threshold of the power warning will be increased, the route will be re-evaluated, and additional battery swap station stops will be found. If the warning of the first influencing factor has not reached the third level warning, it will be immediately upgraded to the third level warning; If multiple warnings are triggered at the same time, the warning of the first influencing factor is used as the basis, the first correction is made according to the warning level of the second influencing factor, and the second correction is made according to the warning level of the third influencing factor, and the operation corresponding to the highest level warning after correction is executed.
8. A system for dynamically predicting the demand for battery replacement of electric ships based on a combined model, based on a method for dynamically predicting the demand for battery replacement of electric ships based on a combined model according to any one of claims 1 to 7, characterized in that: include, A construction module is used to collect ship status and external environment data in real time, build a combined model based on the LSTM model and the XGBoost model, and make instant predictions through the combined model; The forecasting module is used to dynamically adjust the forecast results based on real-time data and new sailing plan changes, and provide the latest forecast of battery replacement demand; The early warning module is used to set thresholds and issue early warnings when the demand for battery replacement exceeds the threshold.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for dynamically predicting the battery replacement demand of an electric ship based on a combined model as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for dynamically predicting the battery replacement demand of an electric ship based on a combined model as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Inter-fleet electric quantity intelligent distribution cooperative charging method and system
CN120634198A
A method and system for intelligent power distribution and collaborative charging among fleets
CN120634198B
