当前位置:网站首页>Matlab| short term load forecasting of power system based on BP neural network

Matlab| short term load forecasting of power system based on BP neural network

2022-06-26 03:04:00 Power system code

Catalog

Abstract

One 、 Power load data import

Two 、 Input and output data normalization

3、 ... and 、 Establishment and training BP neural network

Four 、 Load forecasting using test data

5、 ... and 、Matlab Code display

Abstract

Use BP The neural network realizes the simple task of power load regression prediction . The main steps are : Import data 、 Data normalization 、 establish BP neural network 、 Training BP neural network 、 Use test data to predict load conditions 、 Error analysis and drawing .

One 、 Power load data import

Use Matlab Medium xlsread Function from the specified excel Extract power load data from the file , You can set the number of days to import , Set import here 5 Days of data , As shown in the figure below :

All other data :

Two 、 Input and output data normalization

Although the nerves ⽹ The transmission of each layer of the network ⼊ The signal distribution is different , But in the end “ Point to “ The sample mark of is unchanged , That is, the marginal probability is different ⽽ Conditional probability ⼀ Cause . In order to reduce the impact of distribution changes , Can make ⽤ return ⼀ Strategy Normalization, Map the data distribution to ⼀ A definite interval . nerve ⽹ Collateral , often ⽤ The return of ⼀ There are some strategies BN(Batch Normalization), WN(Weight Normalization), LN(Layer Normalization),IN(Instance Normalization).

Use here max-min Normalization method normalizes all data to 0-1 Between , The normalized data are as follows :

3、 ... and 、 Establishment and training BP neural network

BP Neural network is a kind of multilayer feedforward neural network , The error back propagation signal is added to the multilayer perceptron , To deal with nonlinear continuous functions , The network consists of an input layer 、 Hidden layer 、 Output layer structure , Its main feature is the forward transmission of signals , Error back propagation , It can be used in system model identification 、 Under prediction or control . In forward transmission , The input signal is processed layer by layer from the input layer through the hidden layer , Up to the output layer . The state of neurons in each layer only affects the state of neurons in the next layer . If the output layer doesn't get the desired output ﹐ Then turn to back propagation , Adjust the network weight and threshold according to the prediction error ﹐ So that BP The predicted output of neural network keeps approaching the expected output ﹐ Its topological structure is shown in Figure 1 Shown :


 

  This article specifies the number of input features as 1, The number of output features is 1, Set the number of neurons to 100, Set the learning rate to 0.001, Use Matlab Medium newff Function construction BP neural network , Use train Function training BP neural network :

Four 、 Load forecasting using test data

  test result :

5、 ... and 、Matlab Code display

This article shows only part of the code , The complete code is here : We are shipping your work details

clc;
clear;
close all;
%%  Import data 
month = 12;  % Training month 
day_start = 5; % Start date 
day_len = 5;  % Training days 

file_path = '2018 Load forecasting data ';
map_maxmin = [];
output = [];
%%  Data grouping and normalization 
for day = day_start:1:(day_start + day_len - 1)
    [raw_data, raw_max ,raw_min] = read_load_data_from_excel(file_path, month ,day); %  Reading data from a folder 
    %  Input and output normalization 
    data_temp =  my_map(1, raw_data, raw_max, raw_min, 1, 0); 
    map_maxmin = cat(1, map_maxmin, [0 1]);
    output = cat(1, output, data_temp);
    target_day = day + 1;
end
[target_data, target_max, target_min] = read_load_data_from_excel(file_path, month ,target_day);
t_d =  my_map(1, target_data, target_max, target_min, 1, 0);
%%  Creating networks 

原网站

版权声明
本文为[Power system code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260117427536.html