Testing method, device, storage medium, and processor
Through automated testing methods, the test cases are read and the output results of the PID function block meet the expected range, solving the problems of inefficiency and inaccurate results of traditional manual testing, and achieving efficient and accurate automatic testing.
Patent Information
- Application Number
- CN202111679938.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2041-12-31
AI Technical Summary
Traditional PID functional testing requires manual construction of test cases, resulting in inefficiency of tests and inaccurate test results.
By reading the test cases, including the input parameters and the expected interval of the target control mode, write the input parameters to the PID function block, determine whether the output result belongs to the expected interval, and determine whether the PID function block passes the test.
Automatic testing of PID function blocks is realized, saving testing time, improving testing efficiency and accuracy of test results.
Smart Images

Figure CN114328261B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing, and in particular, to a testing method, device, storage medium, and processor. Background Art
[0002] As the number of software iterations becomes more and more frequent, higher frequency response requirements are imposed on PID function testing and iterative testing. It is necessary to consider the coverage and timeliness testing for PID testing. The traditional manual testing method for PID functions requires testers to manually construct test scenarios, design test cases, deploy test environments, execute them one by one, and manually record test results. In this traditional testing mode, not only does it take a long time to execute the tests, but also testers spend a lot of time on the preconditions of test actions, preparing test data input, and there is no standard output range for MV output, often relying on intuition.
[0003] Therefore, there is an urgent need for an efficient, reliable, fast, and automatic testing method to replace the traditional manual testing solution to improve the PID function coverage testing and output curve verification.
[0004] In response to the above problems, no effective solution has been proposed yet. Summary of the Invention
[0005] Embodiments of the present application provide a testing method, device, storage medium, and processor to at least solve the technical problems of low testing efficiency and inaccurate test results caused by manually constructing test cases to test PID function blocks and judging output results by intuition in related technologies.
[0006] According to one aspect of the embodiments of the present application, a testing method is provided. The testing method is applied to a proportional-integral-derivative (PID) function block and includes: reading a test case, where the test case at least includes: input parameters corresponding to a target control mode, and an expected range in the target control mode, and the expected range includes: a first range for measuring an expected value and a second range for a feedback expected value; writing the input parameters indicated by the test case into the PID function block to obtain an output result; determining whether the output result belongs to the expected value range to obtain a judgment result, where the output result includes: a measured value and a feedback value; and determining whether the PID function block passes the test according to the judgment result.
[0007] Optionally, writing the input parameters indicated by the test case into the PID function block to obtain an output result includes: determining a waiting duration indicated by the test case; after writing the input parameters indicated by the test case into the PID function block, waiting for the waiting duration to obtain output results at each predetermined moment within the waiting duration.
[0008] Optionally, determine whether the output result belongs to the expected value range, including: obtaining the first range and the second range corresponding to each predetermined moment; determining whether the measured value at each predetermined moment belongs to the first range to obtain a first sub-determination result; determining whether the feedback value at each predetermined moment belongs to the second range to obtain a second sub-determination result.
[0009] Optionally, determine whether the PID function block passes the test according to the determination result, including: determining that the PID function block passes the test when the first sub-determination result indicates that the measured value belongs to the first range and the second sub-determination result indicates that the feedback value belongs to the second range; determining that the PID function block fails the test when the first sub-determination result indicates that the measured value does not belong to the first range or the second sub-determination result indicates that the feedback value does not belong to the second range.
[0010] Optionally, before determining whether the output result belongs to the expected value range, including: determining that each predetermined moment within the waiting duration is the horizontal axis of the plane coordinate system; determining that the output result is the vertical axis of the plane coordinate system, and obtaining the first curve corresponding to the measured value and the second curve corresponding to the feedback value.
[0011] Optionally, after obtaining the first curve corresponding to the measured value and the second curve corresponding to the feedback value, the method further includes: obtaining the first range and the second range corresponding to each predetermined moment; determining the third curve corresponding to the first range in the plane coordinate system, where the third curve includes: the curve corresponding to the maximum measured expected value and the curve corresponding to the minimum measured expected value in the first range; determining the fourth curve corresponding to the second range in the plane coordinate system, where the fourth curve includes: the curve corresponding to the maximum feedback expected value and the curve corresponding to the minimum feedback expected value in the second range.
[0012] Optionally, determine whether the output result belongs to the expected value range, including: determining the first target area between the curve corresponding to the maximum measured expected value and the curve corresponding to the minimum measured expected value; determining the second target area between the curve corresponding to the maximum feedback expected value and the curve corresponding to the minimum feedback expected value; detecting whether the first curve falls into the first target area to obtain a first detection result; detecting whether the second curve falls into the second target area to obtain a second detection result.
[0013] Optionally, determine whether the PID function block passes the test according to the determination result, including: determining that the PID function block passes the test when the first detection result indicates that the first curve falls into the first target area and the second detection result indicates that the second curve falls into the second target area; determining that the PID function block fails the test when the first detection result indicates that the measured value does not fall into the first target area or the second detection result indicates that the feedback value does not fall into the second target area.
[0014] According to another aspect of the embodiments of the present application, a testing device is further provided. The testing device is applied to a proportional integral derivative (PID) function block and includes: a reading module for reading test cases, where the test cases at least include input parameters corresponding to a target control mode and an expected interval in the target control mode. The expected interval includes a first interval for measuring the expected value and a second interval for the feedback expected value; a writing module for writing the input parameters indicated by the test cases into the PID function block to obtain an output result; a judging module for judging whether the output result belongs to the expected value interval to obtain a judgment result, where the output result includes a measured value and a feedback value; and a determining module for determining whether the PID function block passes the test according to the judgment result.
[0015] According to another aspect of the embodiments of the present application, a non-volatile storage medium is further provided. The non-volatile storage medium includes a stored program, where when the program runs, it controls the device where the non-volatile storage medium is located to execute any one of the testing methods.
[0016] According to another aspect of the embodiments of the present application, a processor is further provided. The processor is used to run a program, where when the program runs, it executes any one of the testing methods.
[0017] In the embodiments of the present application, by adopting the method of executing test cases and comparing the execution results with the expected interval, by reading the test cases, where the test cases at least include input parameters corresponding to the target control mode and the expected interval in the target control mode. The expected interval includes a first interval for measuring the expected value and a second interval for the feedback expected value; writing the input parameters indicated by the test cases into the PID function block to obtain an output result; judging whether the output result belongs to the expected value interval to obtain a judgment result, where the output result includes a measured value and a feedback value; and determining whether the PID function block passes the test according to the judgment result, the purpose of automatically testing the PID function block is achieved, thereby realizing the technical effects of saving testing time, improving testing efficiency, and improving the accuracy of testing results. Furthermore, the technical problems of low testing efficiency and inaccurate testing results caused by manually constructing test cases to test the PID function block and judging the output results by intuitive feeling in the related art are solved. Description of the Drawings
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0019] Figure 1 is a schematic flowchart of an optional testing method according to the embodiments of the present application;
[0020] Figure 2 is a flowchart of an optional implementation method in an embodiment of the present application;
[0021] Figure 3 is a schematic diagram of a data table of test cases under P control in an embodiment of the present application;
[0022] Figure 4 is a schematic diagram of an input curve and an output curve in an embodiment of the present application;
[0023] Figure 5 is a schematic diagram of a data table of PV expected value, MV expected value, PV actual value, and MV actual value in an embodiment of the present application;
[0024] Figure 6 is a schematic diagram of an optional test report in an embodiment of the present application;
[0025] Figure 7 is a schematic diagram for intuitively displaying a test result according to an embodiment;
[0026] Figure 8 is a schematic structural diagram of an optional test device according to an embodiment of the present application. Detailed implementation manners
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such used data may be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0029] For the convenience of those skilled in the art to better understand the related embodiments of the present application, the following is an explanation of the technical terms or some nouns that may be involved in the related embodiments of the present application:
[0030] PID function block: A function block that implements PID control in a control system.
[0031] P: P control (shield ID). I: I control (shield PD). D: D control (shield PI); PI: PI control (shield D). PD: PD control (shield I). ID: ID control (shield P).
[0032] PB: Proportional parameter in PID parameters. TI: Integral parameter in PID parameters. TD: Derivative parameter in PID parameters. SV: Set value in the control process. PV: Measured value in the control process.
[0033] MV: In the PID control process, the feedback value calculated by the PID program based on the difference between SV and PV and the three PID parameters.
[0034] According to an embodiment of the present application, an embodiment of a test method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0035] Figure 1 is a test method according to an embodiment of the present application, as Figure 1 shown, this test method is applied to a proportional-integral-derivative PID function block, and the method includes the following steps:
[0036] Step S102, obtain a test case, where the test case at least includes: input parameters corresponding to the target control mode, and an expected interval in the target control mode, and the expected interval includes: a first interval of the measured expected value and a second interval of the feedback expected value;
[0037] Step S104, write the input parameters indicated by the test case into the PID function block to obtain an output result;
[0038] Step S106, determine whether the output result belongs to the expected value interval to obtain a judgment result, where the output result includes: a measured value and a feedback value;
[0039] Step S108, determine whether the PID function block passes the test according to the judgment result.
[0040] In this test method, by reading test cases, where the test cases at least include: input parameters corresponding to the target control mode, and an expected range in the target control mode, the expected range includes: a first range for measuring the expected value and a second range for the feedback expected value; writing the input parameters indicated by the test cases into the PID function block to obtain an output result; determining whether the output result belongs to the expected value range to obtain a judgment result, where the output result includes: a measured value and a feedback value; determining whether the PID function block passes the test according to the judgment result, achieving the purpose of automatically testing the PID function block, thereby realizing the technical effects of saving test time, improving test efficiency, and improving the accuracy of test results, and further solving the technical problems of low test efficiency and inaccurate test results caused by manually constructing test cases to test the PID function block and judging the output result by intuitive feeling in the related art.
[0041] It should be noted that the above target control modes include but are not limited to: P control, I control, D control, PI control, PD control, and ID control, etc.
[0042] In some embodiments of the present application, writing the input parameters indicated by the test cases into the PID function block to obtain an output result includes: determining the waiting duration indicated by the test cases; after writing the input parameters indicated by the test cases into the PID function block, waiting for this waiting duration, and obtaining the output results at each predetermined moment within the waiting duration.
[0043] In some alternative embodiments of the present application, determining whether the output result belongs to the expected value range includes: obtaining the first range and the second range corresponding to each predetermined moment; determining whether the measured value at each predetermined moment belongs to the first range to obtain a first sub-judgment result; determining whether the feedback value at each predetermined moment belongs to the second range to obtain a second sub-judgment result.
[0044] In some embodiments of the present application, determining whether the PID function block passes the test according to the judgment result includes: when the first sub-judgment result indicates that the measured value belongs to the first range and the second sub-judgment result indicates that the feedback value belongs to the second range, determining that the PID function block passes the test; when the first sub-judgment result indicates that the measured value does not belong to the first range, or the second sub-judgment result indicates that the feedback value does not belong to the second range, determining that the PID function block fails the test.
[0045] In some other alternative embodiments of the present application, before determining whether the output result belongs to the expected value range, it is possible to determine that each predetermined moment within the waiting duration is the horizontal axis of the plane coordinate system; determine that the output result is the vertical axis of the plane coordinate system, and obtain a first curve corresponding to the measured value and a second curve corresponding to the feedback value.
[0046] It should be noted that after obtaining the first curve corresponding to the measured value and the second curve corresponding to the feedback value, the first interval and the second interval corresponding to each predetermined moment can be obtained; determine the third curve corresponding to the first interval in the plane coordinate system, where the third curve includes: the curve corresponding to the maximum measured expected value and the curve corresponding to the minimum measured expected value in the first interval; determine the fourth curve corresponding to the second interval in the plane coordinate system, where the fourth curve includes: the curve corresponding to the maximum feedback expected value and the curve corresponding to the minimum feedback expected value in the second interval.
[0047] In some embodiments of the present application, the output result can be determined whether it belongs to the expected value interval through the following steps. Specifically, determine the first target area between the curve corresponding to the maximum measured expected value and the curve corresponding to the minimum measured expected value; determine the second target area between the curve corresponding to the maximum feedback expected value and the curve corresponding to the minimum feedback expected value; detect whether the first curve falls into the first target area to obtain the first detection result; detect whether the second curve falls into the second target area to obtain the second detection result. That is, detect whether the first curve falls into the clamping area formed by the curve corresponding to the maximum measured expected value and the curve corresponding to the minimum measured expected value, and detect whether the second curve falls into the clamping area formed by the curve corresponding to the maximum feedback expected value and the curve corresponding to the minimum feedback expected value.
[0048] Specifically, determine whether the PID function block passes the test according to the judgment result, including: when the first detection result indicates that the first curve falls into the first target area and the second detection result indicates that the second curve falls into the second target area, determine that the PID function block passes the test; when the first detection result indicates that the measured value does not fall into the first target area, or the second detection result indicates that the feedback value does not fall into the second target area, determine that the PID function block test fails.
[0049] Figure 2 It is a flowchart of an alternative implementation method of the present application. As Figure 2 shown, the process mainly includes: test case reading, test case execution, output result return, test result judgment, and test report generation.
[0050] Specifically, the above method includes the following steps:
[0051] 1) Test case reading: Through the PID function block design document, the tester designs the PID parameter test items according to the design document, presets the input value and the expected output value. Since the PID output parameter MV is often in the form of a curve, a reasonable interval needs to be designed, thus forming an Excel truth table use case containing parameters, inputs, and interval outputs, and using python to read the formed test cases.
[0052] 2) Test case execution: Based on the verified test cases, assign values to the preset parameters of the PID function block according to the preset parameters in the test cases, achieving the purpose of automatically setting the PID parameters.
[0053] 3) Read back the output result: After waiting according to the preset waiting time in the case, read the value of the output parameter to be tested.
[0054] 4) Judge the test result: Judge the read-back value according to the expected value of the output parameter in the case.
[0055] 5) Generate a test report: Write the test results into Excel for recording. The test execution process does not require human participation and does not require additional installation of a test environment. Just wait for the execution to complete.
[0056] To facilitate those skilled in the art to better understand the related embodiments of this application, the following is an example for illustration:
[0057] Taking a certain software as an example, the PID function block includes various control modes such as: P control (shield ID), I control (shield PD), D control, PI control (shield D), PD control (shield I), ID control (shield P), etc.; there are many input parameters, such as input parameters: PB, TI, TD, KD, etc.
[0058] 1. Organize the parameter pre-settings and the expected intervals of PV and MV into Excel, and store the input and expected results through Excel. Figure 3 It is a schematic diagram of the data table of the test case under P control, as Figure 3 shown. Taking the test content as an example, it can include: under the conditions of PB = 100, TI = 20, TD = 1, KD = 1, the expected interval ranges of PV and MV in various control modes. Specifically, the test content can be: when PID_OPT = 0, perform the standard PID algorithm test; when PID_OPT = 1, perform the PV differential leading control (D_PI) algorithm test; when PID_OPT = 2, perform the PV proportional differential leading control (PD_I) algorithm test.
[0059] 2. Read the designed cases through a Python script, write values to each parameter of the PID, and realize the automatic operation of the PID.
[0060] 3. Read the values that need to be judged according to the cases and record them in Excel.
[0061] 4. Figure 4 It is a schematic diagram of the input (set value) curve and the output (feedback value, measured value) curve. The horizontal axis represents time, and the vertical axis represents the corresponding values of each physical quantity, as Figure 4As shown in the figure: the one at the top belongs to SV (set value), the one at the bottom belongs to MV (feedback value), and the one in the middle belongs to PV (measured value). The PID output is regular and finally approaches the final steady state, as Figure 4 , so the measured values at each moment (time point) can be calculated through parameters, and the expected interval at each time point is given, such as [10, 15], that is, as long as the value to be measured falls within the expected interval, such as Figure 5 shown, which is a schematic diagram of a data table of PV expected value, MV expected value, PV actual value, and MV actual value.
[0062] 5. Automatically record the test results and failure case logs after the execution ends, Figure 6 which is a schematic diagram of an optional test report of this application, as Figure 6 shown. The recorded results of this test report include the actual values read. It can be understood that it is judged whether the actual value is within the expected interval. If it is within the expected interval, TRUE is written, otherwise FALSE is written.
[0063] It is easy to notice that this application provides an efficient, low-cost, and lightweight software automation test method, which overcomes the deficiencies of the existing manual test process. Aiming at the problems of multiple operation modes of the PID function block and difficulty in judging whether the output is consistent with the expectation, a test method is provided, realizing a fast automatic test method for industrial control software function blocks. Through test case design, automatic execution, and recording of test results, this application can reduce the time and test resource investment in function and regression testing while ensuring the effectiveness of test execution, improving the test execution efficiency.
[0064] Figure 7 is a schematic diagram for intuitively displaying test results according to an embodiment. Taking the feedback value MV as an example, when the PID function block test passes, from Figure 7 it can be seen that the curve of the feedback value MV is within the target area (clamping area) formed by the upper and lower limits of the expected feedback interval. Similarly, when the curve of the feedback value MV is within the target area (clamping area) formed by the upper and lower limits of the expected feedback interval, it can be intuitively determined that the PID function block passes the test.
[0065] Figure 8 is a test device according to an embodiment of this application. This test device is applied to a proportional-integral-derivative PID function block, as Figure 8 shown. The device includes:
[0066] A reading module 40, configured to read test cases, where the test cases at least include: input parameters corresponding to the target control mode, and the expected interval under the target control mode. The expected interval includes: a first interval of the measured expected value and a second interval of the feedback expected value;
[0067] A writing module 42 for writing the input parameters indicated by the test case into the PID function block to obtain an output result;
[0068] A judgment module 44 for judging whether the output result belongs to the expected value range to obtain a judgment result, where the output result includes a measured value and a feedback value;
[0069] A determination module 46 for determining whether the PID function block passes the test according to the judgment result.
[0070] In this test device, a reading module 40 is used to read the test case. The test case at least includes the input parameters corresponding to the target control mode and the expected range under the target control mode. The expected range includes a first range of the measured expected value and a second range of the feedback expected value. The writing module 42 is used to write the input parameters indicated by the test case into the PID function block to obtain an output result. The judgment module 44 is used to judge whether the output result belongs to the expected value range to obtain a judgment result, where the output result includes a measured value and a feedback value. The determination module 46 is used to determine whether the PID function block passes the test according to the judgment result, achieving the purpose of automatically testing the PID function block, thereby realizing the technical effects of saving test time, improving test efficiency, and improving the accuracy of test results, and further solving the technical problems of low test efficiency and inaccurate test results caused by manually constructing test cases to test the PID function block and judging the output result by intuitive feeling in the related art.
[0071] According to another aspect of the embodiments of the present application, a non-volatile storage medium is further provided. The non-volatile storage medium includes a stored program. When the program runs, it controls the device where the non-volatile storage medium is located to execute any one of the test methods.
[0072] According to another aspect of the embodiments of the present application, a processor is further provided. The processor is used to run a program. When the program runs, it executes any one of the test methods.
[0073] Specifically, the above storage medium is used to store program instructions for executing the following functions to implement the following functions:
[0074] Read the test case. The test case at least includes the input parameters corresponding to the target control mode and the expected range under the target control mode. The expected range includes a first range of the measured expected value and a second range of the feedback expected value. Write the input parameters indicated by the test case into the PID function block to obtain an output result. Judge whether the output result belongs to the expected value range to obtain a judgment result, where the output result includes a measured value and a feedback value. Determine whether the PID function block passes the test according to the judgment result.
[0075] Specifically, the above-mentioned processor is used to call program instructions in the memory to implement the following functions:
[0076] Read test cases, where the test cases at least include: input parameters corresponding to the target control mode, and the expected interval in the target control mode. The expected interval includes: the first interval for measuring the expected value and the second interval for the feedback expected value; write the input parameters indicated by the test cases into the PID function block to obtain an output result; determine whether the output result belongs to the expected value interval to obtain a judgment result, where the output result includes: the measured value and the feedback value; determine whether the PID function block passes the test according to the judgment result.
[0077] In the embodiments of the present application, by adopting the method of executing test cases and comparing the execution results with the expected interval, by reading test cases, where the test cases at least include: input parameters corresponding to the target control mode, and the expected interval in the target control mode. The expected interval includes: the first interval for measuring the expected value and the second interval for the feedback expected value; write the input parameters indicated by the test cases into the PID function block to obtain an output result; determine whether the output result belongs to the expected value interval to obtain a judgment result, where the output result includes: the measured value and the feedback value; determine whether the PID function block passes the test according to the judgment result, the purpose of automatically testing the PID function block is achieved, thereby realizing the technical effects of saving test time, improving test efficiency, and improving the accuracy of test results, and further solving the technical problems of low test efficiency and inaccurate test results caused by manually constructing test cases to test the PID function block and judging the output result by intuitive feeling in the related art.
[0078] The serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
[0079] In the above-mentioned embodiments of the present application, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0080] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units can be a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces, and the indirect coupling or communication connection of units or modules can be in an electrical or other form.
[0081] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed over multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0082] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0083] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks, or optical discs and other various media that can store program codes.
[0084] The above description is only a preferred embodiment of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.
Claims
1. A testing method, characterized in that, the testing method is applied to a proportional-integral-derivative (PID) function block and includes: reading a test case, where the test case at least includes: input parameters corresponding to a target control mode, and an expected interval under the target control mode, and the expected interval includes: a first interval for measuring an expected value and a second interval for a feedback expected value; writing the input parameters indicated by the test case into the PID function block to obtain an output result; judging whether the output result belongs to the expected value interval to obtain a judgment result, including: obtaining the first interval and the second interval corresponding to each predetermined moment; judging whether the measured value at each predetermined moment belongs to the first interval to obtain a first sub-judgment result; judging whether the feedback value at each predetermined moment belongs to the second interval to obtain a second sub-judgment result, where the output result includes: a measured value and a feedback value; determining whether the PID function block passes the test according to the judgment result.
2. The method according to claim 1, characterized in that, writing the input parameters indicated by the test case into the PID function block to obtain an output result includes: determining the waiting duration indicated by the test case; after writing the input parameters indicated by the test case into the PID function block, waiting for the waiting duration, and obtaining the output results at each predetermined moment within the waiting duration.
3. The method according to claim 1, characterized in that, determining whether the PID function block passes the test according to the judgment result includes: when the first sub-judgment result indicates that the measured value belongs to the first interval and the second sub-judgment result indicates that the feedback value belongs to the second interval, determining that the PID function block passes the test; when the first sub-judgment result indicates that the measured value does not belong to the first interval, or the second sub-judgment result indicates that the feedback value does not belong to the second interval, determining that the PID function block fails the test.
4. The method according to claim 2, characterized in that, before judging whether the output result belongs to the expected value interval, it includes: determining each predetermined moment within the waiting duration as the horizontal axis of a plane coordinate system; determining the output result as the vertical axis of the plane coordinate system, and obtaining a first curve corresponding to the measured value and a second curve corresponding to the feedback value.
5. The method according to claim 4, characterized in that, after obtaining the first curve corresponding to the measured value and the second curve corresponding to the feedback value, the method further includes: obtaining the first interval and the second interval corresponding to each predetermined moment; determining a third curve corresponding to the first interval in the plane coordinate system, where the third curve includes: a curve corresponding to the maximum measured expected value and a curve corresponding to the minimum measured expected value in the first interval; Determine the fourth curve corresponding to the second interval in the plane coordinate system, where the fourth curve includes: the curve corresponding to the maximum feedback expected value and the curve corresponding to the minimum feedback expected value in the second interval.
6. The method according to claim 5, wherein, judging whether the output result belongs to the expected value interval includes: determining a first target area between the curve corresponding to the maximum measurement expected value and the curve corresponding to the minimum measurement expected value; determining a second target area between the curve corresponding to the maximum feedback expected value and the curve corresponding to the minimum feedback expected value; detecting whether the first curve falls into the first target area to obtain a first detection result; detecting whether the second curve falls into the second target area to obtain a second detection result.
7. The method according to claim 6, wherein, determining whether the PID function block passes the test according to the judgment result includes: when the first detection result indicates that the first curve falls into the first target area and the second detection result indicates that the second curve falls into the second target area, determining that the PID function block passes the test; when the first detection result indicates that the measured value does not fall into the first target area, or the second detection result indicates that the feedback value does not fall into the second target area, determining that the PID function block fails the test.
8. A test device, wherein, the test device is applied to a proportional integral derivative (PID) function block and includes: a reading module for reading a test case, where the test case at least includes: input parameters corresponding to a target control mode, and an expected value interval under the target control mode, and the expected value interval includes: a first interval of measurement expected values and a second interval of feedback expected values; a writing module for writing the input parameters indicated by the test case into the PID function block to obtain an output result; a judging module for judging whether the output result belongs to the expected value interval to obtain a judgment result, including: obtaining the first interval and the second interval corresponding to each predetermined moment; judging whether the measured value at each predetermined moment belongs to the first interval to obtain a first sub-judgment result; judging whether the feedback value at each predetermined moment belongs to the second interval to obtain a second sub-judgment result, where the output result includes: a measured value and a feedback value; a determining module for determining whether the PID function block passes the test according to the judgment result.
9. A non-volatile storage medium, wherein, the non-volatile storage medium includes a stored program, and when the program runs, it controls the device where the non-volatile storage medium is located to execute the test method according to any one of claims 1 to 7.
10. A processor, wherein, the processor is used to run a program, and when the program runs, it executes the test method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Automatic test monitoring method, device and equipment and storage medium
CN112231219A