Test method and equipment for secondary equipment of transformer substation and storage medium
By obtaining and analyzing test case models, using natural language processing technology to generate test cases for substation secondary equipment, it solves the problem of time-consuming and labor-consuming manual writing of test cases in the existing technology, and realizes efficient and accurate test case generation and application , improves testing efficiency and accuracy.
Patent Information
- Application Number
- CN202411312967.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-20
AI Technical Summary
In the prior art, the test method of substation secondary equipment relies on manual writing of test cases, which leads to time-consuming and labor-consuming, low testing efficiency and easy to cause errors and omissions. Especially when facing complex functions, the test threshold is high and the efficiency is low.
By obtaining the test case model, reading the model source code, extracting the test command part, semantically encoding the functional requirement description information, generating test objects and operation data replacement code, building test cases, and using natural language processing technology to generate tests that meet actual needs. Use cases, reduce manual intervention, and improve the speed and accuracy of test cases.
It realizes the rapid generation of test cases that meet actual needs, reduces the time and cost of test cases construction, improves testing efficiency and accuracy, and is suitable for different secondary equipment and testing instruments, ensuring the comprehensiveness and accuracy of tests.
Smart Images

Figure CN119201728A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electric power technology, and in particular to a testing method, equipment and storage medium for secondary equipment of a transformer substation. Background Art
[0002] With the rapid development of power systems, substations, as one of the key nodes in the power grid, play an important role in the reliability of the entire power system. At present, the automation and intelligence of substations are constantly improving, and the functional complexity of secondary equipment is also increasing, such as protection devices, measurement devices and monitoring systems, which are of positive significance to the safe, stable and efficient operation of power systems.
[0003] In order to ensure the reliability and accuracy of secondary equipment, the secondary equipment will be tested. Traditional testing methods usually rely on testers to manually write test cases and then call the test cases to execute the tests.
[0004] However, manually writing test cases consumes a lot of manpower and time, especially when facing complex secondary device functions, the number and complexity of test cases will increase significantly. At the same time, the professional knowledge and experience of testers have a great impact on the quality of test cases. The high threshold of testing makes test cases prone to errors and omissions, resulting in low testing efficiency. Summary of the invention
[0005] In view of this, the present invention provides a test method, a device and a storage medium for substation secondary equipment, so as to improve the efficiency of testing the substation secondary equipment.
[0006] A first aspect of the present invention provides a method for testing secondary equipment of a substation, comprising:
[0007] Acquire a test case model set for a secondary device in a substation; the secondary device has functional requirement description information;
[0008] Reading model source code from the test case model;
[0009] Extracting a test command source code portion from the model source code;
[0010] Performing semantic coding on the functional requirement description information to obtain a semantic coding feature vector of the functional requirement description;
[0011] Inputting the semantic coding feature vector of the functional requirement description into a preset generator to generate a test object replacement code part and an operation data replacement code part;
[0012] Constructing a test case according to the test object replacement code part, the operation data replacement code part and the test command source code part;
[0013] The secondary device is tested using the test case.
[0014] A second aspect of the present invention provides a test device for substation secondary equipment, comprising:
[0015] A test case model acquisition module is used to acquire a test case model set for a secondary device in a substation; the secondary device has functional requirement description information;
[0016] A model source code reading module, used to read the model source code from the test case model;
[0017] A source code part extraction module, used for extracting a test command source code part from the model source code;
[0018] A semantic coding module, used to perform semantic coding on the functional requirement description information to obtain a semantic coding feature vector of the functional requirement description;
[0019] A replacement code part generating module, used for inputting the semantic coding feature vector of the functional requirement description into a preset generator to generate a test object replacement code part and an operation data replacement code part;
[0020] A test case construction module, used to construct a test case according to the test object replacement code part, the operation data replacement code part and the test command source code part;
[0021] A device testing module is used to test the secondary device using the test case.
[0022] A third aspect of the present invention provides an electronic device, the electronic device comprising:
[0023] at least one processor; and
[0024] a memory communicatively connected to the at least one processor; wherein,
[0025] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the test method for substation secondary equipment as described in the first aspect above.
[0026] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method for testing secondary equipment of a substation as described in the first aspect above.
[0027] A fifth aspect of the present invention provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the method for testing substation secondary equipment as described in the first aspect above is implemented.
[0028] In this embodiment, a test case model for setting a secondary device in a substation is obtained; the secondary device has functional requirement description information; the model source code is read from the test case model; the test command source code part is extracted from the model source code; the functional requirement description information is semantically encoded to obtain a functional requirement description semantic encoding feature vector; the functional requirement description semantic encoding feature vector is input into a preset generator to generate a test object replacement code part and an operation data replacement code part; a test case is constructed based on the test object replacement code part, the operation data replacement code part and the test command source code part; and the secondary device is tested using the test case. This embodiment generates test cases based on natural language processing technology, and can quickly generate test cases that meet actual needs through semantic analysis and encoding of the functional requirements of the secondary device, which not only reduces manual intervention, but also can be customized according to the specific functional requirements of the secondary device, ensuring the accuracy and effectiveness of the test cases. In this way, not only can the construction speed of the test case be improved, but also the test case can be applied to different secondary devices and test instruments, effectively improving the efficiency of the test and reducing the test cost.
[0029] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 It is a flow chart of a method for testing secondary equipment of a substation provided in Embodiment 1 of the present invention.
[0032] Figure 2 It is a schematic diagram of a cloud testing center provided in Example 1 of the present invention.
[0033] Figure 3 This is a logical architecture diagram of a cloud testing center provided in Example 1 of the present invention.
[0034] Figure 4It is a structural schematic diagram of a testing device for substation secondary equipment provided in Embodiment 2 of the present invention.
[0035] Figure 5 It is a structural schematic diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can cover sequential implementations other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0038] Embodiment 1
[0039] See also Figure 1 , shows a flow chart of a method for testing a substation secondary device provided by a first embodiment of the present invention, the method can be executed by a testing device for substation secondary devices, the testing device for substation secondary devices can be implemented in the form of hardware and / or software, and the testing device for substation secondary devices can be configured in an electronic device. Figure 1 As shown, the method includes:
[0040] Step 101: Obtain a test case model set for secondary equipment in a substation.
[0041] like Figure 2As shown, this embodiment can be applied to a cloud testing center. On the one hand, the cloud testing center can obtain a test case model and functional requirement description information of a secondary device to be tested, and input the test case model and the functional requirement description information into a server 201 deployed with an artificial intelligence-based automatic testing algorithm for substation secondary equipment, wherein the server can use the artificial intelligence-based automatic testing algorithm for substation secondary equipment to process the test case model and the functional requirement description of the device to be tested to generate a test case.
[0042] Furthermore, two-way interactive test control messages are required between the cloud test center's automatic test application and the tester, such as test startup, system online, test case distribution, test stop, report upload, etc. The real-time communication requirements are low, but the interaction process is complex. Considering security, a wireless connection solution is adopted. Wireless connection is used for security verification to ensure communication security. Application layer functions are designed based on wireless connection to implement test process control and test case file transmission respectively. Test control processes such as test system startup, online, test stop, and report upload have the characteristics of request and response, and the message length is small. They are implemented using JSON (JavaScript Object Notation) messages. Downloading test case files and uploading test result data have the characteristics of large data packets and high accuracy requirements. A file transmission method with verification is adopted to ensure transmission accuracy.
[0043] like Figure 3 As shown in the figure, the test template editing platform adopts a four-layer architecture of model, data, application and graphics, and designs modules such as log monitoring, service communication, and service scheduling to achieve decoupling of data, application logic and graphical interface, and further achieve decoupling between specific testers and measurement and control protection devices and test cases, so that a set of test case templates can be applied to multiple testers and multiple devices on site. The model layer defines the data structure of measurement and control protection devices, testers, system parameters, test cases, and test reports, and uses database tables to implement them, providing a basis for data object creation. The above object data structure is designed according to the requirements of automatic verification and test result analysis. The data layer stores the instance data of measurement and control protection devices, testers, system parameters, test cases, and test reports based on the model structure, and uses database table recording. Data objects provide the basis for test case editing and execution, and the business logic layer provides a data object maintenance module. The business logic layer adopts the model / controller / view (MCV) architecture, connecting the graphics layer and the data layer. The graphics page obtains data from the data layer through the business logic layer and feeds back the user operation to the business logic layer. The business logic layer modifies the data and feeds back to the graphics layer, including modules such as parameter management, test case management, template access, and test case tree management. At the same time, the system designs functions such as log monitoring and service communication, providing the basis for system operation and maintenance, including service bus, service scheduling module, and data access interface.
[0044] In this embodiment, the interface provided by the automatic commissioning and acceptance system of the substation can be called to obtain the test case model set for the secondary equipment. The test case model serves as a template for the test case and can include various test scenarios such as functional testing, performance testing, and safety testing of the substation secondary equipment.
[0045] Step 102: Read the model source code from the test case model.
[0046] In this embodiment, source code may be extracted from the test case model and recorded as model source code to facilitate subsequent code segmentation and test case generation.
[0047] Step 103: extract the test command source code portion from the model source code.
[0048] In this embodiment, the model source code may be structurally parsed, and source code related to the command part may be extracted from the model source code and recorded as the command source code part.
[0049] Furthermore, the model source code can be segmented to obtain the test command source code part, the test object source code part and the operation data source code part under the established code framework. Such segmentation helps in the subsequent test case parameter generation and test case assembly.
[0050] The test object source code part is the source code related to the object to be tested, and the operation data source code part is the source code related to the data operation to be tested.
[0051] Step 104: semantically encode the functional requirement description information to obtain a semantically encoded feature vector of the functional requirement description.
[0052] In practical applications, secondary equipment has functional requirement description information, which can be derived from technical specifications, design documents and other documents of substation secondary equipment, which describe in detail the functions and performance standards that the secondary equipment should meet.
[0053] The NLP (Natural Language Processing) technology is used to semantically encode the functional requirement description information of the secondary equipment, and convert it into a computer-recognizable functional requirement description semantic encoding feature vector.
[0054] In one embodiment of the present invention, step 104 may further include the following steps:
[0055] Step S11: semantically parse the functional requirement description information to obtain an abstract syntax tree.
[0056] In this embodiment, a preset semantic parser may be used to perform semantic parsing on the functional requirement description information to obtain an Abstract Syntax Tree (AST).
[0057] Since there may be ambiguity or unclearness in the functional requirement description information, the semantic parser can help eliminate this ambiguity and ensure that each functional requirement is correctly understood.
[0058] Specifically, the abstract syntax tree can convert unstructured text information into a structured data form, so that the various components of functional requirements (such as input, output, conditions, operations, etc.) can be clearly represented in a tree structure, which is easy to understand and analyze.
[0059] By decomposing complex functional requirement description information into simple tree-structured nodes and edges, it can facilitate the subsequent semantic understanding of functional requirement description, code generation and test case design. At the same time, through the tree structure, operations such as traversal, modification and optimization can be easily performed, providing support for subsequent test case generation and execution.
[0060] Step S12: perform semantic embedding coding on each node and each edge in the abstract syntax tree to obtain a semantic embedding coding representation of the original tree.
[0061] In this embodiment, semantic embedding coding may be performed jointly on each node and each edge in the abstract syntax tree to obtain a semantic embedding coding representation of the original tree.
[0062] Through semantic embedding coding, the semantic features of each node and edge can be converted into a vector representation. This vectorized form can retain the semantic information of functional requirements, allowing computers to understand the deep meaning of the requirements.
[0063] In addition, semantic embedding coding maps nodes and edges to a high-dimensional feature space, which can capture more complex semantic relationships and improve expressiveness. In other words, the processing method of semantic embedding coding can capture the relationship and contextual information between nodes, thereby better reflecting the logical structure and functional dependency of functional requirements.
[0064] Step S13: perform feature sequence selection enhancement on the energy distribution spectrum for the set of node semantic embedding coding vectors in the original tree semantic embedding coding representation to obtain a set of enhanced node semantic embedding coding vectors.
[0065] Each node in the abstract syntax tree represents a part of semantic information. Through semantic embedding technology, these nodes can be converted into vectors in high-dimensional space (i.e., node semantic embedding encoding vectors).
[0066] The node semantic embedding coding vector not only contains the basic information of the node, but also implies the context-related semantic information. In addition, the semantic embedding coding vectors of each node in the original tree semantic embedding coding representation respectively reflect part of the semantic information and grammatical structure of the functional requirements description information of the secondary device, but not all semantics have relevance and role for the understanding of the functional requirements of the secondary device and subsequent tasks.
[0067] That is to say, there will be some noise information and redundant information irrelevant to the subsequent semantic understanding and code generation tasks in each node semantic embedding coding vector in the set of node semantic embedding coding vectors. This information will affect the accuracy of semantic understanding of subsequent functional requirements and the execution of subsequent tasks, thereby affecting the generation quality of test cases.
[0068] Based on this, feature sequence selection enhancement can be performed on the set of node semantic embedding coding vectors on the energy distribution spectrum to obtain a set of enhanced node semantic embedding coding vectors, which can better support the subsequent semantic understanding of secondary equipment functional requirements and test case generation tasks.
[0069] Feature sequence selection enhancement on energy distribution spectrum is a feature selection technique that optimizes the combination of node semantic embedding coding vectors by quantifying the energy distribution of node semantic features in different parts.
[0070] In one embodiment of the present invention, step S13 may further include the following steps:
[0071] Step S21, calculate the feature energy distribution spectrum vector of each node semantic embedding coding vector in the set of original node semantic embedding coding vectors, and obtain a sequence of node semantic feature energy distribution spectrum vectors.
[0072] In this embodiment, a feature energy distribution spectrum analysis is performed on each node semantic embedding coding vector in the set of original node semantic embedding coding vectors, and its feature energy distribution spectrum vector is calculated to obtain a sequence of node semantic feature energy distribution spectrum vectors. This can quantify the distribution of the semantic embedding coding vector of each node at different frequencies or energy levels, which helps to identify representative and informative nodes and optimize the feature selection process.
[0073] In one embodiment of the present invention, S21 may further include the following steps:
[0074] S31. Calculate the feature distribution energy collaborative representation vector between each node semantic embedding coding vector and other node semantic embedding coding vectors in the set of node semantic embedding coding vectors respectively, and obtain a sequence of multiple node semantic feature distribution energy collaborative representation vectors.
[0075] In a specific implementation, a predetermined node semantic embedding coding vector is extracted from a sequence of characteristic energy distribution spectrum vectors of the node semantic embedding coding vector.
[0076] The maximum values of the current node semantic embedding coding vector and other node semantic embedding coding vectors are extracted element by element, and a sequence of node semantic feature distribution energy collaborative representation vectors corresponding to the predetermined node semantic embedding coding vector is obtained.
[0077] S32. Calculate the feature distribution energy coordination factor vector of each node semantic feature distribution energy coordination representation vector sequence in the sequence of multiple node semantic feature distribution energy coordination representation vectors to obtain a sequence of node semantic feature energy distribution spectrum vectors.
[0078] In a specific implementation, the maximum value of each node semantic feature distribution energy collaborative representation vector in the sequence of node semantic feature distribution energy collaborative representation vectors is extracted respectively to obtain a sequence of node semantic feature maximum values.
[0079] The mean and variance of the energy co-representation vector of each node semantic feature distribution are calculated respectively, and the sequence of node semantic feature means and the sequence of node semantic feature variances are obtained.
[0080] The sequence of node semantic feature variances and the preset hyperparameters are added by position to obtain the sequence of the first energy distribution coefficients of the node semantic features.
[0081] The square of the difference between the maximum values of node semantic features and the mean values of node semantic features corresponding to the sequence of the maximum values of node semantic features and the sequence of the mean values of node semantic features is calculated to obtain a sequence of node semantic difference values.
[0082] The sequence of node semantic feature variances is multiplied by the constant 2 by position to obtain the sequence of modulated node semantic feature variances.
[0083] The node semantic difference values and the modulated node semantic feature variances in each group corresponding to the sequence of node semantic difference values and the sequence of modulated node semantic feature variances are added to obtain the feature sum, and the feature sum is added to the hyperparameter to obtain the sequence of the second energy distribution coefficients of the node semantic features.
[0084] The sequence of the first energy distribution coefficients of the node semantic features is divided by the sequence of the second energy distribution coefficients of the node semantic features according to the position, and a node semantic feature energy distribution spectrum vector composed of multiple feature distribution energy synergy factors is obtained.
[0085] Step S22: Calculate the mean vector of the sequence of node semantic feature energy distribution spectrum vectors by position as the center vector of the node semantic energy spectrum distribution.
[0086] In this embodiment, the positional mean vector of the node semantic feature energy distribution spectrum vector sequence is calculated to obtain the node semantic energy spectrum distribution center vector, which represents the center position of the entire node semantics in the energy distribution spectrum space.
[0087] Step S23, calculate the energy distribution spectrum span factor between the node semantic energy spectrum distribution center vector and each node semantic feature energy distribution spectrum vector in the sequence of node semantic feature energy distribution spectrum vectors, and obtain a sequence of node semantic energy distribution spectrum span factors.
[0088] In this embodiment, the difference between the central vector of the node semantic feature energy spectrum distribution and the semantic feature energy distribution spectrum vector of each node is calculated to obtain the energy distribution spectrum span factor, thereby constructing a sequence of node semantic energy distribution spectrum span factors, wherein the span factor quantifies the distance between each feature vector and the central vector, reflecting the degree of discreteness of the feature vector.
[0089] In a specific implementation, the difference between the node semantic feature energy distribution spectrum vector and the node semantic energy spectrum distribution center vector is calculated according to the position to obtain the node semantic differential feature vector.
[0090] The covariance matrix between the center vector of the node semantic energy spectrum distribution and the spectrum vector of the node semantic feature energy distribution is calculated, and the inverse of the covariance matrix is taken to obtain the node semantic inverse covariance matrix.
[0091] The transposed vector of the node semantic differential feature vector, the product of the node semantic inverse covariance matrix and the node semantic differential feature vector are calculated to obtain the node semantic distribution value.
[0092] The square root of the node semantic distribution value is calculated to obtain the node semantic energy distribution spectrum span factor.
[0093] Step S24: If each node semantic energy distribution spectrum span factor in the sequence of node semantic energy distribution spectrum span factors is less than or equal to a preset threshold, the sequence of node semantic energy distribution spectrum span factors is determined to be a set of enhanced node semantic embedding coding vectors.
[0094] In this embodiment, the energy distribution spectrum span factor of the node semantics is compared with a preset threshold. When each node semantic energy distribution spectrum span factor in the sequence of node semantic energy distribution spectrum span factors is less than or equal to the preset threshold, the sequence of node semantic energy distribution spectrum span factors is determined to be a set of enhanced node semantic embedding coding vectors. In this way, by selecting node semantics within a certain range of distance from the node semantic center, those redundant or noisy nodes can be effectively removed, ensuring that the set of enhanced node semantic embedding coding vectors is more relevant and representative to the semantic understanding of the functional requirement description information of subsequent secondary devices and the generation of test cases.
[0095] In this embodiment, the process of feature sequence selection enhancement can be expressed as:
[0096] V co,j =max((V i , V j )
[0097]
[0098] P i ={e i1 , e i2 ,..,e ij ,..,e in}
[0099] P={P 1 , P 2 , ..., P i , ..., P N}
[0100]
[0101]
[0102] K={f i |Dist(c,P i )≤θ}
[0103] Among them, V i and V j denote the i-th node semantic embedding coding vector and the j-th node semantic embedding coding vector in the set of node semantic embedding coding vectors, respectively. max(·, ·) denotes the maximum value between the two vectors element by element. V co,ij is the node semantic feature distribution energy collaborative representation vector between the i-th node semantic embedding coding vector and the j-th node semantic embedding coding vector, max(·) is the maximum value of the extracted vector, μ ij and σ ij 2 V co,ijThe mean and variance of , λ is the preset hyperparameter, e ij is the jth feature distribution energy synergy factor in the i-th node semantic feature energy distribution spectrum vector in the sequence of node semantic feature energy distribution spectrum vectors, e in is the nth feature distribution energy synergy factor in the energy distribution spectrum vector of the semantic feature of the i-th node, P represents the sequence of the energy distribution spectrum vector of the node semantic feature, P i is the i-th node semantic feature energy distribution spectrum vector in the sequence of node semantic feature energy distribution spectrum vectors, N is the number of vectors in the sequence of node semantic feature energy distribution spectrum vectors, c is the center vector of node semantic energy spectrum distribution, (·) T is the transpose of the vector, S i is the covariance matrix between the energy distribution spectrum vector of the semantic feature of the i-th node and the center vector of the semantic energy spectrum distribution of the node, Dist(c,P i ) is the node semantic energy distribution spectrum span factor corresponding to the i-th node semantic feature energy distribution spectrum vector, θ is the preset threshold, and f i is the i-th enhanced node semantic embedding coding vector in the set of enhanced node semantic embedding coding vectors, and K is the set of enhanced node semantic embedding coding vectors.
[0104] Step S14: In the original tree semantic embedding coding representation, the set of node semantic embedding coding vectors is replaced with the set of enhanced node semantic embedding coding vectors to obtain the enhanced tree semantic embedding coding representation.
[0105] In this embodiment, in the original tree semantic embedding coding representation, a set of node semantic embedding coding vectors is replaced with a set of enhanced node semantic embedding coding vectors to obtain an enhanced tree semantic embedding coding representation.
[0106] Step S15: Input the enhanced tree semantic embedding coding representation into a preset semantic encoder and encode it into a semantic coding feature vector of the functional requirement description information.
[0107] In this embodiment, the enhanced tree semantics embedding coding representation is input into a preset semantic encoder, such as a semantic encoder based on Tree-LSTM (Tree-structured Long Short Term Memory, tree-long short-term memory network), and the semantic encoder encodes it into a semantic coding feature vector of functional requirement description information.
[0108] Among them, Tree-LSTM is a variant of recursive neural network (RNN) that can be used to process structured input data, such as syntax trees or syntactic trees. Therefore, Tree-LSTM is suitable for syntactic analysis tasks in natural language processing, because Tree-LSTM not only considers the meaning of the words themselves, but also considers the relationship between the words and their positions in the sentence structure, so that Tree-LSTM can capture the structured dependencies between words in the sentence. This helps to understand the semantics of the functional requirement description information more deeply, so as to more accurately understand the semantics of the functional requirement description information of the secondary equipment and generate more accurate semantic encoding feature vectors. In this way, the semantics of the functional requirement description information of the secondary equipment can be understood and encoded, thereby ensuring the intelligence and efficiency of the test case generation process, helping to achieve more intelligent automatic testing of substation secondary equipment, and providing support for the comprehensiveness and accuracy of substation secondary equipment testing.
[0109] Specifically, in Tree-LSTM, the data is first represented as a tree, where each node represents a data unit (such as a word, phrase, etc.), and the edge represents the relationship between nodes. Each node contains an input vector and a state vector (similar to the hidden state in LSTM). The input vector can be a word embedding or other feature representation. One of the keys of Tree-LSTM is to recursively update the state of each node. For each node in the tree, its state update depends on the state of its child nodes. The state update of each node follows the update rule of LSTM, but is appropriately modified to adapt to the tree structure.
[0110] Among them, Tree-LSTM includes: Forget Gate: determines which information should be discarded from the state vector; Input Gate: determines which new information should be stored; Cell State: updates the cell state, combining the information of the forget gate and the input gate; Output Gate: determines the value of the output state, based on the updated cell state. At each level of the tree, the parent node receives information from all its child nodes and combines this information with its own input vector to update its state vector. This process is recursive until the root node of the tree. The root node of the tree ultimately contains the information of the entire tree, and the state vector or output vector of this node can be used for downstream tasks such as classification, regression, etc. In this way, Tree-LSTM effectively processes tree-structured data and captures the hierarchical and sequential relationships between nodes, so that it performs well in processing complex data such as natural language.
[0111] In the process of generating test cases, the functional requirement description information of the secondary equipment is semantically encoded to accurately understand the functional requirements of the secondary equipment. A comprehensive understanding of the functional requirements of the secondary equipment can ensure that the generated test cases cover all necessary functions and scenarios and avoid missing important test points.
[0112] Based on this, in the process of semantic coding of the functional requirement description of the device under test, this embodiment forms an abstract syntax tree by semantically parsing the functional requirement description of the device under test, and introduces a semantic understanding model based on artificial intelligence and deep learning technology at the back end to analyze the abstract syntax tree, so as to capture and learn the semantic embedding coding features of the abstract syntax tree, and update and replace the original node embedding semantic set according to the enhanced representation of each node embedding semantic set in the semantic embedding coding feature, so as to obtain the semantic embedding coding representation of the abstract syntax tree of the enhanced functional requirement description, and then use the semantic encoder based on Tree-LSTM to perform the semantic coding of the enhanced functional requirement description, so as to more comprehensively and accurately understand the semantics of the functional requirement description of the device under test. In this way, the intelligence and efficiency of the test case generation process are ensured, which helps to realize a more intelligent substation secondary equipment automatic test system and provide support for the comprehensiveness and accuracy of substation secondary equipment testing.
[0113] Step 105: Input the semantic encoding feature vector of the functional requirement description into a preset generator to generate a test object replacement code part and an operation data replacement code part.
[0114] In this embodiment, the semantic encoding feature vector of the functional requirement description may be optimized to improve the quality of the feature.
[0115] In a specific implementation, the length of the semantic coding feature vector of the functional requirement description is subtracted from the 0 norm of the semantic coding feature vector of the functional requirement description to obtain the semantic coding isolated representation value of the functional requirement description; the logarithm with base 2 of the square of the semantic coding isolated representation value of the functional requirement description and the sum of the semantic coding isolated representation value of the functional requirement description is calculated to obtain the semantic coding information order value of the functional requirement description; a power function is calculated with each eigenvalue of the semantic coding feature vector of the functional requirement description as the base and the difference between the semantic coding isolated representation value of the functional requirement description and one as the exponent, and the power function is point multiplied with the semantic coding information order value of the functional requirement description to obtain the semantic coding information order value of the functional requirement description. The semantic coding precursor vector is used; the difference between the functional requirement description semantic coding feature vector and the functional requirement description semantic coding isolated representation value minus one is point-multiplied, and then the difference is point-multiplied with the reciprocal of the functional requirement description semantic coding isolated representation value to obtain the functional requirement description semantic coding field constraint vector of the device under test; an exponential function is calculated with the natural constant as the base and each eigenvalue of the functional requirement description semantic coding field constraint vector is exponentially calculated to obtain the functional requirement description semantic coding field bias vector of the device under test; the functional requirement description semantic coding precursor vector is point-added with the functional requirement description semantic coding field bias vector to obtain the optimized functional requirement description semantic coding feature vector.
[0116] Then, the optimization formula of the semantic encoding feature vector of functional requirement description can be expressed as:
[0117]
[0118] n=L-||V||0
[0119] Where V represents the semantic encoding feature vector of the functional requirement description, L represents the length of the semantic encoding feature vector of the functional requirement description, ||·||0 represents the zero norm of the vector, n represents the isolated representation value of the semantic encoding of the functional requirement description, log(·) represents the logarithm operation with base 2, exp[·] represents the exponential operation with base e, (·) ⊙(n-1) It represents the power function of the eigenvalues at each position in the eigenvector, using the difference between the value of the isolated representation minus one as the exponent of the semantic encoding of the functional requirement description. represents point addition, ⊙ represents point multiplication, and V' represents the optimized semantic encoding feature vector of functional requirement description.
[0120] If the optimization is completed, the semantic encoding feature vector of the functional requirement description can be input into the generator based on AIGC (artificial intelligence production content) to generate the test object replacement code part and the operation data replacement code part.
[0121] The test object replacement code portion is the source code related to the object to be tested, and the operation data replacement code portion is the source code related to the data operation to be tested.
[0122] In this embodiment, a set of enhanced node semantic embedding coding vectors is used to replace a set of node semantic embedding coding vectors in the abstract syntax tree semantic embedding coding representation of the functional requirement description to obtain an enhanced node semantic embedding coding representation. Although this improves the accuracy and richness of the semantic coding of each node in the abstract syntax tree, since the edges in the abstract syntax tree are not strengthened by semantic associations, when the enhanced abstract syntax tree semantic embedding coding representation of the functional requirement description is input into the Tree-LSTM-based semantic encoder for global semantic aggregation encoding, the semantic aggregation structure will be offset due to the uneven distribution of semantic topology. It is expected to further improve the global semantic structural aggregation regression comprehensibility of the functional requirement description semantic encoding feature vector, thereby improving the accuracy of the test object replacement code part and the operation data replacement code part obtained by inputting the test case parameter generator based on the AIGC model.
[0123] Therefore, for the high-dimensional feature manifold of the semantic coding feature vector of the functional requirement description, the eigenvalue of the feature set is used as the vector field representation of the aggregation dimension, and the superposition value of the vector field of the semantic coding feature vector of the functional requirement description at the isolated zero position is used as the order information to fix the local position of the eigenvalue of its feature set, and add the bias of the reversibility of the feature regression distribution field of the semantic coding feature vector of the functional requirement description as a reward to achieve the mapping target tracking of the regression distribution of the semantic coding feature vector of the functional requirement description for the eigenvalue position, so that the feature set of the semantic coding feature vector of the functional requirement description can perceive the mapping migration to the aggregate distribution, thereby improving the accuracy of the test object replacement code part and the operation data replacement code part of the semantic coding feature vector of the functional requirement description based on the generator by improving the global semantic structural aggregation regression comprehensibility of the semantic coding feature vector of the functional requirement description. In this way, the semantics of the functional requirement description of the secondary equipment can be understood more comprehensively and accurately, ensuring the intelligence and efficiency of the test case generation process, which is conducive to realizing more intelligent automatic testing of substation secondary equipment and providing support for the comprehensiveness and accuracy of substation secondary equipment testing.
[0124] Step 106: construct a test case based on the test object replacement code part, the operation data replacement code part and the test command source code part.
[0125] In this embodiment, the test object replacement code part, the operation data replacement code part and the test command source code part are effectively spliced and integrated into a complete source code, recorded as the test case source code, so that the test case is constructed based on the test case source code, ensuring the integrity and executableness of the test case.
[0126] In a specific implementation, in a given code framework, the test object replacement code portion replaces the test object source code portion, and the operation data replacement code portion replaces the operation data source code portion, respectively, to meet specific test requirements.
[0127] If the replacement is completed, the test command source code part, the test object replacement code part, and the operation data replacement code part are spliced into the test case source code according to the established code framework, so as to generate the test case using the test case source code.
[0128] Generally speaking, a test case is related to the function to be tested. The test case command, test object and operation data used in the test case correspond to a command of an abstract tester or an interface of the function to be tested or the calculation amount of the value to be measured.
[0129] Step 107: Use the test case to test the secondary device.
[0130] In this embodiment, test cases can be run in the test platform to test the secondary equipment of the substation to verify whether the functions and performances of the secondary equipment of the substation meet expectations.
[0131] In this embodiment, a test case model for setting a secondary device in a substation is obtained; the secondary device has functional requirement description information; the model source code is read from the test case model; the test command source code part is extracted from the model source code; the functional requirement description information is semantically encoded to obtain a functional requirement description semantic encoding feature vector; the functional requirement description semantic encoding feature vector is input into a preset generator to generate a test object replacement code part and an operation data replacement code part; a test case is constructed based on the test object replacement code part, the operation data replacement code part and the test command source code part; and the secondary device is tested using the test case. This embodiment generates test cases based on natural language processing technology, and can quickly generate test cases that meet actual needs through semantic analysis and encoding of the functional requirements of the secondary device, which not only reduces manual intervention, but also can be customized according to the specific functional requirements of the secondary device, ensuring the accuracy and effectiveness of the test cases. In this way, not only can the construction speed of the test case be improved, but also the test case can be applied to different secondary devices and test instruments, effectively improving the efficiency of the test and reducing the test cost.
[0132] Embodiment 2
[0133] See also Figure 4 , shows a schematic diagram of the structure of a test device for substation secondary equipment provided by the second embodiment of the present invention. Figure 4 As shown, the device comprises:
[0134] The test case model acquisition module 401 is used to acquire a test case model set for a secondary device in a substation; the secondary device has functional requirement description information;
[0135] A model source code reading module 402 is used to read the model source code from the test case model;
[0136] A source code part extraction module 403 is used to extract a test command source code part from the model source code;
[0137] A semantic coding module 404 is used to perform semantic coding on the functional requirement description information to obtain a semantic coding feature vector of the functional requirement description;
[0138] A replacement code part generating module 405 is used to input the functional requirement description semantic coding feature vector into a preset generator to generate a test object replacement code part and an operation data replacement code part;
[0139] A test case construction module 406, configured to construct a test case according to the test object replacement code portion, the operation data replacement code portion and the test command source code portion;
[0140] The device testing module 407 is used to test the secondary device using the test case.
[0141] In one embodiment of the present invention, the semantic encoding module 404 includes:
[0142] An abstract syntax tree construction module is used to perform semantic analysis on the functional requirement description information to obtain an abstract syntax tree;
[0143] An abstract syntax tree encoding module is used to perform semantic embedding encoding on each node and each edge in the abstract syntax tree to obtain a semantic embedding encoding representation of the original tree;
[0144] A semantic enhancement module, used for performing feature sequence selection enhancement on the energy distribution spectrum of the set of node semantic embedding coding vectors in the original tree semantic embedding coding representation to obtain a set of enhanced node semantic embedding coding vectors;
[0145] A node replacement module, used to replace the set of node semantic embedding coding vectors in the original tree semantic embedding coding representation with the set of enhanced node semantic embedding coding vectors to obtain an enhanced tree semantic embedding coding representation;
[0146] The encoder calling module is used to input the enhanced tree semantic embedding encoding representation into a preset semantic encoder and encode it into a semantic encoding feature vector of functional requirement description information.
[0147] In one embodiment of the present invention, the semantic enhancement module includes:
[0148] A feature energy distribution spectrum vector calculation module is used to calculate the feature energy distribution spectrum vector of each node semantic embedding coding vector in the set of original node semantic embedding coding vectors to obtain a sequence of node semantic feature energy distribution spectrum vectors;
[0149] An energy spectrum distribution center vector calculation module is used to calculate the mean vector of the sequence of the node semantic feature energy distribution spectrum vector according to the position as the node semantic energy spectrum distribution center vector;
[0150] An energy distribution spectrum span factor calculation module is used to calculate the energy distribution spectrum span factor between the node semantic energy spectrum distribution center vector and each node semantic feature energy distribution spectrum vector in the sequence of the node semantic feature energy distribution spectrum vector, and obtain a sequence of node semantic energy distribution spectrum span factors;
[0151] The enhanced node semantics determination module is used to determine that the sequence of node semantic energy distribution spectrum span factors is a set of enhanced node semantic embedding coding vectors if each node semantic energy distribution spectrum span factor in the sequence of node semantic energy distribution spectrum span factors is less than or equal to a preset threshold.
[0152] In one embodiment of the present invention, the characteristic energy distribution spectrum vector calculation module includes:
[0153] A distribution energy collaborative representation vector calculation module is used to respectively calculate the feature distribution energy collaborative representation vector between each of the node semantic embedding coding vectors and other node semantic embedding coding vectors in the set of the node semantic embedding coding vectors to obtain a sequence of multiple node semantic feature distribution energy collaborative representation vectors;
[0154] The distribution energy synergy factor vector calculation module is used to calculate the feature distribution energy synergy factor vector of the sequence of each node semantic feature distribution energy synergy representation vector in the sequence of the multiple node semantic feature distribution energy synergy representation vectors to obtain the sequence of the node semantic feature energy distribution spectrum vectors.
[0155] In one embodiment of the present invention, the distributed energy collaborative representation vector calculation module is further used for:
[0156] Extracting a predetermined node semantic embedding coding vector from a sequence of characteristic energy distribution spectrum vectors of the node semantic embedding coding vector;
[0157] The maximum values of the node semantic embedding coding vector and other node semantic embedding coding vectors are extracted element by element respectively to obtain a sequence of node semantic feature distribution energy collaborative representation vectors corresponding to the predetermined node semantic embedding coding vector.
[0158] In one embodiment of the present invention, the distributed energy synergy factor vector calculation module is further used for:
[0159] Respectively extracting the maximum value of each node semantic feature distribution energy collaborative representation vector in the sequence of node semantic feature distribution energy collaborative representation vectors to obtain a sequence of node semantic feature maximum values;
[0160] Calculating the mean and variance of the energy collaborative representation vector of each node semantic feature distribution respectively, and obtaining a sequence of node semantic feature means and a sequence of node semantic feature variances;
[0161] Adding the sequence of node semantic feature variances and preset hyperparameters by position to obtain a sequence of first energy distribution coefficients of node semantic features;
[0162] Calculate the square of the difference between the maximum values of the node semantic features and the mean values of the node semantic features, which correspond to the sequence of the maximum values of the node semantic features and the sequence of the mean values of the node semantic features, to obtain a sequence of node semantic difference values;
[0163] Multiplying the sequence of node semantic feature variances by constant 2 by position to obtain a sequence of modulated node semantic feature variances;
[0164] Adding each group of corresponding node semantic difference values and modulation node semantic feature variances in the sequence of node semantic difference values and the sequence of modulation node semantic feature variances to obtain a feature sum, and adding the feature sum to the hyperparameter to obtain a sequence of second energy distribution coefficients of node semantic features;
[0165] The sequence of the first energy distribution coefficients of the node semantic feature is divided by the sequence of the second energy distribution coefficients of the node semantic feature according to the position, so as to obtain the node semantic feature energy distribution spectrum vector composed of a plurality of feature distribution energy synergy factors.
[0166] In one embodiment of the present invention, the energy distribution spectrum span factor calculation module is further used for:
[0167] Calculating the difference between the node semantic feature energy distribution spectrum vector and the node semantic energy spectrum distribution center vector according to the position to obtain the node semantic differential feature vector;
[0168] Calculate the covariance matrix between the node semantic energy spectrum distribution center vector and the node semantic feature energy distribution spectrum vector, take the inverse of the covariance matrix, and obtain the node semantic inverse covariance matrix;
[0169] Calculating the product of the transposed vector of the node semantic differential feature vector, the node semantic inverse covariance matrix and the node semantic differential feature vector to obtain a node semantic distribution value;
[0170] The square root of the node semantic distribution value is calculated to obtain the node semantic energy distribution spectrum span factor.
[0171] In one embodiment of the present invention, the source code part extraction module 403 is further used for:
[0172] The model source code is segmented to obtain a test command source code part, a test object source code part and an operation data source code part under a code framework;
[0173] The test case construction module 406 is also used for:
[0174] In the code framework, the test object source code portion is replaced by the test object replacement code portion, and the operation data source code portion is replaced by the operation data replacement code portion;
[0175] If the replacement is completed, the test command source code part, the test object replacement code part, and the operation data replacement code part are spliced into a test case source code according to the code framework;
[0176] Generate test cases using the test case source code.
[0177] The testing device for substation secondary equipment provided in the embodiment of the present invention can execute the testing method for substation secondary equipment provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the testing method for substation secondary equipment.
[0178] Embodiment 3
[0179] See also Figure 5 , shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0180] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0181] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0182] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as the test method of the substation secondary equipment.
[0183] In some embodiments, the test method of the substation secondary equipment can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the test method of the substation secondary equipment described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the test method of the substation secondary equipment in any other appropriate manner (for example, by means of firmware).
[0184] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0185] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0186] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0187] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0188] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0189] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0190] Embodiment 4
[0191] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the method for testing substation secondary equipment provided by any embodiment of the present invention is implemented.
[0192] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0193] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0194] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for testing secondary equipment of a substation, characterized in that: include: Obtain a test case model for setting up secondary equipment in a substation; The secondary device has functional requirement description information; Reading model source code from the test case model; Extracting a test command source code portion from the model source code; Performing semantic coding on the functional requirement description information to obtain a semantic coding feature vector of the functional requirement description; Inputting the semantic coding feature vector of the functional requirement description into a preset generator to generate a test object replacement code part and an operation data replacement code part; Constructing a test case according to the test object replacement code part, the operation data replacement code part and the test command source code part; The secondary device is tested using the test case.
2. The method according to claim 1, characterized in that The semantic encoding of the functional requirement description information to obtain a semantic encoding feature vector of the functional requirement description includes: Performing semantic analysis on the functional requirement description information to obtain an abstract syntax tree; Performing semantic embedding coding on each node and each edge in the abstract syntax tree to obtain a semantic embedding coding representation of the original tree; Performing feature sequence selection enhancement on the energy distribution spectrum for the set of node semantic embedding coding vectors in the original tree semantic embedding coding representation to obtain a set of enhanced node semantic embedding coding vectors; In the original tree semantic embedding coding representation, the set of node semantic embedding coding vectors is replaced by the set of enhanced node semantic embedding coding vectors to obtain an enhanced tree semantic embedding coding representation; The enhanced tree semantic embedding coding representation is input into a preset semantic encoder and encoded into a semantic coding feature vector of functional requirement description information.
3. The method according to claim 2, characterized in that The method further comprises performing feature sequence selection enhancement on the energy distribution spectrum of the set of node semantic embedding coding vectors in the original tree semantic embedding coding representation to obtain a set of enhanced node semantic embedding coding vectors, including: Calculating the characteristic energy distribution spectrum vector of each node semantic embedding coding vector in the set of original node semantic embedding coding vectors to obtain a sequence of node semantic characteristic energy distribution spectrum vectors; Calculating the mean vector of the sequence of the node semantic feature energy distribution spectrum vector according to the position as the center vector of the node semantic energy spectrum distribution; Calculate the energy distribution spectrum span factor between the node semantic energy spectrum distribution center vector and each node semantic feature energy distribution spectrum vector in the sequence of the node semantic feature energy distribution spectrum vector to obtain a sequence of node semantic energy distribution spectrum span factors; If each node semantic energy distribution spectrum span factor in the sequence of node semantic energy distribution spectrum span factors is less than or equal to a preset threshold, the sequence of node semantic energy distribution spectrum span factors is determined to be a set of enhanced node semantic embedding coding vectors.
4. The method according to claim 3, characterized in that The step of calculating the characteristic energy distribution spectrum vector of each node semantic embedding coding vector in the set of node semantic embedding coding vectors to obtain a sequence of node semantic characteristic energy distribution spectrum vectors includes: Respectively calculating the feature distribution energy collaborative representation vector between each of the node semantic embedding coding vectors and other node semantic embedding coding vectors in the set of the node semantic embedding coding vectors to obtain a sequence of multiple node semantic feature distribution energy collaborative representation vectors; The feature distribution energy coordination factor vector of each sequence of the node semantic feature distribution energy coordination representation vector in the sequence of the plurality of node semantic feature distribution energy coordination representation vectors is calculated to obtain the sequence of the node semantic feature energy distribution spectrum vectors.
5. The method according to claim 4, characterized in that The step of respectively calculating the feature distribution energy collaborative representation vector between each of the node semantic embedding coding vectors and other node semantic embedding coding vectors in the set of the node semantic embedding coding vectors to obtain a sequence of multiple node semantic feature distribution energy collaborative representation vectors includes: Extracting a predetermined node semantic embedding coding vector from a sequence of characteristic energy distribution spectrum vectors of the node semantic embedding coding vector; The maximum values of the node semantic embedding coding vector and other node semantic embedding coding vectors are extracted element by element respectively to obtain a sequence of node semantic feature distribution energy collaborative representation vectors corresponding to the predetermined node semantic embedding coding vector.
6. The method according to claim 4, characterized in that The step of calculating the feature distribution energy coordination factor vector of the sequence of the semantic feature distribution energy coordination representation vectors of each node in the sequence of the plurality of node semantic feature distribution energy coordination representation vectors to obtain the sequence of the node semantic feature energy distribution spectrum vectors includes: Respectively extracting the maximum value of each node semantic feature distribution energy collaborative representation vector in the sequence of node semantic feature distribution energy collaborative representation vectors to obtain a sequence of node semantic feature maximum values; Calculating the mean and variance of the energy collaborative representation vector of each node semantic feature distribution respectively, and obtaining a sequence of node semantic feature means and a sequence of node semantic feature variances; Adding the sequence of node semantic feature variances and preset hyperparameters by position to obtain a sequence of first energy distribution coefficients of node semantic features; Calculate the square of the difference between the maximum values of the node semantic features and the mean values of the node semantic features, which correspond to the sequence of the maximum values of the node semantic features and the sequence of the mean values of the node semantic features, to obtain a sequence of node semantic difference values; Multiplying the sequence of node semantic feature variances by constant 2 by position to obtain a sequence of modulated node semantic feature variances; Adding each group of corresponding node semantic difference values and modulation node semantic feature variances in the sequence of node semantic difference values and the sequence of modulation node semantic feature variances to obtain a feature sum, and adding the feature sum to the hyperparameter to obtain a sequence of second energy distribution coefficients of node semantic features; The sequence of the first energy distribution coefficients of the node semantic feature is divided by the sequence of the second energy distribution coefficients of the node semantic feature according to the position, so as to obtain the node semantic feature energy distribution spectrum vector composed of a plurality of feature distribution energy synergy factors.
7. The method according to claim 3, characterized in that The calculating the energy distribution spectrum span factor between the node semantic energy spectrum distribution center vector and each node semantic feature energy distribution spectrum vector in the sequence of the node semantic feature energy distribution spectrum vector to obtain a sequence of node semantic energy distribution spectrum span factors includes: Calculating the difference between the node semantic feature energy distribution spectrum vector and the node semantic energy spectrum distribution center vector according to the position to obtain the node semantic differential feature vector; Calculate the covariance matrix between the node semantic energy spectrum distribution center vector and the node semantic feature energy distribution spectrum vector, take the inverse of the covariance matrix, and obtain the node semantic inverse covariance matrix; Calculating the product of the transposed vector of the node semantic differential feature vector, the node semantic inverse covariance matrix and the node semantic differential feature vector to obtain a node semantic distribution value; The square root of the node semantic distribution value is calculated to obtain the node semantic energy distribution spectrum span factor.
8. The method according to any one of claims 1 to 7, characterized in that The step of extracting the test command source code portion from the model source code includes: The model source code is segmented to obtain a test command source code part, a test object source code part and an operation data source code part under a code framework; The step of constructing a test case based on the test object replacement code portion, the operation data replacement code portion and the test command source code portion includes: In the code framework, the test object source code portion is replaced by the test object replacement code portion, and the operation data source code portion is replaced by the operation data replacement code portion; If the replacement is completed, the test command source code part, the test object replacement code part, and the operation data replacement code part are spliced into a test case source code according to the code framework; Generate test cases using the test case source code.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for testing a substation secondary device according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for testing a substation secondary device according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Software demand and code mapping method and system
CN113791757A
Test case generation method and test method
CN114265772A
Substation secondary equipment general test method and system
CN117233501A
Cited By
Automatic interface testing platform and method
CN119377127A
Secondary equipment test method, device and equipment based on generative large model
CN120121928A