Training method of power terminal control model, power terminal control method and system
Patent Information
- Application Number
- CN202510659443.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2026-10-13
- Estimated Expiration
- 2045-05-21
AI Technical Summary
[0003]目前的电力终端在互联时,由于不同的电力终端在运行时,状态可能存在不同,需要工作人员根据电力终端的运行数据调节控制器对电力终端进行控制,这种方式较为麻烦,且过于依赖于工作人员的经验,还可能存在较大的误差,难以满足电力终端工作的需求
[0058]本申请实施例至少包括以下有益效果:本申请提供一种电力终端控制模型的训练方法或电力终端控制方法及系统,该方案通过获取CAN控制器的历史控制数据;对历史控制数据进行数据压缩处理,得到历史压缩数据;基于神经网络模型和分类模型对历史压缩数据进行分类处理,得到若干组历史策略数据;根据若干组历史策略数据对前馈神经网络进行模型训练,并引入蜻蜓算法对前馈神经网络进行优化,得到电力终端控制模型。本申请能够减少人工干预,提高电力终端控制的准确性和效率。
Smart Images

Figure CN120670933B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power terminal interconnection technology, and in particular to a training method for a power terminal control model, a power terminal control method, and a system. Background Technology
[0002] With the continuous development of the power industry, the number and types of power terminals are increasing, which puts forward higher requirements for the interconnection and management of power terminals.
[0003] When power terminals are interconnected, different power terminals may have different states during operation. This requires staff to adjust the controller to control the power terminals based on their operating data. This method is cumbersome, relies too much on the staff's experience, and may have significant errors, making it difficult to meet the operational needs of power terminals. Summary of the Invention
[0004] The main objective of this application is to propose a training method for a power terminal control model, a power terminal control method, and a system, which aims to reduce manual intervention and improve the accuracy and efficiency of power terminal control.
[0005] To achieve the above objectives, one aspect of this application proposes a training method for a power terminal control model, the training method comprising the following steps:
[0006] Acquire historical control data from the CAN controller, wherein the historical control data includes historical command data and historical power terminal status data;
[0007] The historical control data is compressed to obtain compressed historical data.
[0008] The historical compressed data is classified based on a neural network model and a classification model to obtain several sets of historical strategy data, wherein the historical strategy data represents the control command strategies corresponding to the operation of the power terminal under different states.
[0009] The feedforward neural network is trained based on several sets of historical strategy data, and the Dragonfly algorithm is introduced to optimize the feedforward neural network to obtain the power terminal control model.
[0010] In some embodiments, performing data compression processing on the historical control data to obtain historical compressed data includes the following steps:
[0011] Statistical analysis is performed on each character in the historical control data to obtain a character frequency table;
[0012] A weighted binary tree is obtained based on the character frequency table, wherein each leaf node in the binary tree represents a character, and the weight is the frequency of occurrence of the character;
[0013] Traverse the binary tree and obtain the character encoding based on the path of the leaf node;
[0014] The historical control data is obtained by replacing the characters in the historical control data according to the character encoding.
[0015] In some embodiments, the classification processing of the historical compressed data based on a neural network model and a classification model to obtain several sets of historical policy data includes the following steps:
[0016] Based on a preset classification standard, the historical compressed data is labeled using a neural network model to obtain historical labeled data.
[0017] The classification model is trained based on the historical labeled data to obtain a classification result.
[0018] Collect the erroneous prediction data generated by the classification model during the classification training process, and return it to the neural network model for secondary classification processing to obtain the secondary classification result. The erroneous prediction data is the primary classification result whose data label is not equal to that of the historical labeled data.
[0019] By integrating the primary classification results of the classification model and the secondary classification results of the neural network model, several sets of historical strategy data are obtained.
[0020] In some embodiments, integrating the primary classification result of the classification model and the secondary classification result of the neural network model to obtain several sets of historical strategy data includes the following steps:
[0021] The primary classification results of the classification model and the secondary classification results of the neural network model are merged according to priority order to obtain a classification result set;
[0022] Cluster analysis was performed on the classification result set to obtain several sets of historical strategy data.
[0023] In some embodiments, the step of training a feedforward neural network based on several sets of historical strategy data and optimizing the feedforward neural network using the Dragonfly Algorithm to obtain a power terminal control model includes the following steps:
[0024] Obtain the structural parameters of the feedforward neural network and the algorithm parameters of the dragonfly algorithm. The structural parameters include the number of network layers and the number of neurons. The algorithm parameters include the population size, the maximum number of iterations, and the behavioral weights. The behaviors include dragonfly individuals' collisions, pairing, gathering, predation, and enemy avoidance.
[0025] The row vector formed by arranging the weights and thresholds of the feedforward neural network is used as the position of the individual dragonfly.
[0026] The feedforward neural network is trained based on several sets of historical strategy data. The fitness value of each dragonfly is calculated using the dragonfly network expression, and the current optimal solution is recorded.
[0027] Update the food location, predator location, and behavior weights according to the fitness function;
[0028] Calculate the displacement distance generated by the dragonfly's behavior based on the dragonfly's position, the food's position, and the predator's position.
[0029] The dragonfly population step size is updated based on the displacement distance generated by the individual dragonfly behavior and the behavior weight. Then, the process returns to the step of training the feedforward neural network model based on several sets of historical strategy data, calculating the fitness value of the individual dragonfly through the dragonfly network expression, and recording the current optimal solution, until the current iteration number is greater than the maximum iteration number.
[0030] The weights and thresholds corresponding to the current optimal solution are used as the weights and thresholds for the initial connection of the feedforward neural network to obtain the power terminal control model.
[0031] In some embodiments, the dragonfly network expression is:
[0032]
[0033] d i =O + -O i ;
[0034] e i =O - +O i ;
[0035]
[0036] Among them, a i b i c i d i e i O represents the displacement distance generated by the i-th dragonfly individual during collision, pairing, clustering, group predation, and predator avoidance behaviors.i and O j Let Y represent the positions of the i-th and j-th dragonflies respectively, and let O represent the number of dragonflies adjacent to the i-th dragonfly. + Indicates the location of the food, O - The location of the predator is indicated by q, w, e, r, and u, which represent the weights of the dragonfly group's behavior, respectively. The inertia weight is represented by t, which is the current iteration number, and ΔO. t+1 This represents the population update step size for generation t+1.
[0037] In some embodiments, the training method for the power terminal control model further includes the following steps:
[0038] All power terminals are uniformly adjusted to the same test state, wherein the test state is any one of the historical power terminal states;
[0039] Based on the test status, the test command data is determined by the power terminal control model;
[0040] Test command data is sent to all the power terminals to detect whether the state of the power terminals has changed within a preset time threshold, and the number of power terminals that have changed and those that have not changed is counted to obtain the state change result.
[0041] The control error rate is determined based on the state change results.
[0042] The control error rate is compared with a preset control threshold. If the control error rate is greater than or equal to the preset control threshold, an error assessment is performed to obtain an error analysis result. The feedforward neural network is then retrained based on the error analysis result until the control error rate is less than the preset control threshold.
[0043] The feedforward neural network whose control error rate is less than the preset control threshold is identified as the new power terminal control model.
[0044] To achieve the above objectives, another aspect of this application proposes a power terminal control method, which includes the following steps:
[0045] Obtain online power terminal status data;
[0046] The online power terminal status data is input into the power terminal control model for control prediction to obtain prediction command data.
[0047] To achieve the above objectives, another aspect of this application proposes a training system for a power terminal control model, the training system comprising:
[0048] The first module is used to acquire historical control data of the CAN controller, wherein the historical control data includes historical command data and historical power terminal status data;
[0049] The second module is used to perform data compression processing on the historical control data to obtain historical compressed data;
[0050] The third module is used to classify the historical compressed data based on a neural network model and a classification model to obtain several sets of historical strategy data, wherein the historical strategy data represents the control command strategies corresponding to the operation of the power terminal in different states.
[0051] The fourth module is used to train the feedforward neural network model based on several sets of historical strategy data, and to optimize the feedforward neural network by introducing the Dragonfly algorithm to obtain the power terminal control model.
[0052] To achieve the above objectives, another aspect of this application provides a power terminal control system, the control system comprising:
[0053] The fifth module is used to acquire online status data of the power terminal;
[0054] The sixth module is used to input the online status data into the power terminal control model for control prediction and obtain prediction command data;
[0055] The seventh module is used to perform state control on the power terminal based on the predicted command data.
[0056] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described training method for the power terminal control model or the power terminal control method.
[0057] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described training method for the power terminal control model or the power terminal control method.
[0058] The embodiments of this application include at least the following beneficial effects: This application provides a training method or a power terminal control method and system for a power terminal control model. This scheme acquires historical control data from a CAN controller; compresses the historical control data to obtain compressed historical data; classifies the compressed historical data based on a neural network model and a classification model to obtain several sets of historical strategy data; trains a feedforward neural network model based on these sets of historical strategy data, and introduces the Dragonfly Algorithm to optimize the feedforward neural network, thereby obtaining a power terminal control model. This application can reduce manual intervention and improve the accuracy and efficiency of power terminal control. Attached Figure Description
[0059] Figure 1 This is a flowchart of the training method for the power terminal control model provided in the embodiments of this application;
[0060] Figure 2 This is a flowchart of the power terminal control method provided in the embodiments of this application;
[0061] Figure 3 This is a flowchart of a power terminal control method provided in another embodiment of this application;
[0062] Figure 4 This is a schematic diagram of the structure of the training system for the power terminal control model provided in the embodiments of this application;
[0063] Figure 5 This is a schematic diagram of the structure of the power terminal control system provided in the embodiments of this application;
[0064] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0066] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0067] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0068] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0069] The training method or control method for a power terminal control model provided in this application relates to the field of power terminal interconnection technology. The training method or control method for a power terminal control model provided in this application can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or vehicle terminal, but is not limited to these. The server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network. The software can be an application implementing the training method or control method for the power terminal control model, but is not limited to the above forms.
[0070] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0071] Figure 1 This is an optional flowchart of the training method for the power terminal control model provided in the embodiments of this application. Figure 1 The training method for the power terminal control model may include, but is not limited to, steps S101 to S104.
[0072] Step S101: Obtain historical control data from the CAN controller, including historical command data and historical power terminal status data.
[0073] Step S102: Perform data compression processing on the historical control data to obtain historical compressed data.
[0074] Step S103: Based on the neural network model and classification model, the historical compressed data is classified to obtain several sets of historical strategy data, where the historical strategy data represents the control command strategy corresponding to the operation of the power terminal under different states.
[0075] Step S104: Train the feedforward neural network model based on several sets of historical strategy data, and introduce the Dragonfly algorithm to optimize the feedforward neural network to obtain the power terminal control model.
[0076] In this embodiment, the CAN controller is the core component of communication. Several power terminals are interconnected through the CAN controller. In order to reduce manual intervention and improve control efficiency, this embodiment obtains a power terminal control model based on historical control data, which can automatically issue control commands according to the status of the power terminals.
[0077] Specifically, the historical control data of the CAN controller stored in the database is retrieved. This historical control data includes historical command data and historical power terminal status data. Historical command data consists of control commands issued by the CAN controller to the power terminals, recorded in the database. These commands are used to adjust the terminal's operating status and reflect historical operating strategies, such as power regulation and switching. Historical power terminal status data consists of the power terminal's operating status parameters before and after executing the control commands, reflecting the equipment's health and load conditions, such as voltage, current, and temperature values.
[0078] Historical compressed data is obtained by compressing historical control data. The compressed data is smaller in size, which can effectively reduce network latency and energy consumption during transmission. It is especially suitable for resource-constrained power terminals, enabling lightweight design and supporting more power terminals to connect.
[0079] Next, the compressed historical control data is classified based on neural network models and classification models, dividing the historical control data into several groups of historical strategy data.
[0080] For example, the decompressed historical control data is first initially labeled using a neural network model. The labeled historical control data is then used to train a classification model to learn the mapping relationship from the power terminal state to the control command. Based on the feature similarity between the power terminal state and its corresponding control command, the data is grouped to obtain several groups of historical strategy data. The historical strategy data represents the control command strategy corresponding to the power terminal operating in different states.
[0081] After obtaining several sets of historical strategy data, a feedforward neural network containing an input layer, a hidden layer, and an output layer is designed. The historical power terminal status data in the historical strategy data is used as input, and the corresponding historical command data is used as the output target. The dragonfly algorithm is used to optimize the parameters of the feedforward neural network instead of the traditional optimizer. The parameters are dynamically adjusted by simulating the behavior of the dragonfly swarm. When the iteration reaches a preset number of times, the optimal solution is used as the model parameters of the feedforward neural network to obtain the power terminal control model.
[0082] In some embodiments, step S102 may include, but is not limited to, steps S201 to S204.
[0083] Step S201: Perform statistical analysis on each character in the historical control data to obtain a character frequency table.
[0084] Step S202: Obtain a weighted binary tree based on the character frequency table, where each leaf node in the binary tree represents a character and the weight is the frequency of the character's occurrence.
[0085] Step S203: Traverse the binary tree and obtain the character encoding based on the path of the leaf node.
[0086] Step S204: Replace the characters in the historical control data according to the character encoding to obtain the historical compressed data.
[0087] In this embodiment, compressing historical control data helps reduce data redundancy and improve the efficiency of subsequent model training.
[0088] Specifically, statistical analysis is performed on each character in the historical control data to calculate the frequency of each character and create a character frequency table.
[0089] A binary tree is constructed based on a character frequency table. Each leaf node in the binary tree represents a character, with the character frequency serving as the node weight. Each internal node represents a character combination, where the frequencies (weights) of two or more characters (or character groups) are added together to generate a new virtual node. This virtual node does not correspond to any actual character but is used to assist in constructing the binary tree structure. In the constructed binary tree, high-frequency characters have shorter paths for faster decoding, while low-frequency characters have longer paths. Since low frequency characters appear less frequently, this results in higher overall compression efficiency.
[0090] Next, traverse the binary tree. The path from the root node to each leaf node defines the character's encoding. Let moving left represent adding "0" and moving right represent adding "1". The path of each leaf node is the character's encoding.
[0091] For example, suppose we move the root node one step to the left to get character A, then the code for character A is "0"; suppose we move the root node one step to the right and then one step to the left to get character B, then the code for character B is "10"; suppose we move the root node one step to the right, then one step to the right, and then one step to the left to get character C, then the code for character C is "110"; suppose we move the root node one step to the right, then one step to the right, and then one step to the right to get character D, then the code for character D is "111".
[0092] It should be noted that the encoding of any character is not a prefix of other encodings (for example, 10 will not conflict with 110) to ensure the uniqueness of decoding.
[0093] The generated character encoding is used to replace the characters in the original historical control data, and the historical compressed data is further converted into binary format to obtain the compressed historical compressed data.
[0094] Optionally, after step S204 in some embodiments, the compression ratio can be calculated based on historical control data before and after compression. The compression ratio serves as a post-evaluation indicator to quantify the compression effect and visually reflect the degree of data volume reduction. By adjusting the statistical period of character frequency (i.e., adjusting the historical period of historical control data), historical compression data with different compression ratios can be obtained. By comparing the compression ratios, the compression scheme with the optimal compression ratio is selected. The formula for calculating the compression ratio is:
[0095]
[0096] In the formula, γ is the compression ratio, and w n r is the feature vector of historical compressed data. n Let w be the feature vector of the historical control data, w be the mean feature vector of the historical compressed data, and r be the mean feature vector of the historical control data.
[0097] In some embodiments, step S103 may include, but is not limited to, steps S301 to S304.
[0098] Step S301: Based on the preset classification criteria, the historical compressed data is labeled using a neural network model to obtain historical labeled data.
[0099] Step S302: Train the classification model based on historical labeled data to obtain a classification result.
[0100] Step S303: Collect the erroneous prediction data generated by the classification model during the classification training process, and return it to the neural network model for secondary classification processing to obtain the secondary classification result. The erroneous prediction data is the primary classification result whose data label is not equal to that of the historical labeled data.
[0101] Step S304: Integrate the primary classification results of the classification model and the secondary classification results of the neural network model to obtain several sets of historical strategy data.
[0102] In this embodiment, the preset classification criteria of historical compressed data are transformed into the prompting engineering basis of the neural network model, providing a clear and unified classification framework for data annotation. The neural network model is used to annotate the historical compressed data, and the annotated historical compressed data is output to obtain the historical annotated data.
[0103] Next, the historical labeled data is divided into training, validation and test sets to support iterative optimization and performance evaluation of the classification model.
[0104] For example, historical labeled data is divided into a 70% training set, a 15% validation set, and a 15% test set. The classification model is trained directly using the training set to learn the mapping relationship between power terminal states and control commands. The parameters during the training process are adjusted using the validation set to avoid overfitting or underfitting. The final performance of the classification model is evaluated by simulating real-world scenarios using the test set.
[0105] Specifically, the classification model has three layers of feedforward network and implicit regression layer, and the output formula of the classification model is:
[0106] A k =∑ j [a j (k)×W j A (2);
[0107] In the formula, A k For the output of the classification model, a j (k) is the output of the j-th regression neuron, W j A represents the connection weight between the j-th regression neuron and the input.
[0108] The output formula of the regression layer in the classification model is:
[0109] a j (k)=∫(a' j (k)) (3);
[0110] In the formula, a' j (k) is the input to the j-th regressive neuron.
[0111] The input formula for the regression layer in the classification model is:
[0112]
[0113] In the formula, B i (k) is the i-th input to the neural network model, C ij The connection weights between the i-th input and the j-th regression neuron are... is the feedback weight of the j-th regression neuron.
[0114] The prediction error is minimized by continuously adjusting the model training parameters, including learning rate, batch size, and number of training epochs.
[0115] For the erroneous predictions generated during the training of the classification model, these are fed back to the neural network model for secondary classification, yielding a secondary classification result. The erroneous predictions are the primary classification results output by the model during the validation phase, where the labels do not match those of the historical labeled data. The secondary classification result is the classification result obtained after the erroneous predictions are reclassified by the neural network model. Compared to unidirectional open-loop labeling and classification, this error feedback mechanism drives the neural network model to continuously improve labeling quality, achieving a closed-loop self-correction.
[0116] The primary classification results and incorrect prediction data from the integrated classification model are combined with the secondary classification results from the neural network model to obtain several sets of historical strategy data. Optionally, if the primary and secondary classification results are inconsistent, the classification results with higher confidence are retained during integration, ultimately resulting in several sets of historical strategy data.
[0117] In some embodiments, step S304 may include, but is not limited to, steps S401 to S402.
[0118] Step S401: Merge the primary classification results of the classification model and the secondary classification results of the neural network model according to priority order to obtain a classification result set.
[0119] Step S402: Perform cluster analysis on the classification result set to obtain several sets of historical strategy data.
[0120] In this embodiment, the secondary classification result of the neural network model has higher priority than the primary classification result of the classification model. During the merging process, if there is a conflict between the primary classification result of the classification model and the secondary classification result of the neural network model, the secondary classification result is used to cover the conflicting data in the primary classification result to obtain the classification result set.
[0121] For example, suppose that based on the historical power terminal status data "voltage 210V", the classification model outputs a primary classification result of "maintaining voltage" and the neural network model outputs a secondary classification result of "reducing voltage". In the case that the primary classification result and the secondary classification result are inconsistent, the secondary classification result will overwrite the primary classification result.
[0122] Furthermore, cluster analysis is performed based on the classification results set to merge data on similar power terminal states into a group. At the same time, consistency checks are performed on the commands corresponding to the power terminal state data. If the control commands within the same group are inconsistent, they are further split into finer subgroups, ultimately resulting in several groups of historical strategy data. The state range of the power terminal's operating status within each group of historical strategy data is clear and corresponds to a unique optimal control command strategy.
[0123] Understandably, if new historical power terminal status data or historical command data are added to the historical control data, they can be incorporated into existing groups or new groups can be generated through the same process described above.
[0124] In some embodiments, step S104 may include, but is not limited to, steps S501 to S507.
[0125] Step S501: Obtain the structural parameters of the feedforward neural network and the algorithm parameters of the dragonfly algorithm. The structural parameters include the number of network layers and the number of neurons. The algorithm parameters include the population size, the maximum number of iterations, and the behavior weights. The behaviors include dragonfly individuals' collisions, pairing, gathering, predation, and enemy avoidance.
[0126] Step S502: The row vector formed by arranging the weights and thresholds of the feedforward neural network is used as the position of the individual dragonfly.
[0127] Step S503: Train the feedforward neural network model based on several sets of historical strategy data, calculate the fitness value of individual dragonflies through the dragonfly network expression, and record the current optimal solution.
[0128] Step S504: Update the food location, predator location, and behavior weights according to the fitness function.
[0129] Step S505: Calculate the displacement distance generated by the dragonfly's behavior based on the dragonfly's position, food location, and predator location.
[0130] Step S506: Update the dragonfly population step size based on the displacement distance and behavior weight generated by the individual dragonfly behavior, and then return to the step of training the feedforward neural network model based on several sets of historical strategy data, calculating the fitness value of the individual dragonfly through the dragonfly network expression, and recording the current optimal solution, until the current iteration number is greater than the maximum iteration number.
[0131] Step S507: Use the weights and thresholds corresponding to the current optimal solution as the weights and thresholds of the initial connection of the feedforward neural network to obtain the power terminal control model.
[0132] In this embodiment, the structural parameters of the feedforward neural network are first designed, including the number of layers and neurons. Next, the algorithm parameters of the dragonfly algorithm are set, including the population size N, the maximum number of iterations T, and the initial behavioral weights. The behaviors include dragonfly collisions, pairing, aggregation, predation, and predator avoidance.
[0133] The row vector (w, θ) formed by the ordered arrangement of the weights w and thresholds θ of the feedforward neural network is used as the position O of the dragonfly individual. The position of the dragonfly individual is randomly initialized according to the range of weights and thresholds.
[0134] The feedforward neural network is trained by selecting training sample data. In this embodiment, the feedforward neural network is trained on several sets of historical control data, the fitness value of each dragonfly is calculated according to the dragonfly network expression, and the current optimal solution is recorded.
[0135] Specifically, the dragonfly network expression is:
[0136]
[0137] d i =O + -O i (8);
[0138] e i =O - +O i (9);
[0139]
[0140] Among them, a i b i c i d i e i O represents the displacement distance generated by the i-th dragonfly individual during collision, pairing, clustering, group predation, and predator avoidance behaviors. i and O j Let Y represent the positions of the i-th and j-th dragonflies respectively, and let O represent the number of dragonflies adjacent to the i-th dragonfly. + Indicates the location of the food, O — The location of the predator is indicated by q, w, e, r, and u, which represent the weights of the dragonfly group's behavior, respectively. The inertia weight is represented by t, which is the current iteration number, and ΔO. t+1 This represents the population update step size for generation t+1.
[0141] We choose mean squared error as the fitness function to update the food position O. + Predator location O — And the behavior weights of the dragonfly swarm. By dynamically adjusting the behavior weights (q, w, e, r, u) through the fitness function, it can adapt to different power scenarios without the need for manual parameter tuning.
[0142] Update the population behaviors a, b, c, d, and e of dragonflies according to equations (5) to (9) in the dragonfly network expression.
[0143] The step size determines the distance and direction of movement of each dragonfly individual in the solution space during each iteration. By retaining a portion of the historical step size during iteration, oscillations caused by sudden changes in direction (such as weights) are prevented. (This indicates that 40% is retained). The dragonfly step size vector ΔO is updated according to equation (10) in the dragonfly network expression. If the current iteration number t is greater than the maximum iteration number T, the connection weight w and threshold θ are retained; otherwise, t = t + 1, and then the process returns to step S503.
[0144] When the current iteration number t is greater than the maximum iteration number T, the weight w and threshold θ corresponding to the optimal solution are used as the initial connection weights and thresholds of the feedforward neural network to obtain the power terminal control model.
[0145] In some embodiments, the training method for the power terminal control model may also include, but is not limited to, steps S601 to S606.
[0146] Step S601: Adjust all power terminals to the same test state, wherein the test state is any one of the historical power terminal states.
[0147] Step S602: Based on the test status, determine the test command data through the power terminal control model.
[0148] Step S603: Send test command data to all power terminals, detect whether the state of the power terminals has changed within the preset time threshold, and count the number of power terminals that have changed and those that have not changed to obtain the state change result.
[0149] Step S604: Determine the control error rate based on the state change result.
[0150] Step S605: Compare the control error rate with the preset control threshold. If the control error rate is greater than or equal to the preset control threshold, perform error evaluation to obtain the error analysis result, and retrain the feedforward neural network based on the error analysis result until the control error rate is less than the preset control threshold.
[0151] Step S606: The feedforward neural network with a control error rate less than the preset control threshold is identified as the new power terminal control model.
[0152] In this embodiment, in order to obtain a power terminal control model with high accuracy, a feedforward neural network is trained and controlled until a power terminal control model with an accuracy greater than a preset control threshold is obtained.
[0153] Specifically, all power terminals are first manually adjusted to the same test state, which can be any of the historical power terminal states recorded in the historical control data.
[0154] The CAN controller determines the test command data through the power terminal control model based on the acquired test status.
[0155] The CAN controller automatically sends the test command data to all power terminals. Within a certain time threshold, it detects whether the status of the power terminals has changed, and counts the number of power terminals that have changed and the number that have not changed, thus obtaining the status change result.
[0156] The total number of all power terminals is calculated based on the number of power terminals that changed and the number that did not change in the state change results. The number of power terminals that did not change is then divided by the total number of all power terminals, and the resulting value is recorded as the control error rate.
[0157] The control error rate is compared with the preset control threshold. If the control error rate is greater than or equal to the preset control threshold, it indicates that the power terminal control model deployed in the CAN controller is inaccurate and error assessment is required to obtain the error analysis results.
[0158] Understandably, errors affecting model accuracy can be commonly categorized into insufficient data, labeling errors, and model defects. For errors caused by insufficient data, the feedforward neural network is retrained by adding training data based on the error analysis results, the power terminal control model is updated, and steps S601 to S604 are executed again to verify the control error rate.
[0159] For example, for high error rate scenarios, historical control data corresponding to the scenario can be collected in a targeted manner to increase training samples and enhance the training data.
[0160] For errors caused by labeling errors, based on the error analysis results, the feedforward neural network is retrained by relabeling the data or adjusting the classification criteria, the power terminal control model is updated, and steps S601 to S604 are executed again to verify the control error rate.
[0161] For errors caused by model defects, the feedforward neural network is retrained by adjusting the model structure or parameters based on the error analysis results, the power terminal control model is updated, and steps S601 to S604 are executed again to verify the control error rate.
[0162] For example, this can be achieved by increasing the number of neurons in the hidden layer (e.g., from 64 to 128) or modifying the structure of the output layer (e.g., subdividing command categories, such as modeling "reduce power by 5%" and "reduce power by 8%" separately).
[0163] If the control error rate is less than the preset control threshold, it indicates that the accuracy of the currently trained power terminal control model is high and meets the control requirements. In this case, the currently trained power terminal control model will be used as the new power terminal control model.
[0164] Figure 2This is an optional flowchart of the power terminal control method provided in the embodiments of this application. Figure 1 The power terminal control method may include, but is not limited to, steps S701 to S703.
[0165] Step S701: Obtain the online status data of the power terminal.
[0166] Step S702: Input the online status data into the power terminal control model for control prediction to obtain prediction command data.
[0167] Step S703: Perform state control on the power terminal based on the predicted command data.
[0168] In this embodiment, multiple power terminals are interconnected through a power terminal control model. The power terminal control model obtains the online status data of the power terminals in real time through a CAN controller. This online status data reflects the current status of the power terminals.
[0169] Online status data is input into the power terminal control model for control prediction, resulting in predictive command data for changing the state of the power terminal. The predictive command data is a command that optimizes the response to any risky event that occurs in the state of the power terminal, thereby achieving the optimal state of the power system.
[0170] Automatically control the status of power terminals that are detected to be at risk based on forecast command data.
[0171] For example, suppose the voltage of one of the power terminals in the power system is 210V, but its safe voltage threshold is 211V. The power terminal control model can quickly detect that the power terminal is about to reach the threshold by acquiring online status data in real time. By controlling the prediction, it can identify the control needs of the power terminal in the state that is about to reach the threshold, and then obtain a voltage reduction command to control the voltage on the power terminal to drop, so as to avoid the risk of failure caused by exceeding the threshold.
[0172] The following is a detailed introduction and explanation of the solutions in the embodiments of the present invention, with reference to specific application examples.
[0173] Reference Figure 3This application embodiment automatically issues control commands based on the power terminal status using a CAN controller, reducing manual intervention and improving control efficiency. Analyzing and classifying historical control data using neural network and classification models enables more accurate identification of control requirements under different states, improving control accuracy. Compression and classification of historical control data helps reduce data redundancy and improve model training efficiency. Utilizing a dragonfly network to optimize the feedforward neural network model further improves the model's accuracy and stability, making the CAN controller control model more reliable. Based on a highly accurate control model, it can quickly respond to changes in the power terminal status, achieving real-time control and improving system response speed and stability. This technical solution adopts a modular design, is easy to expand and upgrade, and can adapt to power terminal interconnection systems of different scales and complexities.
[0174] Specifically, firstly, several groups of power terminals are interconnected through a CAN controller to form a power terminal interconnection system. The CAN controller is the core component in the communication, used to send commands to the corresponding power terminals for control according to the status of the power terminals. The status of several groups of power terminals can also be manually adjusted.
[0175] Next, historical CAN controller control data is retrieved from the database. This control data includes command data and power terminal status data.
[0176] Historical control data is compressed to obtain compressed historical control data, which provides data support for subsequent processing, while reducing data redundancy and improving the training efficiency of the model.
[0177] Based on a neural network model and a pre-set classification model, the compressed historical control data is classified to obtain several sets of historical control data.
[0178] The system trains on several sets of historical control data using a feedforward neural network and then optimizes it by introducing a dragonfly network to obtain a CAN controller control model (i.e., a power terminal control model) with high accuracy.
[0179] Finally, the status information of several sets of power terminals is collected in real time, and based on the status information, a CAN controller control model with high accuracy is used to control the connected power terminals.
[0180] Reference Figure 4 This application also provides a training system for a power terminal control model, which can implement the above-mentioned training method for the power terminal control model. The system includes:
[0181] The first module is used to acquire historical control data from the CAN controller, which includes historical command data and historical power terminal status data.
[0182] The second module is used to compress historical control data to obtain compressed historical data.
[0183] The third module is used to classify and process historical compressed data based on neural network models and classification models to obtain several sets of historical strategy data. The historical strategy data represents the control command strategies corresponding to the operation of power terminals in different states.
[0184] The fourth module is used to train the feedforward neural network based on several sets of historical strategy data, and to optimize the feedforward neural network by introducing the Dragonfly algorithm to obtain the power terminal control model.
[0185] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0186] Reference Figure 5 This application also provides a power terminal control system that can implement the above-described power terminal control method. The system includes:
[0187] The fifth module is used to acquire online status data of the power terminal.
[0188] The sixth module is used to input online status data into the power terminal control model for control prediction and obtain prediction command data.
[0189] The seventh module is used to perform status control on the power terminals based on the forecast command data.
[0190] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the training method for the power terminal control model or the power terminal control method described above. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0191] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0192] Reference Figure 6 , Figure 6 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0193] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0194] The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the training method or power terminal control method of the power terminal control model of the embodiments of this application.
[0195] The input / output interface 903 is used to implement information input and output.
[0196] The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0197] Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904).
[0198] The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0199] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the training method or power terminal control method of the above-described power terminal control model.
[0200] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0201] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0202] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0203] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0204] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0205] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0206] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0207] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A training method for a power terminal control model, characterized in that, The training method for the power terminal control model includes the following steps: Acquire historical control data from the CAN controller, wherein the historical control data includes historical command data and historical power terminal status data; The historical control data is compressed to obtain compressed historical data. The historical compressed data is classified based on a neural network model and a classification model to obtain several sets of historical strategy data, wherein the historical strategy data represents the control command strategies corresponding to the operation of the power terminal under different states. The feedforward neural network is trained based on several sets of historical strategy data, and the Dragonfly algorithm is introduced to optimize the feedforward neural network to obtain the power terminal control model. The process of training a feedforward neural network based on several sets of historical strategy data, and then optimizing the feedforward neural network using the Dragonfly Algorithm to obtain a power terminal control model, includes the following steps: Obtain the structural parameters of the feedforward neural network and the algorithm parameters of the dragonfly algorithm. The structural parameters include the number of network layers and the number of neurons. The algorithm parameters include the population size, the maximum number of iterations, and the behavioral weights. The behaviors include dragonfly individuals' collisions, pairing, gathering, predation, and enemy avoidance. The row vector formed by arranging the weights and thresholds of the feedforward neural network is used as the position of the individual dragonfly. The feedforward neural network is trained based on several sets of historical strategy data. The fitness value of each dragonfly is calculated using the dragonfly network expression, and the current optimal solution is recorded. Update the food location, predator location, and behavior weights according to the fitness function; Calculate the displacement distance generated by the dragonfly's behavior based on the dragonfly's position, the food's position, and the predator's position. The dragonfly population step size is updated based on the displacement distance generated by the individual dragonfly behavior and the behavior weight. Then, the process returns to the step of training the feedforward neural network model based on several sets of historical strategy data, calculating the fitness value of the individual dragonfly through the dragonfly network expression, and recording the current optimal solution, until the current iteration number is greater than the maximum iteration number. The weights and thresholds corresponding to the current optimal solution are used as the weights and thresholds for the initial connection of the feedforward neural network to obtain the power terminal control model; The dragonfly network expression is: ; ; ; ; ; ; in, a i , b i , c i , d i , e i They represent the first i The displacement distance generated by individual dragonflies during collisions, pairing, gathering, predation, and predator avoidance behaviors. O i and O j They represent the first i The and the first j The location of each individual dragonfly Y Indicates the first i The number of adjacent dragonflies of each individual dragonfly O + Indicates the location of the food. O - Indicates the location of the natural enemy. q , w , e , r , u These represent the weights of the dragonfly group's behavior. Indicates inertia weight, t This represents the current iteration number. O t+1 express t +1 generation population update step size.
2. The training method for the power terminal control model according to claim 1, characterized in that, The process of compressing the historical control data to obtain compressed historical data includes the following steps: Statistical analysis is performed on each character in the historical control data to obtain a character frequency table; A weighted binary tree is obtained based on the character frequency table, wherein each leaf node in the binary tree represents a character, and the weight is the frequency of occurrence of the character; Traverse the binary tree and obtain the character encoding based on the path of the leaf node; The historical control data is obtained by replacing the characters in the historical control data according to the character encoding.
3. The training method for the power terminal control model according to claim 1, characterized in that, The historical compressed data is classified based on a neural network model and a classification model to obtain several sets of historical strategy data, including the following steps: Based on a preset classification standard, the historical compressed data is labeled using a neural network model to obtain historical labeled data. The classification model is trained based on the historical labeled data to obtain a classification result. Collect the erroneous prediction data generated by the classification model during the classification training process, and return it to the neural network model for secondary classification processing to obtain the secondary classification result. The erroneous prediction data is the primary classification result whose data label is not equal to that of the historical labeled data. By integrating the primary classification results of the classification model and the secondary classification results of the neural network model, several sets of historical strategy data are obtained.
4. The training method for the power terminal control model according to claim 3, characterized in that, The process of integrating the primary classification results of the classification model and the secondary classification results of the neural network model to obtain several sets of historical strategy data includes the following steps: The primary classification results of the classification model and the secondary classification results of the neural network model are merged according to priority order to obtain a classification result set; Cluster analysis was performed on the classification result set to obtain several sets of historical strategy data.
5. The method according to claim 1, characterized in that, The training method for the power terminal control model also includes the following steps: All power terminals are uniformly adjusted to the same test state, wherein the test state is any one of the historical power terminal states; Based on the test status, the test command data is determined by the power terminal control model; Test command data is sent to all the power terminals to detect whether the state of the power terminals has changed within a preset time threshold, and the number of power terminals that have changed and those that have not changed is counted to obtain the state change result. The control error rate is determined based on the state change results. The control error rate is compared with a preset control threshold. If the control error rate is greater than or equal to the preset control threshold, an error assessment is performed to obtain an error analysis result. The feedforward neural network is then retrained based on the error analysis result until the control error rate is less than the preset control threshold. The feedforward neural network whose control error rate is less than the preset control threshold is identified as the new power terminal control model.
6. A power terminal control method, characterized in that, The power terminal control method includes the following steps: Obtain online status data from power terminals; The online status data is input into the power terminal control model for control prediction to obtain prediction command data; The power terminal is subjected to state control based on the predicted command data; The power terminal control model is determined by the training method according to any one of claims 1-5.
7. A training system for a power terminal control model, characterized in that, The training system for the power terminal control model includes: The first module is used to acquire historical control data of the CAN controller, wherein the historical control data includes historical command data and historical power terminal status data; The second module is used to perform data compression processing on the historical control data to obtain historical compressed data; The third module is used to classify the historical compressed data based on a neural network model and a classification model to obtain several sets of historical strategy data, wherein the historical strategy data represents the control command strategies corresponding to the operation of the power terminal in different states. The fourth module is used to train the feedforward neural network model based on several sets of historical strategy data, and to optimize the feedforward neural network by introducing the Dragonfly algorithm to obtain the power terminal control model. The process of training a feedforward neural network based on several sets of historical strategy data, and then optimizing the feedforward neural network using the Dragonfly Algorithm to obtain a power terminal control model, includes the following steps: Obtain the structural parameters of the feedforward neural network and the algorithm parameters of the dragonfly algorithm. The structural parameters include the number of network layers and the number of neurons. The algorithm parameters include the population size, the maximum number of iterations, and the behavioral weights. The behaviors include dragonfly individuals' collisions, pairing, gathering, predation, and enemy avoidance. The row vector formed by arranging the weights and thresholds of the feedforward neural network is used as the position of the individual dragonfly. The feedforward neural network is trained based on several sets of historical strategy data. The fitness value of each dragonfly is calculated using the dragonfly network expression, and the current optimal solution is recorded. Update the food location, predator location, and behavior weights according to the fitness function; Calculate the displacement distance generated by the dragonfly's behavior based on the dragonfly's position, the food's position, and the predator's position. The dragonfly population step size is updated based on the displacement distance generated by the individual dragonfly behavior and the behavior weight. Then, the process returns to the step of training the feedforward neural network model based on several sets of historical strategy data, calculating the fitness value of the individual dragonfly through the dragonfly network expression, and recording the current optimal solution, until the current iteration number is greater than the maximum iteration number. The weights and thresholds corresponding to the current optimal solution are used as the weights and thresholds for the initial connection of the feedforward neural network to obtain the power terminal control model; The dragonfly network expression is: ; ; ; ; ; ; in, a i , b i , c i , d i , e i They represent the first i The displacement distance generated by individual dragonflies during collisions, pairing, gathering, predation, and predator avoidance behaviors. O i and O j They represent the first i The and the first j The location of each individual dragonfly Y Indicates the first i The number of adjacent dragonflies of each individual dragonfly O + Indicates the location of the food. O - Indicates the location of the natural enemy. q , w , e , r , u These represent the weights of the dragonfly group's behavior. Indicates inertia weight, t This represents the current iteration number. O t+1 express t +1 generation population update step size.
8. A power terminal control system, characterized in that, The power terminal control system includes: The fifth module is used to acquire online status data of the power terminal; The sixth module is used to input the online status data into the power terminal control model for control prediction and obtain prediction command data; The seventh module is used to perform state control on the power terminal based on the predicted command data; The power terminal control model is determined by the training method according to any one of claims 1-5.
Citation Information
Patent Citations
Method and system for predicting short-term power load of micro-grid of offshore oilfield group
CN108197759A
Short-term wind field wind speed prediction method and system based on neural network
CN115983434A