CN116777038A - Method, device and storage medium for predicting electric load of micro-grid - Google Patents

Method, device and storage medium for predicting electric load of micro-grid Download PDF

Info

Publication number
CN116777038A
CN116777038A CN202310433438.8A CN202310433438A CN116777038A CN 116777038 A CN116777038 A CN 116777038A CN 202310433438 A CN202310433438 A CN 202310433438A CN 116777038 A CN116777038 A CN 116777038A
Authority
CN
China
Prior art keywords
data
micro
grid
energy consumption
random forest
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310433438.8A
Other languages
Chinese (zh)
Inventor
王毕元
陈文彬
蔡景东
陈涛威
邓星野
陈晓健
叶梓
徐大勇
苏贤乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Power Grid Co Ltd
Huizhou Power Supply Bureau of Guangdong Power Grid Co Ltd
Original Assignee
Guangdong Power Grid Co Ltd
Huizhou Power Supply Bureau of Guangdong Power Grid Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Power Grid Co Ltd, Huizhou Power Supply Bureau of Guangdong Power Grid Co Ltd filed Critical Guangdong Power Grid Co Ltd
Priority to CN202310433438.8A priority Critical patent/CN116777038A/en
Publication of CN116777038A publication Critical patent/CN116777038A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a method, a device and a storage medium for predicting electric loads of a micro-grid. The method comprises the following steps: collecting a data set required by power load prediction of the micro-grid terminal equipment, constructing a multi-layer random forest algorithm model, and training based on a training sample set and the constructed multi-layer random forest algorithm model; and according to the electricity load data of the current time period, predicting the electricity load of the next time period of the micro-grid at the current moment to obtain an electricity load prediction result. According to the technical scheme, when the multi-layer random forest algorithm model is adopted for load prediction, the MPSO algorithm is combined, so that the prediction precision and the stable prediction performance are higher, and the reliability and the accuracy of the electric load prediction of the micro-grid are further improved.

Description

Method, device and storage medium for predicting electric load of micro-grid
Technical Field
The invention relates to the technical field of power distribution networks, in particular to a method and a device for predicting electric loads of micro-grids and a storage medium.
Background
The micro-grid is an independent system for carrying out combined control on a distributed power supply, an energy storage system and a user load through a power electronic technology, has the functions of autonomous control, protection and management, and can realize single-point grid connection on the basis of ensuring the quality of electric energy so as to meet the requirement of stable supply of electric energy.
The distributed power supply is easily affected by regions and natural factors, so that the output power can be greatly fluctuated, the instability of a micro-grid system is greatly increased, and the problems of safety accidents and the like can be caused while the waste of micro-grid energy sources is caused. The short-term electricity load of the micro-grid is accurately predicted, so that the phenomena can be effectively relieved, the stable operation of the micro-grid system is ensured, the energy consumption is effectively monitored, and the purpose of energy management and scheduling is achieved.
The conventional micro-grid system short-term electricity load prediction method is generally divided into two types, namely a traditional prediction method and an intelligent prediction method, the traditional prediction method is mainly used for predicting through the relativity and the time sequence of data, the principle is simple and easy to realize, the intelligent prediction method has strong analysis processing capacity on the data and a model, and the load prediction precision can be improved, but the micro-grid system electricity load prediction method only uses a single prediction method or a single intelligent algorithm for prediction, and has limitation and lower prediction precision.
Disclosure of Invention
The invention provides a method, a device and a storage medium for predicting the electric load of a micro-grid, which can effectively improve the reliability and the accuracy of the electric load prediction and energy utilization control of the micro-grid.
According to an aspect of the present invention, there is provided a method for predicting an electrical load of a micro grid, including:
collecting a data set required by power load prediction of micro-grid terminal equipment; the electricity load prediction data set comprises historical electricity load data and characteristic data; the characteristic data comprise time data and climate data;
constructing a multi-layer random forest algorithm model, training based on a training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the period next to the current moment of the micro-grid according to the power consumption load data of the period at the current moment to obtain a power consumption load prediction result; the training sample set is obtained by carrying out data processing on the data required by the electricity load prediction; and when the multi-layer random forest algorithm model is trained, optimizing and training parameters of the multi-layer random forest algorithm model according to the MPSO algorithm to obtain an optimal decision tree and an optimal branch feature number.
Optionally, after the multi-layer random forest algorithm model is built, training is performed based on the training sample set and the built multi-layer random forest algorithm model, and the electricity load of the period next to the current time of the micro-grid is predicted according to the electricity load data of the period at the current time to obtain an electricity load prediction result, the method further includes:
And determining the energy consumption prediction data of the micro-grid according to the electricity load prediction result, and controlling the energy consumption of the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid.
Optionally, the constructing a multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the period next to the current time of the micro-grid according to the power consumption load data of the period at the current time to obtain a power consumption load prediction result, including:
performing data processing on the data set required by the electricity load prediction to obtain an initial training sample set;
constructing a first layer random forest model, selecting an initial training sample from the initial training sample set, inputting the initial training sample into the first layer random forest model for training, outputting a first electric load prediction result and obtaining a first training residual error;
constructing a second layer random forest model, substituting the first training residual error into the initial sample set to form a new feature set, inputting the new feature set into the second layer random forest model for training, outputting a second power load prediction result and obtaining a second training residual error;
Constructing a third layer random forest model, substituting the second training residual error into the initial sample set to form a new feature set, inputting the new feature set into the third layer random forest model for training, outputting a third electric load prediction result and obtaining a third training residual error;
determining the electricity load prediction result according to a superposition result obtained after the first electricity load prediction result, the second electricity load prediction result and the third electricity load prediction result are sequentially superposed;
when the random forest models of all layers are built and model training is carried out, the method comprises the following steps:
and carrying out parameter optimization training on a random forest model by adopting the MPSO algorithm, wherein the parameters comprise decision tree numbers and split feature numbers, the decision tree numbers and the split feature numbers correspond to particle attributes in the MPSO algorithm, the out-of-bag errors obtained by training the random forest model are used as fitness values, and variation disturbance items are added in an iterative process to optimize model parameters, so that optimal decision tree numbers and optimal split feature numbers are obtained.
Optionally, the parameter optimization training is performed on the random forest model by adopting the MPSO algorithm, the parameters include decision tree numbers and splitting feature numbers, the decision tree numbers and the splitting feature numbers are corresponding to particle attributes in the MPSO algorithm, the out-of-bag errors obtained by training the random forest model are used as fitness values, variation disturbance items are added in an iterative process to optimize model parameters, and the optimal decision tree numbers and the optimal splitting feature numbers are obtained, including:
Corresponding random forest model parameters and particle swarm attributes, initializing related parameters, and setting initial values and ranges of the strategy tree number and the splitting characteristic number;
substituting the decision tree number and the branch feature number into the random forest model;
taking the data error outside the bag obtained by training the random forest model as a fitness function to control the particle fitness value;
judging whether the particle fitness value is optimal or not under the current iteration times;
if yes, obtaining optimal particles, carrying out mutation treatment on the particles, adding a mutation disturbance item, and storing the speed and direction values of the particles;
if not, updating the particle speed and the position, and returning to the step of substituting the decision tree number and the branch characteristic number into the random forest model and the subsequent steps.
After the mutation treatment is carried out on the particles, a mutation disturbance item is added, and the particle speed and direction value are stored, whether the maximum iteration times are reached is judged;
if yes, outputting the optimal decision tree number and the optimal branch characteristic number;
if not, updating the particle speed and the position, and executing the step of substituting the decision tree number and the grouping feature number into the random forest model and the subsequent steps.
Optionally, determining the micro-grid energy consumption prediction data according to the electricity load prediction result, and performing energy consumption control on the micro-grid according to the micro-grid electricity consumption prediction data and micro-grid electricity consumption actual data, where the method includes:
taking the ratio of the electric energy consumption prediction data for the micro-grid to the actual electric energy consumption data for the micro-grid as a first energy consumption ratio of the micro-grid;
and determining the energy consumption condition of the micro-grid according to the first energy consumption ratio of the micro-grid and a preset energy consumption ratio threshold, and controlling the energy consumption of the micro-grid according to the energy consumption condition of the micro-grid.
Optionally, the determining the energy consumption prediction data of the micro-grid according to the electricity load prediction result, and controlling the energy consumption of the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid, further includes:
the electricity consumption quota of each sub-item of the micro-grid is calculated to obtain an electricity consumption quota value;
acquiring a second energy consumption ratio of the micro-grid according to the micro-grid power consumption prediction data and the power consumption quota value;
and controlling the electric energy consumption of the micro-grid according to the second energy consumption ratio of the micro-grid.
According to another aspect of the present invention, there is provided an electrical load prediction apparatus for a micro grid, including:
the data acquisition unit and the model building unit;
the data acquisition unit is used for acquiring a data set required by power load prediction of the micro-grid terminal equipment; the electricity load prediction data set comprises historical electricity load data and characteristic data; the characteristic data comprise time data and climate data;
the construction model unit is used for constructing a multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the period next to the current time of the micro-grid according to the power consumption load data of the period at the current time to obtain a power consumption load prediction result.
Optionally, the micro-grid electricity load prediction device further includes: an energy consumption control unit; the energy consumption control unit is used for determining the energy consumption prediction data of the micro-grid according to the electricity load prediction result, and controlling the energy consumption of the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid.
Optionally, the micro-grid electricity load prediction device further includes: a data storage unit and a data output unit;
The data storage unit is used for storing a data set required by electricity load prediction acquired by the data acquisition unit from the terminal, a training data set preprocessed by the model building unit and load prediction data of the multi-layer random forest algorithm model, the micro-grid electricity consumption prediction data calculated by the energy control unit, a first energy consumption ratio, a micro-grid system energy consumption quota value and second energy consumption ratio information;
the data output unit is used for outputting a data set required by electricity load prediction acquired by the data acquisition unit from the terminal, the training data set preprocessed by the model building unit and load prediction data of the multi-layer random forest algorithm model, the micro-grid electricity consumption prediction data calculated by the energy control unit, a first energy consumption ratio, a micro-grid system energy consumption quota value and second energy consumption ratio information.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the method for predicting electrical loads for a micro grid according to any embodiment of the present invention when executed.
According to the technical scheme, a multi-layer random forest algorithm model is constructed by collecting a data set required by the electricity load prediction of the micro-grid terminal equipment, training is carried out based on the training sample set and the constructed multi-layer random forest algorithm model, and the electricity load of the next period of the micro-grid at the current moment is predicted according to the electricity load data of the current period to obtain an electricity load prediction result. According to the technical scheme, when the multi-layer random forest algorithm model is adopted for load prediction, the MPSO algorithm is combined, so that the prediction precision and the stable prediction performance are higher, and the reliability and the accuracy of the electric load prediction of the micro-grid are further improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to an embodiment of the present invention.
Fig. 2 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to a second embodiment of the present invention.
Fig. 3 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to a third embodiment of the present invention.
Fig. 4 is a flowchart of a method for optimizing random forest model parameters based on a MPSO algorithm according to a fourth embodiment of the invention.
Fig. 5 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to a fifth embodiment of the present invention.
Fig. 6 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to a sixth embodiment of the present invention.
Fig. 7 is a schematic structural diagram of an electrical load prediction device for a micro-grid according to a seventh embodiment of the present invention.
Fig. 8 is a schematic structural diagram of an electronic device for electric load prediction of a micro-grid according to an eighth embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to an embodiment of the present invention, where the embodiment is applicable to a situation where the electrical load prediction accuracy of a micro-grid system is low, and the method may be executed by a device for predicting an electrical load of a micro-grid.
As shown in fig. 1, the method includes:
s110, collecting a data set required by electricity load prediction of the micro-grid terminal equipment.
The power utilization load prediction data set comprises historical power utilization load data and characteristic data; the characteristic data comprise time data and climate data;
specifically, a data set required by electricity load prediction is acquired from the micro-grid electricity consumption terminal equipment, and the data set required by electricity load prediction is preprocessed, wherein the preprocessing comprises data cleaning and conversion, feature analysis and selection. Firstly, data cleaning is carried out on an acquired load data set, data consistency is detected, invalid values and missing values in the data set are processed, the invalid values can be processed by adopting methods of estimation, whole row deletion, variable deletion, paired deletion and the like, the consistency detection is carried out on data with certain deviation, whether the deviation value exceeds the normal range of the data set is judged according to the reasonable value range and the correlation of the data, and then the processing is carried out; for the missing values, including directly missing data and incomplete data, the directly missing data can be processed by adopting methods of deleting data, automatic filling, manual filling and the like, the incomplete data is mainly some information which should be missing, and the data is filtered out and the data information is complemented. Secondly, due to different data types, the collected data is normalized, the data of different types need to be converted, and the converted data is favorable for algorithm analysis. The data types include integer types, floating point types, character types and the like, non-numerical values in the data types are subjected to type conversion, the non-numerical values are uniformly converted into numerical values, and the data of the same type are beneficial to subsequent intelligent algorithm operation. When the data is converted, the low-precision data type can be converted into the high-precision data type due to different data precision, the same high-precision data can be converted into the low-precision data, the lost data is processed, and the converted data is normalized, so that the same data can be compared and analyzed among different characteristics. And thirdly, carrying out characteristic analysis on the terminal acquired data, wherein the data set contains a plurality of characteristic attributes, but some characteristic attributes are irrelevant to load prediction, and the analysis of the characteristic attributes has strong correlation with the electric load data attributes of the micro-grid, thereby being beneficial to carrying out electric load prediction. Finally, characteristic selection is carried out on the terminal collected data, the climate and the date are one of important factors influencing the electric load of the micro-grid system, data with strong correlation with the electric load data attribute of the micro-grid are selected in the collected data set, the characteristic data comprise rainfall, temperature, humidity, wind speed, illumination, air pressure, month date, week number and the like, and the characteristic selection of the data set can be carried out by adopting a filtering method, an information gain method and the like. And processing the historical electricity load data and the climate data set, and using the data with strong characteristics for training and testing the load prediction model.
The embodiment of the invention is shown by taking the historical load data set acquired in the previous year of the micro-grid system as an example, wherein the acquired historical load data is acquired by acquiring one sample point every 15 minutes, the historical power consumption load data and the climate data set of the micro-grid are processed, the acquired data set is huge, the calculated amount of processing the data set is large, the data set is normalized firstly, and the following formula is adopted:
wherein P is the historical load input data, P' is the load input data after normalization processing, pmin is the minimum value in the historical load input data, and Pmax is the maximum value in the historical load input data.
And correcting the abnormal value of the historical electrical load data of the micro-grid by adopting spline interpolation, linear interpolation or a mean value method, filling up the missing value, and deleting the abnormal data corresponding to the historical electrical load data and the climate data.
The climate data set comprises rainfall, temperature, humidity, wind speed, wind direction, illumination, air pressure, radiation and other data, the temperature data is obtained by taking the day as a unit, the day maximum temperature, the day minimum temperature and the average temperature are normalized by adopting a formula (1), and other types of data are selected as relative values. And processing the climate data set, and correcting abnormal values of the climate data by adopting spline interpolation, linear interpolation or a mean value method to fill up missing values.
And combining the processed climate data sets by taking a day as a unit, wherein the obtained climate combined characteristic data set comprises the sum, the difference, the product and the quotient of any two characteristics, and the difference between the combined characteristic data set and the mean value and the difference between the combined characteristic data set and the median are increased to obtain the climate data characteristic complete set.
The characteristic data set also comprises time data, and the time data is important characteristic data influencing the load prediction of the micro-grid because the working days are different from holidays and load data of various seasons, the characteristic data such as month date, week number and the like are processed, and abnormal values of the time data set are corrected by adopting spline interpolation, linear interpolation or a mean value method to fill the missing values.
S120, constructing a multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the micro-grid in the next period at the current moment according to the power consumption load data of the current moment to obtain a power consumption load prediction result.
The training sample set is obtained by carrying out data processing on data required by power load prediction; and when the multi-layer random forest algorithm model is trained, optimizing and training parameters of the multi-layer random forest algorithm model according to the MPSO algorithm to obtain an optimal decision tree and an optimal branch feature number.
The method for performing data processing on the data required for power load prediction in the present embodiment includes, but is not limited to, the data preprocessing method in the present embodiment, for example, data cleaning and conversion, and feature analysis and selection.
Specifically, the multi-layer random forest algorithm model inherits the advantages of a single-layer random forest algorithm, and can deeply read sample effective information and analyze characteristic variables. The single-layer random forest algorithm model is trained to leave a training residual Y ', the training residual Y ' contains a plurality of pieces of effective information, a new training sample set Y is formed by combining the training residual Y ' with the initial training set Y, the random forest model is trained, and the obtained prediction result is more accurate by combining the multi-layer random forest model with the MPSO algorithm.
According to the technical scheme provided by the embodiment of the invention, the multi-layer random forest algorithm model is constructed by collecting the data set required by the electricity load prediction of the micro-grid terminal equipment, training is carried out based on the training sample set and the constructed multi-layer random forest algorithm model, and the electricity load of the next period of the micro-grid at the current moment is predicted according to the electricity load data of the current period to obtain an electricity load prediction result. According to the technical scheme, when the multi-layer random forest algorithm model is adopted for load prediction, the MPSO algorithm is combined, so that the prediction precision and the stable prediction performance are higher, and the reliability and the accuracy of the electric load prediction of the micro-grid are further improved.
Example two
Fig. 2 is a schematic flow chart of a method for predicting an electrical load of a micro grid according to a second embodiment of the present invention, where the foregoing embodiment is further refined based on the foregoing embodiment. As shown in fig. 2, the method includes:
s210, collecting a data set required by electricity load prediction of the micro-grid terminal equipment.
S220, constructing a multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the micro-grid in the next period at the current moment according to the power consumption load data of the current moment to obtain a power consumption load prediction result.
And S230, determining the energy consumption prediction data of the micro-grid according to the electricity load prediction result, and controlling the energy consumption of the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid.
Specifically, the electric energy consumption data of the micro-grid obtained through the electric load prediction result of the micro-grid is the electric energy consumption prediction data of the next period, the electric energy consumption prediction data of the micro-grid and the electric energy consumption actual data of the micro-grid are in errors, the electric energy consumption condition of the micro-grid can be judged through the errors, so that the electric energy consumption of the micro-grid system is adjusted, the efficient and stable operation of the micro-grid is ensured, the actual electric energy consumption data is collected from the electric energy consumption platform of the micro-grid system, the electric energy consumption prediction data of the micro-grid is compared with the electric energy consumption actual data, when the electric energy consumption actual data of the micro-grid exceeds the electric energy consumption prediction data of the micro-grid, the electric energy consumption of the micro-grid is too high at the moment, the electric energy consumption of the micro-grid needs to be adjusted, energy saving measures are adopted, and when the electric energy consumption actual data of the micro-grid is lower than the electric energy consumption prediction data of the micro-grid, the electric energy consumption is little at the moment, and energy sources can be saved.
According to the technical scheme provided by the embodiment of the invention, the multi-layer random forest algorithm model is constructed by collecting the data set required by the electric load prediction of the micro-grid terminal equipment, and training is performed based on the training sample set and the constructed multi-layer random forest algorithm model, so that the prediction precision and the more stable prediction performance are achieved, and the reliability and the precision of the electric load prediction of the micro-grid are further improved; according to the electricity load data of the current period, the electricity load of the next period at the current moment of the micro-grid is predicted to obtain an electricity load prediction result, safe and efficient operation of the micro-grid is guaranteed, the energy consumption prediction data of the micro-grid is determined according to the electricity load prediction result, and the micro-grid is controlled according to the electricity consumption prediction data of the micro-grid and the actual electricity consumption data of the micro-grid, so that the method has the advantages of relieving the electricity load and reducing the energy consumption.
Example III
Fig. 3 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to a third embodiment of the present invention, as shown in fig. 3, where the method includes:
s310, collecting a data set required by electricity load prediction of the micro-grid terminal equipment.
S320, carrying out data processing on the data set required by the electricity load prediction to obtain an initial training sample set.
S330, constructing a first layer random forest model, selecting an initial training sample from the initial training sample set, inputting the initial training sample into the first layer random forest model for training, outputting a first electric load prediction result and obtaining a first training residual error.
Specifically, n is performed by adopting a Bagging sampling method tree Subsampling to extract n tree Initial training sample sets which are not related to each other are generated to n tree Randomly selecting m from decision tree tree The characteristics are used as classification characteristic values of nodes in a decision tree, the information quantity of each characteristic is calculated, the best characteristic attribute is selected for splitting, and n tree Training a decision tree serving as a first layer random forest model; outputting a first electrical load prediction result, and converting n tree Averaging the predicted values of the decision tree to obtain an output result y1 of the first layer random forest model; obtaining a first training residual y while outputting a result of the first layer random forest model, combining the first training residual y with an initial training set to form a new training sample set to train the random forest model, and training the new trainingThe sample set contains effective information which cannot be identified by the first layer random forest model, takes climate data and time data and a first training residual as a new sample set,wherein the input data x is a characteristic quantity affecting the electric load of the micro-grid, and y is a first training residual value.
Optionally, when constructing the first layer random forest model and performing model training, the method comprises the following steps:
performing parameter optimization training on a first layer random forest model by adopting a MPSO algorithm, wherein the parameters comprise decision tree numbers and split feature numbers, the decision tree numbers and the split feature numbers correspond to particle attributes in the MPSO algorithm, the out-of-bag errors obtained by training the random forest model are taken as fitness values, variation disturbance items are added in an iterative process to optimize model parameters, and the first optimal decision tree number n is obtained best And a first optimal column feature number m best . Then n is best Assignment and n tree ,m best Assignment and m tree
Specifically, n is performed by adopting a Bagging sampling method best Subsampling to extract n best Initial training sample sets which are not related to each other are generated to n best Randomly selecting m from decision tree best The characteristics are used as classification characteristic values of nodes in a decision tree, the information quantity of each characteristic is calculated, the best characteristic attribute is selected for splitting, and n best Training a decision tree serving as a first layer random forest model; outputting a first electrical load prediction result, and converting n best Averaging the predicted values of the decision tree to obtain an output result y1 of the first layer random forest model; the first training residual y is obtained while the first layer random forest model outputs the result, the first training residual y is combined with the initial training set to form a new training sample set for training the random forest model, the new training sample set contains the effective information which cannot be identified by the first layer random forest model, the climate data, the time data and the first training residual are taken as new sample sets, Wherein the input data x is a characteristic quantity affecting the electric load of the micro-grid, and y is a first training residual value.
S340, constructing a second layer random forest model, substituting the first training residual error into the initial sample set to form a new feature set, inputting the new feature set into the second layer random forest model for training, outputting a second power load prediction result and obtaining a second training residual error.
Specifically, the method of Bagging sampling is adopted according to the same method to carry out n' tree Subsampling to extract n' tree Training set x', which are independent of each other t Generating n' tree Randomly selecting m 'from decision tree' tree The characteristics are used as classification characteristic values of nodes in the decision tree, the information quantity of each characteristic is calculated, and the optimal characteristic attribute is selected for splitting; n's' tree Training a decision tree as a second layer random forest, outputting a second electricity load prediction result, and adding n' tree Averaging the predicted values of the decision tree to obtain an output result y of the second-layer random forest model 2 The method comprises the steps of carrying out a first treatment on the surface of the Obtaining a second training residual y ', wherein the second training residual y ' still contains a certain effective information which is not read, and combining the second training residual y ' with the initial training set x t Composition of a new training sample setTraining a random forest model, wherein the new sample set contains effective information which cannot be identified by the second layer random forest model, and climate data, time data and second layer model training residual errors are used as new sample sets >The input data x is a characteristic quantity affecting the electric load of the micro-grid, and y' is a second training residual value.
Optionally, when constructing the second layer random forest model and performing model training, the method comprises the following steps:
performing parameter optimization training on the second layer random forest model by adopting an MPSO algorithm, wherein the parameters comprise decision tree numbers and split characteristic numbers, and dividing the decision tree numbers and the split characteristic numbersThe sign number corresponds to the particle attribute in the MPSO algorithm, the out-of-bag error obtained by training the random forest model is used as a fitness value, a variation disturbance item is added in the iterative process to optimize the model parameter, and a second optimal decision tree number n 'is obtained' best And a second optimal column feature number m' best . Then n' best Assignment and n' tree m′ best Assignment and m' tree
Specifically, the method of Bagging sampling is adopted according to the same method to carry out n' best Subsampling to extract n' best Training set x', which are independent of each other t Generating n' best Randomly selecting m 'from decision tree' best The characteristics are used as classification characteristic values of nodes in the decision tree, the information quantity of each characteristic is calculated, and the optimal characteristic attribute is selected for splitting; n's' best Training a decision tree as a second layer random forest, outputting a second electricity load prediction result, and adding n' best Averaging the predicted values of the decision tree to obtain an output result y of the second-layer random forest model 2 The method comprises the steps of carrying out a first treatment on the surface of the Obtaining a second training residual y ', wherein the second training residual y ' still contains a certain effective information which is not read, and combining the second training residual y ' with the initial training set x t Composition of a new training sample setTraining a random forest model, wherein the new sample set contains effective information which cannot be identified by the second layer random forest model, and climate data, time data and second layer model training residual errors are used as new sample sets>The input data x is a characteristic quantity affecting the electric load of the micro-grid, and y' is a second training residual value.
S350, constructing a third layer random forest model, substituting the second training residual into the initial sample set to form a new feature set, inputting the new feature set into the third layer random forest model for training, outputting a third electric load prediction result and obtaining a third training residual.
In particular according toThe same method adopts a Bagging sampling method to carry out n tree Subsampling to extract n tree Independent training set x t "generate n tree Randomly selecting m 'from decision tree' best The characteristics are used as classification characteristic values of nodes in the decision tree, the information quantity of each characteristic is calculated, and the optimal characteristic attribute is selected for splitting; n is n tree Training a decision tree as a third layer random forest, outputting a third electric load prediction result, and inputting n tree Averaging the predicted values of the decision tree to obtain an output result y of the third-layer random forest model 3
Optionally, when constructing the third layer random forest model and performing model training, the method includes:
performing parameter optimization training on a third-layer random forest model by adopting a MPSO algorithm, wherein the parameters comprise decision tree numbers and split feature numbers, the decision tree numbers and the split feature numbers correspond to particle attributes in the MPSO algorithm, the out-of-bag errors obtained by training the random forest model are taken as fitness values, variation disturbance items are added in an iterative process to optimize model parameters, and the third optimal decision tree number n is obtained best And a third optimal column feature number m best . Then n is best Assignment and n tree
m best Assignment and m tree
Specifically, the method of Bagging sampling is adopted according to the same method to carry out n' best Subsampling to extract n' best Independent training set x t "generate n' best Randomly selecting m 'from decision tree' best The characteristics are used as classification characteristic values of nodes in the decision tree, the information quantity of each characteristic is calculated, and the optimal characteristic attribute is selected for splitting; n's' best Training a decision tree as a third layer random forest, outputting a third electric load prediction result, and adding n' best Averaging the predicted values of the decision tree to obtain a third layer of random forestOutput result y of forest model 3
S360, determining the electricity load prediction result according to the superposition result obtained after the first electricity load prediction result, the second electricity load prediction result and the third electricity load prediction result are sequentially superposed.
Specifically, determining the electric load prediction result can be achieved in two ways, wherein the first is that a superposition result obtained after the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are sequentially superposed is directly used as the electric load prediction result; and the second is to compare the historical electric load data with the superposition result obtained after the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are sequentially superposed, set an error minimum threshold, and when the mean square error between the historical electric load data and the superposition result obtained after the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are sequentially superposed is close to the set threshold, take the superposition result obtained after the first electric load prediction result, the second electric load prediction result and the third electric load prediction result as the electric load prediction result.
As described above, when constructing each layer of random forest model and performing model training, each layer of random forest model comprises:
and carrying out parameter optimization training on the random forest model by adopting an MPSO algorithm, wherein the parameters comprise decision tree numbers and split characteristic numbers, the decision tree numbers and the split characteristic numbers correspond to particle attributes in the MPSO algorithm, the out-of-bag errors obtained by training the random forest model are used as fitness values, and variation disturbance items are added in the iterative process to optimize the model parameters, so that the optimal decision tree numbers and the optimal split characteristic numbers are obtained.
And S370, determining the energy consumption prediction data of the micro-grid according to the electricity load prediction result, and controlling the energy consumption of the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid.
According to the technical scheme provided by the embodiment of the invention, the first layer random forest model, the second layer random forest model and the third layer random forest model are constructed, the MPSO algorithm is adopted to train the first layer random forest model, the second layer random forest model and the third layer random forest model, so that the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are obtained, and the electric load prediction result is determined according to the first electric load prediction result, the second electric load prediction result and the third electric load prediction result, so that the prediction precision is effectively improved, and the prediction performance is more stable.
Example IV
Fig. 4 is a schematic flow chart of a method for optimizing parameters of a random forest model based on a MPSO algorithm, where the method corresponds to the above embodiment, in which the steps adopt the MPSO algorithm to perform parameter optimization training on the random forest model, the parameters include decision tree numbers and split feature numbers, the decision tree numbers and split feature numbers correspond to particle attributes in the MPSO algorithm, an out-bag error obtained by training the random forest model is used as a fitness value, and a variation disturbance term is added in an iterative process to optimize model parameters, so as to obtain refinement of optimal decision tree numbers and optimal split feature numbers, and the method includes:
s410, corresponding the random forest model parameters and the particle swarm attributes, initializing related parameters, and setting initial values and ranges of the strategy tree number and the splitting characteristic number.
Specifically, the decision tree number n in the multi-layer random forest model is set by corresponding the decision tree number and the splitting characteristic number in the multi-layer random forest model to the particle attributes in the particle swarm algorithm, initializing the parameters related to the random forest and the particle swarm, including the particle attributes, the particle swarm scale, the iteration times, the variation disturbance item weight, the convergence accuracy and the like tree And the initial value and range of the split characteristic number m.
S420, substituting the decision tree number and the branch characteristic number into a random forest model.
Specifically, combining a random forest model, calculating the average precision of model classification, and determining the number n of trees tree Substituting the split feature number m into a random forest model.
And S430, controlling the particle fitness value by taking the data error outside the bag obtained by training the random forest model as a fitness function.
Specifically, the adaptation degree value in the particle swarm iteration process is controlled by taking the out-of-bag data error of the random forest model as an adaptation degree function, and the following calculation formula is adopted:
wherein e (i) is the data error outside the bag of the ith decision tree, N is the data set outside the bag, and N is the number of samples of the data set outside the bag.
S440, judging whether the particle fitness value is optimal or not under the current iteration times; if yes, then execute S450; if not, S460 is performed.
Specifically, comparing the particle fitness value under the current iteration times with the known global particle optimal value, if the particle fitness value under the current iteration times meets the global particle optimal value, the particle is the optimal particle, performing mutation treatment on the particle, adding a mutation disturbance item, and storing the particle speed and direction value; if the particle fitness value under the current iteration number does not meet the global particle optimal value, iterating again, and updating the particle speed and the position.
S450, obtaining optimal particles, carrying out mutation treatment on the particles, adding a mutation disturbance item, and storing the particle speed and direction values.
Specifically, the particle with the highest fitness value in the current iteration is taken as the individual optimal particle, and the formula is adoptedPerforming mutation treatment on the particles, adding a mutation disturbance item, and storing the current optimal particle speed and direction value after treatment; wherein K is the distribution coefficient of the Kexil disturbance term, and rand () is [0,1 ]]A random function within.
S460, updating the particle speed and the position, and returning to execute the step of substituting the decision tree number and the grouping feature number into the random forest model and the subsequent steps.
In particular according toFormula (VI)And formula->Updating the movement direction and the movement speed of the particles; wherein (1)>For the particle individual optimum value in the last iteration,/->Is the global optimum, c 1 、c 2 Is an acceleration constant.
S470, after the mutation treatment is carried out on the particles, a mutation disturbance item is added, and after the particle speed and direction values are stored, whether the maximum iteration times are reached is judged; if yes, then execution S480; if not, S460 is performed.
Specifically, judging whether the maximum iteration times are reached or whether convergence accuracy is met, and if so, outputting the optimal decision tree number and the optimal column feature number; if not, updating the particle speed and the position, and executing the step of substituting the decision tree number and the grouping feature number into the random forest model and the subsequent steps.
S480, outputting the optimal decision tree number and the optimal column feature number.
Specifically, the decision tree number and the splitting feature number in the multi-layer random forest model are corresponding to the particle attributes in the particle swarm algorithm, the out-of-bag error obtained by training the random forest model is used as a fitness value, model parameters are continuously optimized in the iteration process to obtain an optimal solution, the optimal solution is subjected to Cauchy variation, and a global optimal parameter value n is output after the maximum iteration times are reached best And m best
According to the technical scheme provided by the embodiment of the invention, the parameter optimization training is carried out on the random forest model by adopting the MPSO algorithm to obtain the optimal decision tree number and the optimal column feature number, and the reliability and the accuracy of the electric load prediction of the micro-grid can be effectively improved by combining the multi-layer random forest algorithm model training according to the optimal decision tree number and the optimal column feature number.
Example five
Fig. 5 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to a fifth embodiment of the present invention, as shown in fig. 5, where the method includes:
s510, collecting a data set required by electricity load prediction of the micro-grid terminal equipment.
S520, constructing a multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the micro-grid in the next period at the current moment according to the power consumption load data of the current moment to obtain a power consumption load prediction result.
And S530, taking the ratio of the electric energy consumption prediction data of the micro-grid to the electric energy consumption actual data of the micro-grid as a first energy consumption ratio of the micro-grid.
Specifically, the electric energy consumption data of the micro-grid obtained through the electric load prediction result of the micro-grid is the electric energy consumption prediction data of the next period of time, and the electric energy consumption of the micro-grid system can be expressed as: e (E) m =E 1 +E 2 +E 3 +…+E nWherein E is m For a period of consumption of electricity under the micro-grid, E 1 、E 2 、E n The electric quantity is used for each branch of the micro-grid; the method comprises the steps of collecting actual electricity consumption data from an energy consumption platform of a micro-grid system, comparing and analyzing the electricity consumption prediction data of the micro-grid with the actual electricity consumption data to obtain a first energy consumption ratio of the micro-grid, wherein the first energy consumption ratio can be expressed as: />Wherein E is m,pred Predictive data for the consumption of electricity for a period of time under the micro-grid, E m,real The electricity consumption actual data of the micro-grid for a period of time is shown, and sigma is the first energy consumption ratio of the micro-grid.
S540, determining the energy consumption condition of the micro-grid according to the first energy consumption ratio of the micro-grid and a preset energy consumption ratio threshold, and controlling the energy consumption of the micro-grid according to the energy consumption condition of the micro-grid.
Specifically, when the first energy consumption ratio sigma of the micro-grid is larger or smaller, the abnormal state of the electric energy consumption of the micro-grid is indicated, the first energy consumption ratio sigma of the micro-grid is set, and when the actual data of the electric energy consumption exceeds 20% of the predicted data of the electric energy consumption for a period of time under the micro-grid, the energy consumption is in the abnormal state. When the first energy consumption ratio sigma of the micro-grid is smaller, the actual data of the power consumption of the micro-grid for a period of time exceeds the predicted data of the power consumption, the power consumption of the micro-grid is too high at the moment, the electric equipment of the micro-grid needs to be adjusted, energy-saving measures are taken, when the first energy consumption ratio sigma of the micro-grid is larger, the actual data of the power consumption of the micro-grid for a period of time is lower than the predicted data of the power consumption, the power consumption is low at the moment, and energy sources can be saved.
According to the technical scheme provided by the embodiment of the invention, the first layer random forest model, the second layer random forest model and the third layer random forest model are constructed, the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are respectively output and obtained, the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are obtained after being overlapped, the electric load prediction result is determined according to the overlapped result, the micro-grid energy consumption prediction data is determined according to the electric load prediction result, and the micro-grid energy consumption is controlled according to the micro-grid electric energy consumption prediction data and the micro-grid electric energy consumption actual data. The method has higher prediction precision and more stable prediction performance, when the power consumption analysis is carried out on the power consumption prediction result, the first energy consumption ratio of the micro-grid is provided, the power consumption at the next moment of the micro-grid system can be timely adjusted through the accurate load prediction result and the first energy consumption ratio of the micro-grid, the power consumption management is carried out, and the effects of relieving the power consumption and reducing the energy consumption are achieved, so that the safe and efficient operation of the micro-grid is ensured.
Example six
Fig. 6 is a schematic flow chart of a method for predicting an electrical load of a micro-grid according to a sixth embodiment of the present invention, as shown in fig. 6, the method includes:
and S610, collecting a data set required by the electricity load prediction of the micro-grid terminal equipment.
S620, constructing a multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the micro-grid in the next period at the current moment according to the power consumption load data of the current moment to obtain a power consumption load prediction result.
And S630, calculating the electricity consumption quota of each sub-item of the micro-grid to obtain an electricity consumption quota value.
Specifically, the energy consumption of the micro-grid system is rated, the energy consumption rating value of the micro-grid can reflect the energy consumption standard of the micro-grid, and a reasonable and scientific energy consumption rating system method is an important component for energy saving management of the micro-grid. When the micro-grid is subjected to energy consumption quota, the regional environment and the development condition of the micro-grid system are fully considered, a reasonable energy consumption quota value is selected, and the micro-grid is ensured to determine an energy consumption reference value under the premise of safe, stable and efficient operation.
The embodiment of the invention is exemplified by a general office building micro-grid system, and the electricity consumption is composed of two major energy consumption quota of a building power distribution system and a refrigerating and heating system, and can be expressed as follows:
E m =E x +E y
Wherein E is x Rated for electricity consumption generated by building distribution system E y Rated for electricity consumption generated by refrigerating and heating system of building, E m And rated for electricity consumption of the building. The building power distribution system comprises a lighting system, a driving system and other power utilization systems, the building refrigerating and heating system comprises an air conditioner tail end and a heating system, and the power consumption quota generated by the building power distribution system can be expressed as:
E x =E z +E q +E s
wherein E is z Rated for lighting system power consumption, E q Rated for power consumption of the drive system E s And the electricity consumption rate is rated for other electricity consumption systems.
The electricity consumption quota generated by the building refrigerating and heating system can be expressed as:
E y =E k +E n
wherein E is k Rated for the electricity consumption of the tail end of the air conditioner E n And the electricity consumption of the heating system is rated.
The office building electricity consumption quota consists of a plurality of small sub-term system electricity consumption quota, and each sub-term electricity consumption quota calculation formula can be expressed as:
wherein E is c Rated for the power consumption of each sub-system, D c For effective operation days of each subentry system in the same year, q cmax The maximum annual energy consumption of each sub-system is shown, and S is the building area of the office building.
S640, obtaining a second energy consumption ratio of the micro-grid according to the micro-grid energy consumption prediction data and the energy consumption quota value;
Specifically, the electricity consumption quota of the micro-grid system of the office building is obtained through calculation, the obtained electricity consumption prediction data of the next period of time is compared and analyzed with the electricity consumption quota, and the energy consumption ratio at the moment is calculated and can be expressed as:
wherein E is m,pred Predictive data for electricity consumption of a period of time under a micro-grid system of a building, E m For the electricity consumption quota, σ' is the second energy consumption ratio of the micro-grid.
And S650, controlling the electric energy consumption of the micro-grid according to the second energy consumption ratio of the micro-grid.
Specifically, when the predicted data of the electricity consumption exceeds 20% of the rated electricity consumption in the next period of time, the energy consumption of the micro-grid system of the building is in an abnormal state. When the second energy consumption ratio sigma' of the micro-grid is smaller, the predicted data of the electricity consumption of the building micro-grid system for a period of time is lower than the electricity consumption quota, and at the moment, the electricity consumption of the building is low, so that energy can be saved; when the second energy consumption ratio sigma' of the micro-grid is larger, the predicted data of the electricity consumption of the building micro-grid system exceeds the electricity consumption quota in a period of time, and at the moment, the electricity consumption of the building is too high, and the electricity consumption of the building needs to be adjusted to take energy-saving measures. According to the second energy consumption ratio sigma 'of the micro-grid, controlling the electric energy consumption of the micro-grid, when the second energy consumption ratio sigma' of the micro-grid is smaller, the electric energy consumption is lower in the next period of time, which means that the electric load of the micro-grid system is reduced, the electric demand is lower, and at the moment, the electric equipment operated by the micro-grid can be reduced to save energy; when the second energy consumption ratio sigma' of the micro-grid is larger, the electricity consumption in the next period of time is higher than the rated energy consumption of the micro-grid system, and the electricity consumption is in a power consumption peak state, so that the electricity consumption demand is higher, and the electricity consumption load of the micro-grid can be relieved by timely adjusting the power of the electric equipment, and the safe and stable operation is ensured.
According to the technical scheme provided by the embodiment of the invention, the first layer random forest model, the second layer random forest model and the third layer random forest model are constructed, the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are respectively output and obtained, the first electric load prediction result, the second electric load prediction result and the third electric load prediction result are obtained after being overlapped, the electric load prediction result is determined according to the overlapped result, the micro-grid energy consumption prediction data is determined according to the electric load prediction result, and the micro-grid energy consumption is controlled according to the micro-grid electric energy consumption prediction data and the micro-grid electric energy consumption actual data. The method has higher prediction precision and more stable prediction performance, and when the power consumption analysis is performed on the power consumption prediction result, the second energy consumption ratio of the micro-grid is provided, and the power consumption at the next moment of the micro-grid system can be timely adjusted through the accurate load prediction result and the second energy consumption ratio of the micro-grid to perform power consumption management, so that the effects of relieving the power consumption and reducing the energy consumption are achieved, and the safe and efficient operation of the micro-grid is ensured.
Example seven
Fig. 7 is a schematic structural diagram of a micro-grid electrical load prediction device according to a seventh embodiment of the present invention, where the micro-grid electrical load prediction device according to the embodiment of the present invention may execute the micro-grid electrical load prediction method according to any embodiment of the present invention, and the micro-grid electrical load prediction device may be implemented in a software and/or hardware manner, and may be configured in any electronic device having a communication function.
As shown in fig. 7, the electric load prediction device for a micro grid includes: a data acquisition unit 710 and a model construction unit 720;
the data acquisition unit 710 is used for acquiring a data set required by power load prediction of the micro-grid terminal equipment; the electricity load prediction data set comprises historical electricity load data and characteristic data; the characteristic data comprise time data and climate data;
the model building unit 720 is used for building a multi-layer random forest algorithm model, training based on the training sample set and the built multi-layer random forest algorithm model, and predicting the power consumption load of the period next to the current time of the micro-grid according to the power consumption load data of the period at the current time to obtain a power consumption load prediction result.
According to the technical scheme provided by the embodiment of the invention, the data acquisition unit and the model construction unit are arranged, the data set required by the electric load prediction of the micro-grid terminal equipment is acquired through the data acquisition unit, the multi-layer random forest algorithm model is constructed, training is carried out based on the training sample set and the constructed multi-layer random forest algorithm model, the prediction precision and the stable prediction performance are higher, and the reliability and the precision of the electric load prediction of the micro-grid are further improved; and according to the electricity load data of the current time period, the electricity load of the next time period of the micro-grid at the current time is predicted to obtain an electricity load prediction result, and the electricity load is managed through the electricity load prediction result, so that the effects of relieving the electricity load and reducing the energy consumption are achieved, and the safe and efficient operation of the micro-grid is ensured.
With continued reference to fig. 7, optionally, the micro-grid electricity load prediction apparatus further includes: an energy use control unit 730;
the energy consumption control unit 730 is configured to determine the energy consumption prediction data of the micro-grid according to the power consumption load prediction result, and perform energy consumption control on the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid.
According to the technical scheme provided by the embodiment of the invention, the energy consumption analysis is carried out according to the electricity load prediction result, the first energy consumption ratio of the micro-grid and the second energy consumption ratio of the micro-grid are provided, the electricity consumption at the next moment of the micro-grid system can be timely adjusted through the accurate load prediction result, the first energy consumption ratio of the micro-grid and the second energy consumption ratio of the micro-grid, the energy consumption management is carried out, the effects of relieving the electricity load and reducing the energy consumption are achieved, and the safe and efficient operation of the micro-grid is ensured.
With continued reference to fig. 7, optionally, the micro-grid electricity load prediction apparatus further includes: a data storage unit 740 and a data output unit 750;
the data storage unit 740 is used for storing the data set required by the power load prediction acquired by the data acquisition unit 710 from the terminal, the training data set preprocessed by the model construction unit 720 and the load prediction data of the multi-layer random forest algorithm model, the power consumption prediction data of the micro-grid calculated by the power control unit 730, the first power consumption ratio, the power consumption quota value of the micro-grid system and the second power consumption ratio information;
the data output unit 750 is configured to output the data set required for power consumption load prediction acquired by the data acquisition unit 710 from the terminal, the training data set and the intelligent prediction model load prediction data preprocessed by the model building unit 720, the power consumption prediction data of the micro grid calculated by the power consumption control unit 730, the first power consumption ratio, the power consumption quota value of the micro grid system, and the second power consumption ratio information.
The micro-grid electricity load prediction device provided by the embodiment of the invention can execute the micro-grid electricity load prediction method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example eight
Fig. 8 is a schematic structural diagram of an electronic device for electric load prediction of a micro-grid according to an eighth embodiment of the present invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 8, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the microgrid electrical load prediction method.
In some embodiments, the microgrid electrical load prediction method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the microgrid electrical load prediction method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the microgrid electrical load prediction method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for predicting an electrical load of a micro-grid, comprising:
collecting a data set required by power load prediction of micro-grid terminal equipment; the electricity load prediction data set comprises historical electricity load data and characteristic data; the characteristic data comprise time data and climate data;
constructing a multi-layer random forest algorithm model, training based on a training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the period next to the current moment of the micro-grid according to the power consumption load data of the period at the current moment to obtain a power consumption load prediction result; the training sample set is obtained by carrying out data processing on the data required by the electricity load prediction; and when the multi-layer random forest algorithm model is trained, optimizing and training parameters of the multi-layer random forest algorithm model according to the MPSO algorithm to obtain an optimal decision tree and an optimal branch feature number.
2. The method according to claim 1, wherein after the multi-layer random forest algorithm model is constructed, training is performed based on the training sample set and the constructed multi-layer random forest algorithm model, and the electricity load of the period of time at the current moment is predicted according to the electricity load data of the period of time at the current moment to obtain the electricity load prediction result, the method further comprises:
and determining the energy consumption prediction data of the micro-grid according to the electricity load prediction result, and controlling the energy consumption of the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid.
3. The method according to claim 1, wherein the constructing the multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the electricity load of the period next to the current time of the micro-grid according to the electricity load data of the period at the current time to obtain the electricity load prediction result includes:
performing data processing on the data set required by the electricity load prediction to obtain an initial training sample set;
constructing a first layer random forest model, selecting an initial training sample from the initial training sample set, inputting the initial training sample into the first layer random forest model for training, outputting a first electric load prediction result and obtaining a first training residual error;
Constructing a second layer random forest model, substituting the first training residual error into the initial sample set to form a new feature set, inputting the new feature set into the second layer random forest model for training, outputting a second power load prediction result and obtaining a second training residual error;
constructing a third layer random forest model, substituting the second training residual error into the initial sample set to form a new feature set, inputting the new feature set into the third layer random forest model for training, outputting a third electric load prediction result and obtaining a third training residual error;
determining the electricity load prediction result according to a superposition result obtained after the first electricity load prediction result, the second electricity load prediction result and the third electricity load prediction result are sequentially superposed;
when the random forest models of all layers are built and model training is carried out, the method comprises the following steps:
and carrying out parameter optimization training on a random forest model by adopting the MPSO algorithm, wherein the parameters comprise decision tree numbers and split feature numbers, the decision tree numbers and the split feature numbers correspond to particle attributes in the MPSO algorithm, the out-of-bag errors obtained by training the random forest model are used as fitness values, and variation disturbance items are added in an iterative process to optimize model parameters, so that optimal decision tree numbers and optimal split feature numbers are obtained.
4. The method of claim 3, wherein the performing parameter optimization training on the random forest model by using the MPSO algorithm, the parameters including decision tree number and splitting feature number, the decision tree number and the splitting feature number corresponding to the particle attribute in the MPSO algorithm, and adding variation disturbance term to optimize model parameters in the iterative process to obtain optimal decision tree number and optimal splitting feature number, comprises:
corresponding random forest model parameters and particle swarm attributes, initializing related parameters, and setting initial values and ranges of the strategy tree number and the splitting characteristic number;
substituting the decision tree number and the branch feature number into the random forest model;
taking the data error outside the bag obtained by training the random forest model as a fitness function to control the particle fitness value;
judging whether the particle fitness value is optimal or not under the current iteration times;
if yes, obtaining optimal particles, carrying out mutation treatment on the particles, adding a mutation disturbance item, and storing the speed and direction values of the particles;
if not, updating the particle speed and the position, and returning to the step of substituting the decision tree number and the branch characteristic number into the random forest model and the subsequent steps.
After the mutation treatment is carried out on the particles, a mutation disturbance item is added, and the particle speed and direction value are stored, whether the maximum iteration times are reached is judged;
if yes, outputting the optimal decision tree number and the optimal branch characteristic number;
if not, updating the particle speed and the position, and executing the step of substituting the decision tree number and the grouping feature number into the random forest model and the subsequent steps.
5. The method of claim 2, wherein determining the microgrid energy consumption prediction data based on the electrical load prediction result, and performing energy consumption control on the microgrid based on the microgrid electrical energy consumption prediction data and the microgrid electrical energy consumption actual data, comprises:
taking the ratio of the electric energy consumption prediction data for the micro-grid to the actual electric energy consumption data for the micro-grid as a first energy consumption ratio of the micro-grid;
and determining the energy consumption condition of the micro-grid according to the first energy consumption ratio of the micro-grid and a preset energy consumption ratio threshold, and controlling the energy consumption of the micro-grid according to the energy consumption condition of the micro-grid.
6. The method of claim 5, wherein determining the microgrid energy consumption prediction data according to the electrical load prediction result, and performing energy consumption control on the microgrid according to the microgrid energy consumption prediction data and the microgrid actual electrical consumption data, further comprises:
The electricity consumption quota of each sub-item of the micro-grid is calculated to obtain an electricity consumption quota value;
acquiring a second energy consumption ratio of the micro-grid according to the micro-grid power consumption prediction data and the power consumption quota value;
and controlling the electric energy consumption of the micro-grid according to the second energy consumption ratio of the micro-grid.
7. An electrical load prediction device for a micro-grid, comprising:
the data acquisition unit and the model building unit;
the data acquisition unit is used for acquiring a data set required by power load prediction of the micro-grid terminal equipment; the electricity load prediction data set comprises historical electricity load data and characteristic data; the characteristic data comprise time data and climate data;
the construction model unit is used for constructing a multi-layer random forest algorithm model, training based on the training sample set and the constructed multi-layer random forest algorithm model, and predicting the power consumption load of the period next to the current time of the micro-grid according to the power consumption load data of the period at the current time to obtain a power consumption load prediction result.
8. The apparatus as recited in claim 7, further comprising: an energy consumption control unit; the energy consumption control unit is used for determining the energy consumption prediction data of the micro-grid according to the electricity load prediction result, and controlling the energy consumption of the micro-grid according to the energy consumption prediction data of the micro-grid and the actual energy consumption data of the micro-grid.
9. The apparatus as recited in claim 8, further comprising: a data storage unit and a data output unit;
the data storage unit is used for storing a data set required by electricity load prediction acquired by the data acquisition unit from the terminal, the training data set preprocessed by the model construction unit and load prediction data of the multi-layer random forest algorithm model, the electric energy consumption prediction data of the micro-grid calculated by the energy consumption control unit, a first energy consumption ratio, an energy consumption quota value of the micro-grid system and second energy consumption ratio information;
the data output unit is used for outputting a data set required by electricity load prediction acquired by the data acquisition unit from the terminal, the training data set preprocessed by the model construction unit and load prediction data of the multi-layer random forest algorithm model, the electric energy consumption prediction data of the micro-grid calculated by the energy consumption control unit, a first energy consumption ratio, an energy consumption quota value of the micro-grid system and second energy consumption ratio information.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-6.
CN202310433438.8A 2023-04-20 2023-04-20 Method, device and storage medium for predicting electric load of micro-grid Pending CN116777038A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310433438.8A CN116777038A (en) 2023-04-20 2023-04-20 Method, device and storage medium for predicting electric load of micro-grid

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310433438.8A CN116777038A (en) 2023-04-20 2023-04-20 Method, device and storage medium for predicting electric load of micro-grid

Publications (1)

Publication Number Publication Date
CN116777038A true CN116777038A (en) 2023-09-19

Family

ID=88012287

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310433438.8A Pending CN116777038A (en) 2023-04-20 2023-04-20 Method, device and storage medium for predicting electric load of micro-grid

Country Status (1)

Country Link
CN (1) CN116777038A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117311244A (en) * 2023-11-28 2023-12-29 广州宝云信息科技有限公司 Energy-saving regulation and control method and system based on equipment working condition prediction

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117311244A (en) * 2023-11-28 2023-12-29 广州宝云信息科技有限公司 Energy-saving regulation and control method and system based on equipment working condition prediction
CN117311244B (en) * 2023-11-28 2024-02-13 广州宝云信息科技有限公司 Energy-saving regulation and control method and system based on equipment working condition prediction

Similar Documents

Publication Publication Date Title
WO2021043180A1 (en) Regional short-term energy power prediction method and system that take weather into consideration
CN116777038A (en) Method, device and storage medium for predicting electric load of micro-grid
CN116307215A (en) Load prediction method, device, equipment and storage medium of power system
CN116341725A (en) Electric load prediction and energy saving system, method, electronic equipment and storage medium
CN116523140A (en) Method and device for detecting electricity theft, electronic equipment and storage medium
CN116595394A (en) Training method of wind speed correction model, wind speed prediction method, wind speed prediction equipment and medium
CN116021981A (en) Method, device, equipment and storage medium for predicting ice coating faults of power distribution network line
CN116502771B (en) Power distribution method and system based on electric power material prediction
CN117332898A (en) New energy small time scale power time sequence rolling prediction method based on machine learning
CN115860190A (en) Training of load detection model, method for detecting power load and related device
CN116484554A (en) Topology identification method, device, equipment and medium for power distribution network
CN115882451A (en) Method, device and equipment for predicting generated power of new energy power station
CN113780644B (en) Photovoltaic output prediction method based on online learning
CN116151034B (en) Insulator core rod crisping prediction method, device, equipment and medium
CN115597872B (en) Load shedding test method, device, equipment and medium for pumped storage unit
CN117131315B (en) Out-of-tolerance electric energy meter determining method and medium based on solving multi-element quadratic function extremum
CN117131353B (en) Method and device for determining out-of-tolerance electric energy meter, electronic equipment and storage medium
CN116822740A (en) Power distribution network operation and maintenance scheme determining method and device, electronic equipment and storage medium
CN116227731A (en) Load prediction method, device, equipment and medium
CN115860249A (en) Distributed photovoltaic power generation power prediction method, device, equipment and medium
CN115456455A (en) Energy storage configuration method, device, equipment and storage medium
CN115952921A (en) Photovoltaic energy power prediction method and device, electronic equipment and storage medium
CN116186536A (en) Risk prediction method, risk prediction device, electronic equipment and storage medium
CN116365288A (en) Photovoltaic fault sensing method, device, equipment and medium based on sunny state
CN117251809A (en) Power grid time sequence data anomaly detection method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination