CN114676042B - Method and device for generating test data of electric power Internet of things - Google Patents

Method and device for generating test data of electric power Internet of things Download PDF

Info

Publication number
CN114676042B
CN114676042B CN202210186789.9A CN202210186789A CN114676042B CN 114676042 B CN114676042 B CN 114676042B CN 202210186789 A CN202210186789 A CN 202210186789A CN 114676042 B CN114676042 B CN 114676042B
Authority
CN
China
Prior art keywords
electric equipment
type
chromosome
data
test
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
Application number
CN202210186789.9A
Other languages
Chinese (zh)
Other versions
CN114676042A (en
Inventor
张宁
尚芳剑
李信
娄竞
陈重韬
王艺霏
刘超
李欣怡
温馨
姚艳丽
王森
张海明
韩璐
祝文军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Corp of China SGCC
Information and Telecommunication Branch of State Grid Jibei Electric Power Co Ltd
Original Assignee
State Grid Corp of China SGCC
Information and Telecommunication Branch of State Grid Jibei Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Corp of China SGCC, Information and Telecommunication Branch of State Grid Jibei Electric Power Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN202210186789.9A priority Critical patent/CN114676042B/en
Publication of CN114676042A publication Critical patent/CN114676042A/en
Application granted granted Critical
Publication of CN114676042B publication Critical patent/CN114676042B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Software Systems (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Marketing (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Quality & Reliability (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Resources & Organizations (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Biology (AREA)
  • Water Supply & Treatment (AREA)
  • Medical Informatics (AREA)
  • Public Health (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Supply And Distribution Of Alternating Current (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a method and a device for generating test data of an electric power Internet of things, and relates to the technical field of software testing and artificial intelligence, wherein the method comprises the following steps: acquiring historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things; the method comprises the steps of taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment, and constructing a training data set of each type of electric equipment; training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment; when a request for generating test data for electric equipment is received, the current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output. The invention can improve the test data generation efficiency and the test efficiency.

Description

Method and device for generating test data of electric power Internet of things
Technical Field
The invention relates to the technical field of software testing and artificial intelligence, in particular to a method and a device for generating test data of an electric power Internet of things.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
The software test has irreplaceable effects in reducing software loopholes and improving the quality of software applications, and in order to better improve the test efficiency and ensure the high efficiency of the test, a great deal of researches are currently carried out on a test data generation method, wherein the method comprises the following steps: performing fuzzy test data generation method research based on an improved genetic algorithm; in order to solve the problem of automatic generation of path-oriented test data, a combination optimization particle swarm algorithm and an ant colony algorithm are provided; in order to solve the problem that test data randomly generated in the fuzzy test cannot conform to a software input standard, a method for dynamically constructing fuzzy test data generation by using a variation strategy is provided; and testing and researching the consistency of the electric power Internet of things edge Internet of things proxy.
A scheme in the prior art is that a user manually compiles test data, the test data generation efficiency is low, and the test efficiency is reduced.
Disclosure of Invention
The embodiment of the invention provides a method for generating test data of an electric power Internet of things, which is used for improving the generation efficiency of the test data and the test efficiency, and comprises the following steps:
acquiring historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things;
the method comprises the steps of taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment, and constructing a training data set of each type of electric equipment;
training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment;
when a request for generating test data for electric equipment is received, current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output;
training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment, wherein the training data set comprises the following steps:
encoding historical electricity consumption data in training data sets of each type of electric equipment to form a plurality of test case sets, and generating an initial population of each type of electric equipment for a genetic algorithm by taking each test case set as a chromosome;
calculating the fitness value of each chromosome in the initial population of each type of electric equipment, and finding out the chromosome with the largest fitness value in the initial population of each type of electric equipment; the fitness value is used for representing different path numbers covered by the chromosome;
modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment;
taking the improved chromosome in the initial population of each type of electric equipment as the next generation population of the electric equipment of the corresponding type for genetic algorithm, and carrying out the next iteration;
when a chromosome with the fitness value reaching a set threshold value or the iteration number reaching the set number is found, obtaining a trained test data generation model;
modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment, wherein the method comprises the following steps:
randomly selecting a path set by using a reinforcement learning algorithm; wherein the randomly selected path set comprises a path set in a chromosome with the maximum fitness value;
respectively calculating Jacquard similarity coefficients between an execution path set of each test case in the chromosome with the maximum fitness value and a randomly selected path set;
changing coding parameters of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value until the execution path set of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value comprises a randomly selected path set or reinforcement learning times reach a set threshold value to obtain updated test cases;
replacing the updated test cases with randomly selected repeated test cases to obtain improved chromosomes; wherein, the repeated test cases are test cases with the same path set.
The embodiment of the invention also provides a device for generating the test data of the electric power Internet of things, which is used for improving the generation efficiency of the test data and the test efficiency, and comprises the following steps:
the acquisition module is used for acquiring historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things;
the training data set construction module is used for constructing a training data set of each type of electric equipment by taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment;
the training module is used for training the machine learning model according to the training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment;
the prediction module is used for inputting the current power utilization data of the electric equipment into the test data generation model corresponding to the electric equipment type when receiving a request for generating the test data for the electric equipment, and outputting the test data of the electric equipment;
the training module is specifically used for:
encoding historical electricity consumption data in training data sets of each type of electric equipment to form a plurality of test case sets, and generating an initial population of each type of electric equipment for a genetic algorithm by taking each test case set as a chromosome;
calculating the fitness value of each chromosome in the initial population of each type of electric equipment, and finding out the chromosome with the largest fitness value in the initial population of each type of electric equipment; the fitness value is used for representing different path numbers covered by the chromosome;
modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment;
taking the improved chromosome in the initial population of each type of electric equipment as the next generation population of the electric equipment of the corresponding type for genetic algorithm, and carrying out the next iteration;
when a chromosome with the fitness value reaching a set threshold value or the iteration number reaching the set number is found, obtaining a trained test data generation model;
the training module is specifically used for:
randomly selecting a path set by using a reinforcement learning algorithm; wherein the randomly selected path set comprises a path set in a chromosome with the maximum fitness value;
respectively calculating Jacquard similarity coefficients between an execution path set of each test case in the chromosome with the maximum fitness value and a randomly selected path set;
changing coding parameters of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value until the execution path set of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value comprises a randomly selected path set or reinforcement learning times reach a set threshold value to obtain updated test cases;
replacing the updated test cases with randomly selected repeated test cases to obtain improved chromosomes; wherein, the repeated test cases are test cases with the same path set.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the method for generating the test data of the electric power Internet of things when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the method for generating the test data of the electric power Internet of things when being executed by a processor.
The embodiment of the invention also provides a computer program product, which comprises a computer program, and the computer program realizes the method for generating the test data of the electric power Internet of things when being executed by a processor.
In the embodiment of the invention, historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things are obtained; the method comprises the steps of taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment, and constructing a training data set of each type of electric equipment; training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment; when a request for generating test data for electric equipment is received, the current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output. Compared with the technical scheme in the prior art, the current electricity utilization data of the electric equipment is input into the test data generation model corresponding to the electric equipment type, namely, the test data of the electric equipment can be output, the test data do not need to be manually compiled, the test data generation efficiency is improved, and the test efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. In the drawings:
fig. 1 is a flow chart of a method for generating test data of an electric power internet of things according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a specific example of a method for generating test data of an electric power Internet of things according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating an example of a preprocessing operation interface for applying the method for generating test data of the Internet of things according to the embodiment of the present invention;
FIG. 4 is a diagram illustrating a specific example of a method for generating test data of an electric power Internet of things according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a specific example of a method for generating test data of an electric power Internet of things according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a specific example of a method for generating test data of an electric power Internet of things according to an embodiment of the present invention;
FIG. 7 is a diagram showing a specific example of outputting power consumption test data by using the method for generating test data of the Internet of things according to the embodiment of the present invention;
fig. 8 is a schematic structural diagram of a test data generating device of an electric power internet of things provided in an embodiment of the present invention;
fig. 9 is a diagram of a specific example of a test data generating device for the internet of things of electric power provided in an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings. The exemplary embodiments of the present invention and their descriptions herein are for the purpose of explaining the present invention, but are not to be construed as limiting the invention.
Before describing the embodiments of the present invention, the terms related to the embodiments of the present invention will be described first.
1. Genetic algorithm: the design concept of the genetic algorithm (Genetic Algorithm, GA) is derived from the biological evolution rule in nature. The algorithm converts the solving process of the problem into operations similar to the crossing, variation and the like of chromosome genes in biological evolution by utilizing computer simulation operation, and is widely applied to the fields of machine learning, signal processing, combination optimization and the like at present.
2. Reinforcement learning: reinforcement learning (Reinforcement Learning, RL), also known as reinforcement learning or evaluation learning, is one of the ways machine learning is typically used to solve the problem of learning to maximize return or achieve a specific goal during interaction with the environment.
Vxi bus:
VME bus Extension for Instrumentation, an abbreviation, i.e., an extension of the VME bus in the field of measuring instruments. The bus standard is an industry standard which is completely open worldwide and is applicable to different factories and application fields of different countries.
The embodiment of the invention provides a method for generating test data of an electric power Internet of things, and fig. 1 is a flow chart of the method for generating the test data of the electric power Internet of things, which is provided by the embodiment of the invention, as shown in fig. 1, and comprises the following steps:
step 101: acquiring historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things;
step 102: the method comprises the steps of taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment, and constructing a training data set of each type of electric equipment;
step 103: training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment;
step 104: when a request for generating test data for electric equipment is received, the current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output.
As can be seen from the flow shown in fig. 1, in the embodiment of the present invention, historical electricity consumption data and historical test data of each type of electric equipment in the electric power internet of things are obtained; the method comprises the steps of taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment, and constructing a training data set of each type of electric equipment; training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment; when a request for generating test data for electric equipment is received, the current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output. Compared with the technical scheme in the prior art, the current electricity utilization data of the electric equipment is input into the test data generation model corresponding to the electric equipment type, namely, the test data of the electric equipment can be output, the test data do not need to be manually compiled, the test data generation efficiency is improved, and the test efficiency is improved.
The following describes the execution of steps 101 to 104 in detail.
Aiming at the step 101, historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things are obtained.
In one embodiment, after obtaining the historical electricity consumption data of each type of electric equipment in the electric power internet of things, the method further comprises the following steps: the historical electricity utilization data of each type of electric equipment in the electric power Internet of things is preprocessed as follows: wavelet transformation, time series analysis, data sample comparison, or any combination thereof.
Specifically, as shown in fig. 2, historical electricity utilization data of each type of electric equipment in the electric power internet of things are obtained; preprocessing historical electricity utilization data of each type of electric equipment in the obtained electric power Internet of things; storing the preprocessed historical electricity utilization data of each type of electric equipment into a database; different test report forms are generated according to different pretreatment modes; and displaying the test report generated by different pretreatment modes at the front end. The generated test report may include, for example: real-time data query, signal disturbance recording, simulation interface design, sensor management configuration, data analysis and data patterning. The preprocessing operation interface may, for example, be as shown in fig. 3, and includes an operation button for starting an experiment, pausing, ending an experiment, and the previous step; the period and the test time can be inquired; and can exhibit amplitude. Specifically, the preprocessing operation interface is changed into a graphical form by using Labview (a program development environment) and performs data interaction by using Web Service (an application program), wherein Labview integrates all functions of hardware and data acquisition communication of GPIB (General-Purpose Interface Bus, universal interface bus), VXI bus, RS-232 protocol (a serial communication standard) and RS-485 protocol (a serial communication standard), and meanwhile, library functions with convenient application are built in.
Aiming at the step 102, the historical electricity utilization data and the historical test data of each type of electric equipment in the electric power Internet of things are used as sample data of each type of electric equipment, and a training data set of each type of electric equipment is constructed.
Specifically, historical electricity utilization data of each type of electric equipment in the electric power Internet of things are preprocessed, the preprocessed historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things are used as sample data of each type of electric equipment, and a training data set of each type of electric equipment is constructed.
Aiming at the step 103, training a machine learning model by using the training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment.
Fig. 4 is a specific example diagram of a method for generating test data of an electric power internet of things according to an embodiment of the present invention, as shown in fig. 4, a process for training and testing before applying a test data generating model of each type of electric equipment according to an embodiment of the present invention may include:
step 401: encoding historical electricity consumption data in training data sets of each type of electric equipment to form a plurality of test case sets, and generating an initial population of each type of electric equipment for a genetic algorithm by taking each test case set as a chromosome;
step 402: calculating the fitness value of each chromosome in the initial population of each type of electric equipment, and finding out the chromosome with the largest fitness value in the initial population of each type of electric equipment; the fitness value is used for representing different path numbers covered by the chromosome;
step 403: modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment;
step 404: taking the improved chromosome in the initial population of each type of electric equipment as the next generation population of the electric equipment of the corresponding type for genetic algorithm, and carrying out the next iteration;
step 405: and when the chromosome with the fitness value reaching the set threshold value or the iteration number reaching the set number of times is found, obtaining the trained test data generation model.
For the step 401, in the embodiment, it is assumed that the number of historical electricity consumption data in the training data set of each type of electricity consumption device is M, where the subscript v represents different electricity consumption devices; different v of corresponding chromosome coverage
The path number is M, wherein the subscript p represents different test case sets; different execution paths p of test case set
The total diameter is M; the different path numbers covered by the corresponding dyeing p color bodies can be obtained by using a path test method through a program control flow chart. Wherein each chromosome is c i =[c i (1),c i (2),...,c i (M p )]Each c i (k) Representing a test case, let c i (k)=[x ik (1),x ik (2),...,x ik (M v )],x ik (l) Specify test case c i (k) Is the first historical electricity usage data of (1).
For the step 402, in the embodiment, the fitness value of each chromosome in the initial population of each type of electric equipment is calculated according to the following formula, and the chromosome with the largest fitness value in the initial population of each type of electric equipment is found:
Figure GDA0004069207430000081
wherein ρ is i A set of paths representing chromosomes numbered i; the number of elements in the collection is denoted by i; m is M p Representing the total number of different paths for chromosome number i; fitness (t) i ) And f i Each represents fitness values for chromosome number i. Specifically, the fitness value is used for representing different path numbers covered by the chromosome, namely different execution path total numbers of the test case set; to calculate each chromosome c in the population i Is required to run M v Twice, each time with a given c i (k) And (5) performing operation.
Fig. 5 is a specific example diagram of a method for generating test data of an electric power internet of things, which is provided in an embodiment of the present invention, as shown in fig. 5, a process for modifying a coding parameter of a chromosome with a maximum fitness value in an initial population of each type of electric equipment in an embodiment of the present invention may include:
step 501: randomly selecting a path set by using a reinforcement learning algorithm; wherein the randomly selected path set comprises a path set in a chromosome with the maximum fitness value;
step 502: respectively calculating Jacquard similarity coefficients between an execution path set of each test case in the chromosome with the maximum fitness value and a randomly selected path set;
step 503: changing coding parameters of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value until the execution path set of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value comprises a randomly selected path set or reinforcement learning times reach a set threshold value to obtain updated test cases;
step 504: replacing the updated test cases with randomly selected repeated test cases to obtain improved chromosomes; wherein, the repeated test cases are test cases with the same path set.
In the examples, chromosome c, where fitness is the greatest best The solution can be found and no other operations are needed if the fitness value of (1). However, if fitness value is greatest, chromosome c best If the number is less than 1, it means that at least the test case c in the chromosome having the largest fitness value exists best (k) And test case c in chromosome with maximum fitness value best (m) corresponding to the path ρ best (k) And ρ best (m) identical, such test cases are referred to as duplicate test cases. At the same time M p Some of the paths are not c best Covered by. Randomly selecting one of the groups contained in c best Path ρ of the path set of (a) r And consider improving the fitness of the best path. For example, fitness values of chromosomes may be increased as follows: from one test case c within the chromosome best (h) Initially, its corresponding path ρ best (h) And ρ r Most similar. Similarity is calculated using the Jacquard index and the test case is then modified in order to find a possible coverage ρ r Is a test case of (2). If the process is successful, the newly identified test case is replaced with a duplicate test case within the chromosome, so that the fitness of the chromosome is improved
Figure GDA0004069207430000091
For the step 502, in the embodiment, the jaccard similarity coefficient between the path set of each test case in the chromosome with the largest fitness value and the randomly selected path set is calculated according to the following formula:
Figure GDA0004069207430000092
wherein list is i Representation braidingA set of paths for chromosome i; list(s) j A set of paths representing chromosomes numbered j; n represents intersection; u represents union; jaccard (list) i ,list j ) A jekcal similarity coefficient representing the path of chromosome number i and the path of chromosome number j.
In an embodiment, the Jaccard distance is calculated as follows to represent the difference between the set of paths for chromosome number i and the set of paths for chromosome number j:
Distance(list i ,list j )=1-Jaccard(list i ,list j );
wherein Distance (list i ,list j ) A Jaccard distance representing the set of paths for chromosome i and the set of paths for chromosome j;
in an embodiment, ρ is identified as follows best (h):
Figure GDA0004069207430000093
Wherein ρ is best (h) The path of the chromosome having the greatest fitness value is represented.
For the above steps 503 and 504, in the embodiment, it is assumed that the current test case is t cur(h) . Then at the beginning of the reinforcement learning process, t cur(h) =c best (h) The method comprises the steps of carrying out a first treatment on the surface of the The subscript cur represents a test case at the current time, and h represents an index of the optimal chromosome. Since the index h is not important here, in the rest of the present embodiment we omit the index, using only t cur =[t cur (1),t cur (2),...,t cur (M v )]. Setting the number of states of the problem to M v . I.e. the state space of the problem is defined as s= { s (1), s (2), …, s (M v ) }. In each state s (l), an action is defined to alter t cur Corresponding historical electricity data x cur (l) A. The invention relates to a method for producing a fibre-reinforced plastic composite Wherein the actions of each state space may include, for example: decrease, increase, malfunction, lowerOne step, the last step, zero setting, the next step of replacement and the last step of replacement. The execution path set of the test case corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value is found to comprise a randomly selected path set, or after the reinforcement learning times reach a set threshold, the updated test case is replaced by a randomly selected repeated test case.
Aiming at the step 104, when a request for generating test data for the electric equipment is received, the current electric data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output.
Specifically, after the output test data of the electric equipment is obtained, for example, a black box test method can be adopted to test the platform function, performance efficiency, reliability, usability and maintainability of the platform on which the electric power internet of things test data generation method is implemented. When the platform functions are tested, whether the functional modules and the logic are correct or not is mainly tested, and a black box test method is used for confirming the realized specified functions; when testing performance efficiency, ensuring that all performance indexes meet requirements; when the reliability is tested, whether data verification is performed when data is input is verified, whether a user has an explicit prompt when operating errors or software is abnormal is judged, and meanwhile, the software is guaranteed to have the capability of recovering from the errors; when the usability is tested, the comprehensiveness, the operability and the learning property of the software are ensured; when maintainability is tested, clear and understandable documents are ensured.
Fig. 6 is a specific example diagram of a method for generating test data of an electric power internet of things, where, as shown in fig. 6, historical electricity consumption data and historical test data of each type of electric equipment in the electric power internet of things are obtained and used as dependency conditions of a test data generation model of each type of electric equipment, i.e., the historical electricity consumption data and the historical test data of each type of electric equipment in the electric power internet of things are used as sample data of each type of electric equipment, and a training data set of each type of electric equipment is constructed; training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment; when a request for generating test data for electric equipment is received, current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type at a test platform, and the test data of the electric equipment is output; and displaying the output test data of the electric equipment to a user as a test result. In the embodiment, the collected data information of the voltage, current, power factor and electric quantity of the intelligent socket is input into a test data generation model of the intelligent socket, and the output electricity consumption data of the intelligent socket is shown in fig. 7.
The embodiment of the invention also provides a device for generating the test data of the electric power Internet of things, which is described in the following embodiment. Because the principle of the device for solving the problems is similar to that of the electric power Internet of things test data generation method, the implementation of the device can refer to the implementation of the electric power Internet of things test data generation method, and repeated parts are not repeated.
An embodiment of the present invention provides a device for generating test data of an electric power internet of things, and fig. 8 is a schematic structural diagram of the device for generating test data of an electric power internet of things, provided in the embodiment of the present invention, as shown in fig. 8, where the device includes the following modules:
the acquiring module 81 is configured to acquire historical electricity utilization data and historical test data of each type of electric equipment in the electric power internet of things;
the training data set construction module 82 is configured to construct a training data set of each type of electric equipment by using historical electricity utilization data and historical test data of each type of electric equipment in the electric power internet of things as sample data of each type of electric equipment;
the training module 83 is configured to train the machine learning model with a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment;
and the prediction module 84 is configured to, when receiving a request for generating test data for the electric device, input current power utilization data of the electric device into a test data generation model corresponding to the class of the electric device, and output the test data of the electric device.
Fig. 9 is a diagram of a specific example of the power internet of things test data generating device according to the embodiment of the present invention, as shown in fig. 9, in this example, the power internet of things test data generating device further includes:
the preprocessing module 91 is configured to, after the acquiring module 81 acquires historical electricity data of each type of electric equipment in the electric power internet of things: the historical electricity utilization data of each type of electric equipment in the electric power Internet of things is preprocessed as follows: wavelet transformation, time series analysis, data sample comparison, or any combination thereof.
In one embodiment, the training module 83 is specifically configured to:
encoding historical electricity consumption data in training data sets of each type of electric equipment to form a plurality of test case sets, and generating an initial population of each type of electric equipment for a genetic algorithm by taking each test case set as a chromosome;
calculating the fitness value of each chromosome in the initial population of each type of electric equipment, and finding out the chromosome with the largest fitness value in the initial population of each type of electric equipment; the fitness value is used for representing different path numbers covered by the chromosome;
modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment;
taking the improved chromosome in the initial population of each type of electric equipment as the next generation population of the electric equipment of the corresponding type for genetic algorithm, and carrying out the next iteration;
and when the chromosome with the fitness value reaching the set threshold value or the iteration number reaching the set number of times is found, obtaining the trained test data generation model.
In one embodiment, the fitness value of each chromosome in the initial population of each type of electric equipment is calculated according to the following formula, and the chromosome with the largest fitness value in the initial population of each type of electric equipment is found:
Figure GDA0004069207430000121
wherein ρ is i A set of paths representing chromosomes numbered i; the number of elements in the collection is denoted by i; m is M p Representing the total number of different paths for chromosome number i; fitness (t) i ) And f i Each represents fitness values for chromosome number i.
In one embodiment, the training module 83 is specifically configured to:
randomly selecting a path set by using a reinforcement learning algorithm; wherein the randomly selected path set comprises a path set in a chromosome with the maximum fitness value;
respectively calculating Jacquard similarity coefficients between an execution path set of each test case in the chromosome with the maximum fitness value and a randomly selected path set;
changing coding parameters of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value until the execution path set of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value comprises a randomly selected path set or reinforcement learning times reach a set threshold value to obtain updated test cases;
replacing the updated test cases with randomly selected repeated test cases to obtain improved chromosomes; wherein, the repeated test cases are test cases with the same path set.
In one embodiment, the Jacquard similarity coefficient between the path set of each test case in the chromosome with the largest fitness value and the randomly selected path set is calculated according to the following formula:
Figure GDA0004069207430000122
wherein list is i A set of paths representing chromosomes numbered i; list(s) j A set of paths representing chromosomes numbered j; n represents intersection; u represents union; jaccard (list) i ,list j ) Jacaded representing the path of chromosome number i and the path of chromosome number jSimilarity coefficient.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the method for generating the test data of the electric power Internet of things when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the method for generating the test data of the electric power Internet of things when being executed by a processor.
The embodiment of the invention also provides a computer program product, which comprises a computer program, and the computer program realizes the method for generating the test data of the electric power Internet of things when being executed by a processor.
In the embodiment of the invention, historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things are obtained; the method comprises the steps of taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment, and constructing a training data set of each type of electric equipment; training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment; when a request for generating test data for electric equipment is received, the current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output. Compared with the technical scheme in the prior art, the current electricity utilization data of the electric equipment is input into the test data generation model corresponding to the electric equipment type, namely, the test data of the electric equipment can be output, the test data do not need to be manually compiled, the test data generation efficiency is improved, and the test efficiency is improved.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (7)

1. The method for generating the test data of the electric power Internet of things is characterized by comprising the following steps of:
acquiring historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things;
the method comprises the steps of taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment, and constructing a training data set of each type of electric equipment;
training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment;
when a request for generating test data for electric equipment is received, current power utilization data of the electric equipment is input into a test data generation model corresponding to the electric equipment type, and the test data of the electric equipment is output;
training a machine learning model by using a training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment, wherein the training data set comprises the following steps:
encoding historical electricity consumption data in training data sets of each type of electric equipment to form a plurality of test case sets, and generating an initial population of each type of electric equipment for a genetic algorithm by taking each test case set as a chromosome;
calculating the fitness value of each chromosome in the initial population of each type of electric equipment, and finding out the chromosome with the largest fitness value in the initial population of each type of electric equipment; the fitness value is used for representing different path numbers covered by the chromosome;
modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment;
taking the improved chromosome in the initial population of each type of electric equipment as the next generation population of the electric equipment of the corresponding type for genetic algorithm, and carrying out the next iteration;
when a chromosome with the fitness value reaching a set threshold value or the iteration number reaching the set number is found, obtaining a trained test data generation model;
modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment, wherein the method comprises the following steps:
randomly selecting a path set by using a reinforcement learning algorithm; wherein the randomly selected path set comprises a path set in a chromosome with the maximum fitness value;
respectively calculating Jacquard similarity coefficients between an execution path set of each test case in the chromosome with the maximum fitness value and a randomly selected path set;
changing coding parameters of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value until the execution path set of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value comprises a randomly selected path set or reinforcement learning times reach a set threshold value to obtain updated test cases;
replacing the updated test cases with randomly selected repeated test cases to obtain improved chromosomes; wherein, the repeated test cases are test cases with the same path set.
2. The method for generating test data of the electric power internet of things according to claim 1, further comprising, after obtaining the historical electricity consumption data of each type of electric equipment in the electric power internet of things:
the historical electricity utilization data of each type of electric equipment in the electric power Internet of things is preprocessed as follows:
wavelet transformation, time series analysis, data sample comparison, or any combination thereof.
3. The method for generating test data of the electric power internet of things according to claim 1, wherein the fitness value of each chromosome in the initial population of each type of electric equipment is calculated according to the following formula, and the chromosome with the largest fitness value in the initial population of each type of electric equipment is found:
Figure FDA0004069207420000021
wherein ρ is i A set of paths representing chromosomes numbered i; the number of elements in the collection is denoted by i; m is M p Representing the total number of different paths for chromosome number i; fitness (t) i ) And f i Each represents fitness values for chromosome number i.
4. The method for generating test data of the electric power internet of things according to claim 1, wherein a jaccard similarity coefficient between a path set of each test case in a chromosome with a maximum fitness value and a randomly selected path set is calculated according to the following formula:
Figure FDA0004069207420000022
wherein list is i A set of paths representing chromosomes numbered i; list(s) j A set of paths representing chromosomes numbered j; n represents intersection; u represents union; jaccard (list) i ,list j ) A jekcal similarity coefficient representing the path of chromosome number i and the path of chromosome number j.
5. An electric power thing networking test data generation device, characterized by comprising:
the acquisition module is used for acquiring historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things;
the training data set construction module is used for constructing a training data set of each type of electric equipment by taking historical electricity utilization data and historical test data of each type of electric equipment in the electric power Internet of things as sample data of each type of electric equipment;
the training module is used for training the machine learning model according to the training data set of each type of electric equipment to obtain a test data generation model of each type of electric equipment;
the prediction module is used for inputting the current power utilization data of the electric equipment into the test data generation model corresponding to the electric equipment type when receiving a request for generating the test data for the electric equipment, and outputting the test data of the electric equipment;
the training module is specifically used for:
encoding historical electricity consumption data in training data sets of each type of electric equipment to form a plurality of test case sets, and generating an initial population of each type of electric equipment for a genetic algorithm by taking each test case set as a chromosome;
calculating the fitness value of each chromosome in the initial population of each type of electric equipment, and finding out the chromosome with the largest fitness value in the initial population of each type of electric equipment; the fitness value is used for representing different path numbers covered by the chromosome;
modifying the coding parameters of the chromosome with the maximum fitness value in the initial population of each type of electric equipment to obtain the improved chromosome in the initial population of each type of electric equipment;
taking the improved chromosome in the initial population of each type of electric equipment as the next generation population of the electric equipment of the corresponding type for genetic algorithm, and carrying out the next iteration;
when a chromosome with the fitness value reaching a set threshold value or the iteration number reaching the set number is found, obtaining a trained test data generation model;
the training module is specifically used for:
randomly selecting a path set by using a reinforcement learning algorithm; wherein the randomly selected path set comprises a path set in a chromosome with the maximum fitness value;
respectively calculating Jacquard similarity coefficients between an execution path set of each test case in the chromosome with the maximum fitness value and a randomly selected path set;
changing coding parameters of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value until the execution path set of the test cases corresponding to the Gao Jieka De similarity coefficient in the chromosome with the largest fitness value comprises a randomly selected path set or reinforcement learning times reach a set threshold value to obtain updated test cases;
replacing the updated test cases with randomly selected repeated test cases to obtain improved chromosomes; wherein, the repeated test cases are test cases with the same path set.
6. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the power internet of things test data generation method of any one of claims 1 to 4 when the computer program is executed.
7. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, implements the power internet of things test data generation method of any one of claims 1 to 4.
CN202210186789.9A 2022-02-28 2022-02-28 Method and device for generating test data of electric power Internet of things Active CN114676042B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210186789.9A CN114676042B (en) 2022-02-28 2022-02-28 Method and device for generating test data of electric power Internet of things

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210186789.9A CN114676042B (en) 2022-02-28 2022-02-28 Method and device for generating test data of electric power Internet of things

Publications (2)

Publication Number Publication Date
CN114676042A CN114676042A (en) 2022-06-28
CN114676042B true CN114676042B (en) 2023-04-25

Family

ID=82072470

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210186789.9A Active CN114676042B (en) 2022-02-28 2022-02-28 Method and device for generating test data of electric power Internet of things

Country Status (1)

Country Link
CN (1) CN114676042B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116775499A (en) * 2023-08-21 2023-09-19 中国电信股份有限公司 Test data generation method, device, computer equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866904B (en) * 2015-06-16 2019-01-01 中电科软件信息服务有限公司 A kind of BP neural network parallel method of the genetic algorithm optimization based on spark
CN107423818A (en) * 2017-06-26 2017-12-01 中国电力科学研究院 A kind of method and system of the test data set generation of power information acquisition system unified interface
CN111176990B (en) * 2019-12-23 2023-05-30 深圳壹账通智能科技有限公司 Test data generation method and device based on data decision, and computer equipment

Also Published As

Publication number Publication date
CN114676042A (en) 2022-06-28

Similar Documents

Publication Publication Date Title
US20230028511A1 (en) Constructing and operating an artificial recurrent neural network
WO2022258775A1 (en) Automatic xai (autoxai) with evolutionary nas techniques and model discovery and refinement
CN114676042B (en) Method and device for generating test data of electric power Internet of things
Le Thi My Hanh et al. Mutation-based test data generation for simulink models using genetic algorithm and simulated annealing
CN116245019A (en) Load prediction method, system, device and storage medium based on Bagging sampling and improved random forest algorithm
Wang et al. Policy iteration for relational MDPs
Becker et al. Discovering ordinary differential equations that govern time-series
CN113901622A (en) Genetic algorithm optimization-based SVM power distribution network topology identification method
Ma et al. Rethinking decision transformer via hierarchical reinforcement learning
CN115936926A (en) SMOTE-GBDT-based unbalanced electricity stealing data classification method and device, computer equipment and storage medium
GB2586981A (en) Code optimisation system and method
Palermo et al. A reinforcement learning environment for mathematical reasoning via program synthesis
Sànchez-Marrè et al. Evolving GESCONDA to an Intelligent Decision Support Tool
Marsden et al. Predicting Student Performance with Control-flow Graph Embeddings
Duyvesteyn et al. Genetic programming in economic modelling
Pang et al. Qml-AiNet: an immune-inspired network approach to qualitative model learning
Winkler et al. Genetic programming based model structure identification using on-line system data
Pereira Automated Logic Circuit Invention
Wojtusiak Data-driven constructive induction in the learnable evolution model
Lounis et al. Predicting quality attributes via machine-learning algorithms
Liu Towards Practical Offline Reinforcement Learning: Sample Efficient Policy Selection and Evaluation
CN117873888A (en) Deep learning-based efficient PDF application program fuzzy test case generation method
Lanzi Estimating classifier generalization and action’s effect: A minimalist approach
CN117592727A (en) Insurance resource processing method and device, electronic equipment and storage medium
Borges et al. Representing, learning and extracting temporal knowledge from neural networks: a case study

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