A PLC system software and hardware adaptive testing method and system
By analyzing the configuration and test sequence description files in the PLC system, generating configuration parameter sequences and establishing a dynamic test unit collection, the software and hardware adaptive testing method of the PLC system is implemented, solving the problems of complexity and inflexibility of the existing test methods, and improving the flexibility and portability of the test system.
Patent Information
- Application Number
- CN202411991845.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The existing PLC system automation testing methods are complex, lack flexible and portable adaptive testing methods, and are difficult to statistics and analyze test data.
It provides a software and hardware adaptive testing method for PLC system. By analyzing the PLC system configuration and test sequence description file, generating configuration parameter sequences, extracting test item characteristic values, establishing a dynamic test unit collection, and automatically generating test programs based on test requirements, realizing online hardware reconstruction and software automatic generation.
It improves the flexibility and portability of the test system, simplifies test data statistics and analysis, reduces test costs and time investment, and adapts to automated testing of different models of PLC products.
Smart Images

Figure CN119396128B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of PLC and programmable control technology, and in particular to a method and system for adaptively testing software and hardware of a PLC system. Background Art
[0002] Programmable control systems have the characteristics of distributed control, flexible deployment, and a wide variety of signals. There are great differences in the technical routes of various manufacturers of programmable control systems. In the future, more types of programmable control systems will have more different types and characteristics. The use of existing testing methods and quality supervision means has exposed some problems. First, the automatic testing technology and methods for programmable control systems are complex, and there is a lack of effective and fast adaptive testing methods; second, programmable control systems contain a variety of signal types and interface methods. The existing testing methods have cumbersome wiring, many types of instruments and meters, poor compatibility, and lack of system versatility; third, test data statistics are difficult and it is difficult to form data analysis.
[0003] PLCs are usually designed for specific tasks or applications, and their hardware and software configurations are relatively fixed. Generally, the test system is developed during the development phase of the PLC, which makes it difficult to adapt to the automated testing of different models of PLC products. The test programs in the PLC automated test system are generally built-in, and changing the PLC test program may require downtime, and upgrading the hardware may also involve a large cost and time investment. Summary of the invention
[0004] The embodiments of the present application provide a method and system for adaptive testing of software and hardware of a PLC system, which can be used to reconfigure the hardware online to adapt to different test objects, and can automatically generate test programs according to test requirements in software, greatly improving the flexibility and portability of the test system.
[0005] The present application provides a PLC system software and hardware adaptive testing method, including:
[0006] Parse the configuration and test sequence description files of the PLC system under test, and generate the configuration parameter sequence of the PLC system under test;
[0007] Extracting test item characteristic values of the PLC system under test according to the configuration parameter sequence, establishing a minimum executable dynamic test unit set according to the test item characteristic values, and extracting test item input and output requirements to determine expected result data of each test item and generate a test data set;
[0008] Traversing each minimum executable dynamic test unit in the dynamic test unit set, generating a test program according to the test data set, and setting a test point and recording a variable set in the test program;
[0009] Determine the degree of dependence of each minimum executable dynamic test unit on the test resources, sort all the minimum executable dynamic test units according to the degree of dependence, and use the sorting result as the execution order of the minimum executable dynamic test units;
[0010] Calculate the distribution of application demand resources of each minimum executable dynamic test unit and generate a scheduling strategy for the minimum executable dynamic test unit;
[0011] Load all minimum executable dynamic test units and complete the initialization of the dynamic test state machine;
[0012] According to the execution order, the minimum executable dynamic test units are executed one by one in sequence, and the change data of the variable set recorded at the tested point is recorded. If an exception is encountered during the test, the current minimum executable dynamic test unit is terminated and the next minimum executable dynamic test unit is executed until the test is completed and the test results are obtained.
[0013] Optionally, parsing the configuration and test sequence description files of the PLC system under test to generate a configuration parameter sequence of the PLC system under test includes:
[0014] Read the configuration and test sequence description files of the PLC system under test, and parse out the basic information and test information of the PLC system under test;
[0015] Analyze the number of module nodes and node information under the test information node, and analyze the test sequence information of the object under test;
[0016] A configuration parameter sequence of the PLC system under test is generated according to the test sequence information and the basic information of the PLC system under test.
[0017] Optionally, extracting the test item characteristic values of the PLC system under test according to the configuration parameter sequence includes:
[0018] Parse the configuration information of the test instrument and set the characteristic value of the test instrument;
[0019] Determine the location of its bus and driver through the test instrument characteristic value, and form the test driver characteristic value;
[0020] Establishing the physical channel resource mapping of the test instrument with a single signal mapping relationship characteristic sequence and a synchronization signal mapping relationship sequence;
[0021] According to the mapping relationship among the test items, the PLC system under test and the test instrument, the test item characteristic values of the PLC system under test are formed.
[0022] Optionally, establishing a minimum executable dynamic test unit set according to the test item characteristic value includes:
[0023] Traverse the test item characteristic values of the PLC system under test, extract the minimum executable dynamic test unit according to the minimum executable principle, and set a unique UUID identifier for each minimum executable dynamic test unit;
[0024] All minimum executable dynamic test units are combined into a minimum executable dynamic test unit set.
[0025] Optionally, extract the test item input and output requirements to determine the expected result data for each test item. Generating the test data set includes:
[0026] Read the test item input and output information, and query all matching minimum executable dynamic test units in the minimum executable dynamic test unit set;
[0027] According to the test item characteristic value of the minimum executable dynamic test unit, relevant parameters are set for each minimum executable dynamic test unit of the test item, and the test data set is formed by combining them.
[0028] Optionally, traversing each minimum executable dynamic test unit in the dynamic test unit set, generating a test program according to the test data set, and setting a test point and recording a variable set in the test program include:
[0029] Generate a function FUNCTION or function block FUNCTION_BLOCK that complies with the PLC programming language ST;
[0030] Establish input and output data corresponding to VAR_INPUT and VAR_OUTPUT in ST code, the tested point variable corresponds to the local variable VAR in ST code, and the test program corresponds to the function body of SI language;
[0031] Create adjustable parameters, record the positions of the adjustable parameters in the generated ST code, and assign values to the adjustable parameters;
[0032] Call the compiler corresponding to the PLC, compile the ST code to generate a test program;
[0033] Collect the adjustable parameters in the test program to form a set of recorded variables for the measured points.
[0034] Optionally, calculating the distribution of application demand resources of each minimum executable dynamic test unit and generating a minimum executable dynamic test unit scheduling strategy includes:
[0035] Obtain resource information required for each minimum executable dynamic test unit;
[0036] Establishing a resource requirement model for a minimum executable dynamic test unit based on the acquired resource information;
[0037] Count the distribution of resource requirements and generate the minimum executable dynamic test unit scheduling strategy.
[0038] Optionally, load all minimum executable dynamic test units to complete the dynamic test state machine initialization including:
[0039] Loading all minimum executable dynamic test units, determining all possible states, wherein one state is used to represent an execution condition of the minimum executable dynamic test unit;
[0040] Identify the events or inputs that cause the state to change, and define transition rules for each pair of state and event to complete the dynamic test state machine initialization, wherein the transition rules are the actions that should be taken when the target event occurs in the specified state.
[0041] Optionally, according to the execution order, the minimum executable dynamic test units are executed one by one in sequence, and the change data of the recorded variable set of the tested point is recorded, including:
[0042] After each minimum executable dynamic test unit is completed, the data analysis task is started synchronously while the next minimum executable dynamic test unit is running, the test data is recorded in the database, and the test results are analyzed;
[0043] In case of an exception during the test, the current minimum executable dynamic test unit is terminated and the next minimum executable dynamic test unit is executed until all test items are completed.
[0044] The embodiment of the present application also proposes a PLC system software and hardware adaptive testing system, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the PLC system software and hardware adaptive testing method as described above are implemented.
[0045] The method of the embodiment of the present application can be reconfigured online in hardware to adapt to different test objects, and can automatically generate test programs according to test requirements in software, greatly improving the flexibility and portability of the test system.
[0046] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0048] Figure 1 The overall process diagram of the PLC system software and hardware adaptive testing method according to the embodiment of the present application is shown;
[0049] Figure 2 This is a schematic diagram of the hardware adaptive test connection of the PLC system software and hardware adaptive test method according to the embodiment of the present application. DETAILED DESCRIPTION
[0050] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0051] The present application embodiment provides a PLC system software and hardware adaptive testing method, such as Figure 1 Shown include:
[0052] In step S101, the configuration and test sequence description files of the PLC system under test are parsed to generate a configuration parameter sequence of the PLC system under test. In some embodiments, parsing the configuration and test sequence description files of the PLC system under test to generate a configuration parameter sequence of the PLC system under test includes:
[0053] Read the configuration and test sequence description files of the PLC system under test, and parse out the basic information and test information of the PLC system under test. Specifically, the basic information of the PLC system under test includes four nodes: product name, model, version, and manufacturer. The test device uses product name, model, version, and manufacturer as the unique identifier of the object under test.
[0054] Parse the number of module nodes and node information under the test information node, and parse the test sequence information of the object under test. Specifically, for example, parse the number of module nodes under the test information node, each test module node has four nodes: module name, module model, test type, and test channel group. The test channel group has a test channel node that matches the number of test channels of the test module body. The test channel node has four nodes: signal type, signal name, data direction, and signal parameter.
[0055] Parse the test sequence information of the object under test. A test sequence can have multiple test items. Establish the project name, project sequence, and test action group of each test item. A test item can have multiple test actions. Each test action description includes the action name, action sequence, action type, acquisition parameters, and test pin information.
[0056] According to the test sequence information and the basic information of the PLC system under test, a configuration parameter sequence of the PLC system under test is generated. Specifically, the test sequence information and the PLC system under test information are combined to generate a configuration parameter sequence of the PLC system under test, including test instrument use configuration information, test instrument drive information, test instrument matching resource information, interface adapter connection information, test channel connection information, test item test target information, and test item input and output information.
[0057] In step S102, the test item characteristic values of the PLC system under test are extracted according to the configuration parameter sequence, and based on the test item characteristic values, a minimum executable dynamic test unit set is established, and the test item input and output requirements are extracted to determine the expected result data of each test item and generate a test data set.
[0058] In some embodiments, extracting the test item characteristic value of the PLC system under test according to the configuration parameter sequence includes:
[0059] Parse the configuration information of the test instrument and set the characteristic value of the test instrument. Specifically, parse the test instrument usage configuration information. The test instruments include signal generators, power supplies, digital multimeters, switches, and oscilloscopes. Set the characteristic value of the test instrument according to the type of the test instrument.
[0060] The location of the bus and driver is determined by the test instrument characteristic value to form the test driver characteristic value. For example, the test instrument is connected to the test system computer through the bus. Different types of instruments have different drivers, and the drivers of the same type but different manufacturers are also different. The test device software processing unit determines the exact location of the bus and driver through the test instrument characteristic value to form the test driver characteristic value.
[0061] Establish the test instrument physical channel resource mapping, with a single signal mapping relationship feature sequence and a synchronous signal mapping relationship sequence. Specifically, establish a physical channel resource mapping pair, associate the signal type, type, and parameter information with the test channel, and form a single signal mapping relationship feature sequence and a synchronous signal mapping relationship sequence.
[0062] According to the mapping relationship between the test items, the PLC system under test, and the test instrument, the test item characteristic value of the PLC system under test is formed. Based on the above steps, the test instrument characteristic value, the test drive characteristic value, the single signal mapping relationship characteristic sequence and the synchronization signal mapping relationship sequence, the interface adapter and the PLC device channel connection table, and the connection relationship table between the internal connection switch of the test device and the adapter channel are combined to form the test item characteristic value of the PLC system under test.
[0063] In some examples, establishing a minimum executable dynamic test unit set according to the test item characteristic value includes:
[0064] Traverse the test item characteristic values of the PLC system under test, extract the minimum executable dynamic test unit according to the minimum executable principle, and set a unique UUID identifier for each minimum executable dynamic test unit. Each minimum executable dynamic test unit contains the test purpose, test instrument characteristic value, test drive characteristic value, single signal mapping relationship characteristic sequence, synchronization signal mapping relationship sequence, interface adapter and PLC device channel connection table, test device internal connection switch and adapter channel connection relationship table.
[0065] All minimum executable dynamic test units are combined into a minimum executable dynamic test unit set.
[0066] In step S103, each minimum executable dynamic test unit in the dynamic test unit set is traversed, a test program is generated according to the test data set, and a test point is set and a variable set is recorded in the test program.
[0067] In step S104, the degree of dependence of each minimum executable dynamic test unit on the test resource is determined, and all minimum executable dynamic test units are sorted according to the degree of dependence, and the sorting result is used as the execution order of the minimum executable dynamic test units.
[0068] In step S105, the distribution of application requirement resources of each minimum executable dynamic test unit is calculated to generate a minimum executable dynamic test unit scheduling strategy.
[0069] In step S106, all minimum executable dynamic test units are loaded to complete the initialization of the dynamic test state machine.
[0070] In step S107, according to the execution order, the minimum executable dynamic test units are executed one by one in sequence, and the change data of the variable set recorded at the tested point is recorded. If an exception is encountered during the test process, the current minimum executable dynamic test unit is terminated and the next minimum executable dynamic test unit is executed until the test is completed and the test results are obtained.
[0071] In some embodiments, extracting test item input and output requirements to determine expected result data for each test item, and generating a test data set includes:
[0072] Read the test item input and output information, and query all matching minimum executable dynamic test units in the minimum executable dynamic test unit set.
[0073] According to the test item characteristic value of the minimum executable dynamic test unit, set relevant parameters for each minimum executable dynamic test unit of the test item, and combine to form a test data set. Specifically, query all matching minimum executable dynamic test units in the minimum executable dynamic test unit set, and set basic test values, random test values, and expected result data according to the signal type based on the single signal mapping relationship characteristic sequence and the synchronization signal mapping relationship sequence of the minimum executable dynamic test unit. Set the basic test value, random test value, and expected result data for each minimum executable dynamic test unit of the test item, and combine to generate a test data set.
[0074] In some embodiments, traversing each minimum executable dynamic test unit in the dynamic test unit set, generating a test program according to a test data set, and setting a test point and recording a variable set in the test program include:
[0075] Generate a function FUNCTION or function block FUNCTION_BLOCK that complies with the PLC programming language ST;
[0076] Establish input and output data corresponding to VAR_INPUT and VAR_OUTPUT in ST code, the tested point variable corresponds to the local variable VAR in ST code, and the test program corresponds to the function body of SI language;
[0077] Create adjustable parameters, record the positions of the adjustable parameters in the generated ST code, and assign values to the adjustable parameters.
[0078] Call the compiler corresponding to the PLC, compile the ST code to generate a test program;
[0079] Collect the adjustable parameters in the test program to form a set of recorded variables for the measured points.
[0080] Furthermore, evaluate the degree of dependence of each minimum executable dynamic test unit on the test resources, and sort all minimum executable dynamic test units from high to low according to the degree of dependence. The sorting result will be used as the order in which the minimum executable dynamic test unit is executed. Specifically: evaluate whether the minimum executable dynamic test unit needs to exclusively occupy the test resources. If so, increase the priority of the minimum executable dynamic test unit; evaluate whether there is a test order dependency, that is, the result of one minimum executable dynamic test unit may affect another minimum executable dynamic test unit. If so, sort them in the order of dependency. Evaluate whether the CPU or memory is occupied for a long time during the execution of the minimum executable dynamic test unit. If so, the priority of the minimum executable dynamic test unit is reduced; evaluate whether there is a time window restriction, and some test items can only be run within a specific time period. If so, adjust the execution order according to the time window restriction.
[0081] Further, the distribution of application requirement resources of each minimum executable dynamic test unit is calculated, a minimum executable dynamic test unit, a test data set, a test resource, and a test program matrix are constructed, and the minimum executable dynamic test unit scheduling strategy is generated according to the test resource situation. In some embodiments, the distribution of application requirement resources of each minimum executable dynamic test unit is calculated, and the minimum executable dynamic test unit scheduling strategy is generated, including:
[0082] Get the resource information required for each minimal executable dynamic test unit.
[0083] A resource requirement model is established for the minimum executable dynamic test unit according to the obtained resource information.
[0084] Count the distribution of resource requirements and generate a minimum executable dynamic test unit scheduling strategy. Specifically, check whether there are multiple minimum executable dynamic test units competing for the same resources at the same time, identify the competition points, optimize the test sequence, and generate a minimum executable dynamic test unit scheduling strategy.
[0085] The correctness of the test program of each minimum executable dynamic test unit is verified, and static analysis tools are used to automatically detect potential problems in the code and remove erroneous test programs and minimum executable dynamic test units.
[0086] In some embodiments, loading all minimum executable dynamic test units and completing the initialization of the dynamic test state machine includes:
[0087] Loading all minimum executable dynamic test units, determining all possible states, wherein one state is used to represent an execution condition of the minimum executable dynamic test unit;
[0088] Identify the events or inputs that cause the state to change, and define transition rules for each pair of state and event to complete the dynamic test state machine initialization, wherein the transition rules are the actions that should be taken when the target event occurs in the specified state.
[0089] In some embodiments, according to the execution order, the minimum executable dynamic test units are executed one by one in sequence, and the change data of the recorded variable set of the tested point is recorded, including:
[0090] After each minimum executable dynamic test unit is completed, the data analysis task is started synchronously while the next minimum executable dynamic test unit is running, the test data is recorded in the database, and the test results are analyzed. For example, according to the execution order of the minimum executable dynamic test unit, the dynamic test state machine executes the minimum executable dynamic test unit one by one in turn, and records the change data of the variable set of the tested point.
[0091] If an exception is encountered during the test, the current minimum executable dynamic test unit is terminated and the next minimum executable dynamic test unit is executed until all test items are completed and a test report is generated.
[0092] The present application designs a PLC system hardware and software adaptive testing method, which enables the test device to be reconfigured online in hardware to adapt to different test objects, and the software can automatically generate test programs according to test requirements, greatly improving the flexibility and portability of the test system. Without reducing the performance of the automated test device, test resource configuration can be performed to maximize the role of existing test resources, while reducing the size of the test device and reducing the cost of developing and maintaining the test device.
[0093] The embodiment of the present application also proposes a PLC system software and hardware adaptive testing system, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the PLC system software and hardware adaptive testing method as described above are implemented.
[0094] Specifically, Figure 2As shown, the PLC system hardware and software adaptive test system includes a hardware processing unit, a software processing unit, a test instrument, a signal test interface, an interface adapter, a test status display, and a test channel. The hardware processing unit adopts a standard programmable controller device, and the software processing unit is installed on the computer system, and the hardware processing unit is connected through a network cable; the hardware processing unit is connected to the test instrument, the test instrument is connected to the test channel, the test channel is connected to the signal test interface, the signal test interface is connected to the hardware processing unit through the interface adapter, receives the instructions of the hardware processing unit, and generates different test signals. The test status display is 32 red, yellow, and green lights. The test channel groups the signal test interface and decomposes it into an input test channel and an output test channel. The interface adapter is used to realize that the input and output signals and the communication interface of the test channel can be dynamically adjusted according to the test requirements, so that the fixed hardware can realize a variety of programmable solutions, and the test instrument no longer has a single test function. The signal test interface provides an interface that can adapt to different test signals. The test status display is 32 red, yellow, and green lights, which can display the system status, test case execution status, and test result status information. The test channel groups the signal test interface and decomposes it into input test channel and output test channel. The interface adapter is used to realize that the input and output signals and communication interface of the test channel can be dynamically adjusted according to the test requirements, so that the fixed hardware can realize a variety of programmable solutions, so that the test instrument no longer has a single test function.
[0095] The software processing unit of the test device allocates the test resources of the test device in real time, changes the test functions, and realizes the reusability of the test system for different objects under test and different test requirements.
[0096] The software processing unit of the test system performs parsing and processing operations, parses the configuration of the PLC system under test and the test sequence description file, generates a configuration parameter sequence of the PLC system under test, establishes a minimum executable dynamic test unit set, generates a test data set, generates a test program, sets a variable set for the measured point record, sorts the minimum executable dynamic test unit, generates a dynamic test item scheduling strategy, loads all test items, completes the initialization of the dynamic test state machine, and according to the execution order of the test items, the dynamic test state machine executes the test items one by one in sequence, records the change data of the variable set recorded at the measured point, completes the data analysis and records it in the database, and generates a test report.
[0097] Connect the signal test interface of the PLC system under test and the test device, and the test device hardware processing unit loads the test device configuration parameters to complete the initialization. The test device software processing unit decomposes the device configuration parameters into the configuration data structure of different test instruments, and configures the parameters to each instrument through the configuration data structure; the test device software processing unit determines the test instrument that meets the requirements of the system under test according to the configuration parameters, and establishes a test channel from the port of the device under test to the port of the test instrument.
[0098] Power on the PLC system under test, download the configuration parameter sequence of the PLC system under test and the PLC control program under test into the PLC system under test, and run the PLC system under test.
[0099] Start the test, the test device automatically completes the initialization of the dynamic test state machine, the software processing unit automatically runs all the minimum executable dynamic test units, collects and outputs test signals, executes test items, monitors the test execution status in real time, and records detailed log information.
[0100] The test device automatically records the test data, collects, organizes and analyzes the test results, and generates an analysis report.
[0101] A specific example of the implementation of this application includes testing the execution time of PLC basic instructions, IO output response time, and simulation acquisition accuracy. The three test examples are carried out in the same system, and the three test functions are configured separately through the description file. The corresponding function tests are automatically completed without modifying the software and hardware.
[0102] First, the PLC basic instruction execution time test is carried out. This test is to obtain the time for the tested PLC to execute basic instructions. In order to magnify the difference, the test project is designed to run 1 million addition programs, configure a cumulative collection cycle of 5,000, and perform 100 tests. Start the execution test item, collect the running time of 5,000 cycles, record 100 test data, obtain the average value of the basic instruction execution time, and the test results can be saved as a test report.
[0103] Then, the IO output response time test is performed to count the time from the PLC control instruction being issued -> the device receiving the control instruction and executing -> the device completing the execution and detecting the status update. The test device collects the output response process time of the PLC system under test. Without modifying the test system, configure the digital input and digital acquisition signals, configure the test items and the input and output voltage / current signals of the test instrument, and connect the test channels. Generate the DO output and DI acquisition program running in the PLC as the test program set for this test item. Send the control program to the PLC, start the test item, start timing, execute 1000 cycles and 100 tests, calculate the average value, and save the test results as a test report.
[0104] Then, the analog quantity acquisition accuracy test is carried out. The analog quantity input pin of the controller under test is connected through the analog quantity output signal device of the automatic test device. After the signal is collected to the analog quantity input module of the controller under test, the analog quantity input module of the controller under test collects the field signal and converts it into a standard range value. The error between the collected value and the nominal value is compared, and the execution logic of the test device calculates the error value. Without modifying the test system, configure the analog quantity input, output signal and test channel, configure the input and output voltage / current signals of the test items and the test instrument, generate typical test voltage values and current values, generate test cases, and generate the PLC software AI acquisition range conversion program as the test program set for this test item. Send the control program to the PLC, start the test item, and the test device automatically outputs different voltage and current signal values according to the test data value, and collects the feedback voltage and current values, performs error comparison, performs 100 tests, calculates the average value, and saves the test results as a test report.
[0105] This application can automatically adjust the test device configuration according to changes in test requirements, dynamically generate test programs, and improve test efficiency, flexibility, and adaptability. Especially when facing different types of PLC systems, there is no need to build multiple PLC test equipment to achieve highly flexible and scalable PLC system automation testing.
[0106] It should be noted that in the various embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0107] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0109] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A PLC system software and hardware adaptive testing method, characterized in that: include: Parse the configuration and test sequence description files of the PLC system under test, and generate the configuration parameter sequence of the PLC system under test; Extracting test item characteristic values of the PLC system under test according to the configuration parameter sequence, establishing a minimum executable dynamic test unit set according to the test item characteristic values, and extracting test item input and output requirements to determine expected result data of each test item and generate a test data set; Traversing each minimum executable dynamic test unit in the dynamic test unit set, generating a test program according to the test data set, and setting a test point and recording a variable set in the test program; Determine the degree of dependence of each minimum executable dynamic test unit on the test resources, sort all the minimum executable dynamic test units according to the degree of dependence, and use the sorting result as the execution order of the minimum executable dynamic test units; Calculate the distribution of application demand resources of each minimum executable dynamic test unit and generate a scheduling strategy for the minimum executable dynamic test unit; Load all minimum executable dynamic test units and complete the initialization of the dynamic test state machine; According to the execution order, the minimum executable dynamic test units are executed one by one in sequence, and the change data of the variable set recorded at the tested point is recorded. If an exception is encountered during the test, the current minimum executable dynamic test unit is terminated and the next minimum executable dynamic test unit is executed until the test is completed and the test results are obtained.
2. The PLC system software and hardware adaptive testing method according to claim 1, characterized in that: Parse the configuration and test sequence description files of the PLC system under test, and generate the configuration parameter sequence of the PLC system under test, including: Read the configuration and test sequence description files of the PLC system under test, and parse out the basic information and test information of the PLC system under test; Analyze the number of module nodes and node information under the test information node, and analyze the test sequence information of the object under test; A configuration parameter sequence of the PLC system under test is generated according to the test sequence information and the basic information of the PLC system under test.
3. The PLC system software and hardware adaptive testing method according to claim 1, characterized in that: According to the configuration parameter sequence, the test item characteristic values of the PLC system under test are extracted, including: Parse the configuration information of the test instrument and set the characteristic value of the test instrument; Determine the location of its bus and driver through the test instrument characteristic value, and form the test driver characteristic value; Establishing the physical channel resource mapping of the test instrument with a single signal mapping relationship characteristic sequence and a synchronization signal mapping relationship sequence; According to the mapping relationship among the test items, the PLC system under test and the test instrument, the test item characteristic values of the PLC system under test are formed.
4. The PLC system software and hardware adaptive testing method according to claim 3, characterized in that: According to the test item characteristic value, establishing a minimum executable dynamic test unit set includes: Traverse the test item characteristic values of the PLC system under test, extract the minimum executable dynamic test unit according to the minimum executable principle, and set a unique UUID identifier for each minimum executable dynamic test unit; All minimum executable dynamic test units are combined into a minimum executable dynamic test unit set.
5. The PLC system software and hardware adaptive testing method according to claim 3, characterized in that: Extract the test item input and output requirements to determine the expected result data for each test item. Generate a test data set including: Read the test item input and output information, and query all matching minimum executable dynamic test units in the minimum executable dynamic test unit set; According to the test item characteristic value of the minimum executable dynamic test unit, relevant parameters are set for each minimum executable dynamic test unit of the test item, and the test data set is formed by combining them.
6. The PLC system software and hardware adaptive testing method according to claim 5, characterized in that: Traversing each minimum executable dynamic test unit in the dynamic test unit set, generating a test program according to a test data set, and setting a test point and recording a variable set in the test program include: Generate a function FUNCTION or function block FUNCTION_BLOCK that complies with the PLC programming language ST; Establish input and output data corresponding to VAR_INPUT and VAR_OUTPUT in ST code, the tested point variable corresponds to the local variable VAR in ST code, and the test program corresponds to the function body of SI language; Create adjustable parameters, record the positions of the adjustable parameters in the generated ST code, and assign values to the adjustable parameters; Call the compiler corresponding to the PLC, compile the ST code to generate a test program; Collect the adjustable parameters in the test program to form a set of recorded variables for the measured points.
7. The PLC system software and hardware adaptive testing method according to claim 6, characterized in that: Calculate the distribution of application demand resources of each minimum executable dynamic test unit and generate the minimum executable dynamic test unit scheduling strategy including: Obtain resource information required for each minimum executable dynamic test unit; Establishing a resource requirement model for a minimum executable dynamic test unit based on the acquired resource information; Count the distribution of resource requirements and generate the minimum executable dynamic test unit scheduling strategy.
8. The PLC system software and hardware adaptive testing method according to claim 6, characterized in that: Load all minimum executable dynamic test units and complete the initialization of the dynamic test state machine including: Loading all minimum executable dynamic test units, determining all possible states, wherein one state is used to represent an execution condition of the minimum executable dynamic test unit; Identify the events or inputs that cause the state to change, and define transition rules for each pair of state and event to complete the dynamic test state machine initialization, wherein the transition rules are the actions that should be taken when the target event occurs in the specified state.
9. The PLC system software and hardware adaptive testing method according to claim 8, characterized in that: According to the execution order, the minimum executable dynamic test units are executed one by one in sequence, and the change data of the recorded variable set of the tested point is recorded, including: After each minimum executable dynamic test unit is completed, the data analysis task is started synchronously while the next minimum executable dynamic test unit is running, the test data is recorded in the database, and the test results are analyzed; In case of an exception during the test, the current minimum executable dynamic test unit is terminated and the next minimum executable dynamic test unit is executed until all test items are completed.
10. A PLC system software and hardware adaptive testing system, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the PLC system software and hardware adaptive testing method as described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Complex resource constraint-oriented test task scheduling method
CN113282402A
Satellite-borne telemetering and remote control dynamic closed-loop test system based on asynchronous serial communication interface
CN114465939A