CN117175595B - Power grid regulation and control method and system based on multi-level data - Google Patents
Power grid regulation and control method and system based on multi-level data Download PDFInfo
- Publication number
- CN117175595B CN117175595B CN202311407380.6A CN202311407380A CN117175595B CN 117175595 B CN117175595 B CN 117175595B CN 202311407380 A CN202311407380 A CN 202311407380A CN 117175595 B CN117175595 B CN 117175595B
- Authority
- CN
- China
- Prior art keywords
- load
- power grid
- load prediction
- data
- node
- 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.)
- Active
Links
Landscapes
- Supply And Distribution Of Alternating Current (AREA)
Abstract
Description
技术领域Technical field
本发明涉及电网调控技术领域,尤其涉及一种基于多级数据的电网调控方法及系统。The present invention relates to the technical field of power grid control, and in particular to a power grid control method and system based on multi-level data.
背景技术Background technique
电网调控是电力系统调度运行领域软件应用系统进行电网运行监控、分析计算所需的基础数据,但随着越来越大的用电需求,电网负载也日益增加,因此需要对电网调控策略进行实时更新和优化。Grid regulation is the basic data required for power grid operation monitoring, analysis and calculation by software application systems in the field of power system dispatching and operation. However, with the increasing demand for electricity, the grid load is also increasing, so it is necessary to conduct real-time implementation of grid regulation strategies. Updated and optimized.
在现有技术中,CN114548653A,一种电网负荷调控平台数据采集方法、系统与电子设备提供一种电网负荷调控平台数据采集方法、系统与电子设备,通过对数据进行整合的机制和手段,使数据得到综合利用,能够很好地为决策分析提供支撑,提高系统投资回报率,能够对各业务系统的数据进行有效融合,集中统一管理,转化为有价值的信息,为相关的业务应用提供统一的数据支持,真正实现一个数据,一个入口,统一出口、多级应用,从多种异构数据源自动获取有关数据,并根据数据的属性关系进行有效性校验,实现自动计算、统计、汇总及自动义的操作方式,满足不同业务场景应用及不同的业务领域提供应用。In the existing technology, CN114548653A, a data collection method, system and electronic equipment for a power grid load control platform provides a data collection method, system and electronic equipment for a power grid load control platform. Through the mechanism and means of integrating data, the data is When comprehensively utilized, it can provide good support for decision-making analysis, improve the system's return on investment, effectively integrate data from various business systems, centralize and unify management, transform it into valuable information, and provide unified information for related business applications. Data support truly realizes one data, one entrance, unified export, and multi-level applications, automatically obtains relevant data from multiple heterogeneous data sources, and conducts validity verification based on the attribute relationships of the data to achieve automatic calculation, statistics, summary, and Automated operation mode meets different business scenario applications and provides applications in different business fields.
CN107451188A,一种电网调控模型数据多级节点组合的发布方法及系统,公开了一种电网调控模型数据多级节点组合的发布方法及系统,设定电网调控模型多级节点组合的范围;在所述电网调控模型多级节点组合的范围内,建立容器对象涉及的多级节点的配置文件;通过单一属性节点访问容器对象涉及的多级节点的配置文件,发布所述容器对象包含的多级节点数据,本发明提供的技术方案结合特定容器下对象数据层次定义,通过设定专属特性标识,提供了一种整体访问设备容器内电网调控模型全数据的方法。该方法不改变OPCUA对象访问服务的定义,仅在服务实现端增加对设备容器内对象及属性的层次化的编排,使应用能够快速获取所需电网调控模型数据。CN107451188A, a method and system for releasing multi-level node combinations of power grid control model data, discloses a method and system for releasing multi-level node combinations of power grid control model data, and sets the range of multi-level node combinations of power grid control model; in the Within the scope of the multi-level node combination of the power grid control model, a configuration file of the multi-level nodes involved in the container object is established; the configuration file of the multi-level nodes involved in the container object is accessed through a single attribute node, and the multi-level nodes included in the container object are published. Data, the technical solution provided by the present invention combines the object data hierarchical definition under a specific container, and provides a method for overall access to the full data of the power grid control model in the equipment container by setting exclusive characteristic identifiers. This method does not change the definition of the OPCUA object access service, but only adds hierarchical orchestration of objects and attributes in the device container on the service implementation side, so that the application can quickly obtain the required power grid control model data.
综上,现有技术虽然能够对电网中现有设备数据进行读取和根据预设模式对电网调控策略进行调整,但无法根据实时负载对电网进行适应性调整,也未考虑时间和历史用电策略对电网调控策略的影响,因此,本方案至少能解决一部分现有问题。To sum up, although the existing technology can read the data of existing equipment in the power grid and adjust the power grid control strategy according to the preset mode, it cannot make adaptive adjustments to the power grid based on real-time load, nor does it take into account time and historical power consumption. The impact of the strategy on the power grid control strategy, therefore, this solution can at least solve some of the existing problems.
发明内容Contents of the invention
本发明实施例提供一种基于多级数据的电网调控方法及系统,用于根据电网实时状态动态调整电网调控策略。Embodiments of the present invention provide a power grid control method and system based on multi-level data, which are used to dynamically adjust the power grid control strategy according to the real-time status of the power grid.
本发明实施例的第一方面,一种基于多级数据的电网调控方法,包括:The first aspect of the embodiment of the present invention, a power grid control method based on multi-level data, includes:
获取电网初始数据,将所述电网初始数据输入至预设的第一负荷预测模型,通过所述第一负荷预测模型对所述电网初始数据进行预处理,确定第一负荷输入,根据所述第一负荷输入,结合所述第一负荷预测模型,得到第二负荷输入;Obtain the initial data of the power grid, input the initial data of the power grid into a preset first load prediction model, preprocess the initial data of the power grid through the first load prediction model, determine the first load input, and according to the first load prediction model A load input, combined with the first load prediction model, to obtain a second load input;
根据所述第二负荷输入,结合预设的第二负荷预测模型,将所述第二负荷输入在所述第二负荷预测模型中以根节点至叶节点的顺序进行传递,得到第二负荷输出,根据所述第二负荷输出,结合预设的结果优化算法,确定负荷预测结果,其中,所述第二负荷模型是基于极端梯度提升算法构建的树模型;According to the second load input, combined with the preset second load prediction model, the second load input is transferred in the second load prediction model in the order of root node to leaf node to obtain the second load output. , according to the second load output, combined with the preset result optimization algorithm, determine the load prediction result, wherein the second load model is a tree model constructed based on the extreme gradient boosting algorithm;
根据所述负荷预测结果,结合电网初始数据,构建能源动作空间,根据所述能源动作空间,通过预设的策略优化算法,确定调控优化策略,其中,所述策略优化算法是根据改良的近端策略优化算法构建的。According to the load prediction results, combined with the initial data of the power grid, an energy action space is constructed. According to the energy action space, a control optimization strategy is determined through a preset strategy optimization algorithm, wherein the strategy optimization algorithm is based on an improved near-end Built using strategy optimization algorithms.
在一种可选的实施方式中,In an alternative implementation,
所述将所述电网初始数据输入至预设的第一负荷预测模型,通过所述第一负荷预测模型对所述电网初始数据进行预处理,确定第一负荷输入,根据所述第一负荷输入,结合所述第一负荷预测模型,得到第二负荷输入包括:The initial data of the power grid is input into a preset first load prediction model, and the initial data of the power grid is preprocessed through the first load prediction model to determine the first load input. According to the first load input , combined with the first load prediction model, the second load input includes:
通过数据库获取历史用电数据,并根据设置于电网节点中的智能传感器获取电网状态数据,将所述历史用电数据和所述电网状态数据加入至同一集合,并记为所述电网初始数据;Acquire historical power consumption data through the database, obtain power grid status data according to smart sensors installed in power grid nodes, add the historical power consumption data and the power grid status data to the same set, and record them as the power grid initial data;
通过所述第一负荷预测模型对所述电网初始数据进行数据清洗和特征选择操作,得到所述第一负荷输入;Perform data cleaning and feature selection operations on the initial data of the power grid through the first load prediction model to obtain the first load input;
根据所述第一负荷输入,通过所述第一负荷预测模型中的双向状态网络,确定前向隐藏状态和后向隐藏状态;According to the first load input, determine the forward hidden state and the backward hidden state through the bidirectional state network in the first load prediction model;
根据所述前向隐藏状态和所述后向隐藏状态,结合预设的残差模块和自注意力机制,将所述双向状态网络中特定层的输入数据直接加入至所述双向状态网络的输出数据中,确定所述第二负荷输入。According to the forward hidden state and the backward hidden state, combined with the preset residual module and self-attention mechanism, the input data of a specific layer in the bidirectional state network is directly added to the output of the bidirectional state network data, determine the second load input.
在一种可选的实施方式中,In an alternative implementation,
所述根据所述第二负荷输入,结合预设的第二负荷预测模型,将所述第二负荷输入在所述第二负荷预测模型中以根节点至叶节点的顺序进行传递,得到第二负荷输出,根据所述第二负荷输出,结合预设的结果优化算法,确定负荷预测结果,其中,所述第二负荷模型是基于极端梯度提升算法构建的树模型包括:According to the second load input, combined with the preset second load prediction model, the second load input is transferred in the second load prediction model in the order of root node to leaf node to obtain the second load prediction model. Load output, based on the second load output, combined with the preset result optimization algorithm, determines the load prediction result, wherein the second load model is a tree model constructed based on the extreme gradient boosting algorithm, including:
获取所述第二负荷输入,将所述第二负荷输入加入至所述第二负荷预测模型,所述第二负荷输入从所述第二负荷预测模型的根节点向下传递,在每个叶节点处,根据预设的节点分裂条件,判断传递方向,若满足所述预设的节点分裂条件则向左传递,若不满足,则向右传递,直至传递完成,得到所述第二负荷输出;Obtain the second load input, add the second load input to the second load prediction model, and pass the second load input downward from the root node of the second load prediction model, at each leaf At the node, the transmission direction is determined according to the preset node splitting conditions. If the preset node splitting conditions are met, the transmission is to the left. If not, the transmission is to the right until the transmission is completed, and the second load output is obtained. ;
根据所述第二负荷输出,结合所述结果优化算法,去除所述第二负荷中的异常值并根据数据趋势进行修正,确定所述负荷预测结果。According to the second load output, combined with the result optimization algorithm, the abnormal values in the second load are removed and corrected according to the data trend to determine the load prediction result.
在一种可选的实施方式中,所述方法还包括训练所述第二负荷预测模型:In an optional implementation, the method further includes training the second load prediction model:
获取第二负荷输入,将所述第二负荷输入转换为特征向量,对于连续特征值,通过等频分桶策略将所述连续特征值划分离散的区间,进行离散化,得到特征取值范围,根据所述特征取值范围,通过轻量梯度提升算法构建直方图;Obtain the second load input and convert the second load input into a feature vector. For continuous feature values, divide the continuous feature values into discrete intervals through the equal-frequency bucketing strategy and perform discretization to obtain the feature value range. According to the feature value range, a histogram is constructed through a lightweight gradient boosting algorithm;
基于叶节点优先生长策略,通过节点增益函数确定当前叶节点的第一增益值,选择当前叶节点中拥有最大增益的节点进行分裂,得到最大增益值并根据所述最大增益值构建损失函数,根据所述损失函数,计算当前叶节点的梯度和二阶导数,并构建目标函数的二阶泰勒展开;Based on the leaf node priority growth strategy, the first gain value of the current leaf node is determined through the node gain function, the node with the maximum gain among the current leaf nodes is selected for splitting, the maximum gain value is obtained, and a loss function is constructed based on the maximum gain value. According to The loss function calculates the gradient and second-order derivative of the current leaf node, and constructs a second-order Taylor expansion of the objective function;
对于每个叶节点,遍历全部叶节点的特征值,结合当前叶节点的梯度和二阶导数,确定分裂后损失函数值最小叶节点,记为分裂叶节点,并将所述分裂叶节点分裂为两个叶节点,并计算分裂后叶节点的梯度和二阶导数,重复操作直至满足停止条件。For each leaf node, traverse the eigenvalues of all leaf nodes, combine the gradient and second derivative of the current leaf node, determine the leaf node with the smallest loss function value after splitting, record it as a split leaf node, and split the split leaf node into Two leaf nodes, and calculate the gradient and second-order derivative of the leaf node after splitting, and repeat the operation until the stopping condition is met.
在一种可选的实施方式中,In an alternative implementation,
所述通过节点增益函数确定当前叶节点的第一增益值,选择当前叶节点中拥有最大增益的节点进行分裂,得到最大增益值并根据所述最大增益值构建损失函数如下公式所示:Determine the first gain value of the current leaf node through the node gain function, select the node with the maximum gain among the current leaf nodes for splitting, obtain the maximum gain value, and construct a loss function based on the maximum gain value as shown in the following formula:
; ;
其中,D表示当前节点的数据集,Loss(D)表示损失函数,y i表示样本i的真实标签,y avg表示当前节点的均值,y split表示分裂后的节点均值,max split ()表示在所有可能的方式中选择能够最大化损失函数的分裂方式。Among them, D represents the data set of the current node, Loss(D) represents the loss function, y i represents the real label of sample i , y avg represents the mean value of the current node, y split represents the node mean value after splitting, max split () represents the Choose the splitting method that maximizes the loss function among all possible methods.
在一种可选的实施方式中,In an alternative implementation,
所述根据所述负荷预测结果,结合电网初始数据,构建能源动作空间,根据所述能源动作空间,通过预设的策略优化算法,确定调控优化策略包括:The energy action space is constructed based on the load prediction results and the initial data of the power grid. According to the energy action space, the control optimization strategy is determined through a preset strategy optimization algorithm, including:
获取所述负荷预测结果和所述电网初始数据,根据所述负荷预测结果和所述电网初始数据,定义状态空间,根据所述状态空间确定第一调整范围和第二调整范围,根据所述第一调整范围和第二调整范围,结合预先获取的电源单元特性,确定所述能源动作空间;Obtain the load prediction result and the power grid initial data, define a state space according to the load prediction result and the power grid initial data, determine a first adjustment range and a second adjustment range according to the state space, and determine the first adjustment range and the second adjustment range according to the state space. The first adjustment range and the second adjustment range determine the energy action space in combination with the pre-acquired power unit characteristics;
根据所述能源动作空间,结合系统损耗和电网稳定性,确定奖励函数,根据所述奖励函数,在每个时间步根据所述策略优化算法选择电网动作,根据所述电网动作,迭代所述状态空间和所述能源动作空间,根据迭代后的状态空间和能源动作空间,结合预设的策略优化算法,确定所述调控优化策略。According to the energy action space, combined with system losses and grid stability, a reward function is determined. According to the reward function, a grid action is selected according to the policy optimization algorithm at each time step. According to the grid action, the state is iterated space and the energy action space. According to the iterated state space and energy action space, combined with the preset strategy optimization algorithm, the control optimization strategy is determined.
在一种可选的实施方式中,In an alternative implementation,
所述根据所述能源动作空间,结合系统损耗和电网稳定性,确定奖励函数如下公式所示:According to the energy action space, combined with system loss and grid stability, the reward function is determined as follows:
; ;
其中,R(s,a)表示奖励值,s表示系统状态,a表示电网动作,Loss(s,a)表示系统损耗,α表示权重系数,VoltageStability(s,a)表示电压稳定性。Among them, R(s,a) represents the reward value, s represents the system state, a represents the grid action, Loss(s,a) represents the system loss, α represents the weight coefficient, and VoltageStability(s,a) represents the voltage stability.
本发明实施例的第二方面,提供一种基于多级数据的电网调控系统,包括:A second aspect of the embodiment of the present invention provides a power grid control system based on multi-level data, including:
第一单元,用于获取电网初始数据,将电网初始数据输入至预设的第一负荷预测模型,通过所述第一负荷预测模型对所述电网初始数据进行预处理,确定第一负荷输入,根据所述第一负荷输入,结合所述第一负荷预测模型,得到第二负荷输入;The first unit is used to obtain the initial data of the power grid, input the initial data of the power grid into a preset first load prediction model, preprocess the initial data of the power grid through the first load prediction model, and determine the first load input, According to the first load input, combined with the first load prediction model, a second load input is obtained;
第二单元,用于根据所述第二负荷输入,结合预设的第二负荷预测模型,将所述第二负荷输入在所述第二负荷预测模型中以根节点至叶节点的顺序进行传递,得到第二负荷输出,根据所述第二负荷输出,结合预设的结果优化算法,确定负荷预测结果,其中,所述第二负荷模型是基于极端梯度提升算法构建的树模型;The second unit is configured to transmit the second load input in the second load prediction model in the order of root node to leaf node according to the second load input and combined with the preset second load prediction model. , obtain the second load output, and determine the load prediction result according to the second load output in combination with the preset result optimization algorithm, where the second load model is a tree model constructed based on the extreme gradient boosting algorithm;
第三单元,用于根据所述负荷预测结果,结合电网初始数据,构建能源动作空间,根据所述能源动作空间,通过预设的策略优化算法,确定调控优化策略,其中,所述策略优化算法是根据改良的近端策略优化算法构建的。The third unit is used to construct an energy action space based on the load prediction results and combined with the initial data of the power grid. According to the energy action space, determine the control optimization strategy through a preset strategy optimization algorithm, wherein the strategy optimization algorithm It is built based on the improved proximal strategy optimization algorithm.
本发明实施例的第三方面,A third aspect of the embodiment of the present invention,
提供一种电子设备,包括:An electronic device is provided, including:
处理器;processor;
用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
其中,所述处理器被配置为调用所述存储器存储的指令,以执行前述所述的方法。Wherein, the processor is configured to call instructions stored in the memory to execute the aforementioned method.
本发明实施例的第四方面,The fourth aspect of the embodiment of the present invention,
提供一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现前述所述的方法。A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
本发明实施例通过预设的第一和第二负荷预测模型,该方案能够对电网的负荷进行精准的预测。这有助于系统更好地了解未来的用电需求,从而制定更有效的调控策略,采用基于极端梯度提升算法构建的树模型,可以更好地捕捉负荷之间的复杂关系。这种模型能够提供更准确的第二负荷预测结果,有助于改善对电网状态的理解,通过结合负荷预测结果和电网初始数据,能够构建能源动作空间。这个空间反映了系统中可用的能源调控选项,为后续的策略优化提供了基础,综上所述,本方案通过负荷预测和策略优化算法能够更好地适应电网运行的复杂性,提高电网的调控能力。According to the embodiment of the present invention, the solution can accurately predict the load of the power grid through the preset first and second load prediction models. This helps the system better understand future power demand and formulate more effective regulation strategies. The use of a tree model built based on the extreme gradient boosting algorithm can better capture the complex relationships between loads. This model can provide more accurate secondary load prediction results and help improve the understanding of the grid status. By combining the load prediction results with the initial grid data, an energy action space can be constructed. This space reflects the energy regulation options available in the system and provides a basis for subsequent strategy optimization. In summary, this solution can better adapt to the complexity of power grid operation and improve the regulation of the power grid through load forecasting and strategy optimization algorithms. ability.
附图说明Description of the drawings
图1为本发明实施例一种基于多级数据的电网调控方法的流程示意图;Figure 1 is a schematic flow chart of a power grid control method based on multi-level data according to an embodiment of the present invention;
图2为本发明实施例一种基于多级数据的电网调控系统的结构示意图。Figure 2 is a schematic structural diagram of a power grid control system based on multi-level data according to an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments These are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
下面以具体地实施例对本发明的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solution of the present invention will be described in detail below with specific examples. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
图1为本发明实施例一种基于多级数据的电网调控方法的流程示意图,如图1所示,所述方法包括:Figure 1 is a schematic flow chart of a power grid control method based on multi-level data according to an embodiment of the present invention. As shown in Figure 1, the method includes:
S1.获取电网初始数据,将所述电网初始数据输入至预设的第一负荷预测模型,通过所述第一负荷预测模型对所述电网初始数据进行预处理,确定第一负荷输入,根据所述第一负荷输入,结合所述第一负荷预测模型,得到第二负荷输入;S1. Obtain the initial data of the power grid, input the initial data of the power grid into the preset first load prediction model, preprocess the initial data of the power grid through the first load prediction model, determine the first load input, and determine the first load input according to the preset first load prediction model. The first load input is combined with the first load prediction model to obtain a second load input;
所述电网初始数据,具体指历史用电数据,分布式能源数据和电网状态数据,其中历史用电数据是指过去单位时间内的用电量数据,分布式能源数据是指光伏发电,风能发电和水电等分布式能源的实时或历史发电量数据,电网状态数据是指电网中各个节点的电压、频率和设备运行状态等信息。The initial data of the power grid specifically refers to historical power consumption data, distributed energy data and power grid status data. The historical power consumption data refers to the power consumption data per unit time in the past, and the distributed energy data refers to photovoltaic power generation and wind power generation. Real-time or historical power generation data of distributed energy sources such as hydropower and hydropower. Grid status data refers to information such as voltage, frequency and equipment operating status of each node in the grid.
所述第一负荷输入是指将电网初始数据输入到第一负荷预测模型中进行处理的结果,所述预处理具体为使用第一负荷预测模型对所述电网初始数据进行数据清洗和特征选择,可以包括处理缺失值、异常值,选择最相关的特征等操作。The first load input refers to the result of inputting the initial data of the power grid into the first load prediction model for processing. The preprocessing specifically includes using the first load prediction model to perform data cleaning and feature selection on the initial data of the power grid, This can include operations such as handling missing values, outliers, and selecting the most relevant features.
在一种可选的实施方式中,In an alternative implementation,
将所述电网初始数据输入至预设的第一负荷预测模型,通过所述第一负荷预测模型对所述电网初始数据进行预处理,确定第一负荷输入,根据所述第一负荷输入,结合所述第一负荷预测模型,得到第二负荷输入包括:The initial data of the power grid is input into a preset first load prediction model. The initial data of the power grid is preprocessed through the first load prediction model to determine the first load input. According to the first load input, combined with The first load prediction model obtains the second load input including:
通过数据库获取历史用电数据,并根据设置于电网节点中的智能传感器获取电网状态数据,将所述历史用电数据和所述电网状态数据加入至同一集合,并记为电网初始数据;Acquire historical power consumption data through the database, obtain power grid status data according to smart sensors installed in power grid nodes, add the historical power consumption data and the power grid status data to the same set, and record them as initial power grid data;
通过第一负荷预测模型对所述电网初始数据进行数据清洗和特征选择操作,得到所述第一负荷输入;Perform data cleaning and feature selection operations on the initial data of the power grid through the first load prediction model to obtain the first load input;
根据所述第一负荷输入,通过所述第一负荷预测模型中的双向状态网络,确定前向隐藏状态和后向隐藏状态;According to the first load input, determine the forward hidden state and the backward hidden state through the bidirectional state network in the first load prediction model;
根据所述前向隐藏状态和所述后向隐藏状态,结合预设的残差模块和自注意力机制,将所述双向状态网络中特定层的输入数据直接加入至所述双向状态网络的输出数据中,确定所述第二负荷输入。According to the forward hidden state and the backward hidden state, combined with the preset residual module and self-attention mechanism, the input data of a specific layer in the bidirectional state network is directly added to the output of the bidirectional state network data, determine the second load input.
从历史用电数据库中获取数据,包括时间戳和相应的用电量信息,通过设置在电网节点中的智能传感器获取电网状态数据,包括电流、电压、频率等信息,将历史用电数据和电网状态数据合并成一个数据集,其中时间戳将用于对数据进行对齐。Obtain data from the historical power consumption database, including timestamps and corresponding power consumption information. Obtain power grid status data through smart sensors set in power grid nodes, including current, voltage, frequency and other information. Combine historical power consumption data with the power grid. State data is merged into a single dataset where timestamps are used to align the data.
使用第一负荷预测模型进行数据清洗和特征选择,包括处理缺失值、异常值,选择最相关的特征等操作,根据经过清洗和特征选择的数据,生成第一负荷输入,并将第一负荷输入作为第一负荷预测模型的输入值;Use the first load prediction model for data cleaning and feature selection, including processing missing values, outliers, selecting the most relevant features, etc. Based on the cleaned and feature selected data, generate the first load input and input the first load As the input value of the first load forecasting model;
示例性地,假设有一个电网,想要预测未来一天的电力负荷。收集了历史用电数据和与电网节点中的智能传感器相关的电网状态数据,对于缺失的时间点,使用前后数据的平均值进行填充,通过基于阈值的方法,将超出合理范围的数据视为异常值并进行处理,计算各特征与目标(负荷)之间的相关性,选择相关性高的特征,通过上述操作,得到所述第一负荷输入。For example, suppose you have a power grid and want to predict the power load for the next day. Historical power consumption data and grid status data related to smart sensors in grid nodes are collected. For missing time points, the average value of before and after data is used to fill in the data. Through a threshold-based method, data beyond the reasonable range are regarded as anomalies. value and process it, calculate the correlation between each feature and the target (load), select the feature with high correlation, and obtain the first load input through the above operations.
所述合理范围的数据可以根据历史用电数据确定,也可根据日期和时间,进行对应的调整,如夏天由于空调的使用,会增大电网负荷,所以上述方案中合理范围可以根据历史夏天平均负荷进行确定。The reasonable range of data can be determined based on historical power consumption data, or can be adjusted accordingly based on the date and time. For example, the use of air conditioners in summer will increase the grid load, so the reasonable range in the above scheme can be based on the historical summer average. Load is determined.
使用深度学习框架,导入所需的层、优化器和其他工具,加载已经预训练好的第一负荷预测模型,该模型包含双向状态网络,获取所述第一负荷输入数据,并确保格式和结构与模型输入匹配,将第一负荷输入数据添加到已加载的第一负荷预测模型中,通过模型的输出获取前向和后向隐藏状态。Using a deep learning framework, import the required layers, optimizers and other tools, load the pre-trained first load prediction model, which contains a bidirectional state network, obtain the first load input data, and ensure the format and structure Matching the model inputs, the first load input data is added to the loaded first load prediction model, and the forward and backward hidden states are obtained through the output of the model.
所述前向隐藏状态是模型在处理输入序列时从序列的起始到结束所保留的信息,前向隐藏状态包含了序列中当前时间步之前的所有信息,是模型在当前时间步之前所学到的表示,所述后向隐藏状态是模型在处理输入序列时从序列的结束到起始所保留的信息,后向隐藏状态包含了序列中当前时间步之后的所有信息,是模型在当前时间步之后所学到的表示。The forward hidden state is the information retained by the model from the beginning to the end of the sequence when processing the input sequence. The forward hidden state contains all the information before the current time step in the sequence and is what the model has learned before the current time step. The backward hidden state is the information retained by the model from the end to the beginning of the sequence when processing the input sequence. The backward hidden state contains all the information after the current time step in the sequence and is the model's current time. The representation learned after the step.
获取双向状态网络中特定层的前向隐藏状态和后向隐藏状态,通过对应元素相加将前向和后向隐藏状态与原始输入进行残差连接,对于特定层,可能需要选择不同的残差连接策略,如选择直接加法连接或加权加法连接,使用自注意力机制计算注意力权重,并将所述注意力权重应用于隐藏状态的加权组合,对双向隐藏状态进行调整,确定经过残差模块和自注意力机制处理后的隐藏状态,并将这一隐藏状态作为第二负荷输入;Obtain the forward hidden state and backward hidden state of a specific layer in the bidirectional state network, and perform residual connection between the forward and backward hidden states with the original input by adding the corresponding elements. For a specific layer, you may need to choose different residuals Connection strategy, such as choosing direct additive connection or weighted additive connection, using the self-attention mechanism to calculate attention weights, and applying the attention weights to the weighted combination of hidden states, adjusting the bidirectional hidden states, and determining the residual module and the hidden state processed by the self-attention mechanism, and use this hidden state as the second load input;
示例性地,假设有一个任务是预测电网的负荷情况,定义一个包含多个计算层的预测模型,每个计算层都有对应的前向隐藏状态和后向隐藏状态,我们将残差模块设置在特定层进行残差连接,在每个计算层中,提取对应的前向隐藏状态和后向隐藏状态,并根据自注意力机制动态调整提取到的前向隐藏状态和后向隐藏状态的权重,通过注意力权重对所述双向状态网络进行调整,确定所述第二负荷输入。For example, assuming that there is a task to predict the load condition of the power grid and define a prediction model containing multiple calculation layers. Each calculation layer has a corresponding forward hidden state and backward hidden state. We set the residual module Residual connections are performed in specific layers. In each calculation layer, the corresponding forward hidden state and backward hidden state are extracted, and the weights of the extracted forward hidden state and backward hidden state are dynamically adjusted according to the self-attention mechanism. , adjusting the bidirectional state network through attention weights to determine the second load input.
在本步骤中,通过整合历史用电数据和电网状态数据,电网初始数据形成了一个包含丰富信息的综合数据集,提高了对电网整体状态的综合认知,有助于建立更全面、准确的负荷预测模型;第一负荷预测模型对电网初始数据进行了数据清洗和特征选择,提取了关键的负荷预测特征,通过去除噪声和选择重要特征,提高了模型对输入数据的理解和表达能力,增强了模型的泛化能力;利用双向状态网络提取了每个时间步的前向和后向隐藏状态,能够捕捉到时间序列中前后相关的信息,更好地反映了负荷的动态变化,提高了模型对序列的建模能力;在特定层引入残差模块和自注意力机制,强化了模型对序列信息的处理能力,通过残差连接,模型更好地保留了原始输入的信息;自注意力机制增强了模型对序列中不同时间步的关注度,提高了对关键信息的捕捉能力。In this step, by integrating historical power consumption data and grid status data, the initial grid data forms a comprehensive data set containing rich information, which improves the comprehensive understanding of the overall status of the grid and helps to establish a more comprehensive and accurate Load forecasting model; the first load forecasting model performs data cleaning and feature selection on the initial data of the power grid, extracts key load forecasting features, and improves the model's ability to understand and express the input data by removing noise and selecting important features, and enhances It improves the generalization ability of the model; the bidirectional state network is used to extract the forward and backward hidden states of each time step, which can capture the relevant information in the time series, better reflect the dynamic changes of the load, and improve the model The ability to model sequences; the introduction of residual modules and self-attention mechanisms in specific layers strengthens the model's ability to process sequence information. Through residual connections, the model better retains the original input information; self-attention mechanism It enhances the model's attention to different time steps in the sequence and improves its ability to capture key information.
综上,该实施例通过整合多源数据、引入复杂的模型结构和处理机制,有效地提高了电网负荷预测的能力,为电网调控提供了更智能化的支持。In summary, this embodiment effectively improves the ability of power grid load prediction by integrating multi-source data and introducing complex model structures and processing mechanisms, and provides more intelligent support for power grid regulation.
S2.根据所述第二负荷输入,结合预设的第二负荷预测模型,将所述第二负荷输入在所述第二负荷预测模型中以根节点至叶节点的顺序进行传递,得到第二负荷输出,根据所述第二负荷输出,结合预设的结果优化算法,确定负荷预测结果,其中,所述第二负荷模型是基于极端梯度提升算法构建的树模型;S2. According to the second load input, combined with the preset second load prediction model, the second load input is transferred in the order of root node to leaf node in the second load prediction model to obtain the second load prediction model. Load output, determine the load prediction result according to the second load output and combined with the preset result optimization algorithm, wherein the second load model is a tree model constructed based on the extreme gradient boosting algorithm;
所述树模型是一类基于树结构的机器学习模型,通过对输入数据进行递归的二元划分,构建一颗树形结构来进行预测或分类;所述根节点是决策树或树状模型的起始节点,位于树的最顶端。它是树的入口,从根节点开始,树的每一层节点都通过边连接到下一层节点,根节点的任务是选择一个特征,然后根据该特征对输入数据进行划分,所述叶节点是树的末端节点,它没有子节点。在叶节点上,模型给出最终的输出或预测结果,叶节点包含一个输出值,这个值是由输入数据在树的每个分支上经过判定条件后最终到达的叶节点决定的。所述极端梯度提升是一种梯度提升算法,属于集成学习的一种。The tree model is a type of machine learning model based on a tree structure. It constructs a tree structure for prediction or classification through recursive binary division of input data; the root node is a decision tree or tree model. The starting node is located at the top of the tree. It is the entrance of the tree. Starting from the root node, each node of the tree is connected to the node of the next layer through edges. The task of the root node is to select a feature and then divide the input data according to the feature. The leaf nodes is the end node of the tree, it has no child nodes. At the leaf node, the model gives the final output or prediction result. The leaf node contains an output value. This value is determined by the leaf node that the input data finally reaches after passing the judgment condition on each branch of the tree. The extreme gradient boosting is a gradient boosting algorithm, which is a type of ensemble learning.
在一种可选的实施方式中,In an alternative implementation,
根据所述第二负荷输入,结合预设的第二负荷预测模型,将所述第二负荷输入在所述第二负荷预测模型中以根节点至叶节点的顺序进行传递,得到第二负荷输出,根据所述第二负荷输出,结合预设的结果优化算法,确定负荷预测结果,其中,所述第二负荷模型是基于极端梯度提升算法构建的树模型包括:According to the second load input, combined with the preset second load prediction model, the second load input is transferred in the second load prediction model in the order of root node to leaf node to obtain the second load output. , according to the second load output, combined with the preset result optimization algorithm, the load prediction result is determined, wherein the second load model is a tree model constructed based on the extreme gradient boosting algorithm and includes:
获取所述第二负荷输入,将所述第二负荷输入加入至所述第二负荷预测模型,所述第二负荷输入从所述第二负荷预测模型的根节点向下传递,在每个叶节点处,根据预设的节点分裂条件,判断传递方向,若满足所述预设的节点分裂条件则向左传递,若不满足,则向右传递,直至传递完成,得到所述第二负荷输出;Obtain the second load input, add the second load input to the second load prediction model, and pass the second load input downward from the root node of the second load prediction model, at each leaf At the node, the transmission direction is determined according to the preset node splitting conditions. If the preset node splitting conditions are met, the transmission is to the left. If not, the transmission is to the right until the transmission is completed, and the second load output is obtained. ;
根据所述第二负荷输出,结合所述结果优化算法,去除所述第二负荷中的异常值并根据数据趋势进行修正,确定所述负荷预测结果。According to the second load output, combined with the result optimization algorithm, the abnormal values in the second load are removed and corrected according to the data trend to determine the load prediction result.
从树模型的根节点开始,根据预设的节点分裂条件,递归地将第二负荷输入传递至树的每个节点,对于每个节点,判断传递方向:若满足节点分裂条件,则向左传递,否则向右传递,重复此过程,直至到达叶节点,在叶节点处,获取该节点的输出值,即第二负荷的预测值,这个输出值将作为最终的第二负荷输出;Starting from the root node of the tree model, recursively transfer the second load input to each node of the tree according to the preset node splitting conditions. For each node, determine the transfer direction: if the node splitting conditions are met, transfer to the left , otherwise pass to the right, repeat this process until reaching the leaf node, at the leaf node, obtain the output value of the node, that is, the predicted value of the second load, this output value will be used as the final second load output;
所述节点分裂条件,是根据具体的节点设置的,示例性的,现在有一个特征向量(x,y),第一节点的分裂条件为x大于1,如果符合,则进入左子树,如果不符合,则进入右子树。The node splitting condition is set according to the specific node. For example, there is now a feature vector (x, y). The splitting condition of the first node is that x is greater than 1. If it is met, enter the left subtree. If If not, enter the right subtree.
利用结果优化算法对第二负荷输出进行优化,使用异常值检测算法识别并去除第二负荷输出中的异常值;分析第二负荷输出的趋势,可以使用滑动窗口、指数平滑等方法,根据过去的观测值来修正可能的异常值,使其符合数据的整体趋势;结合去除异常值和趋势修正后的第二负荷输出,确定最终的负荷预测结果。Use the result optimization algorithm to optimize the second load output, use the outlier detection algorithm to identify and remove outliers in the second load output; analyze the trend of the second load output, you can use sliding window, exponential smoothing and other methods, based on past Observed values are used to correct possible outliers to make them consistent with the overall trend of the data; the final load forecast result is determined by combining the second load output after removing outliers and trend correction.
示例性地,假设有一份包含历史负荷数据的时间序列,其中每个时间点都有相应的第二负荷值,使用Z-score或IQR等统计学方法进行异常值检测,假设某个时间点的第二负荷值超过了一定的阈值,被认为是异常值,将被检测为异常值的数据点从第二负荷输出中去除,可以通过删除异常值或用合理的替代值(例如前后时刻的平均值)进行填充,利用滑动窗口、指数平滑等方法分析第二负荷输出的趋势,如果在某个时间点的第二负荷值明显偏离了趋势,可能是异常点,需要进行修正;使用滑动窗口平均或滑动窗口中位数等方法,计算每个时间点的邻近时间点的平均或中位数,将当前时间点的第二负荷值与计算得到的值比较,进行修正。将修正后的第二负荷输出与之前去除异常值的结果合并,得到最终的负荷预测结果。For example, assume that there is a time series containing historical load data, in which each time point has a corresponding second load value, and statistical methods such as Z-score or IQR are used to detect outliers. Assume that at a certain time point The second load value exceeds a certain threshold and is considered an outlier. The data points detected as outliers are removed from the second load output. This can be done by deleting the outliers or using reasonable replacement values (such as the average of the preceding and following moments). value) to fill in, use sliding window, exponential smoothing and other methods to analyze the trend of the second load output. If the second load value at a certain point in time obviously deviates from the trend, it may be an abnormal point and needs to be corrected; use sliding window averaging Or sliding window median and other methods, calculate the average or median of adjacent time points at each time point, compare the second load value at the current time point with the calculated value, and make corrections. The corrected second load output is combined with the previous result of removing outliers to obtain the final load forecast result.
本实施例中,通过将第二负荷输入逐层传递至树模型的叶节点,模型能够根据不同特征和条件进行精细划分,从而提高负荷预测的准确性;通过预设的节点分裂条件,模型能够自适应地根据输入数据的特征进行不同的划分,使得模型更能够适应复杂的电网负荷变化规律;结果优化算法结合异常值检测和修正策略,有助于去除第二负荷输出中的异常值。这提高了负荷预测的鲁棒性,使得模型在面对异常情况时能够更好地适应和预测,通过分析第二负荷输出的趋势,采用滑动窗口、指数平滑等方法,可以更好地捕捉和修正数据的变化趋势。这有助于使负荷预测结果更加平稳和符合实际情况。In this embodiment, by transferring the second load input to the leaf nodes of the tree model layer by layer, the model can be finely divided according to different characteristics and conditions, thereby improving the accuracy of load prediction; through the preset node splitting conditions, the model can Adaptively perform different divisions based on the characteristics of the input data, making the model more adaptable to complex power grid load changes; the resulting optimization algorithm, combined with outlier detection and correction strategies, helps remove outliers in the second load output. This improves the robustness of load forecasting, allowing the model to better adapt and predict when faced with abnormal situations. By analyzing the trend of the secondary load output and using methods such as sliding windows and exponential smoothing, it can better capture and predict Correct data trends. This helps make the load forecast results smoother and more realistic.
在一种可选的实施方式中,所述方法还包括训练第二负荷预测模型:In an optional implementation, the method further includes training a second load prediction model:
获取第二负荷输入,将所述第二负荷输入转换为特征向量,对于连续特征值,通过等频分桶策略将所述连续特征值划分离散的区间,进行离散化,得到特征取值范围,根据所述特征取值范围,通过轻量梯度提升算法构建直方图;Obtain the second load input and convert the second load input into a feature vector. For continuous feature values, divide the continuous feature values into discrete intervals through the equal-frequency bucketing strategy and perform discretization to obtain the feature value range. According to the feature value range, a histogram is constructed through a lightweight gradient boosting algorithm;
基于叶节点优先生长策略,通过节点增益函数确定当前叶节点的第一增益值,选择当前叶节点中拥有最大增益的节点进行分裂,得到最大增益值并根据所述最大增益值构建损失函数,根据所述损失函数,计算当前叶节点的梯度和二阶导数,并构建目标函数的二阶泰勒展开;Based on the leaf node priority growth strategy, the first gain value of the current leaf node is determined through the node gain function, the node with the maximum gain among the current leaf nodes is selected for splitting, the maximum gain value is obtained, and a loss function is constructed based on the maximum gain value. According to The loss function calculates the gradient and second-order derivative of the current leaf node, and constructs a second-order Taylor expansion of the objective function;
对于每个叶节点,遍历全部叶节点的特征值,结合当前叶节点的梯度和二阶导数,确定分裂后损失函数值最小叶节点,将这一叶节点记为分裂叶节点,并将所述分裂叶节点分裂为两个叶节点,并计算分裂后叶节点的梯度和二阶导数,重复操作直至满足停止条件。For each leaf node, traverse the eigenvalues of all leaf nodes, combine the gradient and second-order derivative of the current leaf node, determine the leaf node with the smallest loss function value after splitting, record this leaf node as a split leaf node, and record the The split leaf node is split into two leaf nodes, and the gradient and second derivative of the split leaf node are calculated, and the operation is repeated until the stopping condition is met.
获取第二负荷的历史数据,包括各种特征如温度、季节、时间等,将第二负荷输入转换为特征向量。对于连续特征,使用等频分桶策略进行离散化,得到特征的离散值。每个样本将转化为一个包含各个特征的特征向量,初始化一个树模型,设定树的最大深度、学习率等超参数,对每个特征进行离散化后,基于轻量梯度提升算法构建直方图。Obtain the historical data of the second load, including various characteristics such as temperature, season, time, etc., and convert the second load input into a feature vector. For continuous features, the equal-frequency bucketing strategy is used for discretization to obtain the discrete values of the features. Each sample will be converted into a feature vector containing each feature, a tree model is initialized, and hyperparameters such as the maximum depth of the tree and learning rate are set. After each feature is discretized, a histogram is constructed based on a lightweight gradient boosting algorithm. .
从根节点开始,初始化整棵树,遍历每个叶节点,通过节点增益函数确定当前叶节点的第一增益值,示例性地,从根节点开始,整棵树开始为空,对于每个叶节点,计算其第一增益值,这是通过节点增益函数来确定的,节点增益函数通常是一个代表模型拟合质量的指标,如平方损失、绝对损失等。它表示在当前节点上模型的性能提升程度。在平方损失的情况下,增益可以是节点分裂前后的均方误差减小量,对于每个叶节点,计算其分裂后左子节点和右子节点的节点增益值。Starting from the root node, initialize the entire tree, traverse each leaf node, and determine the first gain value of the current leaf node through the node gain function. For example, starting from the root node, the entire tree starts to be empty. For each leaf node, calculate its first gain value, which is determined by the node gain function. The node gain function is usually an indicator representing the quality of model fitting, such as square loss, absolute loss, etc. It indicates the degree of performance improvement of the model on the current node. In the case of square loss, the gain can be the mean square error reduction before and after the node split. For each leaf node, calculate the node gain value of its left child node and right child node after the split.
选择具有最大增益的叶节点进行分裂,根据最大增益值构建损失函数,通常使用平方损失或绝对损失,根据损失函数,计算当前叶节点的梯度和二阶导数,并构建目标函数的二阶泰勒展开。Select the leaf node with the maximum gain for splitting, construct a loss function based on the maximum gain value, usually using square loss or absolute loss, calculate the gradient and second-order derivative of the current leaf node according to the loss function, and construct the second-order Taylor expansion of the objective function .
遍历当前叶节点的特征值,对每个特征值进行分裂测试,结合当前叶节点的梯度和二阶导数,确定分裂后损失函数值最小的叶节点。将满足条件的特征值作为分裂点,将当前叶节点分裂为两个叶节点,计算分裂后叶节点的梯度和二阶导数,重复操作,直至树的深度达到设定值或节点中样本数小于某个阈值。Traverse the eigenvalues of the current leaf node, perform a split test on each eigenvalue, and combine the gradient and second derivative of the current leaf node to determine the leaf node with the smallest loss function value after splitting. Use the eigenvalues that meet the conditions as the split point, split the current leaf node into two leaf nodes, calculate the gradient and second-order derivative of the split leaf node, and repeat the operation until the depth of the tree reaches the set value or the number of samples in the node is less than a certain threshold.
所述等频分桶策略是一种将连续特征值划分为离散区间的方法,确保每个区间内包含相同数量的样本,等频分桶策略通过对数据的分段来简化复杂性,同时减少对异常值的敏感性,并提高模型的鲁棒性。等频分同策略具体为,对特征值进行升序排序,据需要确定分桶的数量,例如,如果希望将特征分为 10 个桶,那么就将数据划分为10个等分,根据分桶的数量计算相应的分位数,将特征值根据计算得到的分位数分成对应的桶。每个桶内包含相同数量的样本,将每个桶用一个标签或代表该桶的值进行离散化。The equal-frequency bucketing strategy is a method of dividing continuous feature values into discrete intervals to ensure that each interval contains the same number of samples. The equal-frequency bucketing strategy simplifies complexity by segmenting data while reducing Sensitivity to outliers and improve model robustness. The specific strategy of equal frequency classification is to sort the feature values in ascending order and determine the number of buckets as needed. For example, if you want to divide the features into 10 buckets, then divide the data into 10 equal parts. Quantity calculates the corresponding quantile, and divides the feature values into corresponding buckets based on the calculated quantile. Each bucket contains the same number of samples, and each bucket is discretized with a label or value that represents the bucket.
在本实施例中,通过采用轻量梯度提升算法和节点优先生长策略,能够更高效地构建树模型,减少计算复杂度,提高模型的训练速度,通过等频分桶策略进行特征离散化,有助于提高模型的鲁棒性,减少对异常值的敏感性,使模型更好地适应不同的数据分布,通过节点分裂和优化操作,使得树模型能够更好地捕捉数据的非线性关系,提高了模型的预测性能。In this embodiment, by using the lightweight gradient boosting algorithm and the node priority growth strategy, the tree model can be constructed more efficiently, reducing the computational complexity, improving the training speed of the model, and performing feature discretization through the equal-frequency bucketing strategy. Helps improve the robustness of the model, reduce sensitivity to outliers, and enable the model to better adapt to different data distributions. Through node splitting and optimization operations, the tree model can better capture the nonlinear relationship of the data and improve the prediction performance of the model.
在一种可选的实施方式中, 通过节点增益函数确定当前叶节点的第一增益值,选择当前叶节点中拥有最大增益的节点进行分裂,得到最大增益值并根据所述最大增益值构建损失函数如下公式所示:In an optional implementation, the first gain value of the current leaf node is determined through the node gain function, the node with the maximum gain among the current leaf nodes is selected for splitting, the maximum gain value is obtained, and the loss is constructed based on the maximum gain value The function is shown in the following formula:
; ;
其中,D表示当前节点的数据集,Loss(D)表示损失函数,y i表示样本i的真实标签,y avg表示当前节点的均值,y split表示分裂后的节点均值,max split ()表示在所有可能的方式中选择能够最大化损失函数的分裂方式。Among them, D represents the data set of the current node, Loss(D) represents the loss function, y i represents the real label of sample i , y avg represents the mean value of the current node, y split represents the node mean value after splitting, max split () represents the Choose the splitting method that maximizes the loss function among all possible methods.
本函数通过计算损失函数,选择当前叶节点中具有最大增益的节点进行分裂。这意味着模型在选择分裂节点时,更加关注于提高整体模型的拟合效果,使得分裂后的子节点更有可能包含更多的信息,能够更好地捕捉样本之间的差异,通过损失函数的最大化选择分裂方式,模型更加注重提高训练集的拟合效果,有望提高模型的预测性能。这在电网调控中特别重要,因为精准的负荷预测对于电网的合理调度至关重要,同时由于损失函数考虑了分裂后节点的均方误差,因此模型更加适应于不同分布的数据,综上,本函数可以使轻量梯度提升算法更加有效地构建树模型,提高模型的性能和鲁棒性,进而在电网调控中实现更加精准和可靠的负荷预测。This function calculates the loss function and selects the node with the largest gain among the current leaf nodes for splitting. This means that when selecting split nodes, the model focuses more on improving the fitting effect of the overall model, making the split child nodes more likely to contain more information and better capture the differences between samples. Through the loss function By maximizing the selection splitting method, the model pays more attention to improving the fitting effect of the training set, which is expected to improve the prediction performance of the model. This is particularly important in power grid regulation, because accurate load forecasting is crucial for reasonable dispatch of the power grid. At the same time, because the loss function takes into account the mean square error of the nodes after splitting, the model is more suitable for data with different distributions. In summary, this paper The function can make the lightweight gradient boosting algorithm build a tree model more effectively, improve the performance and robustness of the model, and achieve more accurate and reliable load forecasting in power grid regulation.
S3.根据所述负荷预测结果,结合电网初始数据,构建能源动作空间,根据所述能源动作空间,通过预设的策略优化算法,确定调控优化策略,其中,所述策略优化算法是根据改良的近端策略优化算法构建的。S3. According to the load prediction results and combined with the initial data of the power grid, an energy action space is constructed. According to the energy action space, a control optimization strategy is determined through a preset strategy optimization algorithm. The strategy optimization algorithm is based on an improved Constructed by proximal strategy optimization algorithm.
所述能源动作空间是指在电网调控中,系统可供选择的能源调度方案的集合。它描述了在给定一定的电网初始数据和负荷预测结果下,系统可以采取的各种能源调度决策;所述策略优化算法是一种用于优化策略的近端方法,通过在每次迭代中执行多个策略更新步骤,通过最小化策略更新的相对概率比例来确保更新的保守性。The energy action space refers to the collection of energy dispatching plans that can be selected by the system in power grid regulation. It describes various energy dispatch decisions that the system can take given certain initial data of the power grid and load forecast results; the strategy optimization algorithm is a proximal method for optimizing strategies, by Multiple policy update steps are performed to ensure the conservativeness of the update by minimizing the relative probability ratio of the policy update.
在一种可选的实施方式中,In an alternative implementation,
根据所述负荷预测结果,结合电网初始数据,构建能源动作空间,根据所述能源动作空间,通过预设的策略优化算法,确定调控优化策略,其中,所述策略优化算法是根据改良的近端策略优化算法构建的包括:According to the load prediction results, combined with the initial data of the power grid, an energy action space is constructed. According to the energy action space, a control optimization strategy is determined through a preset strategy optimization algorithm, wherein the strategy optimization algorithm is based on an improved near-end The strategy optimization algorithm constructed includes:
获取所述负荷预测结果和所述电网初始数据,根据所述负荷预测结果和所述电网初始数据,定义状态空间,根据所述状态空间确定第一调整范围和第二调整范围,根据所述第一调整范围和第二调整范围,结合预先获取的电源单元特性,确定所述能源动作空间;Obtain the load prediction result and the power grid initial data, define a state space according to the load prediction result and the power grid initial data, determine a first adjustment range and a second adjustment range according to the state space, and determine the first adjustment range and the second adjustment range according to the state space. The first adjustment range and the second adjustment range determine the energy action space in combination with the pre-acquired power unit characteristics;
根据所述能源动作空间,结合系统损耗和电网稳定性,确定奖励函数,根据所述奖励函数,在每个时间步根据所述策略优化算法选择电网动作,根据所述电网动作,迭代所述状态空间和所述能源动作空间,根据迭代后的状态空间和能源动作空间,结合预设的策略优化算法,确定所述调控优化策略。According to the energy action space, combined with system losses and grid stability, a reward function is determined. According to the reward function, a grid action is selected according to the policy optimization algorithm at each time step. According to the grid action, the state is iterated space and the energy action space. According to the iterated state space and energy action space, combined with the preset strategy optimization algorithm, the control optimization strategy is determined.
从数据库或其他数据源中获取负荷预测结果和电网初始数据,结合负荷预测结果和电网初始数据,定义状态空间。状态空间可能包括电网节点状态、负荷需求、能源供给状态等,根据定义的状态空间,结合预先获取电源单元的特性,包括发电机启停特性、储能系统的充放电特性,定义能源动作空间,包括有功功率的调整、无功功率的调整、电力市场交易等。Obtain the load prediction results and the initial data of the power grid from the database or other data sources, and combine the load prediction results and the initial data of the power grid to define the state space. The state space may include grid node status, load demand, energy supply status, etc. According to the defined state space, combined with the characteristics of the power supply unit obtained in advance, including the start-stop characteristics of the generator and the charging and discharging characteristics of the energy storage system, the energy action space is defined. Including active power adjustment, reactive power adjustment, power market transactions, etc.
示例性地,发电机最大有功功率:1000 kW,最小有功功率输出(Pmin):100 kW,有功功率调整粒度:50 kW,最大无功功率输出(Qmax):300 kVAR,最小无功功率输出(Qmin):-200 kVAR,则发电机的能源动作空间的有功功率范围:100 kW - 1000 kW,以50 kW为调整粒度,无功功率范围:-200 kVAR - 300 kVAR,以50 kVAR为调整粒度。For example, the maximum active power of the generator: 1000 kW, the minimum active power output (Pmin): 100 kW, the active power adjustment granularity: 50 kW, the maximum reactive power output (Qmax): 300 kVAR, the minimum reactive power output ( Qmin): -200 kVAR, then the active power range of the generator's energy action space: 100 kW - 1000 kW, with 50 kW as the adjustment granularity, and the reactive power range: -200 kVAR - 300 kVAR, with 50 kVAR as the adjustment granularity .
根据电网状态和电源单元的输出,计算系统损耗,考虑电压稳定性、频率稳定性等因素,定义电网稳定性指标,将系统损耗和电网稳定性指标结合,构建奖励函数,如奖励函数可以是系统损耗的负值,因为系统损耗越小越好,同时考虑电网稳定性的影响,并根据之前步骤定义的状态空间和能源动作空间,作为优化算法的搜索空间。According to the power grid status and the output of the power supply unit, calculate the system loss, consider voltage stability, frequency stability and other factors, define the grid stability index, combine the system loss and the grid stability index, and construct a reward function. For example, the reward function can be the system The negative value of the loss, because the smaller the system loss, the better, taking into account the impact of grid stability, and using the state space and energy action space defined in the previous steps as the search space of the optimization algorithm.
在每个时间步,使用策略优化算法在定义好的状态空间和能源动作空间中搜索最优动作,优化算法生成新的电网动作,更新电源单元的输出,模拟电网的响应,根据当前电网状态、电源单元的输出和定义的奖励函数,计算当前时间步的奖励,利用奖励信息,更新策略优化算法中的参数或模型,重复上述步骤,直至达到最大迭代次数或预设停止条件,如迭代50次,根据最终的策略模型,确定调控优化策略,即在给定电网状态下应采取的电源单元动作。At each time step, a strategy optimization algorithm is used to search for optimal actions in the defined state space and energy action space. The optimization algorithm generates new grid actions, updates the output of the power supply unit, and simulates the response of the grid. According to the current grid state, Calculate the reward of the current time step based on the output of the power unit and the defined reward function, use the reward information to update the parameters or model in the policy optimization algorithm, and repeat the above steps until the maximum number of iterations or the preset stop condition is reached, such as 50 iterations. , based on the final strategy model, determine the control optimization strategy, that is, the power unit actions that should be taken under a given grid state.
所述第一调整范围具体指无功功率的调整范围,所述第二调整范围具体指有功功率的调整范围,所述状态空间是描述电网和系统状态的集合,包括但不限于电网节点电压、频率等电网状态,系统负荷需求,所述能源动作空间具体指电源单元可调整的动作范围,包括有功功率和无功功率的调整范围,发电机启停状态,储能系统的充放电状态以及其他电源单元的动作,所述电源单元特性是指供电系统中的发电机、储能系统等能源装置。The first adjustment range specifically refers to the adjustment range of reactive power, the second adjustment range specifically refers to the adjustment range of active power, and the state space is a set that describes the status of the power grid and the system, including but not limited to grid node voltage, Grid status such as frequency, system load demand, the energy action space specifically refers to the adjustable action range of the power supply unit, including the adjustment range of active power and reactive power, the start and stop status of the generator, the charging and discharging status of the energy storage system, and others Actions of the power supply unit, the characteristics of the power supply unit refer to energy devices such as generators and energy storage systems in the power supply system.
在本实施例中,通过定义状态空间,确定第一调整范围和第二调整范围,系统能够在更高层次、更全面的维度上考虑电网状态和调整需求。这有助于提高调控的灵活性和精确性,考虑电源单元的特性,如发电机的启停特性、储能系统的充放电效率等,有助于构建更符合实际的能源动作空间,通过细致设计奖励函数和选择适用于电网调控问题的策略优化算法,可以使系统更加智能地作出调控决策,基于能源动作空间的调控决策不仅仅考虑系统损耗的优化,还综合考虑电网的稳定性,这有助于维持电网的安全运行和提高电能的经济利用效率。In this embodiment, by defining the state space and determining the first adjustment range and the second adjustment range, the system can consider the power grid status and adjustment requirements at a higher level and in a more comprehensive dimension. This helps to improve the flexibility and accuracy of regulation. Taking into account the characteristics of the power supply unit, such as the start and stop characteristics of the generator, the charge and discharge efficiency of the energy storage system, etc., it helps to build a more realistic energy action space. Designing reward functions and selecting strategic optimization algorithms suitable for power grid control problems can make the system make control decisions more intelligently. Control decisions based on energy action space not only consider the optimization of system losses, but also comprehensively consider the stability of the power grid. This has Help maintain the safe operation of the power grid and improve the economic efficiency of electric energy utilization.
综上,本实施例通过全面考虑系统状态、能源特性和调控需求,以智能的方式进行实时决策和迭代优化,从而全面提升电网调控的效能,使电网更加安全、稳定和高效。In summary, this embodiment comprehensively considers the system status, energy characteristics and control requirements, and performs real-time decision-making and iterative optimization in an intelligent manner, thereby comprehensively improving the efficiency of power grid control and making the power grid more secure, stable and efficient.
在一种可选的实施方式中,根据所述能源动作空间,结合系统损耗和电网稳定性,确定奖励函数如下公式所示:In an optional implementation, according to the energy action space, combined with system loss and grid stability, the reward function is determined as follows:
; ;
其中,R(s,a)表示奖励值,s表示系统状态,a表示电网动作,Loss(s,a)表示系统损耗,α表示权重系数,VoltageStability(s,a)表示电压稳定性。Among them, R(s,a) represents the reward value, s represents the system state, a represents the grid action, Loss(s,a) represents the system loss, α represents the weight coefficient, and VoltageStability(s,a) represents the voltage stability.
通过使用本函数,通过最小化系统损耗,调控系统更趋向于提高电能的有效利用率,降低能量损失,从而促进电网的经济性,通过引入电压稳定性项,奖励函数使得系统调控更关注电网的稳定性。这有助于防止因调控决策引起的电压不稳定问题,提高电网的可靠性,奖励函数综合考虑了系统损耗和电压稳定性两个重要因素。通过调整权重系数,可以平衡在经济性和稳定性之间的权衡。这样的综合优化目标有助于实现电网调控决策的多目标优化,综上,通过使用本函数,充分考虑了经济性和稳定性两个方面,通过权衡两者的关系,使得电网调控系统在多级数据的支持下更加智能、全面地进行调控决策,进一步提高电网的调控效能。By using this function and minimizing system losses, the control system tends to improve the effective utilization of electric energy and reduce energy losses, thereby promoting the economy of the power grid. By introducing the voltage stability term, the reward function makes system control pay more attention to the power grid. stability. This helps prevent voltage instability caused by regulation decisions and improves the reliability of the power grid. The reward function takes into account two important factors: system loss and voltage stability. By adjusting the weight coefficient, the trade-off between economy and stability can be balanced. Such a comprehensive optimization goal helps to achieve multi-objective optimization of power grid regulation decisions. In summary, by using this function, the two aspects of economy and stability are fully considered. By weighing the relationship between the two, the power grid regulation system can achieve multi-objective optimization. With the support of advanced data, control decisions can be made more intelligently and comprehensively to further improve the control efficiency of the power grid.
图2为本发明实施例一种基于多级数据的电网调控系统的结构示意图,如图2所示,所述系统包括:Figure 2 is a schematic structural diagram of a power grid control system based on multi-level data according to an embodiment of the present invention. As shown in Figure 2, the system includes:
第一单元,用于获取电网初始数据,将电网初始数据输入至预设的第一负荷预测模型,通过所述第一负荷预测模型对所述电网初始数据进行预处理,确定第一负荷输入,根据所述第一负荷输入,结合所述第一负荷预测模型,得到第二负荷输入;The first unit is used to obtain the initial data of the power grid, input the initial data of the power grid into a preset first load prediction model, preprocess the initial data of the power grid through the first load prediction model, and determine the first load input, According to the first load input, combined with the first load prediction model, a second load input is obtained;
第二单元,用于根据所述第二负荷输入,结合预设的第二负荷预测模型,将所述第二负荷输入在所述第二负荷预测模型中以根节点至叶节点的顺序进行传递,得到第二负荷输出,根据所述第二负荷输出,结合预设的结果优化算法,确定负荷预测结果,其中,所述第二负荷模型是基于极端梯度提升算法构建的树模型;The second unit is configured to transmit the second load input in the second load prediction model in the order of root node to leaf node according to the second load input and combined with the preset second load prediction model. , obtain the second load output, and determine the load prediction result according to the second load output in combination with the preset result optimization algorithm, where the second load model is a tree model constructed based on the extreme gradient boosting algorithm;
第三单元,用于根据所述负荷预测结果,结合电网初始数据,构建能源动作空间,根据所述能源动作空间,通过预设的策略优化算法,确定调控优化策略,其中,所述策略优化算法是根据改良的近端策略优化算法构建的。The third unit is used to construct an energy action space based on the load prediction results and combined with the initial data of the power grid. According to the energy action space, determine the control optimization strategy through a preset strategy optimization algorithm, wherein the strategy optimization algorithm It is built based on the improved proximal strategy optimization algorithm.
本发明可以是方法、装置、系统和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于执行本发明的各个方面的计算机可读程序指令。The invention may be a method, apparatus, system and/or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions thereon for performing various aspects of the invention.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, but not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features can be equivalently replaced; and these modifications or substitutions do not deviate from the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention. scope.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311407380.6A CN117175595B (en) | 2023-10-27 | 2023-10-27 | Power grid regulation and control method and system based on multi-level data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311407380.6A CN117175595B (en) | 2023-10-27 | 2023-10-27 | Power grid regulation and control method and system based on multi-level data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117175595A CN117175595A (en) | 2023-12-05 |
CN117175595B true CN117175595B (en) | 2024-03-15 |
Family
ID=88941619
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311407380.6A Active CN117175595B (en) | 2023-10-27 | 2023-10-27 | Power grid regulation and control method and system based on multi-level data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117175595B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117833291B (en) * | 2023-12-30 | 2024-10-15 | 北京国网电力技术股份有限公司 | Self-adaptive control method and system for network-structured energy storage system |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107451188A (en) * | 2017-06-26 | 2017-12-08 | 中国电力科学研究院 | A kind of dissemination method and system of power grid regulation model data multistage combination of nodes |
CN113783179A (en) * | 2020-06-09 | 2021-12-10 | 北京映翰通网络技术股份有限公司 | Power grid load prediction and optimization method |
EP3968247A1 (en) * | 2019-06-21 | 2022-03-16 | Siemens Aktiengesellschaft | Power load data prediction method and device, and storage medium |
CN114548653A (en) * | 2021-12-30 | 2022-05-27 | 国网宁夏电力有限公司 | A data acquisition method, system and electronic device for a power grid load control platform |
CN115952928A (en) * | 2023-03-13 | 2023-04-11 | 广东电网有限责任公司佛山供电局 | Short-term power load prediction method, device, equipment and storage medium |
CN115994314A (en) * | 2022-08-26 | 2023-04-21 | 上海市建筑科学研究院有限公司 | Load prediction method |
CN116187601A (en) * | 2023-05-04 | 2023-05-30 | 华北理工大学 | Comprehensive energy system operation optimization method based on load prediction |
CN116316599A (en) * | 2023-03-28 | 2023-06-23 | 广东电网有限责任公司东莞供电局 | Intelligent electricity load prediction method |
CN116646933A (en) * | 2023-07-24 | 2023-08-25 | 北京中能亿信软件有限公司 | Big data-based power load scheduling method and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111275240B (en) * | 2019-12-27 | 2023-06-09 | 华北电力大学 | A Load Forecasting Method Based on Multi-energy Coupling Scenario |
-
2023
- 2023-10-27 CN CN202311407380.6A patent/CN117175595B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107451188A (en) * | 2017-06-26 | 2017-12-08 | 中国电力科学研究院 | A kind of dissemination method and system of power grid regulation model data multistage combination of nodes |
EP3968247A1 (en) * | 2019-06-21 | 2022-03-16 | Siemens Aktiengesellschaft | Power load data prediction method and device, and storage medium |
CN113783179A (en) * | 2020-06-09 | 2021-12-10 | 北京映翰通网络技术股份有限公司 | Power grid load prediction and optimization method |
CN114548653A (en) * | 2021-12-30 | 2022-05-27 | 国网宁夏电力有限公司 | A data acquisition method, system and electronic device for a power grid load control platform |
CN115994314A (en) * | 2022-08-26 | 2023-04-21 | 上海市建筑科学研究院有限公司 | Load prediction method |
CN115952928A (en) * | 2023-03-13 | 2023-04-11 | 广东电网有限责任公司佛山供电局 | Short-term power load prediction method, device, equipment and storage medium |
CN116316599A (en) * | 2023-03-28 | 2023-06-23 | 广东电网有限责任公司东莞供电局 | Intelligent electricity load prediction method |
CN116187601A (en) * | 2023-05-04 | 2023-05-30 | 华北理工大学 | Comprehensive energy system operation optimization method based on load prediction |
CN116646933A (en) * | 2023-07-24 | 2023-08-25 | 北京中能亿信软件有限公司 | Big data-based power load scheduling method and system |
Non-Patent Citations (3)
Title |
---|
基于梯度提升决策树的电力短期负荷预测模型;毕云帆等;《青岛大学学报(工程技术版)》;全文 * |
基于深度强化学习近端策略优化的电网无功优化方法;张沛等;《电网技术》;全文 * |
基于近端策略优化算法的新能源电力系统安全约束经济调度方法;杨志学等;《电网技术》;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN117175595A (en) | 2023-12-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110969290B (en) | A method and system for runoff probability prediction based on deep learning | |
CN115130741A (en) | Multi-model fusion based multi-factor power demand medium and short term prediction method | |
CN111680818B (en) | Short-term reactive load prediction method and system | |
CN110518580A (en) | Active power distribution network operation optimization method considering micro-grid active optimization | |
CN118469332B (en) | A multi-type load collaborative control method and system for industrial parks | |
CN117175595B (en) | Power grid regulation and control method and system based on multi-level data | |
CN113361776A (en) | Power load probability prediction method based on user power consumption behavior clustering | |
CN117810976A (en) | Photovoltaic-scale-access-oriented power distribution network voltage scheduling system and method thereof | |
CN117060408A (en) | New energy power generation prediction method and system | |
CN116882079A (en) | Water pump characteristic curve self-adaptive calibration and prediction method | |
CN117650548A (en) | Comprehensive energy operation optimization method and system based on hydrogen energy storage cooperation | |
CN117748609A (en) | Optical storage power distribution method of comprehensive energy supply station | |
CN115616333A (en) | A distribution network line loss prediction method and system | |
CN110059938A (en) | A kind of distribution network planning method based on correlation rule driving | |
CN118508452A (en) | Dispatching method, device, equipment and storage medium for source-grid-load-storage power system | |
CN115994459B (en) | Method, system and equipment for optimizing construction time sequence of mass power grid infrastructure projects | |
CN117239734A (en) | Short-term power load prediction method based on Lasso-IGWO-BiLSTM | |
CN117911059A (en) | Power grid disclosure data and meteorological data-based electricity price prediction method and system | |
CN112467803B (en) | A method and system for generating typical scenarios of distributed power sources and new loads | |
CN116454941A (en) | Energy storage configuration method based on new energy load growth prediction combination | |
Li et al. | EMLP: short-term gas load forecasting based on ensemble multilayer perceptron with adaptive weight correction | |
CN113807019A (en) | MCMC wind power simulation method based on improved scene classification and de-coarse-graining | |
CN119134338B (en) | Method for controlling load frequency of power system by deep reinforcement learning | |
CN119813169A (en) | Energy generation forecasting method based on evolutionary variational mode decomposition | |
CN119809118A (en) | A multi-objective optimization method and system for distributed renewable energy distribution network dispatching |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |