Control strategy implementation method and system for charging and discharging of household optical storage battery

By performing feature processing on the optical storage battery charge and discharge data and extracting features from the CNN model, the problem of static battery charge and discharge strategies in the existing technology is solved, and high-precision battery charge and discharge strategy prediction and user revenue maximization are achieved.

CN118630803APending Publication Date: 2024-09-10JIANGYIN CHENGCHU INTELLIGENT SYST CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410621210.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The existing technology cannot dynamically calculate based on photovoltaic power generation, user electricity consumption behavior and electricity prices, and cannot realize users' diversified electricity needs and maximize revenue. The charging and discharging strategy is static and cannot meet the dynamic changes of users.

Method used

By defining the training data set, performing feature linearization, position information and time feature embedding processing, using fast Fourier transform to convert one-dimensional battery power changes into two-dimensional data, and building a CNN model based on Inception Block V1, extracting features and aggregating them, Realize intelligent prediction of battery charging and discharging strategies.

Benefits of technology

It realizes intelligent prediction of battery charging and discharging strategies with high prediction accuracy, meeting users' charging and discharging control needs in various scenarios and maximizing user benefits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118630803A
    Figure CN118630803A
Patent Text Reader

Abstract

The invention belongs to the technical field of battery charging and discharging control, and discloses a household optical storage battery charging and discharging control strategy implementation method and system, and the method comprises the following steps: defining each row of fields of a training data set, and setting a time sequence interval t of two adjacent rows of data; preprocessing the training data set to obtain input data; performing feature linearization and position information and time feature embedding processing on the obtained input data to obtain final input data Input; performing fast Fourier transform on the Input data, and converting one-dimensional battery power change into two-dimensional variable data; according to the method, a CNN model is constructed based on Inception BlockV1, feature extraction and aggregation are carried out on obtained two-dimensional variable data, final output data Output is obtained, and intelligent prediction is realized, so that intelligent prediction of battery charge and discharge strategy control is realized, the prediction precision is high, charge and discharge control requirements of users in various scenes are met, and maximization of user benefits is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of battery charging and discharging control, and in particular to a method and system for realizing a control strategy for charging and discharging a household photovoltaic storage battery. Background Art

[0002] In the household photovoltaic energy storage management system, the photovoltaic power generation, the user's load power consumption, and the grid electricity price are not controllable by the photovoltaic energy storage management system at a macro level. The system can only achieve maximum benefits for users by controlling the battery charging and discharging scheduling strategy.

[0003] When electricity prices are at peak, the load will give priority to using batteries to store electricity. When electricity prices are at low, the load will use grid electricity as much as possible, or even use grid electricity to charge the battery. When electricity prices are off-peak, photovoltaic power generation, load electricity consumption, battery power, user preferences and grid prices are comprehensively considered.

[0004] The battery charging and discharging strategy of the existing technology realizes photovoltaic power generation and grid charging of the battery by setting the battery charging time period; and sets the battery discharging time period to realize battery discharge for load use or grid feeding. For the uncovered time period, the "self-generation and self-use" strategy is adopted by default, that is, photovoltaic power generation is used for load use first, and the battery is charged if there is excess power. If the photovoltaic power generation is not enough for the load use, the battery will be discharged. This static setting of the charging and discharging strategy cannot be dynamically calculated based on the photovoltaic power generation, the user's actual power consumption behavior and the electricity price package, and cannot realize the user's diversified power consumption needs and maximize the benefits. Summary of the invention

[0005] Purpose of the invention: In view of the problems existing in the above-mentioned prior art, the present invention constructs a method for implementing a control strategy for charging and discharging a household photovoltaic storage battery. In addition, the present invention also proposes a system for implementing a control strategy for charging and discharging a household photovoltaic storage battery.

[0006] Technical solution: In one aspect of the present invention, a method for implementing a control strategy for charging and discharging a household photovoltaic storage battery is provided, the method comprising the following steps:

[0007] S1 defines the fields of each row of the training data set, namely: (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather identification, user preference, battery charge and discharge power) are respectively expressed as (V0, V1, V2...V13), where V0 represents the time feature, V1~V12 represents the input feature vector, V13 represents the output label data, and the time series interval t between two adjacent rows of data is set; and the training data set is preprocessed to obtain the input data;

[0008] S2 performs feature linearization, position information and time feature embedding processing on the input data to obtain the final input data Input;

[0009] S3 performs fast Fourier transform on the input data to convert the one-dimensional battery power change into two-dimensional variable data;

[0010] S4 builds a CNN model based on Inception Block V1, extracts and aggregates features of the two-dimensional variable data obtained in step S3, and obtains the final output data Output;

[0011] S5 repeats the training until the loss function is within the expected range and saves the model structure and parameters.

[0012] Further, including:

[0013] In step S1, the training data set is preprocessed, including:

[0014] S11 defines the length of the time series seq_len, that is, each seq_len row of the training data set is recorded as the input data of a sample;

[0015] S12 sets the label length label_len, which represents the time series length label_len*t that the model needs to predict, that is, the label_len rows in the training data set that follow are recorded as label data of a sample;

[0016] S13 defines the prediction length predict_len, which means that the model needs to predict the battery charging and discharging power value of predict_len*t in the future, so as to determine the number of data rows required for a single training data;

[0017] S14 performs text vectorization and standardization on the V1 to V13 sequence feature data of the training data in each sample so that the mean of the data is 0 and the standard deviation is 1, thereby obtaining the input data IP.

[0018] Further, including:

[0019] The step S2 specifically includes:

[0020] S21 defines the training batch, subtracts the local mean from each batch of data IP and divides it by the local standard deviation to ensure that the normalized data has steady-state characteristics;

[0021] S22 defines the model dimension d_model, linearly transforms the input data IP input features into the d_model dimension, and then obtains Input1;

[0022] S23 performs PositionalEmbedding processing on the input feature position information to obtain Input2;

[0023] S24 performs TemporalEmbedding on the temporal feature V0, extracts the year, month, week, hour, and minute information from the temporal feature, performs embedding processing on them respectively, and linearly converts them into Input3 of the d_model dimension;

[0024] S25 integrates the input feature data, position information and time feature vector to obtain the final input data Input=Input1+Input2+Input3; in order to prevent overfitting, the specific value of dropout is taken and applied to Input=dropout(Input).

[0025] Further, including:

[0026] The step S2 further comprises:

[0027] Through linear transformation, the time series seq_len dimension of the final input data Input is mapped to the (seq_len+predict_len) space. The dimension of the final input data Input is represented by [B, T, C], where B represents batch, T represents the time series length Time=seq_len+predict_len, and C represents the feature dimension d_model.

[0028] Further, including:

[0029] The step S3 specifically includes:

[0030] S31 performs fast Fourier transform on the final input data Input, takes the frequencies f with the largest amplitudes A of the first K, and calculates the corresponding period period_list and weight period_weight through the frequency f;

[0031] S32 defines {f1,...,f K}=arg before K, according to the fast Fourier transform conjugation property, we get the frequencies f1,...,f K The range is between [1,T / 2]; the period T is the time series length T in the final input data Input, i∈[1,K];

[0032] Therefore, period_list contains the topK period values ​​P i , the period_weight dimension is expressed as: [B, topK].

[0033] Further, including:

[0034] The step S3 further comprises:

[0035] S33 to (f i ,p i ), reshape the time series length T of the final input data Input into a two-dimensional variable Out(i) of Num(i) periods, that is:

[0036]

[0037] Out(i) dimension = [B, C, Num(i), p i ].

[0038] Further, including:

[0039] The step S4 specifically includes:

[0040] S41 uses convolution kernels of different sizes to extract features from Out(i), aggregates the results of feature extraction, and obtains the updated dimension of Out(i), Out(i) dimension = [B, C', Num(i), p i ];

[0041] S42 Out(i) dimension = [B, C', Num(i), p i ] is restored to [B,C,T], and then switched to [B,T,C], the first K Out(i) form res:[B,T,C,K];

[0042] S43 aggregates the first K outputs Out(i) and period_weight after feature extraction from the CNN model, and uses residual connection to improve the difference between network learning input and output to prevent gradient disappearance;

[0043] S44 repeats steps S31-S33, S41-S43 several times to obtain the final output result Output: [B, T, C].

[0044] Further, including:

[0045] The step S41 comprises:

[0046] S411 uses convolution kernels of different sizes to perform feature extraction on Out(i), and after aggregating the results of feature extraction, the dimension of Out(i) is obtained. The convolution kernels are selected as kernel=1*1, kernel=3*3, kernel=5*5, kernel=7*7, and kernel=9*9 respectively;

[0047] S412 uses the GELU activation function on Out(i) to extract nonlinear features;

[0048] S413 uses convolution kernels of different sizes to perform feature extraction on Out(i) again, and aggregates the results of the second feature extraction to obtain the corresponding Out(i) dimension. The convolution kernels are selected as kernel=1*1, kernel=3*3, kernel=5*5, kernel=7*7, and kernel=9*9 respectively.

[0049] Further, including:

[0050] Before step S5, the method further comprises the following steps:

[0051] S45 converts Output to the original model dimension Output through linearization transformation;

[0052] S46 uses the denormalization of non-steady-state data to convert the original model dimension Output into the original unit, improving the practical applicability of the model;

[0053] S47 intercepts the model result of the last predict_len length of the T time series in Output:[B,T,C], so the Output dimension becomes: [B,predict_len,C];

[0054] S48 extracts the last column V13 in the feature dimension C of the model Output, which is the model test result of the battery charging and discharging power. The Output dimension is [B, predict_len, 1];

[0055] S49 uses the MSELoss mean square error loss function to calculate the model test results and the label value loss = MSELoss (Output, batch_y); where batch_y is the label value;

[0056] S410 uses the Adam gradient descent method to back-propagate and update model parameters.

[0057] On the other hand, the present invention also provides a control strategy implementation system for charging and discharging household photovoltaic storage batteries, the system comprising:

[0058] The data set definition module is used to define the fields of each row of the training data set, namely: (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather identification, user preference, battery charge and discharge power) are respectively expressed as (V0, V1, V2...V13), where V0 represents the time feature, V1~V12 represents the input feature vector, V13 represents the output label data, and the time series interval t between two adjacent rows of data is set; and the training data set is preprocessed to obtain the input data;

[0059] The preprocessing module is used to perform feature linearization, position information and time feature embedding processing on the input data to obtain the final input data Input;

[0060] Dimension conversion module, used to perform fast Fourier transform on input data, converting one-dimensional battery power changes into two-dimensional variable data;

[0061] The training module is used to build a CNN model based on Inception BlockV1, extract features and aggregate the obtained two-dimensional variable data to obtain the final output data Output;

[0062] Repeat the training until the loss function is within the expected range, and save the model structure and parameters.

[0063] Beneficial effects: The present invention linearizes the features of the collected data, embeds the position information and time features, and then uses FFT to convert the one-dimensional battery power change curve based on the time series with the synergistic influence of multiple variables into multiple two-dimensional change curves of different frequencies and periods; finally, CNN is used to capture the intra-cycle and inter-cycle features of each frequency, thereby realizing intelligent prediction of battery charging and discharging strategy control with high prediction accuracy. The present invention meets the charging and discharging control needs of users in various scenarios and maximizes user benefits. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0065] Figure 1 is a schematic diagram of a one-dimensional display of the battery charging and discharging power based on a time series according to an embodiment of the present invention;

[0066] Figure 2It is a schematic diagram of converting the time domain of a one-dimensional variable into the frequency domain through FFT according to an embodiment of the present invention;

[0067] Figure 3 This is a system structure diagram of a control strategy for charging and discharging household photovoltaic storage batteries according to an embodiment of the present invention;

[0068] Figure 4 It is a flow chart of a method for implementing a control strategy for charging and discharging a household photovoltaic storage battery as described in an embodiment of the present invention. DETAILED DESCRIPTION

[0069] In order to better understand the present invention, the technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0070] Example 1

[0071] The execution of the battery's charging and discharging strategy is directly reflected in the battery's charging and discharging power and execution time. The timing data of the battery's charging and discharging power is the result of the superposition of multiple processes and has an inherent multi-cycle attribute. The influencing factors include: photovoltaic power generation, user electricity consumption behavior, peak and valley electricity price packages, energy storage installed capacity, user preferences, weather, etc.

[0072] The timing changes of the battery's charge and discharge power at each time point are not only related to the adjacent moments, but also highly correlated with the adjacent cycles, that is, they present two timing changes: intraperiod and interperiod.

[0073] like Figure 1 As shown in the figure, the battery's charge and discharge power is periodic, with the upper horizontal axis representing discharge and the lower horizontal axis representing charge. The intra-cycle change corresponds to the short-term process within a cycle, while the inter-cycle change can reflect the long-term trend between consecutive cycles. FFT is used to convert the one-dimensional battery power change curve based on the time series into multiple two-dimensional change curves with different frequencies and cycles; then the CNN convolutional neural network is used to extract the intra-cycle and inter-cycle features of each frequency, and finally the prediction results are output.

[0074] The present invention aims to convert a one-dimensional battery power change curve graph based on time series with the coordinated influence of multiple variables into multiple two-dimensional change curves of different frequencies and periods through FFT, extract the intra-cycle and inter-cycle features of each frequency through CNN, predict the control strategy of battery charging and discharging, realize automatic control of battery charging and discharging and maximize the benefits for users.

[0075] Among them, the technical terms involved include: FFT: Fast Fourier Transform, the full name is Fast Fourier Transform, the time complexity is O(NlogN); the performance is better than DFT discrete Fourier transform O(N2); SOC: State Of Charge, refers to the current power of the battery, ranging from 0 to 100%; CNN: Convolutional Neural Network.

[0076] First, if Figure 4 As shown, the present invention provides a method for implementing a control strategy for charging and discharging a household photovoltaic storage battery, the method comprising the following steps:

[0077] S1 defines the fields of each row of the training data set, namely: (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather identification, user preference, battery charge and discharge power) are respectively expressed as (V0, V1, V2...V13), where V0 represents the time feature, V1~V12 represents the input feature vector, V13 represents the output label data, and the time series interval t between two adjacent rows of data is set; and the training data set is preprocessed to obtain the input data;

[0078] S2 performs feature linearization, position information and time feature embedding processing on the input data to obtain the final input data Input;

[0079] S3 performs fast Fourier transform on the input data to convert the one-dimensional battery power change into two-dimensional variable data;

[0080] S4 builds a CNN model based on Inception BlockV1, extracts and aggregates features of the two-dimensional variable data obtained in step S3, and obtains the final output data Output;

[0081] The model is trained repeatedly until the loss function is within the expected range, and the model structure and parameters are saved, and then the implementation data is predicted to obtain the corresponding prediction results.

[0082] Furthermore, in this embodiment:

[0083] In step S1, the training data set is preprocessed, including:

[0084] S11 defines the length of the time series seq_len, that is, each seq_len row of the training data set is recorded as the input data of a sample;

[0085] S12 sets the label length label_len, which represents the time series length label_len*t that the model needs to predict, that is, the label_len rows in the training data set that follow are recorded as label data of a sample;

[0086] S13 defines the prediction length predict_len, which means that the model needs to predict the battery charging and discharging power value of predict_len*t in the future, so as to determine the number of data rows required for a single training data;

[0087] S14 performs text vectorization and standardization on the V1 to V13 sequence feature data of the training data in each sample so that the mean of the data is 0 and the standard deviation is 1, thereby obtaining the input data IP.

[0088] In this embodiment, step S2 specifically includes:

[0089] S21 defines the training batch, subtracts the local mean from each batch of data IP and divides it by the local standard deviation to ensure that the normalized data has steady-state characteristics;

[0090] S22 defines the model dimension d_model, linearly transforms the input data IP input features into the d_model dimension, and then obtains Input1;

[0091] S23 performs PositionalEmbedding processing on the input feature position information to obtain Input2;

[0092] S24 performs TemporalEmbedding on the temporal feature V0, extracts the year, month, week, hour, and minute information from the temporal feature, performs embedding processing on them respectively, and linearly converts them into Input3 of the d_model dimension;

[0093] S25 integrates the input feature data, position information and time feature vector to obtain the final input data Input=Input1+Input2+Input3; in order to prevent overfitting, the specific value of dropout is taken and applied to Input=dropout(Input).

[0094] In this embodiment, step S3 specifically includes:

[0095] S31 performs fast Fourier transform on the final input data Input, takes the frequencies f with the largest amplitudes A of the first K, and calculates the corresponding period period_list and weight period_weight through the frequency f;

[0096] S32 defines {f1,...,f K}=arg before K, according to the fast Fourier transform conjugation property, we get the frequencies f1,...,f K The range is between [1,T / 2]; the period T is the time series length T in the final input data Input, i∈[1,K];

[0097] Therefore, period_list contains the topK period values ​​P i , the period_weight dimension is expressed as: [B, topK].

[0098] In this embodiment, step S4 specifically includes:

[0099] S41 uses convolution kernels of different sizes to extract features from Out(i), aggregates the results of feature extraction, and obtains the updated dimension of Out(i), Out(i) dimension = [B, C', Num(i), p i ];

[0100] S42 Out(i) dimension = [B, C', Num(i), p i ] is restored to [B,C,T], and then switched to [B,T,C], the first K Out(i) form res:[B,T,C,K];

[0101] S43 aggregates the first K outputs Out(i) and period_weight after feature extraction from the CNN model, and uses residual connection to improve the difference between network learning input and output to prevent gradient disappearance;

[0102] S44 repeats steps S31-S33, S41-S43 several times to obtain the final output result Output: [B, T, C].

[0103] Example 2

[0104] In this embodiment, based on Embodiment 1, step S2 further includes:

[0105] Through linear transformation, the time series seq_len dimension of the final input data Input is mapped to the (seq_len+predict_len) space. The dimension of the final input data Input is represented by [B, T, C], where B represents batch, T represents the time series length Time=seq_len+predict_len, and C represents the feature dimension d_model.

[0106] Example 3

[0107] Based on Example 1, step S3 further includes:

[0108] S33 to (f i ,p i ), reshape the time series length T of the final input data Input into a two-dimensional variable Out(i) of Num(i) periods, that is:

[0109]

[0110] Out(i) dimension = [B, C, Num(i), p i ].

[0111] Example 4

[0112] Based on Example 1, step S41 includes:

[0113] S411 uses convolution kernels of different sizes to perform feature extraction on Out(i), and after aggregating the results of feature extraction, the dimension of Out(i) is obtained. The convolution kernels are selected as kernel=1*1, kernel=3*3, kernel=5*5, kernel=7*7, and kernel=9*9 respectively;

[0114] S412 uses the GELU activation function on Out(i) to extract nonlinear features;

[0115] S413 uses convolution kernels of different sizes to perform feature extraction on Out(i) again, and aggregates the results of the second feature extraction to obtain the corresponding Out(i) dimension. The convolution kernels are selected as kernel=1*1, kernel=3*3, kernel=5*5, kernel=7*7, and kernel=9*9 respectively.

[0116] Example 5

[0117] Based on Example 1, the following steps are further included between steps S4 and S5:

[0118] S45 converts Output to the original model dimension Output through linearization transformation;

[0119] S46 uses the denormalization of non-steady-state data to convert the original model dimension Output into the original unit, improving the practical applicability of the model;

[0120] S47 intercepts the model result of the last predict_len length of the T time series in Output:[B,T,C], so the Output dimension becomes: [B,predict_len,C];

[0121] S48 extracts the last column V13 in the feature dimension C of the model Output, which is the model test result of the battery charging and discharging power. The Output dimension is [B, predict_len, 1];

[0122] S49 uses the MSELoss mean square error loss function to calculate the model test results and the label value loss = MSELoss (Output, batch_y); where batch_y is the label value;

[0123] S410 uses the Adam gradient descent method to back-propagate and update model parameters.

[0124] Example 6

[0125] like Figure 3 As shown in the figure, the battery power change curve for household use has the characteristics of periodicity. FFT (Fast Fourier Transform) is used to convert the one-dimensional change of battery power in the time domain into a frequency domain diagram to obtain the change curves with different frequencies and periods.

[0126] Then CNN is used to capture the intra-cycle and inter-cycle features of each frequency for prediction.

[0127] The core idea of ​​the present invention is to embed and vectorize the multivariate synergistic factors (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather identification, user preference, battery charging and discharging power) that affect the battery charging and discharging strategy as the input feature vector of the FFT+CNN model based on time series. First, the one-dimensional battery power change is converted into a two-dimensional variable through FFT fast Fourier transform; then the two-dimensional variable characteristics within and between cycles of each frequency are captured respectively through CNN, and finally prediction is performed to output the prediction result.

[0128] Based on this, the present invention also provides a control strategy implementation system for charging and discharging household photovoltaic storage batteries, the system comprising:

[0129] The data set definition module is used to define the fields of each row of the training data set, namely: (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather identification, user preference, battery charge and discharge power) are respectively expressed as (V0, V1, V2...V13), where V0 represents the time feature, V1~V12 represents the input feature vector, V13 represents the output label data, and the time series interval t between two adjacent rows of data is set; and the training data set is preprocessed to obtain the input data;

[0130] The preprocessing module is used to perform feature linearization, position information and time feature embedding processing on the input data to obtain the final input data Input;

[0131] Dimension conversion module, used to perform fast Fourier transform on input data, converting one-dimensional battery power changes into two-dimensional variable data;

[0132] The training module is used to build a CNN model based on Inception BlockV1, extract features and aggregate the obtained two-dimensional variable data to obtain the final output data Output;

[0133] Repeat the training until the loss function is within the expected range, save the model structure and parameters, and then obtain the final prediction result.

[0134] The application module is used to adjust the control strategy of the user's solar storage battery charging and discharging to realize the system's intelligent prediction of battery charging and discharging.

[0135] In order to illustrate the effectiveness of the method and system described in the present invention, the applicant provides a specific embodiment, including:

[0136] Data processing:

[0137] (1) Define the fields of each row of the training data set (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather mark, user preference, battery charge and discharge power) as V0, V1, V2...V13 respectively; where V0 represents the time feature, V1~V12 represents the input feature vector, and V13 represents the output label data; the time series interval between two adjacent rows of data is 5 minutes; each row of data represents the observation value at one time step (5 minutes).

[0138] (2) Define the time series length seq_len = 1152, which represents the number of time steps in each sample, that is, 1152*5 minutes = 4 days. The training data in this time window is used as the training input of a single sample, that is, every 1152 rows of records in the training data set are used as the input data of a sample;

[0139] The label length label_len = 12, which means that the time series length that the model needs to predict is 12*5 minutes, that is, the next 12 rows of records in the training data set are used as label data for one sample;

[0140] The prediction length predict_len=12 means that the model needs to predict the battery charging and discharging power values ​​for the next 12*5 minutes.

[0141] Therefore, the number of data rows required for a single training sample is 1152+12=1164;

[0142] The V1 to V13 sequence feature data of the training data in each sample are text vectorized and standardized so that the mean of the data is 0 and the standard deviation is 1, thereby obtaining the input data Input.

[0143] (3) Define the training batch Batch = 32, subtract the local mean from each batch of data and divide it by the local standard deviation to ensure that the normalized data has steady-state characteristics. Use the normalization method for non-steady-state data to better suit model training and help improve the stability and convergence speed of model training:

[0144] Input = [IP-mean(IP)] / std(IP)

[0145] Where, mean(IP) represents the local mean of the input data IP, and std(IP) represents the local standard deviation of the input data IP;

[0146] (4) Define the model dimension d_model = 512, linearize the Input input features into the d_model dimension, and obtain Input1;

[0147] Input1:[32,seq_len,13]->[32,seq_len,512]

[0148] (5) Perform PositionalEmbedding processing on the input feature position information to obtain Input2:

[0149] Even position: PE(position,2i)=sin(position*exp(-log10000 / d_model*2i))

[0150] Odd position: PE(position,2i+1)=cos(position*exp(-log10000 / d_model*2i))

[0151] Input2:[32,seq_len,512].

[0152] (6) TemporalEmbedding is used to embed the time feature V0, extract the year, month, week, hour, and minute information in the time feature, embed them separately, and linearly convert them into the d_model dimension;

[0153] Input3:[32,5,512]->[32,seq_len,512]

[0154] (7) Integrate the input feature data, location information and time feature vector to obtain Input = Input1 + Input2 + Input3; To prevent overfitting, set dropout = 0.1 and apply it to Input = dropout(Input);

[0155] (8) Through linear transformation, the input time series seq_len dimension is mapped to the (seq_len+predict_len) space;

[0156] Input:[32,(seq_len+predict_len),512].

[0157] The dimension of the input data is represented by [B, T, C], where B represents batch = 32, T represents the time series length Time = seq_len + predict_len, and C represents the feature dimension C = 512.

[0158] FFT and CNN (Inception BlockV1) processing:

[0159] (9) Perform FFT on the input data, define topK=10, take the topK frequencies f with the largest amplitude A, and calculate the corresponding period period_list and weight period_weight through frequency f.

[0160] A=average(AMP(FFT(Input)));

[0161] AMP stands for amplitude, which means amplitude. Here, the amplitude value is taken. FFT converts the time domain into the frequency domain, and obtains the changes of N multiple different frequencies to form the spectrum. Only the top K frequencies with the largest amplitude have a greater impact on the one-dimensional time domain change.

[0162] {f1,...fk}=argTopK, according to the conjugation property of FFT transformation, the range of frequencies f1,...fk can be obtained between [1,T / 2];

[0163] cycle The T here is the time series dimension T in the Input.

[0164] period_list contains topK period values;

[0165] period_weight dimension: [B, topK].

[0166] The input feature vector of the FFT contains:

[0167] Time: Format: yyyy-MM-ddHH:mm:ss, the interval between two adjacent data is 5 minutes;

[0168] Battery installed capacity: unit: kWh;

[0169] SOC: current battery power, 0-100%. If the user installs multiple batteries, the weighted average is used to calculate the SOC.

[0170] Electricity price level: 0 means On-peek, 1 means Mid-peek, and 2 means Off-peek;

[0171] Electricity price: 27.693 (On-peek), 21.031 (Mid-peek), 5.160 (Off-peek), in cents, refers to the price of the power grid package during the current statistical period;

[0172] Photovoltaic power generation: unit: Wh;

[0173] The amount of electricity charged by photovoltaic power to the battery: unit: Wh;

[0174] Photovoltaic grid-connected power: unit: Wh;

[0175] Load power consumption: unit: Wh;

[0176] The load power consumption comes from the battery: unit: Wh;

[0177] The load power consumption comes from the grid: unit: Wh;

[0178] Extreme weather indicator: whether there will be extreme weather within 48 hours, 0-no, 1-yes;

[0179] User preferences: 0-minimize grid dependence; 1-minimize electricity bills;

[0180] Battery charge and discharge power: unit: W, greater than 0 indicates discharge, equal to 0 indicates standby, and less than 0 indicates charge; the battery charge and discharge power is the final predicted output result.

[0181] like Figure 2 As shown in the figure, the time domain of a one-dimensional variable is transformed into the frequency domain through FFT, the topK frequencies with the largest amplitude are taken, each frequency segment is converted into a two-dimensional variable model through Reshape, and then CNN captures the features within and between cycles.

[0182] (10) Reshap dimension change operation:

[0183] For the topK pairs (fi,pi) in the previous step, reshape the dimension T in Input into a two-dimensional variable Out(i) with Num(i) periods equal to pi:

[0184]

[0185] Out(i) dimension = [B, C, Num(i), pi] = [32, 512, Num(i), pi], where i = 1, 2, ..., K.

[0186] In the present invention, CNN uses the Inception V1 network model which has sparseness, small resource occupation and high computing performance.

[0187] (11) Build a CNN model based on Inception BlockV1:

[0188] Use convolution kernels to extract features from Out(i)

[0189] Convolution kernel size kernel = 1*1, padding = 0, stride = 1; number of convolution kernels out_channels = 1024;

[0190] Convolution kernel size kernel = 3*3, padding = 1, stride = 1; number of convolution kernels out_channels = 1024;

[0191] Convolution kernel size kernel = 5*5, padding = 2, stride = 1; number of convolution kernels out_channels = 1024;

[0192] Convolution kernel size kernel = 7*7, padding = 3, stride = 1; number of convolution kernels out_channels = 1024;

[0193] Convolution kernel size kernel = 9*9, padding = 4, stride = 1; number of convolution kernels out_channels = 1024;

[0194] Aggregate the above results and get Out(i) dimension = [32, 1024, Num(i), pi];

[0195] Use the GELU activation function for Out(i) to extract nonlinear features, and then use the following convolution kernels to extract features for Out(i), including:

[0196] Convolution kernel size kernel = 1*1, padding = 0, stride = 1; number of convolution kernels out_channels = d_model = 512;

[0197] Convolution kernel size kernel = 3*3, padding = 1, stride = 1; number of convolution kernels out_channels = d_model = 512;

[0198] Convolution kernel size kernel = 5*5, padding = 2, stride = 1; number of convolution kernels out_channels = d_model = 512;

[0199] Convolution kernel size kernel = 7*7, padding = 3, stride = 1; number of convolution kernels out_channels = d_model = 512;

[0200] The convolution kernel size is kernel=9*9, padding=4, and strike=1. The number of convolution kernels is out_channels=d_model=512.

[0201] Aggregate the above results and get Out(i) dimension = [32,512,Num(i),pi];

[0202] (12) Reshape back restore dimension operation:

[0203] Restore Out(i) dimension = [B, C, Num(i), pi] = [32, 512, Num(i), pi] to: [B, C, T], then switch the position to: [B, T, C]

[0204] The topK Out(i) form res:[B,T,C,topK]

[0205] (13) Adaptive aggregation: aggregate the topK outputs Out(i) after CNN feature extraction and period_weight;

[0206] Normalize period_weight using softmax function:softmax(period_weight);

[0207] Transform period_weight dimension to: [B, topK]->[B, T, C, topK];

[0208] Weighted sum of res and period_weight: res = res*period_weight; the dimension of res becomes [B, T, C];

[0209] (14) Use residual connections to improve the difference between network learning input and output and prevent gradient disappearance;

[0210] (15)res=res+Input; In order to increase the depth and complexity of the model, improve the model's ability to model the input sequence, and learn richer context information, repeat steps 9 to 14 Nx=4 times to obtain Output: [B, T, C]

[0211] (16) Echoing step 4, the Output is converted to the original model dimension Output through linear transformation: [B, T, 512] -> [B, T, 13]. In step (4), in order to improve the model feature extraction and expression capabilities, a dimensionality increase operation is performed, that is, [B, T, 13] is upgraded to [B, T, 512]. However, the current step needs to downgrade [B, T, 512] to the actual dimension of the training data [B, T, 13] to facilitate the subsequent extraction of prediction values.

[0212] (17) Echoing step 3, the denormalization of non-stationary data is used to convert the output into the original unit to improve the practical applicability of the model;

[0213] Among them, step (3) performs normalization processing on non-steady-state data based on time series data in order to obtain steady-state data for model training and feature extraction. The current step requires de-normalization of the trained model data and converting it into original unit data so that it can be compared with the label data on the same level.

[0214] (18) In Output:[B,T,C], the T time series is the model result of the final predict_len length, and the Output dimension becomes: [B,predict_len,C];

[0215] (19) Extract the last column V13 in the feature dimension C of the model output, which is the model test result of the battery charging and discharging power. The output dimension is [B, predict_len, 1];

[0216] (20) Using the MSELoss mean square error loss function, calculate the model test results and the label value loss = MSELoss (Output, batch_y); where batch_y is the label value;

[0217] (21) Use the Adam gradient descent method to back propagate and update the model parameters; repeat the above steps until the loss is within the expected range, and save the model structure and parameters. Here, repeating the above steps refers to all of them, that is, from (1) to (21), one batch of Batch = 32 samples is trained and the model parameters are updated once; then continue to train the next batch of data until the loss is within the expected range.

[0218] It can be seen from the above experiments that the present invention realizes the intelligent prediction of battery charging and discharging strategy control with high prediction accuracy, and the present invention meets the charging and discharging control needs of users in various scenarios, thereby maximizing user benefits.

[0219] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0220] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present invention without departing from the spirit and scope of the embodiments of the present invention. Thus, if these modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for implementing a control strategy for charging and discharging a household photovoltaic storage battery, characterized in that: The method comprises the following steps: S1 defines the fields of each row of the training data set, namely: (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather identification, user preference, battery charge and discharge power) are respectively expressed as (V0, V1, V2...V13), where V0 represents the time feature, V1~V12 represents the input feature vector, V13 represents the output label data, and the time series interval t between two adjacent rows of data is set; and the training data set is preprocessed to obtain the input data; S2 performs feature linearization, position information and time feature embedding processing on the input data to obtain the final input data Input; S3 performs fast Fourier transform on the input data to convert the one-dimensional battery power change into two-dimensional variable data; S4 builds a CNN model based on Inception BlockV1, extracts and aggregates features of the two-dimensional variable data obtained in step S3, and obtains the final output data Output; S5 repeats the training until the loss function is within the expected range and saves the model structure and parameters.

2. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 1, characterized in that: In step S1, the training data set is preprocessed, including: S11 defines the length of the time series seq_len, that is, each seq_len row of the training data set is recorded as the input data of a sample; S12 sets the label length label_len, which represents the time series length label_len*t that the model needs to predict, that is, the label_len rows in the training data set that follow are recorded as label data of a sample; S13 defines the prediction length predict_len, which means that the model needs to predict the battery charging and discharging power value of predict_len*t in the future, so as to determine the number of data rows required for a single training data; S14 performs text vectorization and standardization on the V1 to V13 sequence feature data of the training data in each sample so that the mean of the data is 0 and the standard deviation is 1, thereby obtaining the input data IP.

3. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 2, characterized in that: The step S2 specifically includes: S21 defines the training batch, subtracts the local mean from each batch of data IP and divides it by the local standard deviation to ensure that the normalized data has steady-state characteristics; S22 defines the model dimension d_model, linearly transforms the input data IP input features into the d_model dimension, and then obtains Input1; S23 performs PositionalEmbedding processing on the input feature position information to obtain Input2; S24 performs TemporalEmbedding on the temporal feature V0, extracts the year, month, week, hour, and minute information from the temporal feature, performs embedding processing on them respectively, and linearly converts them into Input3 of the d_model dimension; S25 integrates the input feature data, position information and time feature vector to obtain the final input data Input=Input1+Input2+Input3; in order to prevent overfitting, the specific value of dropout is taken and applied to Input=dropout(Input).

4. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 3 is characterized in that: The step S2 further comprises: Through linear transformation, the time series seq_len dimension of the final input data Input is mapped to the (seq_len+predict_len) space. The dimension of the final input data Input is represented by [B, T, C], where B represents batch, T represents the time series length Time=seq_len+predict_len, and C represents the feature dimension d_model.

5. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 1 or 4, characterized in that: The step S3 specifically includes: S31 performs fast Fourier transform on the final input data Input, takes the frequencies f with the largest amplitudes A of the first K, and calculates the corresponding period period_list and weight period_weight through the frequency f; S32 defines {f1,...,f K }=arg before K, according to the fast Fourier transform conjugation property, we get the frequencies f1,...,f K The range is between [1,T / 2]; the period T is the length of the time series in the final input data Input, i∈[1,K]; Therefore, period_list contains the topK period values ​​P i , the period_weight dimension is expressed as: [B, topK].

6. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 5, characterized in that: The step S3 further comprises: S33 to (f i ,p i ), reshape the time series length T of the final input data Input into a two-dimensional variable Out(i) of Num(i) periods, that is: Out(i) dimension = [B, C, Num(i), p i ].

7. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 6, characterized in that: The step S4 specifically includes: S41 uses convolution kernels of different sizes to extract features from Out(i), aggregates the results of feature extraction, and obtains the updated dimension of Out(i), Out(i) dimension = [B, C', Num(i), p i ]; S42 Out(i) dimension = [B, C', Num(i), p i ] is restored to [B,C,T], and then switched to [B,T,C], the first K Out(i) form res:[B,T,C,K]; S43 aggregates the first K outputs Out(i) and period_weight after feature extraction from the CNN model, and uses residual connection to improve the difference between network learning input and output to prevent gradient disappearance; S44 repeats steps S31-S33, S41-S43 several times to obtain the final output result Output: [B, T, C].

8. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 7, characterized in that: The step S41 comprises: S411 uses convolution kernels of different sizes to perform feature extraction on Out(i), and after aggregating the results of feature extraction, the dimension of Out(i) is obtained. The convolution kernels are selected as kernel=1*1, kernel=3*3, kernel=5*5, kernel=7*7, and kernel=9*9 respectively; S412 uses the GELU activation function on Out(i) to extract nonlinear features; S413 uses convolution kernels of different sizes to perform feature extraction on Out(i) again, and aggregates the results of the second feature extraction to obtain the corresponding Out(i) dimension. The convolution kernels are selected as kernel=1*1, kernel=3*3, kernel=5*5, kernel=7*7, and kernel=9*9 respectively.

9. The method for implementing the control strategy for charging and discharging of household photovoltaic storage batteries according to claim 7, characterized in that: Before step S5, the method further comprises the following steps: S45 converts Output to the original model dimension Output through linearization transformation; S46 uses the denormalization of non-steady-state data to convert the original model dimension Output into the original unit, improving the practical applicability of the model; S47 intercepts the model result of the last predict_len length of the T time series in Output:[B,T,C], so the Output dimension becomes: [B,predict_len,C]; S48 extracts the last column V13 in the feature dimension C of the model Output, which is the model test result of the battery charging and discharging power. The Output dimension is [B, predict_len, 1]; S49 uses the MSELoss mean square error loss function to calculate the model test results and the label value loss = MSELoss (Output, batch_y); where batch_y is the label value; S410 uses the Adam gradient descent method to back-propagate and update model parameters.

10. A control strategy implementation system for household photovoltaic battery charging and discharging, characterized in that: The system includes: The data set definition module is used to define the fields of each row of the training data set, namely: (time, battery installed capacity, SOC, electricity price level, electricity price, photovoltaic power generation, photovoltaic to battery power, photovoltaic grid-connected power, load power consumption, load power consumption from battery, load power consumption from grid, extreme weather identification, user preference, battery charge and discharge power) are respectively expressed as (V0, V1, V2...V13), where V0 represents the time feature, V1~V12 represents the input feature vector, V13 represents the output label data, and the time series interval t between two adjacent rows of data is set; and the training data set is preprocessed to obtain the input data; The preprocessing module is used to perform feature linearization, position information and time feature embedding processing on the input data to obtain the final input data Input; Dimension conversion module, used to perform fast Fourier transform on input data, converting one-dimensional battery power changes into two-dimensional variable data; The training module is used to build a CNN model based on Inception BlockV1, extract features and aggregate the obtained two-dimensional variable data to obtain the final output data Output; Repeat the training until the loss function is within the expected range, and save the model structure and parameters.

Citation Information

Cited By

  • Omnibearing safety protection method and system for energy storage battery of base station

    CN118801544A

  • A comprehensive safety protection method and system for base station energy storage batteries

    CN118801544B