Wind power sensor test method and system based on ASN.1 script use case
By testing methods based on ASN.1 script use cases, the problem of low efficiency, insufficient standardization, environmental simulation difficulties, and complex script maintenance in the existing wind power sensor testing method have been solved, and the efficient and automated test process has been achieved. Nature and adaptability.
Patent Information
- Application Number
- CN202411442880.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-21
AI Technical Summary
The existing wind power sensor testing methods have problems such as inefficient efficiency, insufficient standardization, difficulty in environmental simulation and complex script maintenance, which are difficult to meet the needs of high reliability testing of wind power sensors.
The testing method based on ASN.1 script case is used to realize the automated testing process by writing script test cases, extracting and parsing keywords, processing the keyword EXE TESTCASE for step-by-step retrieval and splicing, and using DB algorithm to optimize the OCR recognition model.
Improve the rejection of scripts and test script adaptability, simplify the maintenance of script, enhance the accuracy of OCR recognition, improve test efficiency and automation, and adapt to a complex and varied test environment.
Smart Images

Figure CN119336642A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of script testing, and in particular to a wind power sensor testing method and system based on an ASN.1 script use case. Background Art
[0002] With the increasing attention paid to renewable energy, the wind power industry has developed rapidly. The stable operation of wind turbines depends on the accurate monitoring of various sensors. However, wind power sensors usually work in harsh environments, such as high temperature, low temperature, high humidity, strong vibration, etc. These factors will affect the performance and life of the sensors. In addition, the geographical location of wind farms is usually remote, and the maintenance and replacement costs of sensors are high. Therefore, the testing and verification of wind power sensors has become an important challenge facing the wind power industry.
[0003] The current wind power sensor testing methods mainly rely on manual operation and a series of scripting techniques in terms of structural principles, including linear scripts, structured scripts, shared scripts, data-driven scripts, and keyword-driven scripts. These methods each have different characteristics and limitations: 1. Linear script: The script is obtained by recording the manual execution of the test process. It is simple and fast to operate, but has poor reusability, is easily affected by software changes, and has poor ability to handle unforeseen abnormal situations.
[0004] 2. Structured script: Contains instructions for controlling script execution, such as sequence, selection, iteration, etc. It has good robustness, but the script is complex and does not achieve complete separation of test data and script.
[0005] 3. Shared scripts: can be used by multiple test cases, reducing overhead and maintenance costs, but the need to track multiple scripts may lead to increased management complexity.
[0006] 4. Data-driven scripts: Store test inputs in separate data files to improve test case writing speed and maintenance efficiency, but the initial setup cost is high and requires professional programming support.
[0007] 5. Keyword-driven script: It is an extension of data-driven script and is divided into three parts: control script, keyword action description and data. It combines the advantages of multiple scripting technologies, but its implementation is complex and requires a high degree of expertise.
[0008] In general, the existing testing methods have the following defects or problems: Inefficiency: Traditional testing methods rely on manual operations, which are inefficient and easily affected by subjective factors.
[0009] Insufficient standardization: Existing testing methods lack unified standards, resulting in poor consistency and comparability of test results.
[0010] Difficulty in environmental simulation: Traditional testing methods cannot accurately simulate the complex working environment of wind power sensors and cannot fully evaluate their performance.
[0011] Script maintenance is complex: Different types of scripts have their own advantages and disadvantages, but all have problems such as complex maintenance and poor reusability.
[0012] Therefore, the existing testing methods still need to be improved in terms of automation level, testing efficiency, environmental adaptability, and script management to better meet the needs of high reliability testing of wind power sensors. Summary of the invention
[0013] In order to solve the above-mentioned problems, the present invention provides a wind power sensor testing method and system based on ASN.1 script use case.
[0014] In a first aspect, the present invention provides a wind power sensor testing method based on an ASN.1 script use case, which adopts the following technical solution: A wind power sensor testing method based on an ASN.1 script use case, comprising: Write script test cases; Extract keywords from the text of script test cases and parse them; Process the keyword EXE TESTCASE to search and splice the test case scripts step by step; Perform keyword recognition on the spliced test case script OCR recognition model; wherein, the DB algorithm is used to optimize the OCR recognition model; The identified keywords are processed separately and the testing process is carried out according to the identification results.
[0015] Furthermore, the script test case writing includes three steps: recording a data message template, storing the template in a file manner, and editing the script. The storing of the template in a file manner includes storing the test message in the data message template in a file manner to separate the test data from the test script. The file content is divided into two parts: INPUT $type: data message, input data message, $type is the type defined in the ASN.1 file; OUTPUT $type: datagram, output datagram, that is, expected result.
[0016] Furthermore, the extracting and parsing of keywords in the text of the script test case includes loading the script test case, extracting and parsing keywords in the text using regular expressions, and caching the script test case text into a memory space by reading a file, and the test case extension is tc.
[0017] Furthermore, the processing keyword EXE TESTCASE performs step-by-step retrieval and splicing of test case scripts, including step-by-step retrieval of test case scripts, and retrieving corresponding test case scripts from a database or script library according to the referenced test case number. When the referenced test case references other test cases, the referenced test cases will continue to be retrieved until the bottom-level test case is retrieved.
[0018] Furthermore, the processing keyword EXE TESTCASE performs step-by-step retrieval and splicing of test case scripts, including script text splicing, wherein after all relevant test case scripts are retrieved, the script text is spliced, and during the splicing process, it is ensured that the logical order and dependency relationship between the scripts are correct to form a complete test script.
[0019] Furthermore, the use of the DB algorithm to optimize the OCR recognition model includes end-to-end training of the OCR recognition model using a differentiable binary step function, wherein a probability map and a threshold map are used to amplify the gradient of the error prediction through a gain factor k, and the model is optimized to obtain a more accurate recognition result.
[0020] Further, the gradient of the error prediction is amplified by the gain factor k, including using the following formula: P refers to the probability map, T refers to the threshold map, and k is the gain factor, which is set to 50 based on the empirical rule of the experiment.
[0021] In a second aspect, a wind power sensor test system based on an ASN.1 script use case includes: The data acquisition module,is configured to,write scripted test cases; The parsing module is configured to extract keywords from the text of the script test case and parse them; The splicing module is configured to process the keyword EXE TESTCASE and perform level-by-level retrieval and splicing of test case scripts; The recognition module is configured to perform keyword recognition on the spliced test case script OCR recognition model; wherein the DB algorithm is used to optimize the OCR recognition model; The test module is configured to process the recognized keywords separately and perform the test process according to the recognition results.
[0022] In a third aspect, the present invention provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded and executed by a processor of a terminal device, for example, a wind power sensor testing method based on an ASN.1 script use case.
[0023] In a fourth aspect, the present invention provides a terminal device, including a processor and a computer-readable storage medium, the processor being used to implement various instructions; the computer-readable storage medium being used to store multiple instructions, the instructions being suitable for being loaded by the processor and executing the wind power sensor testing method based on the ASN.1 script use case.
[0024] In summary, the present invention has the following beneficial technical effects: 1. Improve script reusability. By searching and splicing test case scripts level by level, the present invention overcomes the defect of poor reusability of traditional scripts and allows scripts to be reused in different test scenarios.
[0025] 2. Enhance the adaptability of test scripts. The present invention can handle the reference relationship between scripts, ensure the correct logical order and dependency relationship, and thus adapt to complex and changing test requirements.
[0026] 3. Simplify script maintenance. By automating the retrieval and splicing of test scripts, the workload of manual maintenance is reduced, and the maintenance cost and error probability are reduced.
[0027] 4. Improve OCR recognition accuracy. Use DB algorithm to process keywords, improve OCR text recognition accuracy in complex backgrounds, and solve the problem of low accuracy of traditional OCR in automated testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a schematic diagram of a wind power sensor testing method based on an ASN.1 script use case according to Embodiment 1 of the present invention.
[0029] Figure 2 3 is a comparison diagram of standard binarization and differentiable binarization in the DB algorithm of Example 1 of the present invention. DETAILED DESCRIPTION
[0030] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0031] Example 1 Reference Figure 1 , a wind power sensor testing method based on an ASN.1 script use case of this embodiment includes: Write script test cases; Extract keywords from the text of script test cases and parse them; Process the keyword EXE TESTCASE to search and splice the test case scripts step by step; Perform keyword recognition on the spliced test case script OCR recognition model; wherein, the DB algorithm is used to optimize the OCR recognition model; The identified keywords are processed separately and the testing process is carried out according to the identification results.
[0032] Specifically: S1. Use case for writing scripts: Writing a script consists of three major steps: recording data message templates, storing templates in file format, and editing scripts.
[0033] 1) Recording data message template: This step is similar to recording script data in a linear script mode, but it does not require recording all test cases. Instead, it only requires recording a few large processes and functional points as test case data templates.
[0034] 2) Store templates in file format: This step is similar to the data-driven script method. It stores test messages in files to separate test data from test scripts. The file content is divided into two parts: INPUT $type: data message, input data message, $type is the type defined in the ASN.1 file; OUTPUT $type: datagram, output datagram, that is, expected result.
[0035] Storage file, such as: CNW11STAttachSU.hex 3) Edit the script: This step integrates scripting techniques such as shared scripts, structured scripts, and keyword-driven scripts.
[0036] Keyword definitions: Test case structure: (3) Implementation code: According to the script definition, the test platform is developed to implement the script.
[0037] Step 1: Load the script test case, use regular expressions to extract keywords from the text, parse it line by line, and cache the script test case text into the memory space by reading the file. The test case extension is tc; Step 2: Process the keyword EXE TESTCASE to implement step-by-step retrieval and splicing of test case scripts 1) Retrieve test case scripts level by level: The system retrieves the corresponding test case scripts from the database or script library according to the referenced test case number. If the referenced test case references other test cases, the system will continue to retrieve these referenced test cases until the bottom-level test case is retrieved.
[0038] 2) Script text splicing: After retrieving all relevant test case scripts, the system will splice the script text. During the splicing process, the system will ensure that the logical order and dependency between the scripts are correct to form a complete test script.
[0039] 3) OCR processing and DB algorithm application: To improve the accuracy of OCR recognition, the system uses the DB (Differentiable Binarization) algorithm to process keywords. The DB algorithm is a segmentation-based text detection algorithm that distinguishes text areas from backgrounds through the DB module and uses a dynamic threshold. The advantages of this algorithm include simple structure, no need for tedious post-processing, and good accuracy and performance.
[0040] 4) Principle of DB algorithm: DB algorithm approximates the standard binarized step function through a differentiable binarization module, thereby achieving end-to-end training of the network. It uses probability maps and threshold maps to amplify the gradient of error prediction through a gain factor k (usually set to 50 based on experimental experience) and optimizes the model to obtain more accurate recognition results. The DB algorithm has a simple structure and no tedious post-processing. Its open source data has good accuracy and performance.
[0041] After obtaining the probability map, the traditional algorithm based on image segmentation will set all pixels below t to 0, otherwise set them to 1. The formula is: But the standard binarization method is not differentiable, so the network cannot be trained end-to-end. To solve this problem, the DB algorithm uses differentiable binarization (DB), which approximates the step function of the standard binarization. It uses another formula: P refers to the probability map above, T refers to the threshold map, and k is the gain factor, which is set to 50 based on the empirical rule of thumb. Figure 2 (a) in Figure 3 shows the difference between standard binarization and differentiable binarization.
[0042] When using cross entropy loss, the losses for positive and negative samples are: Taking partial derivatives of input x may result in: It can be found that the gain factor amplifies the gradient of the error prediction, thereby optimizing the model to obtain better results. Figure 2 As shown, Figure 2 In (b), the part where x < 0 indicates that the positive sample is predicted as a negative sample. It can be seen that the gain factor k amplifies the gradient. Figure 2 (c) shows x>0, which refers to the case where negative samples are predicted as positive samples, and the gradient is also amplified.
[0043] Step 3: Process the keyword LOAD, convert the data message into an entity object according to the ASN.1 definition, and parse the INPUT content in the script, such as: The ASN.1 file definition is as follows: Step 4: Process the keywords ADD, DELETE, UPDATE, and SET to modify the entity object, such as: Step 5: Process the keyword PARALLEL to implement parallel message sending, which needs to be mapped into multiple sub-threads during implementation; Step 6: Process the keyword FOR ($frequency) to implement the script loop processing, which needs to be mapped to a For loop during implementation; Step 7: Process the keyword SEND to implement message encoding and sending, and start data message recording, where the message encoding is as follows: After sending is started, the data message and time are recorded in the log file; Step 8: Process the keyword SLEEP and wait for a response message. If a message is received or the time expires, proceed to the next step. Step 9: Process the keyword CHECK, compare the specified value of the received message with the value in the expected result, and parse the OUTPUT content in the test case script and compare it with the received message; Step 10: Update the result of the corresponding test case in the test report according to the test case number, and end the data message recording; Step 11: Check whether the CHECK results of the test case are consistent; Step 12: Delete the message recording file. If the CHECK passes, the recording file is deleted and the whole process ends.
[0044] Through this technical solution, the present invention overcomes the defects of the prior art: (1) Improving script reusability: By retrieving and splicing test case scripts step by step, this method overcomes the defect of poor reusability of traditional scripts and allows scripts to be reused in different test scenarios.
[0045] (2) Enhance the adaptability of test scripts: This method can handle the reference relationship between scripts, ensure the correct logical order and dependency relationship, and thus adapt to complex and changing test requirements.
[0046] (3) Simplify script maintenance: By automating the retrieval and splicing of test scripts, the workload of manual maintenance is reduced, and the maintenance cost and error probability are reduced.
[0047] Problems solved (1) Automated testing process: This method realizes the automatic retrieval and splicing of test scripts, reduces manual intervention, and improves the automation level of the testing process.
[0048] (2) Improve OCR recognition accuracy: The DB algorithm is used to process keywords, which improves the accuracy of OCR text recognition in complex backgrounds and solves the problem of low accuracy of traditional OCR in automated testing.
[0049] (3) Adaptability to complex test environments: Through step-by-step reference and script splicing, this method can adapt to the needs of complex test environments and ensure the comprehensiveness and accuracy of the test.
[0050] Advantages compared to existing technologies (1) Higher efficiency and automation: By automating the retrieval and splicing of test scripts, this method improves test efficiency and automation and reduces manual operations and errors.
[0051] (2) Better environmental adaptability: This method can adapt to complex and changing test environments and ensure the accuracy and reliability of test results.
[0052] (3) Enhanced OCR recognition capability: The DB algorithm improves the OCR recognition accuracy, especially in complex backgrounds and low-quality images, which has obvious advantages over traditional OCR technology.
[0053] (4) Simplify script management and maintenance: Automated script management reduces maintenance workload, improves script maintainability and scalability, and reduces long-term maintenance costs.
[0054] Example 2 This embodiment provides a wind power sensor test system based on an ASN.1 script use case, including: The data acquisition module,is configured to,write scripted test cases; The parsing module is configured to extract keywords from the text of the script test case and parse them; The splicing module is configured to process the keyword EXE TESTCASE and perform level-by-level retrieval and splicing of test case scripts; The recognition module is configured to perform keyword recognition on the spliced test case script OCR recognition model; wherein the DB algorithm is used to optimize the OCR recognition model; The test module is configured to process the recognized keywords separately and perform the test process according to the recognition results.
[0055] A computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded and executed by a processor of a terminal device, for example, a wind power sensor testing method based on an ASN.1 script use case.
[0056] A terminal device includes a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; the computer-readable storage medium is used to store multiple instructions, wherein the instructions are suitable for being loaded and executed by the processor to implement a wind power sensor testing method based on an ASN.1 script use case.
[0057] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A wind power sensor testing method based on ASN.1 script use case, characterized in that: include: Write script test cases; Extract keywords from the text of script test cases and parse them; Process the keyword EXE TESTCASE to search and splice the test case scripts step by step; Perform keyword recognition on the spliced test case script OCR recognition model; wherein, the DB algorithm is used to optimize the OCR recognition model; The identified keywords are processed separately and the testing process is carried out according to the identification results.
2. A wind power sensor testing method based on ASN.1 script use case according to claim 1, characterized in that: The script test case writing includes three steps: recording a data message template, storing the template in a file mode, and editing the script. The storing of the template in a file mode includes storing the test message in the data message template in a file mode to separate the test data from the test script. The file content is divided into two parts: INPUT $type: data message, input data message, $type is the type defined in the ASN.1 file; OUTPUT $type: datagram, output datagram, that is, expected result.
3. A wind power sensor testing method based on ASN.1 script use case according to claim 2, characterized in that: The method of extracting keywords from the text of the script test case and parsing it includes loading the script test case, extracting keywords from the text using regular expressions and parsing it, and caching the script test case text into a memory space by reading a file, and the test case extension is tc.
4. A wind power sensor testing method based on ASN.1 script use case according to claim 3, characterized in that: The processing keyword EXE TESTCASE performs step-by-step retrieval and splicing of test case scripts, including step-by-step retrieval of test case scripts, retrieving corresponding test case scripts from a database or script library according to the referenced test case number, and when the referenced test case references other test cases, the referenced test cases will continue to be retrieved until the bottom-level test case is retrieved.
5. A wind power sensor testing method based on ASN.1 script use case according to claim 4, characterized in that: The processing keyword EXE TESTCASE performs step-by-step retrieval and splicing of test case scripts, including script text splicing, wherein after all relevant test case scripts are retrieved, the script texts are spliced, and during the splicing process, it is ensured that the logical sequence and dependency relationship between the scripts are correct to form a complete test script.
6. A wind power sensor testing method based on ASN.1 script use case according to claim 5, characterized in that: The DB algorithm is used to optimize the OCR recognition model, including using a differentiable binary step function to perform end-to-end training on the OCR recognition model, wherein a probability map and a threshold map are used, and the gradient of the error prediction is amplified by a gain factor k to optimize the model to obtain a more accurate recognition result.
7. A wind power sensor testing method based on ASN.1 script use case according to claim 6, characterized in that: The gradient of the error prediction is amplified by the gain factor k, including using the following formula: P refers to the probability map, T refers to the threshold map, and k is the gain factor, which is set to 50 based on the empirical rule of the experiment.
8. A wind power sensor test system based on ASN.1 script use case, characterized in that: include: The data acquisition module,is configured to,write scripted test cases; The parsing module is configured to extract keywords from the text of the script test case and parse them; The splicing module is configured to process the keyword EXE TESTCASE and perform level-by-level retrieval and splicing of test case scripts; The recognition module is configured to perform keyword recognition on the spliced test case script OCR recognition model; wherein the DB algorithm is used to optimize the OCR recognition model; The test module is configured to process the recognized keywords separately and perform the test process according to the recognition results.
9. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instructions are suitable for being loaded by a processor of a terminal device and executing the method according to claim 1 .
10. A terminal device, comprising a processor and a computer-readable storage medium, wherein the processor is used to implement each instruction; and the computer-readable storage medium is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing the method as claimed in claim 1 .