Hybrid power supply method and system based on Transformer model
Through the hybrid power supply method based on the Transformer model, the combination of lead-acid batteries and lithium batteries is solved, and the insufficient power quality monitoring and battery performance problems in the data center power supply system is achieved, and the hybrid power supply with high stability and reliability is achieved, which improves the data center Performance and stability of power supply systems.
Patent Information
- Application Number
- CN202311780058.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2043-12-22
AI Technical Summary
The existing data center power supply system lacks real-time monitoring and evaluation of power supply quality, and cannot promptly discover and solve power supply problems. The energy density of traditional lead-acid batteries is low and the lifespan is short. The temperature rises and the capacity decreases when the lithium battery is discharged at high rate. , affects its service life and safety.
Using a hybrid power supply method based on the Transformer model, lead-acid batteries and lithium batteries are used in combination. By pre-processing the battery status data, load requirements and energy recovery data, the Transformer model is constructed, and the power supply data at the next moment is predicted and based on the prediction. As a result, the battery output ratio is adjusted to match the optimal power supply strategy to achieve stable and reliable hybrid power supply.
It realizes the stable and reliable combination of different types of batteries, improves the performance and stability of the data center power supply system, promptly monitors and adjusts the power supply strategy, and improves the stability and reliability of the power supply system.
Smart Images

Figure CN118137635B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of load power supply, and in particular relates to a hybrid power supply method and system based on a Transformer model. Background Art
[0002] Data centers are important infrastructure in the modern information society, and their stable operation is crucial to ensuring the continuity of various businesses. Traditional data center power supply systems mainly use lead-acid batteries as backup power sources, but lead-acid batteries have problems such as low energy density, short life, and high maintenance costs. Lithium batteries have the advantages of high energy density, long life, and environmental protection, and have gradually become an ideal choice for data center backup power sources. However, lithium batteries are prone to temperature rise and capacity attenuation when discharged at high rates, which affects their service life and safety. Therefore, how to reasonably combine lead-acid batteries and lithium batteries to give full play to the advantages of both and improve the performance and stability of data center power supply systems is a problem that needs to be solved.
[0003] In addition, the existing data center power supply system usually lacks real-time monitoring and evaluation of power quality, and cannot detect and solve power supply problems in a timely manner. At the same time, with the continuous increase in data volume and the improvement of business continuity requirements, data centers have put forward higher requirements for the stability and reliability of power supply systems. Therefore, it is necessary to further improve and perfect the existing data center power supply system. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies in the prior art and to provide a hybrid power supply method and system based on a Transformer model, which can combine different types of batteries and has the advantages of high stability and high reliability.
[0005] The present invention provides the following technical solutions:
[0006] In a first aspect, a hybrid power supply method based on a Transformer model is provided, comprising:
[0007] Preprocessing historical state data of the first battery, historical state data of the second battery, historical load demand of the load end, and historical data of recovered energy to build a Transformer model;
[0008] Input the collected first battery status data, second battery status data, load demand and recovered energy data at the current moment into the trained Transformer model, and the Transformer model outputs the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment;
[0009] Compare the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment with the formulated power supply strategy to match the optimal power supply strategy;
[0010] According to the predicted and matched optimal power supply strategy, the output ratio of the first battery, the second battery and the recovered energy is adjusted to achieve hybrid power supply to the load end.
[0011] Optionally, the collected first battery status data, second battery status data, load demand and recovered energy data at the current moment are input into a trained Transformer model, and the Transformer model outputs the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment. When the output predicted first battery status data, second battery status data and load demand at the next moment exceed the set alarm value, the alarm system is triggered.
[0012] In a second aspect, a hybrid power supply method based on a Transformer model is provided, the method comprising the steps in the first aspect and:
[0013] Monitor the first battery status data, the second battery status data, the load demand and the recovered energy data at the current moment, and determine whether the matching optimal power supply strategy is met;
[0014] If satisfied, the current optimal power supply strategy is maintained;
[0015] If not, the optimal power supply strategy is directly matched according to the first battery status data, the second battery status data, the load demand and the recovered energy data monitored at the current moment, and the output ratio of the first battery, the second battery and the recovered energy is adjusted according to the directly matched optimal power supply strategy.
[0016] Optionally, the first battery status data, the second battery status data, the load demand and the recovered energy data at the current moment are monitored, and the determination of whether the matching optimal power supply strategy is met is performed, and the monitoring time interval is greater than the comparison of the predicted first battery status data, the second battery status data, the load demand and the recovered energy data at the next moment with the formulated power supply strategy, and the collection time interval used for prediction in the matching optimal power supply strategy is compared.
[0017] Optionally, the historical status data of the first battery, the historical status data of the second battery, the historical load demand of the load end and the historical data of recovered energy are preprocessed to construct a Transformer model, and the preprocessing includes cleaning, conversion, standardization, encoding, normalization, segmentation and storage.
[0018] Optionally, the historical state data of the first battery, the historical state data of the second battery, the historical load demand of the load end, and the historical data of recovered energy are preprocessed to construct a Transformer model, wherein the first battery and the second battery are of different battery types; the Transformer model includes a multi-head self-attention sublayer and a feedforward neural network sublayer connected in sequence; position encoding and layer normalization operations are introduced in the multi-head self-attention sublayer;
[0019] The multi-head self-attention layer introduces the position-encoded input sequence X pos for:
[0020]
[0021] Among them, X is the original input data, pos represents the position of the word in the sequence, and d model Represents the dimension of word embedding in the model;
[0022] The intermediate output of the multi-head attention layer is:
[0023] MultiHead(Q,K,V)=Concat(head 1 ,head 2 ,...,head h )
[0024] Among them, head i is the i-th attention head;
[0025] The i-th attention head i for:
[0026]
[0027] Among them, Q, K and V are the input sequence X pos The three vectors obtained by linear transformation; W i Q , W i K , W i Q is the relevant weight matrix of the i-th attention head;
[0028] The layer normalized output X of the multi-head attention layer ln for:
[0029] X ln =LayerNormalization(MultiHead(Q,K,V)):
[0030] The output of the feedforward neural network FFN(X ln )for:
[0031] FFN(X ln )=RELU(X ln W 1 +b 1 )W 2 +b 2
[0032] Among them, W 1 and W 2 are the weight matrices of the two fully connected layers, b 1 and b 2 are the bias vectors of the two fully connected layers respectively.
[0033] Optionally, the historical state data of the first battery, the historical state data of the second battery, the historical load demand of the load end, and the historical data of the recovered energy are preprocessed to construct the Transformer model.
[0034] The historical status data of the first battery includes: an average value and a standard deviation of the historical voltage of the first battery, a remaining power and a power change rate of the first battery in a historical time period, a historical temperature of the first battery, and a historical ambient temperature of the first battery;
[0035] The historical status data of the second battery includes: an average value and a standard deviation of the historical voltage of the second battery, a remaining power and a power change rate of the second battery in a historical time period, a historical temperature of the second battery, and a historical ambient temperature of the second battery;
[0036] The historical load demand of the load end includes: the historical current average value, maximum value and minimum value of the load end;
[0037] The historical data of the recovered energy includes: the historical remaining power of the recovered energy, the historical power change rate, and the average value and standard deviation of the historical voltage;
[0038] The first battery status data, the second battery status data, the load demand and the recovered energy data collected at the current moment are input into the trained Transformer model;
[0039] The current first battery status data, second battery status data, load demand and recovered energy data are obtained by detection through a detection chip or a detection sensor.
[0040] The first battery status data includes: the voltage of the first battery, the remaining power and power change rate of the first battery, the temperature of the first battery and the ambient temperature of the first battery;
[0041] The second battery status data includes: the second battery voltage, the remaining power and power change rate of the second battery, the second battery temperature and the ambient temperature of the second battery;
[0042] The load requirements include: current and change at the load end;
[0043] The recovered energy data includes: the remaining amount of recovered energy, the rate of change of amount of recovered energy and the voltage of recovered energy.
[0044] In a third aspect, a hybrid power supply system based on a Transformer model is provided, comprising a first battery, a second battery, a recovery energy unit and a control unit; the output ends of the first battery, the second battery and the recovery energy unit are connected to a load end, and the control unit regulates the output of the first battery, the second battery and the recovery energy unit according to data information from the load end; the control unit comprises:
[0045] A construction module, for preprocessing the historical state data of the first battery, the historical state data of the second battery, the historical load demand of the load end, and the historical data of the recovered energy, so as to construct a Transformer model;
[0046] A prediction module, used to input the collected first battery status data, second battery status data, load demand and recovered energy data at the current moment into the trained Transformer model, and the Transformer model outputs the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment;
[0047] A comparison and matching module is used to compare the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment with the formulated power supply strategy to match the optimal power supply strategy;
[0048] The adjustment module is used to adjust the output ratio of the first battery, the second battery and the recovered energy in the energy recovery unit according to the predicted optimal power supply strategy, so as to realize hybrid power supply to the load end.
[0049] In a fourth aspect, a computer device is provided, comprising a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the steps of the hybrid power supply method based on the Transformer model described in any one of the first aspect or the second aspect are implemented.
[0050] In a fifth aspect, a computer-readable storage medium is provided for storing a computer program; when the computer program is executed by a processor, the steps of the hybrid power supply method based on the Transformer model described in any one of the first aspect or the second aspect are implemented.
[0051] Compared with the prior art, the present invention has the following beneficial effects:
[0052] (1) The present invention uses the Transformer model to predict the load demand, the first battery status data, the second battery status data and the energy recovery data at the load end, and matches the optimal power supply strategy according to the prediction results, so that different types of batteries can be combined and used stably and reliably to exert the optimal effects of multiple energies, thereby ensuring both high stability and high reliability.
[0053] (2) The present invention also adds a feedback emergency measure, which can monitor the optimal power supply strategy matched according to the prediction results. When the prediction results of the Transformer model deviate, or when at least one of the first battery, the second battery, and the recovered energy fails, the optimal power supply strategy is adjusted in time, thereby further improving the power supply stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 is a flow chart of a hybrid power supply method based on a Transformer model in Embodiment 1 of the present invention;
[0055] Figure 2 is a flow chart of a hybrid power supply method based on a Transformer model in Embodiment 2 of the present invention;
[0056] Figure 3 It is a structural block diagram of the hybrid power supply system based on the Transformer model of the present invention. DETAILED DESCRIPTION
[0057] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0058] Embodiment 1
[0059] like Figure 1 As shown, a hybrid power supply method based on a Transformer model is provided, comprising the following steps:
[0060] S1: Preprocess the historical state data of the first battery, the historical state data of the second battery, the historical load demand of the load end, and the historical data of the recovered energy to build a Transformer model.
[0061] Specifically, the first battery and the second battery are of different types. If the load end is a data center, the first battery may be a lead-acid battery and the second battery may be a lithium battery, thereby combining the advantages of the two batteries. It is worth noting that the output voltages of the first battery and the second battery must be able to maintain the normal operation of the load end.
[0062] The historical status data of the first battery includes: an average value and a standard deviation of the historical voltage of the first battery, a remaining power and a power change rate of the first battery in a historical time period, a historical temperature of the first battery, and a historical ambient temperature of the first battery;
[0063] The historical status data of the second battery includes: an average value and a standard deviation of the historical voltage of the second battery, a remaining power and a power change rate of the second battery in a historical time period, a historical temperature of the second battery, and a historical ambient temperature of the second battery;
[0064] The historical load demand of the load end includes: the historical current average value, maximum value and minimum value of the load end;
[0065] The historical data of recovered energy include: the historical remaining power of the recovered energy, the historical power change rate, and the average value and standard deviation of the historical voltage.
[0066] The preprocessing in step S1 includes cleaning, conversion, standardization, encoding, normalization, segmentation and storage.
[0067] Specifically, cleaning includes filling missing values, processing outliers, deleting duplicate values, etc. to ensure the quality and accuracy of the data. Preprocessing and cleaning are performed because the data may contain missing, outliers, or erroneous values, so data cleaning operations are required.
[0068] Transformations include normalizing data, converting time series data into tensor form, etc. Transformations can transform the collected data to facilitate the input of the Transformer model.
[0069] Standardization is to enable the model to better learn and understand the characteristics of the data; standardization can scale the data to a common numerical range, such as converting all data to values between 0 and 1.
[0070] Encoding is for categorical variables or category data. Specifically, one-hot encoding or unique hot encoding can be used to convert category data into a format that the model can process.
[0071] Normalization is to normalize the scale of the data to the same scale for easy model comparison and processing; the minimum-maximum normalization method can be used to map the data to the range of [0,1].
[0072] The purpose of segmentation is to divide the collected data into three parts: training set, validation set and test set. The training set is used to train the model, the validation set is used to adjust the model parameters and prevent overfitting, and the test set is used to evaluate the performance of the model.
[0073] Storage is to store the processed data in an appropriate format or database to facilitate subsequent model training and application.
[0074] Through the above preprocessing steps, the historical status data of the first battery, the historical status data of the second battery, the historical load demand of the load end and the historical data of recovered energy can be effectively preprocessed to provide accurate and consistent data input for subsequent Transformer model applications.
[0075] Specifically, in step S1, the constructed Transformer model includes a multi-head self-attention sublayer and a feedforward neural network sublayer connected in sequence; position encoding and layer normalization operations are introduced in the multi-head self-attention sublayer.
[0076] Specifically, the multi-head self-attention layer introduces the position-encoded input sequence X pos for:
[0077]
[0078] Among them, X is the original input data, pos represents the position of the word in the sequence, and d model Represents the dimension of word embedding in the model;
[0079] The intermediate output of the multi-head attention layer is:
[0080] MultiHead(Q,K,V)=Concat(head 1 ,head 2 ,...,head h )
[0081] Among them, head i is the i-th attention head;
[0082] The i-th attention head i for:
[0083]
[0084] Among them, Q, K and V are the input sequence X pos The three vectors obtained by linear transformation; W i Q , W i K , W i Qis the relevant weight matrix of the i-th attention head;
[0085] The layer normalized output X of the multi-head attention layer ln for:
[0086] X ln =LayerNormalization(MultiHead(Q,K,V)):
[0087] The output of the feedforward neural network FFN(X ln )for:
[0088] FFN(X ln )=RELU(X ln W 1+ b 1 )W 2 +b 2
[0089] Among them, W 1 and W 2 are the weight matrices of the two fully connected layers, b 1 and b 2 are the bias vectors of the two fully connected layers respectively.
[0090] That is, the final output of the Transformer model is X final for:
[0091] X final =FFN(LayerNormalization(MultiHead(Q,K,V))).
[0092] After the Transformer model is built, it needs to be trained. During training, the loss function and optimizer need to be defined: select a suitable loss function (such as the cross entropy loss function) to measure the prediction error of the model. At the same time, select an optimizer (such as Adam, SGD, etc.) to update the parameters of the model.
[0093] When training the Transformer model, the model is trained using the training set and the model parameters are updated through multiple iterations. During each iteration, the value of the loss function is calculated and the model parameters are updated according to the optimizer. In order to prevent overfitting, regularization methods (such as Dropout, weight decay, etc.) can be used during training.
[0094] After the Transformer model is trained, it needs to be evaluated and tuned. Specifically, the trained model is evaluated using the test set, and the model's accuracy, recall and other indicators are calculated to understand the performance of the model in practical applications; according to the performance of the model on the test set, the model parameters, optimizer and learning rate are adjusted to improve the model performance. The best hyperparameter combination can be found using methods such as grid search and Bayesian optimization.
[0095] S2: The collected first battery status data, second battery status data, load demand and recovered energy data at the current moment are input into the trained Transformer model, and the Transformer model outputs the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment.
[0096] The current first battery status data, second battery status data, load demand and recovered energy data are collected through a detection chip or a detection sensor. Specifically, the collection can be set once per second, or once every 3-6 seconds. The collected data may contain noise and abnormal values, so they need to be cleaned. The cleaning method can be set by referring to the existing technology.
[0097] The first battery status data includes: the voltage of the first battery, the remaining power and power change rate of the first battery, the temperature of the first battery and the ambient temperature of the first battery;
[0098] The second battery status data includes: the second battery voltage, the remaining power and power change rate of the second battery, the second battery temperature and the ambient temperature of the second battery;
[0099] The load requirements include: current and change at the load end;
[0100] The recovered energy data includes: the remaining amount of recovered energy, the rate of change of amount of recovered energy and the voltage of recovered energy.
[0101] After the current data is collected, necessary preprocessing can be performed before inputting it into the Transformer model for prediction. The specific method of preprocessing can refer to the preprocessing method of historical data in step S1, and of course it can also be adjusted according to actual needs.
[0102] S3: Compare the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment with the formulated power supply strategy to match the optimal power supply strategy.
[0103] The power supply strategy can be set according to actual needs. For example, when the load demand increases, the power supply proportion of the lithium battery can be predicted and increased; when the load demand decreases, the power supply proportion of the lead-acid battery can be reduced and more recycled energy can be used.
[0104] Another example is to provide a solution when the predicted load demand is low: first, based on the current battery status data, a lead-acid battery with a higher power is selected for power supply, because the lead-acid battery generally has a higher power storage capacity and a lower cost; if the power of the lead-acid battery is not enough to meet the load demand, a lithium battery with a higher power can be selected for power supply;
[0105] When the predicted load demand is high: First, based on the current battery status data, select a lithium battery with a higher power level for power supply. This is because lithium batteries usually have a higher energy density and a faster charging speed, and can meet the power demand of high load demand; if the power of the lithium battery is not enough to meet the load demand, then a lead-acid battery with a higher power level can be selected for power supply.
[0106] When the predicted load demand is between the two: use lead-acid batteries and lithium batteries for power supply at the same time. The power supply ratio of each battery can be reasonably allocated according to the predicted load demand and the current battery status data. For example, if the predicted load demand is 60%, then the lead-acid battery can be allocated to supply 40% of the power and the lithium battery can be allocated to supply 60% of the power. It should be noted that when using multiple batteries for power supply at the same time, it is necessary to ensure that the battery management system can effectively manage the battery charging and discharging process to avoid excessive use and loss.
[0107] The power supply strategy can be more refined, and the formulation of the power supply strategy should be based on expert advice.
[0108] S4: According to the predicted optimal power supply strategy, the output ratio of the first battery, the second battery and the recovered energy is adjusted to achieve hybrid power supply to the load end.
[0109] In some other embodiments, an alarm is added, that is, when the first battery status data, the second battery status data, the load demand and the recovered energy data predicted by the Transformer model output at the next moment exceed the set alarm value, the alarm system is triggered, thereby promptly notifying the operation and maintenance personnel to take corresponding measures to handle and repair the fault.
[0110] Embodiment 2
[0111] like Figure 2As shown, a hybrid power supply method based on a Transformer model is provided, which, in addition to the steps of the first embodiment, further includes the following steps:
[0112] S5: monitoring the first battery status data, the second battery status data, the load demand and the recovered energy data at the current moment, and determining whether the matching optimal power supply strategy is met;
[0113] If satisfied, the current optimal power supply strategy is maintained;
[0114] If not, the optimal power supply strategy is directly matched according to the first battery status data, the second battery status data, the load demand and the recovered energy data monitored at the current moment, and the output ratio of the first battery, the second battery and the recovered energy is adjusted according to the directly matched optimal power supply strategy.
[0115] The optimal power supply strategy of Example 1 is determined based on the Transformer model prediction. The purpose of step S6 in Example 2 is to ensure the accuracy of the optimal power supply strategy, that is, step S6 is equivalent to a feedback emergency measure, which can monitor the optimal power supply strategy matched according to the prediction. When the prediction result of the Transformer model deviates, or when at least one of the first battery, the second battery, and the recovered energy fails, the optimal power supply strategy can be adjusted in time, thereby further improving the power supply stability.
[0116] Specifically, the first battery status data, the second battery status data, the load demand and the recovered energy data at the current moment are monitored, and it is determined whether the matching optimal power supply strategy is satisfied. The monitoring time interval is greater than the comparison of the predicted first battery status data, the second battery status data, the load demand and the recovered energy data at the next moment with the formulated power supply strategy, and the collection time interval used for prediction in the matching optimal power supply strategy, that is, the monitoring time interval in step S2 is greater than the data collection time interval used for prediction in step S6.
[0117] In some other embodiments, energy efficiency evaluation can be performed once a week, taking into account multiple factors such as energy cost, battery life, environmental factors, etc. to achieve better energy allocation and management, and improve energy efficiency and reduce energy costs by continuously optimizing the power supply strategy. We use evaluation indicators such as total energy consumption, number of battery replacements, number of failures, etc. to measure the performance and reliability of the power supply system, and then adjust the parameters of the Transformer model or change the power supply strategy according to the evaluation results to optimize energy efficiency.
[0118] Embodiment 3
[0119] like Figure 3As shown, a hybrid power supply system based on a Transformer model is provided, comprising a first battery, a second battery, a recovery energy unit and a control unit; the output ends of the first battery, the second battery and the recovery energy unit are connected to the load end to provide energy to the load end, and the control unit regulates the output of the first battery, the second battery and the recovery energy unit according to data information of the load end; the control unit comprises:
[0120] A construction module, for preprocessing the historical state data of the first battery, the historical state data of the second battery, the historical load demand of the load end, and the historical data of the recovered energy, so as to construct a Transformer model;
[0121] A prediction module, used to input the collected first battery status data, second battery status data, load demand and recovered energy data at the current moment into the trained Transformer model, and the Transformer model outputs the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment;
[0122] A comparison and matching module is used to compare the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment with the formulated power supply strategy to match the optimal power supply strategy;
[0123] The adjustment module is used to adjust the output ratio of the first battery, the second battery and the recovered energy in the energy recovery unit according to the predicted optimal power supply strategy, so as to realize hybrid power supply to the load end.
[0124] Embodiment 4:
[0125] The present invention provides a computer device, comprising a processor and a memory; wherein the processor implements the steps of the hybrid power supply method based on the Transformer model when executing a computer program stored in the memory.
[0126] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0127] Embodiment 5
[0128] The present invention provides a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, the steps of the hybrid power supply method based on the Transformer model are implemented.
[0129] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0130] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system, device, and storage medium disclosed in the embodiment, since they correspond to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0131] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention or some parts of the embodiments.
[0132] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.
Claims
1. A hybrid power supply method based on Transformer model, characterized in that: include: Preprocessing historical state data of the first battery, historical state data of the second battery, historical load demand of the load end, and historical data of recovered energy to build a Transformer model; Input the collected first battery status data, second battery status data, load demand and recovered energy data at the current moment into the trained Transformer model, and the Transformer model outputs the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment; Compare the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment with the formulated power supply strategy to match the optimal power supply strategy; According to the predicted optimal power supply strategy, the output ratio of the first battery, the second battery and the recovered energy is adjusted to achieve hybrid power supply to the load end; The historical state data of the first battery, the historical state data of the second battery, the historical load demand of the load end, and the historical data of recovered energy are preprocessed to construct a Transformer model, wherein the first battery and the second battery are of different types; the Transformer model includes a multi-head self-attention sublayer and a feedforward neural network sublayer connected in sequence; position encoding and layer normalization operations are introduced in the multi-head self-attention sublayer; The multi-head self-attention sublayer introduces the position-encoded input sequence X pos for: Among them, X is the original input data, pos represents the position of the word in the sequence, and d model Represents the dimension of word embedding in the model; The intermediate output of the multi-head self-attention sublayer is: MultiHead(Q,K,V)=Concat(head1,head2,...,head h ) Among them, head i is the i-th attention head; The i-th attention head i for: Among them, Q, K and V are the input sequence X pos The three vectors obtained by linear transformation; W i Q , W i K , W i Q is the relevant weight matrix of the i-th attention head; The layer normalized output X of the multi-head self-attention sublayer ln for: X ln =LayerNormalization(MultiHead(Q,K,V)): The output of the feedforward neural network FFN(X ln )for: <h2 style=";text-align:left;direction:ltr">FFN(X<h2 style=";text-align:left;direction:ltr"> ln <h2 style=";text-align:left;direction:ltr"> RELU(X)<h2 style=";text-align:left;direction:ltr"> ln <h2 style=";text-align:left;direction:ltr"> W<h2 style=";text-align:left;direction:ltr"> 1+ <h2 style=";text-align:left;direction:ltr"> b1)W2+b2 Among them, W1 and W2 are the weight matrices of the two fully connected layers, and b1 and b2 are the bias vectors of the two fully connected layers; The historical state data of the first battery, the historical state data of the second battery, the historical load demand of the load end, and the historical data of the recovered energy are preprocessed to construct the Transformer model. The historical status data of the first battery includes: an average value and a standard deviation of the historical voltage of the first battery, a remaining power and a power change rate of the first battery in a historical time period, a historical temperature of the first battery, and a historical ambient temperature of the first battery; The historical status data of the second battery includes: an average value and a standard deviation of the historical voltage of the second battery, a remaining power and a power change rate of the second battery in a historical time period, a historical temperature of the second battery, and a historical ambient temperature of the second battery; The historical load demand of the load end includes: the historical current average value, maximum value and minimum value of the load end; The historical data of the recovered energy includes: the historical remaining power of the recovered energy, the historical power change rate, and the average value and standard deviation of the historical voltage; The first battery status data, the second battery status data, the load demand and the recovered energy data collected at the current moment are input into the trained Transformer model; The current first battery status data, second battery status data, load demand and recovered energy data are obtained by detection through a detection chip or a detection sensor; The first battery status data includes: the voltage of the first battery, the remaining power and power change rate of the first battery, the temperature of the first battery and the ambient temperature of the first battery; The second battery status data includes: the second battery voltage, the remaining power and power change rate of the second battery, the second battery temperature and the ambient temperature of the second battery; The load demand includes: the current and the change amount at the load end; The recovered energy data includes: the remaining amount of recovered energy, the rate of change of amount of recovered energy and the voltage of recovered energy.
2. The hybrid power supply method based on the Transformer model according to claim 1, characterized in that: The first battery status data, the second battery status data, the load demand and the recovered energy data collected at the current moment are input into the trained Transformer model, and the Transformer model outputs the predicted first battery status data, the second battery status data, the load demand and the recovered energy data at the next moment. When the output predicted first battery status data, the second battery status data and the load demand at the next moment exceed the set alarm value, the alarm system is triggered.
3. The hybrid power supply method based on the Transformer model according to claim 1, characterized in that: The method further comprises: Monitor the first battery status data, the second battery status data, the load demand and the recovered energy data at the current moment, and determine whether the matching optimal power supply strategy is met; If satisfied, the current optimal power supply strategy is maintained; If not, the optimal power supply strategy is directly matched according to the first battery status data, the second battery status data, the load demand and the recovered energy data monitored at the current moment, and the output ratio of the first battery, the second battery and the recovered energy is adjusted according to the directly matched optimal power supply strategy.
4. The hybrid power supply method based on the Transformer model according to claim 3 is characterized in that: The first battery status data, the second battery status data, the load demand and the recovered energy data at the current moment are monitored, and it is determined whether the matching optimal power supply strategy is met. The monitoring time interval is greater than the comparison of the predicted first battery status data, the second battery status data, the load demand and the recovered energy data at the next moment with the formulated power supply strategy, and the collection time interval used for prediction in the matching optimal power supply strategy.
5. The hybrid power supply method based on the Transformer model according to claim 1, characterized in that: The historical status data of the first battery, the historical status data of the second battery, the historical load demand of the load end and the historical data of recovered energy are preprocessed to construct the Transformer model, and the preprocessing includes cleaning, conversion, standardization, encoding, normalization, segmentation and storage.
6. A hybrid power supply system based on a Transformer model, based on the hybrid power supply method based on a Transformer model according to claim 1, characterized in that: It includes a first battery, a second battery, a recovery energy unit and a control unit; the output ends of the first battery, the second battery and the recovery energy unit are connected to the load end, and the control unit regulates the output of the first battery, the second battery and the recovery energy unit according to the data information of the load end; the control unit includes: A construction module, for preprocessing historical state data of the first battery, historical state data of the second battery, historical load demand of the load end, and historical data of recovered energy, so as to construct a Transformer model; A prediction module, used to input the collected first battery status data, second battery status data, load demand and recovered energy data at the current moment into the trained Transformer model, and the Transformer model outputs the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment; A comparison and matching module, used to compare the predicted first battery status data, second battery status data, load demand and recovered energy data at the next moment with the formulated power supply strategy to match the optimal power supply strategy; The adjustment module is used to adjust the output ratio of the first battery, the second battery and the recovered energy in the energy recovery unit according to the predicted optimal power supply strategy, so as to realize hybrid power supply to the load end.
7. A computer device, characterized in that: It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the steps of the hybrid power supply method based on the Transformer model described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that: Used to store computer programs; when the computer programs are executed by the processor, the steps of the hybrid power supply method based on the Transformer model described in any one of claims 1 to 5 are implemented.
