Measurement terminal software testing method and device based on digital twinning, computer equipment, readable storage medium and program product
By using digital twin-based measurement terminal software testing method in the measurement terminal system, using the virtual testing environment and the virtual measurement terminal system for simulation and simulation testing, the problem of limitations in the existing technology is solved, and the further development is achieved. Efficient and accurate testing.
Patent Information
- Application Number
- CN202411382538.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-07
AI Technical Summary
In the prior art, the testing operating conditions of the measurement terminal software test in the measurement terminal system are relatively limited, resulting in higher testing limitations and affecting the stability and reliability of the system.
Using the measurement terminal software test method based on digital twins, the virtual measurement terminal system based on digital twins is started in the preset virtual test environment, and the virtual main station is simulated by simulating the virtual main station, virtual electricity meter, virtual measurement terminal and virtual interactive equipment. The interaction between them generates test scripts and collects interaction and operation information, and performs performance testing.
Through the virtual measurement terminal system and preset virtual testing environment, the simulation simulation of measurement terminal software testing in the measurement terminal system is realized, overcoming the cost and difficulty limitations of physical system testing, reducing the testing limitations, and improving testing accuracy and coverage.
Smart Images

Figure CN119396713A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a measurement terminal software testing method, apparatus, computer equipment, computer-readable storage medium, and computer program product based on digital twins. Background Art
[0002] With the continuous development of the economy, the measurement terminal system is becoming more and more complex to better meet user needs. If the software in the measurement terminal system runs abnormally, it will affect the normal operation of the measurement terminal system and reduce the stability and reliability of the measurement terminal system. In order to ensure the normal operation of the measurement terminal system, a method for testing the measurement terminal software in the terminal system is urgently needed.
[0003] In traditional technology, the measurement terminal software test of the measurement terminal system is performed by building a test environment for the physical hardware system. However, the content of the measurement terminal software test is limited by the cost and testing difficulty, which may easily lead to the situation that the test conditions of the measurement terminal software test in the measurement terminal system are relatively limited, resulting in high limitations of the measurement terminal software test in the measurement terminal system. Summary of the invention
[0004] Based on this, it is necessary to provide a measurement terminal software testing method, device, computer equipment, computer-readable storage medium and computer program product based on digital twins that can reduce the limitations of measurement terminal software testing in the measurement terminal system in response to the above technical problems.
[0005] In a first aspect, the present application provides a measurement terminal software testing method based on digital twins, comprising:
[0006] In response to the measurement terminal software test instruction, a virtual measurement terminal system pre-simulated based on the digital twin is started in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device;
[0007] According to the measurement terminal software test items in the measurement terminal software test instructions, the interaction between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample;
[0008] Executing the test script, and collecting interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and operation information of the virtual measurement terminal system;
[0009] The performance of the test sample corresponding to the software to be tested and the software performance are tested according to the interaction information and the operation information to obtain a test result.
[0010] In one of the embodiments, simulating the operation of the virtual measurement terminal system according to the measurement terminal software test items in the measurement terminal software test instructions to obtain a test sample includes: simulating the operation of the virtual measurement terminal system according to the measurement terminal software test items in the measurement terminal software test instructions to obtain an operation test sample; simulating the command and response of the virtual measurement terminal system according to the measurement terminal software test items in the measurement terminal software test instructions to obtain a data test sample; and generating a test sample according to the operation test sample and the data test sample.
[0011] In one of the embodiments, before starting the virtual measurement terminal system based on digital twin pre-simulation in a preset virtual test environment, the method also includes: simulating the hardware environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a hardware simulation system, wherein the hardware simulation system includes a simulated processor, a simulated memory bus, and a simulated hardware exception handling mechanism; simulating the software environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a software simulation system, wherein the software simulation system includes a simulated operating system, a simulated software exception handling mechanism, and a simulated software system; and constructing a virtual measurement terminal system according to the hardware simulation system and the software simulation system.
[0012] In one embodiment, the method further includes: defining a data structure of a register in a simulation processor to obtain a register data structure; and defining an instruction set architecture specification in the simulation processor to obtain an instruction set architecture specification; determining instruction information according to an instruction format and instruction code in the instruction set architecture specification; and constructing a simulation processor according to the register data structure, the instruction set architecture specification and the instruction information.
[0013] In one of the embodiments, the instruction information is determined based on the instruction format and instruction code in the instruction set architecture specification, including: for each instruction in the instruction set architecture specification, according to the instruction format and instruction code of the instruction, identifying the type of the instruction to which the instruction belongs, and obtaining the instruction type of the instruction; according to the instruction type and instruction format of the instruction, querying and obtaining the operation information of the instruction, and determining the operation information of the instruction as the instruction information of the instruction.
[0014] In one of the embodiments, the method further includes: obtaining preset meter abnormal status information, and constructing an exception handling function based on the preset meter abnormal status information; obtaining a preset interrupt request initiated by an analog processor, and constructing an interrupt vector table and an interrupt handling function based on the preset interrupt request; prioritizing each interrupt handling item corresponding to the preset interrupt request to obtain the priority of each interrupt handling item; simulating hardware exception handling and interrupt mechanism based on the exception handling function, interrupt vector table, interrupt handling function and the priority of each interrupt handling item to obtain a hardware exception handling mechanism.
[0015] In a second aspect, the present application also provides a measurement terminal software testing device based on digital twins, comprising:
[0016] A startup module, used to respond to a measurement terminal software test instruction and start a virtual measurement terminal system pre-simulated based on a digital twin in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device;
[0017] a simulation module, configured to simulate the interaction between the virtual master station and the virtual electric meter, the virtual measuring terminal and the virtual interactive device respectively according to the measuring terminal software test items in the measuring terminal software test instructions, obtain test samples, and generate a test script according to the test samples;
[0018] A collection module, used to execute the test script and collect interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and operation information of the virtual measurement terminal system;
[0019] The testing module is used to test the performance of the test sample corresponding to the software to be tested and the software performance according to the interaction information and the operation information to obtain the test result.
[0020] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0021] In response to the measurement terminal software test instruction, a virtual measurement terminal system pre-simulated based on the digital twin is started in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device;
[0022] According to the measurement terminal software test items in the measurement terminal software test instructions, the interaction between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample;
[0023] Executing the test script, and collecting interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and operation information of the virtual measurement terminal system;
[0024] The performance of the test sample corresponding to the software to be tested and the software performance are tested according to the interaction information and the operation information to obtain a test result.
[0025] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0026] In response to the measurement terminal software test instruction, a virtual measurement terminal system pre-simulated based on the digital twin is started in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device;
[0027] According to the measurement terminal software test items in the measurement terminal software test instructions, the interaction between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample;
[0028] Executing the test script, and collecting interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and operation information of the virtual measurement terminal system;
[0029] The performance of the test sample corresponding to the software to be tested and the software performance are tested according to the interaction information and the operation information to obtain a test result.
[0030] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0031] In response to the measurement terminal software test instruction, a virtual measurement terminal system pre-simulated based on the digital twin is started in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device;
[0032] According to the measurement terminal software test items in the measurement terminal software test instructions, the interaction between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample;
[0033] Executing the test script, and collecting interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and operation information of the virtual measurement terminal system;
[0034] The performance of the test sample corresponding to the software to be tested and the software performance are tested according to the interaction information and the operation information to obtain a test result.
[0035] The above-mentioned digital twin-based measurement terminal software testing method, device, computer equipment, computer-readable storage medium and computer program product, by responding to the measurement terminal software test instruction, start the virtual measurement terminal system pre-simulated based on the digital twin in a preset virtual test environment, wherein the virtual measurement terminal system is composed of a virtual main station, a virtual meter, a virtual measurement terminal and a virtual interactive device; according to the measurement terminal software test items in the measurement terminal software test instruction, the interaction between the virtual main station and the virtual meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample; the test script is executed, and the data between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system are collected. the interactive information and the operating information of the virtual measurement terminal system; according to the interactive information and the operating information, the performance of the test sample corresponding to the software to be tested and the software performance are tested to obtain the test results, and the simulation process of the measurement terminal software test in the measurement terminal system is realized by the virtual measurement terminal system and the preset virtual test environment. The measurement terminal software test of various measurement terminal software test contents of the software in the terminal system can be realized through the test samples, and various test conditions can also be simulated through the operating information of the virtual measurement terminal system, thereby overcoming the technical defects of the physical system measurement terminal software test being limited by the cost and test difficulty, and the test conditions of the measurement terminal software test in the measurement terminal system are easily limited. Therefore, the limitations of the measurement terminal software test in the measurement terminal system are reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 This is an application environment diagram of a measurement terminal software testing method based on digital twins in one embodiment;
[0038] Figure 2 It is a flowchart of a measurement terminal software testing method based on digital twins in one embodiment;
[0039] Figure 3 A schematic diagram of interaction between a server and a virtual measurement terminal system in one embodiment;
[0040] Figure 4 A flowchart of steps for constructing a virtual measurement terminal system before starting a virtual measurement terminal system pre-simulated based on a digital twin in a preset virtual test environment in one embodiment;
[0041] Figure 5 A schematic diagram of the structure of a hardware simulation system in one embodiment;
[0042] Figure 6 A schematic diagram of the structure of a software simulation system in one embodiment;
[0043] Figure 7 It is a structural block diagram of a measurement terminal software testing device based on digital twin in one embodiment;
[0044] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] It should be noted that the information (including but not limited to measurement terminal software test instructions, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the acquisition, transmission, storage, use and processing of relevant data are in compliance with the relevant provisions of national laws and regulations. For content pushed to users (for example, test results, etc.), users can refuse or conveniently refuse content push, etc. In the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.
[0047] The digital twin-based measurement terminal software testing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. In response to the measurement terminal software test instruction, the server 104 starts a virtual measurement terminal system based on digital twin pre-simulation in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual main station, a virtual meter, a virtual measurement terminal and a virtual interactive device; according to the measurement terminal software test items in the measurement terminal software test instruction, the interaction between the virtual main station and the virtual meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample; the test script is executed, and the interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and the operation information of the virtual measurement terminal system are collected; according to the interaction information and the operation information, the performance of the test sample corresponding to the software to be tested and the software performance are tested to obtain the test results. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0048] In an exemplary embodiment, Figure 2As shown in the figure, a digital twin-based measurement terminal software testing method is provided. Figure 1 The server 104 in the example is used as an example to illustrate, including the following steps 202 to 208. Among them:
[0049] Step 202, in response to the measurement terminal software test instruction, start a virtual measurement terminal system pre-simulated based on the digital twin in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual meter, a virtual measurement terminal and a virtual interactive device.
[0050] The measurement terminal software test instruction in step 202 is an instruction for instructing to perform software testing on the software to be tested. The software to be tested is software waiting to be tested. The software to be tested is software waiting to be configured or configured in the measurement terminal of the measurement terminal system. The measurement terminal system refers to a physical terminal system.
[0051] Among them, the measurement terminal software test instruction in step 202 can be in response to user operation, that is, initiated by the user, or in response to a preset condition. The preset condition can be that software waiting to be configured to the measurement terminal system is detected, and the software is determined as the software to be tested corresponding to the measurement terminal software test instruction; the preset condition can also be that when it is detected that there is a software update in the software configured in the measurement terminal system, the software configured in the measurement terminal system after the software update is determined as the software to be tested corresponding to the measurement terminal software test instruction; the preset condition can also be that when it is detected that the interval time between the last software test of the software configured in the measurement terminal system exceeds a preset interval time threshold, the software is determined as the software to be tested.
[0052] The virtual interactive device in step 202 includes but is not limited to a virtual monitoring device, a virtual sensor, a virtual communication device, and the like.
[0053] In this way, the software test of the software that has been configured or is waiting to be configured in the measurement terminal system can meet the user's needs; the software that is waiting to be configured to the measurement terminal system is configured to the measurement terminal system after software testing before being configured to the measurement terminal system; and, if the interval between the last software test of the software configured in the measurement terminal system is long or the software is updated, after software testing, if there is an abnormality in the software configured in the measurement terminal system, the abnormality can be corrected, which can ensure the normal operation of the software in the measurement terminal system and improve the stability and reliability of the measurement terminal system.
[0054] Exemplarily, step 202 includes: in response to a measurement terminal software test instruction, controlling a pre-simulated virtual measurement terminal system to start in a preset virtual test environment.
[0055] Optionally, the method also includes: simulating the measurement terminal system based on the digital twin technology to obtain a virtual measurement terminal system.
[0056] Step 204 , according to the measurement terminal software test items in the measurement terminal software test instructions, the interactions between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device are simulated to obtain test samples, and a test script is generated according to the test samples.
[0057] Exemplarily, according to the measurement terminal software test items in the measurement terminal software test instructions, the interactions between the virtual master station and the virtual meter, the virtual measurement terminal and the virtual interactive device are simulated to obtain test samples, including: parsing the measurement terminal software test instructions to obtain the measurement terminal software test items, wherein the measurement terminal software test items include at least one of functional testing, security testing and compatibility testing; according to the measurement terminal software test items, the interactions between the virtual master station and the virtual meter, the virtual measurement terminal and the virtual interactive device are simulated to obtain operation test samples and data test samples; and the operation test samples and the data test samples are combined into test samples.
[0058] As an embodiment, according to the measurement terminal software test items, the interactions between the virtual master station and the virtual electricity meter, the virtual measurement terminal and the virtual interactive device are simulated to obtain operation test samples and data test samples, including: according to the measurement terminal software test items in the measurement terminal software test instructions, the operations of the virtual master station and the software to be tested are simulated to obtain operation test samples; according to the measurement terminal software test items in the measurement terminal software test instructions, the interactions between the virtual master station and the virtual electricity meter, the virtual measurement terminal and the virtual interactive device are simulated to obtain data test samples.
[0059] Furthermore, according to the measurement terminal software test items in the measurement terminal software test instructions, the interactions between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device are simulated to obtain data test samples, including: according to the measurement terminal software test items in the measurement terminal software test instructions, the commands of the virtual master station are simulated to obtain master station command simulation data; according to the master station command simulation data, the responses of the virtual electric meter, the virtual measurement terminal and the virtual interactive device after receiving the commands of the virtual master station are simulated to obtain device response simulation data; the master station command simulation data and the device response simulation data are combined to obtain data test samples.
[0060] As an embodiment, according to the master station command simulation data, the responses of the virtual meter, the virtual measurement terminal and the virtual interactive device after receiving the virtual master station command respectively are simulated to obtain device response simulation data, including: for each virtual device in the virtual measurement terminal system that receives the command of the virtual master station, according to the master station command simulation data received by the virtual device and the response rule corresponding to the virtual device, the response of the virtual device is simulated to obtain device response simulation data. Specifically, in the case where the virtual device includes a virtual meter, the device response simulation data corresponding to the virtual meter includes meter reading data and device status data; in the case where the virtual device includes a virtual interactive device, the device response simulation data corresponding to the virtual meter includes device status data and device feedback data.
[0061] As an embodiment, generating a test script according to a test example includes: constructing a test logic and a test step according to the test example; and generating a test script according to the test logic and the test step.
[0062] Step 206 , executing the test script, and collecting the interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and the operation information of the virtual measurement terminal system.
[0063] Among them, the operation information of the virtual measurement terminal system in step 206 includes the status information of the virtual measurement terminal system and the system log of the virtual measurement terminal system, and the interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system includes the input data interactively inputted into the software to be tested by the virtual measurement terminal system and the software to be tested deployed in the virtual measurement terminal, and the output data fed back by the software to be tested in response to the input data.
[0064] Exemplarily, step 206 includes: executing the test script, and collecting input data and output data of the software to be tested deployed in the virtual measurement terminal, and collecting status information and system logs of the virtual measurement terminal system.
[0065] Step 208: Test the performance of the test sample and the software performance corresponding to the software to be tested according to the interaction information and the operation information to obtain the test result.
[0066] As an embodiment, step 208 includes: testing the performance of the test sample corresponding to the software to be tested according to the interaction information to obtain a first test result; testing the performance of the software to be tested according to the operation information to obtain a second test result; generating a test result based on the first test result and the second test result.
[0067] Furthermore, based on the interaction information, the performance of the test sample corresponding to the tested software is tested to obtain a first test result, including: based on the interaction information, the execution information of the test sample corresponding to the tested software is tested to obtain execution test information; based on the execution test information, the execution performance of the test sample corresponding to the tested software is tested to obtain a first test result, wherein the execution test information includes but is not limited to execution time test information, execution efficiency test information, and execution resource occupancy test information, etc.
[0068] As an embodiment, the performance of the software to be tested is tested according to the operation information to obtain a second test result, including: generating performance indicators corresponding to the software to be tested according to the operation information; testing the performance of the software to be tested according to the performance indicators corresponding to the software to be tested to obtain a second test result.
[0069] As an example, refer to Figure 3 , a server 104 using a digital twin-based measurement terminal software testing method interacts with a virtual measurement terminal system 10, the virtual measurement terminal system 10 includes a virtual main station 11, a virtual measurement terminal 12, a virtual meter 13 and a virtual interactive device 14, the virtual main station 11 is connected to the virtual measurement terminal 12, the virtual measurement terminal 12 communicates with the virtual interactive device 14 and the virtual meter 13 through an interface 15, the server 104 generates a test sample by simulating the virtual measurement terminal system 10, and generates a test script according to the test sample, controls the virtual measurement terminal system 10 to execute the test script, collects the interaction information between the virtual measurement terminal 12 and the virtual main station 11, the virtual meter 13 and the virtual interactive device 14, and collects the operation information of the virtual measurement terminal system 10, and then the server 104 tests the software to be tested deployed in the virtual measurement terminal according to the interaction information and the operation information, obtains the test result, and then analyzes the test result and outputs a test report.
[0070] It can be understood that implementing measurement terminal software testing through a pre-simulated virtual measurement system reduces the demand for real hardware equipment (physical measurement system), reduces the cost of virtual terminal software testing, improves the compatibility of virtual terminal software testing, and shortens the virtual terminal software testing time.
[0071] In the above-mentioned digital twin-based measurement terminal software testing method, by responding to the measurement terminal software testing instruction, a virtual measurement terminal system pre-simulated based on the digital twin is started in a preset virtual test environment, wherein the virtual measurement terminal system is composed of a virtual main station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device; according to the measurement terminal software test items in the measurement terminal software testing instruction, the interaction between the virtual main station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample; the test script is executed, and the interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and the operation information of the virtual measurement terminal system are collected ; According to the interaction information and operation information, the performance of the test samples and the software performance of the tested software corresponding to the test samples are tested to obtain the test results. The simulation process of the measurement terminal software test in the measurement terminal system is realized by using the virtual measurement terminal system and the preset virtual test environment. The measurement terminal software test of various measurement terminal software test contents of the software in the terminal system can be realized through the test samples, and various test conditions can also be simulated through the operation information of the virtual measurement terminal system, thereby overcoming the technical defects of the physical system measurement terminal software test, which is limited by the cost and test difficulty, and is prone to the test conditions of the measurement terminal software test in the measurement terminal system. Therefore, the limitations of the measurement terminal software test in the measurement terminal system are reduced.
[0072] In an exemplary embodiment, Figure 4 As shown, before starting the virtual measurement terminal system based on digital twin pre-simulation in the preset virtual test environment, steps 302 to 306 are included. Among them:
[0073] Step 302 , simulating the hardware environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a hardware simulation system, wherein the hardware simulation system includes a simulated processor, a simulated memory bus and a simulated hardware exception handling mechanism.
[0074] As an embodiment, step 302 includes: simulating the processor of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated processor; simulating the memory operation of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated memory bus; simulating the hardware exception handling strategy of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated hardware exception handling mechanism; and constructing a hardware simulation system based on the simulated processor, the simulated memory bus and the simulated hardware exception handling mechanism.
[0075] Furthermore, the processor of the measurement terminal corresponding to the measurement terminal software test instruction is simulated to obtain a simulated processor, including: defining the data structure of the register in the simulated processor to obtain the register data structure; and defining the instruction set architecture specification in the simulated processor to obtain the instruction set architecture specification; determining the instruction information according to the instruction format and instruction code in the instruction set architecture specification; and constructing the simulated processor according to the register data structure, the instruction set architecture specification and the instruction information.
[0076] Specifically, the data structure of the registers in the simulation processor is defined, and the register data structure obtained includes: the registers include but are not limited to general registers, program counters and status registers, etc. When the registers include general registers, the data structure of the general registers is defined through a structure to obtain the register data structure of the general registers; when the registers include status registers, the data structure of the status register is defined through a flag bit or a function interface to obtain the register data structure of the status register, wherein the flag bit includes at least one of a conditional flag and a control flag, and the flag definition of the status register is updated through the function interface; when the registers include a program counter, the data structure of the program counter is defined through the function interface to obtain the register data structure of the program counter, specifically, the increment operation of the program counter is updated through the function interface.
[0077] As an embodiment, an instruction set architecture specification in a simulation processor is defined to obtain an instruction set architecture specification, including: the instruction set architecture specification includes an instruction set composed of each instruction supported by the simulation processor, as well as the instruction format, operation code and simulation logic of each instruction; for each instruction, the instruction format and operation code of the instruction are defined through a structure; according to the instruction format and operation code of the instruction, the execution process of the instruction is simulated to obtain the simulation logic of the instruction.
[0078] As an embodiment, instruction information is determined based on the instruction format and instruction code in the instruction set architecture specification, including: for each instruction in the instruction set architecture specification, according to the instruction format and instruction code of the instruction, the type of the instruction is identified to obtain the instruction type of the instruction; according to the instruction type and instruction format of the instruction, operation information of the instruction is queried and determined as the instruction information of the instruction.
[0079] Furthermore, according to the instruction type and instruction format of the instruction, the operation information of the instruction is queried, including: according to the operation format of the instruction, determining the complexity of the instruction, wherein the more complex the operation format, the higher the complexity of the instruction; if the complexity of the instruction is less than a preset complexity threshold, then according to the instruction type of the instruction, querying a lookup table to obtain the operation function of the instruction, and determining the operation function of the instruction as the operation information of the instruction, wherein the lookup table includes a mapping relationship between the instruction type and the instruction function; if the complexity of the instruction is not less than the preset complexity threshold, then according to the instruction type of the instruction, matching is performed to obtain the operation logic of the instruction, the instruction format of the instruction is parsed to obtain the operand of the instruction, and the operand and operation logic of the instruction are determined as the operation information of the instruction.
[0080] As an embodiment, the memory operation of the measurement terminal corresponding to the software test instruction of the measurement terminal is simulated to obtain a simulated memory bus, including: defining the data structure in the simulated memory bus to obtain the memory data structure; simulating the memory access timing in the simulated memory bus to obtain a simulated memory clock; simulating the read and write operations of the simulated memory bus in response to the read and write requests of the simulated processor through the simulated memory clock to obtain the read and write simulation logic; and constructing the simulated memory bus according to the memory data structure, the simulated memory clock and the read and write simulation logic.
[0081] In this way, when simulating the memory bus, a simulated memory clock is introduced. Taking into account the timing of memory read and write operations, as well as the delay and synchronization issues of memory access, it is ensured that the read and write operations of different addresses can be executed in a predetermined order, thereby improving the similarity between the simulated memory bus and the actual memory bus.
[0082] Furthermore, the data structure in the simulated memory bus is defined to obtain a memory data structure, including: defining continuous memory blocks in the simulated memory bus through an array, and defining a memory area for dynamic allocation in the simulated memory bus through a linked list.
[0083] As an embodiment, the hardware exception handling strategy of the measurement terminal corresponding to the software test instruction of the measurement terminal is simulated to obtain a simulated hardware exception handling mechanism, including: obtaining preset meter abnormal status information, and constructing an exception handling function according to the preset meter abnormal status information; obtaining a preset interrupt request initiated by a simulated processor, and constructing an interrupt handling function according to the preset interrupt request; generating an interrupt vector table according to the interrupt handling function, wherein the interrupt vector table is used to characterize the mapping relationship between the interrupt vector number and the interrupt handling function, and the interrupt vector number is used to identify the interrupt handling item corresponding to the preset interrupt request; sorting the interrupt handling items corresponding to the preset interrupt request to obtain the priority of each interrupt handling item, wherein the interrupt handling items with a high priority are processed first; according to the exception handling function, the interrupt vector table, the interrupt handling function and the priority of each interrupt handling item, the hardware exception handling and interrupt mechanism are simulated to obtain a hardware exception handling mechanism.
[0084] Furthermore, based on the exception handling function, interrupt vector table, interrupt handling function and the priority of each interrupt handling item, the hardware exception handling and interrupt mechanism are simulated to obtain the hardware exception handling mechanism, including: constructing an interrupt handling strategy based on the priority of each interrupt handling item, the interrupt vector table and the interrupt handling function; based on the interrupt handling strategy and the exception handling function, the hardware exception handling and interrupt mechanism are simulated to obtain the hardware exception handling mechanism.
[0085] As another embodiment, step 302 includes: simulating the peripheral configuration of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated peripheral; simulating the operation timing of the hardware environment in the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated hardware clock; and constructing a hardware simulation system based on the simulated processor, simulated peripheral, simulated hardware clock, simulated memory bus and simulated hardware exception handling mechanism.
[0086] Furthermore, the peripheral configuration of the measurement system in the terminal system corresponding to the measurement terminal software test instruction is simulated to obtain simulated peripherals, including: according to the peripheral type of the peripheral configuration of the measurement terminal corresponding to the measurement terminal software test instruction, the state and operation of the peripheral of the measurement terminal corresponding to the measurement terminal software test instruction is simulated to obtain simulated peripherals, wherein the peripherals of the measurement terminal corresponding to the measurement terminal software test instruction include but are not limited to buttons, display screens, serial ports, etc., the buttons are used to respond to user operations, and the user operations are not limited to turning pages, setting parameters, etc., the display screen is used to display the parameters of the terminal system corresponding to the measurement terminal software test instruction, and the serial port can be RS-485, Ethernet, etc., for realizing local communication.
[0087] As an example, refer to Figure 5The hardware simulation system 50 includes a simulation processor 51, a simulation memory bus 52, a simulation hardware exception handling mechanism 53, a simulation peripheral 54 and a simulation hardware clock 55, wherein the simulation processor 51 is used to initiate read and write requests or abnormal interrupt operations; the simulation peripheral 54 is used for user operations to initiate read and write operations or abnormal interrupt operations; the simulation memory bus 52 is used to respond to read and write requests initiated by the simulation processor 51 or the simulation peripheral 54, and perform read and write operations; the simulation hardware exception handling mechanism 53 is used to respond to abnormal interrupt operations initiated by the simulation processor 51 or the simulation peripheral 54, and perform exception handling; the simulation hardware clock 55 is used to manage the processing timing between components in the hardware simulation system 50 except the simulation hardware clock 55.
[0088] Step 304 , simulating the software environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a software simulation system, wherein the software simulation system includes a simulated operating system, a simulated software exception handling mechanism and a simulated software system.
[0089] As an embodiment, step 304 includes: simulating the operating system of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated operating system; simulating the software exception handling strategy of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated software exception handling mechanism; simulating the installation and configuration of the software of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a simulated software system; and constructing a software simulation system based on the simulated operating system, the simulated software exception handling mechanism and the simulated software system.
[0090] Furthermore, the operating system of the measurement terminal corresponding to the measurement terminal software test instruction is simulated to obtain a simulated operating system, including: according to the measurement terminal software test items in the measurement terminal software test instruction and the system architecture of the measurement terminal corresponding to the measurement terminal software test instruction, the operating system of the measurement terminal corresponding to the measurement terminal software test instruction is simulated to obtain a simulated operating system, wherein the simulated operating software system can be a Linux operating system or other operating systems, which is not limited here. The simulated operating software system is used to download image files suitable for the virtual measurement terminal system. The image files can be in formats such as ISO (CD-ROM image file) and IMG (file compression format), and include core components of the operating system, drivers and other necessary software.
[0091] As an embodiment, the software exception handling strategy of the measurement terminal corresponding to the software test instruction of the measurement terminal is simulated to obtain a simulated software exception handling mechanism, including: wherein the software exceptions corresponding to the software exception handling strategy include but are not limited to memory errors, CPU errors, disk failures, etc. According to the exception type of the simulated software exception of the measurement terminal corresponding to the software test instruction of the measurement terminal, the software exception handling strategy of the measurement terminal corresponding to the software test instruction of the measurement terminal is simulated to obtain a simulated software exception handling mechanism.
[0092] As an embodiment, the installation and configuration of the software of the measuring terminal corresponding to the measurement terminal software test instruction is simulated to obtain a simulated software system, including: the software of the measuring terminal corresponding to the measurement terminal software test instruction is the software deployed in the measurement terminal corresponding to the measurement terminal software test instruction, and the measurement terminal is used to collect meter data, so the software of the measuring terminal in the measurement terminal corresponding to the measurement terminal software test instruction includes uplink communication software, message analysis software, data center software, application management software, local communication software and meter reading management software; the environment variables, configuration files and library files of the uplink communication software, message analysis software, data center software, application management software, local communication software and meter reading management software of the measurement terminal corresponding to the measurement terminal software test instruction are simulated and configured to obtain a simulated software system.
[0093] As another embodiment, step 304 includes: simulating the operation status, operating state and alarm information display of the software simulation system and the hardware simulation system to obtain a simulation display interface; simulating the interface for obtaining the operating state data of the software to be tested under the simulation of the software simulation system and the hardware simulation system corresponding to the software test instructions of the measurement terminal to obtain a simulation interface, wherein the operating state data includes but is not limited to CPU utilization, memory usage, network delay and other data; constructing a software simulation system according to the simulated operating system, the simulated display interface, the simulated interface, the simulated software exception handling mechanism and the simulated software system.
[0094] As an example, refer to Figure 6 The software simulation system 60 includes a simulation operating system 61 , a simulation software exception handling mechanism 62 , a simulation software system 63 , a simulation display interface 64 and a simulation interface 65 .
[0095] Step 306: construct a virtual measurement terminal system according to the hardware simulation system and the software simulation system.
[0096] Exemplarily, step 306 includes: integrating the hardware simulation system, the software simulation system, the virtual measurement terminal, the virtual master station, the virtual electricity meter and the virtual interactive device to obtain a virtual measurement terminal system.
[0097] In this embodiment, a hardware simulation system is obtained by simulating the hardware environment of the measurement terminal corresponding to the measurement terminal software test instruction, wherein the hardware simulation system includes a simulated processor, a simulated memory bus and a simulated hardware exception handling mechanism; a software simulation system is obtained by simulating the software environment of the measurement terminal corresponding to the measurement terminal software test instruction, wherein the software simulation system includes a simulated operating system, a simulated software exception handling mechanism and a simulated software system; a virtual measurement terminal system is constructed according to the hardware simulation system and the software simulation system, and the simulation of the hardware environment and software environment of the measurement terminal corresponding to the measurement terminal software test instruction is realized, so that when the software to be tested is tested through the virtual measurement terminal system, the simulated environment is more in line with the actual terminal system, thereby improving the accuracy of the measurement terminal software test.
[0098] As a detailed embodiment, the hardware environment of the measurement terminal corresponding to the software test instruction of the measurement terminal is simulated to obtain a hardware simulation system, wherein the hardware simulation system includes a simulated processor, a simulated memory bus and a simulated hardware exception handling mechanism; the data structure of the register in the simulated processor is defined to obtain the register data structure; and the instruction set architecture specification in the simulated processor is defined to obtain the instruction set architecture specification; for each instruction in the instruction set architecture specification, the type of the instruction is identified according to the instruction format and instruction code of the instruction to obtain the instruction type of the instruction; according to the instruction type and instruction format of the instruction, the operation information of the instruction is queried and obtained, and the operation information of the instruction is determined as the instruction information of the instruction; according to the register data structure, the instruction set architecture specification and the instruction information, a simulated processor is constructed; and the instruction type of the instruction is obtained. Preset the abnormal status information of the electric meter, and construct an exception handling function according to the preset abnormal status information of the electric meter; obtain the preset interrupt request initiated by the simulation processor, and construct an interrupt vector table and an interrupt handling function according to the preset interrupt request; prioritize the interrupt handling items corresponding to the preset interrupt request to obtain the priority of each interrupt handling item; simulate the hardware exception handling and interrupt mechanism according to the exception handling function, the interrupt vector table, the interrupt handling function and the priority of each interrupt handling item to obtain the hardware exception handling mechanism; simulate the software environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain the software simulation system, wherein the software simulation system includes a simulated operating system, a simulated software exception handling mechanism and a simulated software system; construct a virtual measurement terminal system according to the hardware simulation system and the software simulation system.
[0099] Furthermore, in response to the measurement terminal software test instruction, a virtual measurement terminal system pre-simulated based on the digital twin is started in a preset virtual test environment, wherein the virtual measurement terminal system is composed of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device; according to the measurement terminal software test items in the measurement terminal software test instruction, the operation of the virtual measurement terminal system is simulated to obtain an operation test sample; according to the measurement terminal software test items in the measurement terminal software test instruction, the command and response of the virtual measurement terminal system are simulated to obtain a data test sample; according to the operation test sample and the data test sample, a test sample is generated, and according to the test sample, a test script is generated; the test script is executed, and the interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and the operation information of the virtual measurement terminal system are collected; according to the interaction information and the operation information, the performance of the test sample corresponding to the software to be tested and the software performance are tested to obtain a test result.
[0100] In this way, by simulating the hardware environment of the measurement terminal corresponding to the measurement terminal software test instruction, a hardware simulation system is obtained, wherein the hardware simulation system includes a simulated processor, a simulated memory bus and a simulated hardware exception handling mechanism; by simulating the software environment of the measurement terminal corresponding to the measurement terminal software test instruction, a software simulation system is obtained, wherein the software simulation system includes a simulated operating system, a simulated software exception handling mechanism and a simulated software system; according to the hardware simulation system and the software simulation system, a virtual measurement terminal system is constructed, and the simulation of the hardware environment and software environment of the measurement terminal corresponding to the measurement terminal software test instruction is realized, so that when the software to be tested is tested through the virtual measurement terminal system, the simulated environment is more in line with the actual terminal system, thereby improving the accuracy of the measurement terminal software test.
[0101] Furthermore, by responding to the measurement terminal software test instruction, a virtual measurement terminal system based on digital twin pre-simulation is started in a preset virtual test environment, wherein the virtual measurement terminal system is composed of a virtual main station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device; according to the measurement terminal software test items in the measurement terminal software test instruction, the interaction between the virtual main station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample; the test script is executed, and the interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and the operation information of the virtual measurement terminal system are collected; according to the interaction information and The running information is used to test the performance of the test samples and the software performance of the tested software to obtain the test results. The simulation process of the measurement terminal software test in the measurement terminal system is realized by using the virtual measurement terminal system and the preset virtual test environment. The measurement terminal software test of various measurement terminal software test contents of the software in the terminal system can be realized through the test samples. Various test conditions can also be simulated through the running information of the virtual measurement terminal system, thereby overcoming the technical defects of the physical system measurement terminal software test being limited by the cost and test difficulty, and the test conditions of the measurement terminal software test in the measurement terminal system are relatively limited. Therefore, the limitations of the measurement terminal software test in the measurement terminal system are reduced.
[0102] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0103] Based on the same inventive concept, the embodiment of the present application also provides a digital twin-based measurement terminal software testing device for implementing the digital twin-based measurement terminal software testing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more digital twin-based measurement terminal software testing device embodiments provided below can refer to the limitations of the digital twin-based measurement terminal software testing method above, and will not be repeated here.
[0104] In an exemplary embodiment, Figure 7 As shown, a digital twin-based measurement terminal software testing device 700 is provided, including: a startup module 702, a simulation module 704, a collection module 706 and a test module 708, wherein:
[0105] A starting module 702 is used to start a virtual measurement terminal system pre-simulated based on the digital twin in a preset virtual test environment in response to a measurement terminal software test instruction, wherein the virtual measurement terminal system consists of a virtual master station, a virtual meter, a virtual measurement terminal and a virtual interactive device;
[0106] The simulation module 704 is used to simulate the interaction between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device respectively according to the measurement terminal software test items in the measurement terminal software test instructions, obtain test samples, and generate a test script according to the test samples;
[0107] The acquisition module 706 is used to execute the test script and acquire the interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and the operation information of the virtual measurement terminal system;
[0108] The testing module 708 is used to test the performance of the test sample corresponding to the software to be tested and the software performance according to the interaction information and the operation information to obtain the test result.
[0109] In one of the embodiments, the simulation module 704 is also used to simulate the operation of the virtual measurement terminal system according to the measurement terminal software test items in the measurement terminal software test instructions to obtain operation test samples; simulate the commands and responses of the virtual measurement terminal system according to the measurement terminal software test items in the measurement terminal software test instructions to obtain data test samples; and generate test samples according to the operation test samples and the data test samples.
[0110] In one of the embodiments, before starting a virtual measurement terminal system pre-simulated based on a digital twin in a preset virtual test environment, the device also includes: a simulation module, which is used to simulate the hardware environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a hardware simulation system, wherein the hardware simulation system includes a simulated processor, a simulated memory bus, and a simulated hardware exception handling mechanism; simulate the software environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a software simulation system, wherein the software simulation system includes a simulated operating system, a simulated software exception handling mechanism, and a simulated software system; and construct a virtual measurement terminal system based on the hardware simulation system and the software simulation system.
[0111] In one of the embodiments, the simulation module is also used to define the data structure of the registers in the simulation processor to obtain the register data structure; and to define the instruction set architecture specification in the simulation processor to obtain the instruction set architecture specification; determine the instruction information according to the instruction format and instruction code in the instruction set architecture specification; and construct the simulation processor according to the register data structure, the instruction set architecture specification and the instruction information.
[0112] In one of the embodiments, the simulation module is also used to identify the type of instruction to which each instruction in the instruction set architecture specification belongs based on the instruction format and instruction code of the instruction to obtain the instruction type of the instruction; based on the instruction type and instruction format of the instruction, query and obtain operation information of the instruction, and determine the operation information of the instruction as the instruction information of the instruction.
[0113] In one of the embodiments, the simulation module is also used to obtain preset meter abnormal status information, and construct an exception handling function based on the preset meter abnormal status information; obtain a preset interrupt request initiated by the simulation processor, and construct an interrupt vector table and an interrupt handling function based on the preset interrupt request; prioritize each interrupt handling item corresponding to the preset interrupt request to obtain the priority of each interrupt handling item; simulate the hardware exception handling and interrupt mechanism based on the exception handling function, interrupt vector table, interrupt handling function and the priority of each interrupt handling item to obtain the hardware exception handling mechanism.
[0114] Each module in the above-mentioned digital twin-based measurement terminal software testing device can be implemented in whole or in part by software, hardware, and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0115] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a measurement terminal software testing method based on digital twins is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0116] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0118] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0119] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0120] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0122] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A measurement terminal software testing method based on digital twins, characterized in that: The method comprises: In response to the measurement terminal software test instruction, a virtual measurement terminal system pre-simulated based on the digital twin is started in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device; According to the measurement terminal software test items in the measurement terminal software test instructions, the interaction between the virtual master station and the virtual electric meter, the virtual measurement terminal and the virtual interactive device is simulated to obtain a test sample, and a test script is generated according to the test sample; Executing the test script, and collecting interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and operation information of the virtual measurement terminal system; The performance of the test sample corresponding to the software to be tested and the software performance are tested according to the interaction information and the operation information to obtain a test result.
2. The method according to claim 1, characterized in that The step of simulating the operation of the virtual measurement terminal system according to the measurement terminal software test items in the measurement terminal software test instructions to obtain a test sample includes: According to the measurement terminal software test items in the measurement terminal software test instructions, the operation of the virtual measurement terminal system is simulated to obtain an operation test sample; According to the measurement terminal software test items in the measurement terminal software test instructions, simulating the commands and responses of the virtual measurement terminal system to obtain data test samples; A test sample is generated according to the operation test sample and the data test sample.
3. The method according to claim 1, characterized in that Before starting the virtual measurement terminal system based on digital twin pre-simulation in the preset virtual test environment, the method further includes: Simulating the hardware environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a hardware simulation system, wherein the hardware simulation system includes a simulated processor, a simulated memory bus and a simulated hardware exception handling mechanism; Simulating the software environment of the measurement terminal corresponding to the measurement terminal software test instruction to obtain a software simulation system, wherein the software simulation system includes a simulated operating system, a simulated software exception handling mechanism and a simulated software system; A virtual measurement terminal system is constructed according to the hardware simulation system and the software simulation system.
4. The method according to claim 3, characterized in that The method further comprises: The data structure of the register in the simulation processor is defined to obtain the register data structure; and the instruction set architecture specification in the simulation processor is defined to obtain the instruction set architecture specification; Determining instruction information according to the instruction format and instruction code in the instruction set architecture specification; A simulated processor is constructed according to the register data structure, the instruction set architecture specification and the instruction information.
5. The method according to claim 4, characterized in that The step of determining instruction information according to the instruction format and instruction code in the instruction set architecture specification includes: For each instruction in the instruction set architecture specification, according to the instruction format and instruction code of the instruction, the type of the instruction is identified to obtain the instruction type of the instruction; According to the instruction type and instruction format of the instruction, operation information of the instruction is queried and obtained, and the operation information of the instruction is determined as the instruction information of the instruction.
6. The method according to claim 4, characterized in that The method further comprises: Obtaining preset abnormal status information of the electric meter, and constructing an abnormality handling function according to the preset abnormal status information of the electric meter; Obtaining a preset interrupt request initiated by the analog processor, and constructing an interrupt vector table and an interrupt processing function according to the preset interrupt request; Prioritizing each interrupt processing item corresponding to the preset interrupt request to obtain the priority of each interrupt processing item; According to the exception handling function, interrupt vector table, interrupt handling function and the priority of each interrupt handling item, the hardware exception handling and interrupt mechanism are simulated to obtain the hardware exception handling mechanism.
7. A measurement terminal software testing device based on digital twins, characterized in that: The device comprises: A startup module, used to respond to a measurement terminal software test instruction and start a virtual measurement terminal system pre-simulated based on a digital twin in a preset virtual test environment, wherein the virtual measurement terminal system consists of a virtual master station, a virtual electric meter, a virtual measurement terminal and a virtual interactive device; a simulation module, configured to simulate the interaction between the virtual master station and the virtual electric meter, the virtual measuring terminal and the virtual interactive device respectively according to the measuring terminal software test items in the measuring terminal software test instructions, obtain test samples, and generate a test script according to the test samples; A collection module, used to execute the test script and collect interaction information between the software to be tested deployed in the virtual measurement terminal and the virtual measurement terminal system and operation information of the virtual measurement terminal system; The testing module is used to test the performance of the test sample corresponding to the software to be tested and the software performance according to the interaction information and the operation information to obtain the test result.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.