PLC equipment detection method and device, electronic equipment and storage medium
By testing based on the PLC module type automated test scheme and configuration file indication channel, the problem of professional knowledge dependence in PLC equipment module testing is solved, and efficient and accurate recording of test results is achieved.
Patent Information
- Application Number
- CN202510435673.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-07-22
AI Technical Summary
Existing PLC equipment module testing requires professional knowledge, the test results are prone to omissions or errors, and the test efficiency is low.
Determine the test plan according to the PLC module type, automatically test through the configuration file indication channel, record the test results, and reduce dependence on professional knowledge.
Improve testing efficiency, avoid omissions and errors in manual testing, and ensure the accuracy and completeness of test results.
Smart Images

Figure CN120353211A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of quality inspection, and in particular, to a detection method, device, electronic device, and storage medium for a PLC device. Background Art
[0002] In an industrial automation system, a PLC (Programmable Logic Controller) device is an electronic device dedicated to industrial automation control, equivalent to the "brain" of an industrial system. Its stability and reliability are directly related to the operation quality of the entire system. Therefore, strict quality inspection of PLC devices is an important measure to ensure the normal operation of the system.
[0003] In scenarios such as laboratories and university teaching, it is generally necessary to conduct pre-deployment tests and regular maintenance tests on the performance of each module of the purchased PLC device. However, currently, the testing of each module of the PLC device usually adopts the method of manual item-by-item testing. This not only requires testers to have professional PLC knowledge and be familiar with the characteristics of specific devices, with high requirements for personnel quality, but also the test results are prone to omissions or errors due to operation mistakes or subjective judgments, resulting in low test efficiency. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a detection method, device, electronic device, and storage medium for a PLC device that can overcome the above problems or at least partially solve the above problems.
[0005] To solve the above problems, embodiments of the present invention disclose a detection method for a programmable logic controller (PLC) device. The PLC device includes a plurality of PLC modules, and the method includes:
[0006] Determine the type of each of the PLC modules, and according to the type of each of the PLC modules, determine a test plan for each of the PLC modules. The test plan includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection method of the test circuit for the PLC module;
[0007] Obtain a configuration file, where the configuration file is used to indicate the channel of the PLC module corresponding to the test variable;
[0008] When the test circuit connection of the PLC module is completed, for each of the PLC modules in sequence, according to the test steps, test each channel of the PLC module to obtain the variable values of the test variables corresponding to each channel, and record the variable values of the test variables in the test record form.
[0009] Optionally, the step of testing each channel of the PLC module according to the test steps for each of the PLC modules in sequence includes:
[0010] Obtain the test sequence of each of the PLC modules;
[0011] According to the test sequence, for each of the PLC modules in sequence, test each channel of the PLC module according to the test steps.
[0012] Optionally, the step of determining the test scheme for each of the PLC modules according to the type of each of the PLC modules includes:
[0013] For each of the PLC modules, input the type of the PLC module into a preset knowledge base for matching to obtain the test scheme of the PLC module.
[0014] Optionally, the step of testing each channel of the PLC module to obtain the variable values of the test variables corresponding to each channel includes:
[0015] After the binding relationship between the test variable and the channel of the PLC module has been configured in the configuration page of the PLC device, test each channel of the PLC module to obtain the variable values of the test variables corresponding to each channel.
[0016] Optionally, the configuration file is further used to indicate the signals in the test steps corresponding to the test variables; the step of testing each channel of the PLC module according to the test steps includes:
[0017] Parse the configuration file to obtain the signals in the test steps corresponding to the test variables and the channels of the PLC module corresponding to the test variables;
[0018] Determine the channels of the PLC module corresponding to the signals in the test steps according to the signals in the test steps corresponding to the test variables and the channels of the PLC module corresponding to the test variables;
[0019] Test the channels of the PLC module corresponding to the signals in the test steps according to the test steps.
[0020] Optionally, the configuration file is further used to indicate the signals in the test record table corresponding to the test variables; the step of recording the variable value of the test variable in the test record table includes:
[0021] Parse the configuration file to obtain the signals in the test record table corresponding to the test variables;
[0022] Record the variable value of the test variable as the signal value of the signal in the test record table corresponding to the test variable in the test record table.
[0023] Optionally, the test step includes the expected value of the signal in the test step, and the method further includes:
[0024] Compare the variable value of the test variable with the expected value of the signal in the test step corresponding to the test variable;
[0025] If the variable value of the test variable is different from the expected value of the signal in the test step corresponding to the test variable, determine that the variable value of the test variable is an outlier and mark the outlier in the test record table.
[0026] Optionally, the method further includes:
[0027] Determine the type of the outlier;
[0028] Input the type of the outlier into a preset knowledge base for matching to obtain the reason for generating the outlier.
[0029] Optionally, the step of testing the channels of the PLC module corresponding to the signals in the test step according to the test step includes:
[0030] Test the channels of the PLC module corresponding to the signals in the test step according to the test step and repeat a preset number of times.
[0031] Optionally, the step of testing each channel of the PLC module according to the test step to obtain the variable value of the test variable corresponding to each channel includes:
[0032] Test the channels of the PLC module corresponding to the signals in the test step according to the test step and repeat a preset number of times to obtain multiple candidate variable values of the test variable corresponding to each channel;
[0033] Determine the average value of the multiple candidate variable values of the test variable;
[0034] Take the average value as the variable value of the test variable.
[0035] Correspondingly, an embodiment of the present invention discloses a detection device for a programmable logic controller (PLC) device. The PLC device includes a plurality of PLC modules, and the device includes:
[0036] A test scheme determination module, configured to determine the types of the respective PLC modules, and determine the test schemes for the respective PLC modules according to the types of the respective PLC modules. The test scheme includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection mode of the test circuit for the PLC module;
[0037] A configuration file acquisition module, configured to acquire a configuration file, where the configuration file is used to indicate the channels of the PLC module corresponding to the test variables;
[0038] A test module, configured to, when the test circuit connection of the PLC module is completed, sequentially perform tests on each channel of each PLC module according to the test steps, obtain the variable values of the test variables corresponding to each channel, and record the variable values of the test variables in the test record form.
[0039] Optionally, the test module includes:
[0040] A test sequence acquisition sub-module, configured to acquire the test sequences of the respective PLC modules;
[0041] A test sub-module, configured to sequentially perform tests on each channel of each PLC module according to the test steps according to the test sequences.
[0042] Optionally, the test scheme determination module includes:
[0043] A test scheme determination sub-module, configured to input the type of each PLC module into a preset knowledge base for matching to obtain the test scheme of the PLC module.
[0044] Optionally, the test module includes:
[0045] A variable configuration sub-module, configured to perform tests on each channel of the PLC module after the binding relationship between the test variables and the channels of the PLC module has been configured in the configuration page of the PLC device, and obtain the variable values of the test variables corresponding to each channel.
[0046] Optionally, the configuration file is further used to indicate signals in the test steps corresponding to the test variables. The test module includes:
[0047] A first configuration file parsing sub-module, configured to parse the configuration file to obtain signals in the test steps corresponding to the test variables, and channels of the PLC module corresponding to the test variables;
[0048] A channel determination sub-module, configured to determine channels of the PLC module corresponding to signals in the test steps according to signals in the test steps corresponding to the test variables and channels of the PLC module corresponding to the test variables;
[0049] A channel testing sub-module, configured to test channels of the PLC module corresponding to signals in the test steps according to the test steps.
[0050] Optionally, the configuration file is further used to indicate signals in the test record form corresponding to the test variables. The test module includes:
[0051] A first configuration file parsing sub-module, configured to parse the configuration file to obtain signals in the test record form corresponding to the test variables;
[0052] A recording sub-module, configured to record the variable value of the test variable as the signal value of the signal in the test record form corresponding to the test variable in the test record form.
[0053] Optionally, the test steps include expected values of signals in the test steps. The device further includes:
[0054] A comparison module, configured to compare the variable value of the test variable with the expected value of the signal in the test step corresponding to the test variable;
[0055] An outlier determination module, configured to determine that the variable value of the test variable is an outlier if the variable value of the test variable is different from the expected value of the signal in the test step corresponding to the test variable, and mark the outlier in the test record form.
[0056] Optionally, the device further includes:
[0057] An outlier type determination module, configured to determine the type of the outlier;
[0058] A cause determination module, configured to input the type of the outlier into a preset knowledge base for matching to obtain the cause of generating the outlier.
[0059] Optionally, the test module includes:
[0060] A repeated test sub-module, configured to test channels of the PLC module corresponding to signals in the test steps according to the test steps, and repeat a preset number of times.
[0061] Optionally, the test module includes:
[0062] A plurality of candidate variable value determination sub-modules, configured to test channels of the PLC module corresponding to signals in the test steps according to the test steps, and repeat a preset number of times, to obtain a plurality of candidate variable values of the test variable corresponding to each channel;
[0063] An average value determination sub-module, configured to determine an average value of the plurality of candidate variable values of the test variable;
[0064] A variable value determination sub-module, configured to use the average value as the variable value of the test variable.
[0065] Correspondingly, an embodiment of the present invention discloses an electronic device, including: a processor, a memory, and a computer program stored on the memory and capable of running on the processor, where when the computer program is executed by the processor, each step of the above-described embodiment of the detection method for a programmable logic controller (PLC) device is implemented.
[0066] Correspondingly, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each step of the above-described embodiment of the detection method for a programmable logic controller (PLC) device is implemented.
[0067] Embodiments of the present invention have the following advantages:
[0068] A detection method for a programmable logic controller (PLC) device according to an embodiment of the present invention first determines the types of each PLC module, and determines the test scheme for each PLC module according to the types of each PLC module. Among them, the test scheme includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection method of the test circuit for the PLC module. This method of determining the test scheme for each PLC module according to the types of each PLC module does not require the tester to have professional PLC knowledge and be familiar with the characteristics of specific devices. Then, a configuration file is obtained. The configuration file is used to indicate the channels of the PLC module corresponding to the test variables. When the test circuit of the PLC module is connected, for each PLC module in turn, according to the test steps, each channel of the PLC module is tested to obtain the variable values of the test variables corresponding to each channel, and the variable values of the test variables are recorded in the test record form. The method of automatically testing each channel of the PLC module according to the test steps and recording the test results in the test record form avoids the risk of omission or error in the test results in the manual item-by-item testing method and improves the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 is a flowchart of the steps of a detection method for a PLC device according to an embodiment of the present invention;
[0070] Figure 2 is a block diagram of the structure of a detection device for a PLC device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0071] In order to make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the drawings and specific embodiments.
[0072] In an industrial automation system, a PLC device is an electronic device specifically used for industrial automation control, equivalent to the "brain" of the industrial system. Its stability and reliability are directly related to the operation quality of the entire system. Therefore, strict quality detection of the PLC device is an important measure to ensure the normal operation of the system.
[0073] In scenarios such as laboratories and college teaching, it is generally necessary to conduct pre-deployment tests and regular maintenance tests on the performance of each module of the purchased PLC equipment. However, currently, the tests on each module of the PLC equipment are usually carried out manually item by item. This not only requires the testers to have professional PLC knowledge and be familiar with the characteristics of specific equipment, with relatively high requirements for personnel quality, but also the test results are prone to omissions or errors due to operation mistakes or subjective judgments, resulting in low test efficiency.
[0074] One of the core concepts of the embodiments of the present invention is to automatically test each channel of the PLC module according to the test steps and record the test results in a test record form, avoiding the risk of omissions or errors in the test results in the manual item-by-item test method and improving the test efficiency.
[0075] Refer to Figure 1 , which shows the step flow chart of a detection method for a PLC device according to an embodiment of the present invention. The PLC device includes multiple PLC modules, and specifically, the following steps may be included:
[0076] Step 101, determine the types of each of the PLC modules, and according to the types of each of the PLC modules, determine the test schemes for each of the PLC modules. The test scheme includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection method of the test circuit for the PLC module.
[0077] A PLC device is a digital computer designed specifically for industrial environments and is used to control machinery, production lines, or automated processes. A PLC device includes multiple PLC modules. A PLC module is a pluggable functional unit of a PLC device. PLC modules typically include the following types: Digital Input (DI) modules, which are used to receive switch signals (such as button, sensor signals); Digital Output (DO) modules, which are used to output switch signals (on / off) to control the start, stop, or status switching of devices; Analog Input (AI) modules, which are used to receive continuously varying physical quantity signals and convert them into digital values for PLC processing, such as measuring analog parameters like temperature, pressure, flow rate, liquid level, etc.; Analog Output (AO) modules, which are used to output continuously varying analog signals, such as adjusting the operating state of devices (such as speed, temperature, pressure); Communication modules, such as Modbus communication modules and Powerlink communication modules; Temperature sensing modules; Humidity sensing modules; SOE (Sequence of Events) modules, which are used to capture and store events such as sudden failures and status changes of devices or systems and timestamp them at the millisecond level (even microsecond level); CPU (Central Processing Unit) modules.
[0078] Determine the types of each PLC module of the PLC device to be tested. For each PLC module, according to the type of the PLC module, determine the corresponding test plan. The test plan includes test steps, test record forms, test circuit diagrams, etc. The test steps are used to indicate the test steps for each channel of the PLC module. Among them, a PLC module includes multiple channels. A channel refers to an independent wiring terminal or interface on the PLC module and is used to connect external sensors, actuators, and other devices. Exemplarily, the Nth circuit interface on the analog input module represents the Nth channel of the analog input module, where N is a positive integer. The test record form is used to record the test results for each channel of the PLC module, and the test circuit diagram is used to indicate the connection method of the test circuit for the PLC module.
[0079] Step 102, obtain a configuration file, where the configuration file is used to indicate the channel of the PLC module corresponding to the test variable.
[0080] Embodiments of the present invention can be implemented through a system. Obtain the configuration file constructed by the user in the system. The configuration file is used to indicate the channel of the PLC module corresponding to the test variable, and one channel corresponds to one test variable.
[0081] Step 103, when the test circuits of the PLC modules are connected, for each of the PLC modules in turn, according to the test steps, test each channel of the PLC module to obtain the variable values of the test variables corresponding to the respective channels, and record the variable values of the test variables in the test record form.
[0082] After determining the test plans for each PLC module, the test plans for each PLC module can be displayed on the display page of the system. The user can complete the physical connection of the test circuits for each PLC module by referring to the test circuit diagrams in the test plans. By displaying the test plans for each PLC module on the display page of the system, the user can connect the test circuits by referring to the test circuit diagrams, reducing the need for the prior knowledge of the testers and eliminating the requirement for the testers to have professional PLC knowledge and be familiar with the characteristics of specific devices.
[0083] After the physical connection of the test circuits for each PLC module is completed, for each PLC module in turn, according to the test steps in the test plan corresponding to the PLC module, test each channel of the PLC module to obtain the variable values of the test variables corresponding to the respective channels. Since the test in the configuration file indicates the channels of the PLC module corresponding to the test variables, it is possible to know which channel the variable value of the test variable obtained from the test corresponds to. The variable value of the test variable is the test result obtained from the test. Record the variable value of the test variable in the test record form.
[0084] A detection method for a programmable logic controller (PLC) device according to an embodiment of the present invention first determines the types of each PLC module, and determines the test plan for each PLC module according to the types of each PLC module. The test plan includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection method of the test circuit for the PLC module. This method of determining the test plan for each PLC module according to the types of each PLC module does not require the testers to have professional PLC knowledge and be familiar with the characteristics of specific devices. Then, obtain a configuration file, which is used to indicate the channels of the PLC module corresponding to the test variables. When the test circuits of the PLC modules are connected, for each PLC module in turn, according to the test steps, test each channel of the PLC module to obtain the variable values of the test variables corresponding to the respective channels, and record the variable values of the test variables in the test record form. The method of automatically testing each channel of the PLC module according to the test steps and recording the test results in the test record form avoids the risk of omission or error in the test results in the case of manual item-by-item testing, improving the test efficiency.
[0085] In the embodiment of the present invention, in step 103, for each of the PLC modules in sequence, according to the test steps, each channel of the PLC module is tested, which may specifically include the following sub-steps:
[0086] Sub-step S11: Obtain the test sequence of each of the PLC modules.
[0087] In practical applications, the user can configure the test workflow of the PLC device in the system. The test workflow indicates the test sequence of each PLC module. Exemplarily, the user can create a test work block for each PLC module of the PLC device in the system, and assemble the test work of each module in sequence by dragging and connecting lines to form a complete test workflow. Obtain the test workflow of the PLC device configured by the user in the system to obtain the test sequence of each PLC module.
[0088] Sub-step S12: According to the test sequence, for each of the PLC modules in sequence, according to the test steps, each channel of the PLC module is tested.
[0089] According to the test sequence of each PLC module, for each PLC module in sequence, according to the test steps, each channel of the PLC module is tested. The module being tested can be highlighted on the display page of the system, and the module with a test error can be highlighted in red, etc., so as to provide the user with a customizable and clear and intuitive front-end workflow display page.
[0090] In the embodiment of the present invention, in step 101, determining the test plan for each of the PLC modules according to the type of each of the PLC modules includes:
[0091] For each of the PLC modules, input the type of the PLC module into a preset knowledge base for matching to obtain the test plan for the PLC module.
[0092] In practical applications, the type of the PLC module can be used as a keyword and input into a preset knowledge base for matching to obtain a standardized test plan corresponding to the PLC module. The test plan includes test steps, test record forms, test circuit diagrams, etc. The preset knowledge base can be a standard industrial knowledge base. The standard industrial knowledge base is a system for storing, managing, and sharing structured data such as technical specifications, device parameters, and fault handling solutions in the field of industrial automation, and usually includes PLC module technical data, communication protocols, test standards, maintenance guides, etc. Of course, the invention embodiment does not limit the preset knowledge base.
[0093] By matching the type of the PLC module with a preset knowledge base as a keyword to obtain a test plan, the standardization and normalization of the PLC module test can be achieved, reducing the need for testers' prior knowledge and eliminating the requirement for testers to have professional PLC knowledge and be familiar with specific device characteristics.
[0094] In the embodiment of the present invention, the step of testing each channel of the PLC module to obtain the variable values of the test variables corresponding to the respective channels in step 103 includes:
[0095] After the binding relationship between the test variable and the channel of the PLC module has been configured in the configuration page of the PLC device, each channel of the PLC module is tested to obtain the variable values of the test variables corresponding to the respective channels.
[0096] The configuration page of the PLC device is a visual operation interface in the industrial automation system for configuring, monitoring, and controlling the PLC device and its modules. It integrates the hardware parameters, communication settings, logical control, and real-time data of the PLC device in a graphical manner. Users can create variables, write, compile, and download programs on this page, and control the program to automatically execute in a loop in the PLC device, enabling efficient management of the automation process. Users need to first create a test variable in the configuration page of the PLC device, and then bind the test variable to the channel of the PLC module through the address of the channel of the PLC module. One channel corresponds to one test variable. After the created test variable is bound to the channel of the PLC module in the configuration page of the PLC device, each channel of the PLC module is tested to obtain the variable values of the test variables corresponding to the respective channels.
[0097] Exemplarily, a user creates an AI test variable on the PLC configuration page and binds the AI test variable to the second path of the analog input module through the address of the second path of the analog input module, that is, the second circuit interface of the analog input module. At this time, a voltage is input to the second path of the analog input module through an external circuit. If the acquisition function of the analog input module is normal, since a voltage is input through the external circuit, the variable value of the AI test variable should be TRUE. If it is FALSE, it indicates that there is a problem with the signal acquisition function of this path of this module. If the test variable corresponds to an analog output module, conversely, a value of TRUE is assigned to the variable in the PLC configuration, and it is checked whether there is an output of a current signal on the corresponding bound path.
[0098] In the embodiment of the present invention, the configuration file is further used to indicate the signals in the test steps corresponding to the test variables; the step of testing each channel of the PLC module according to the test steps in step 103 may specifically include the following sub-steps:
[0099] Sub-step S21: Parse the configuration file to obtain the signals in the test steps corresponding to the test variables, and the channels of the PLC modules corresponding to the test variables.
[0100] After obtaining the configuration file, parse the configuration file to obtain the signals in the test steps corresponding to the test variables, and the channels of the PLC modules corresponding to the test variables. Since the test variables are created by the user and the test steps are obtained by matching a preset knowledge base, the names of the signals to be detected in the test steps are different from the names of the test variables. It is necessary to parse the configuration file to associate the test variables with the signals in the test steps, and the test variables with the channels of the PLC modules.
[0101] Sub-step S22: Determine the channels of the PLC modules corresponding to the signals in the test steps according to the signals in the test steps corresponding to the test variables, and the channels of the PLC modules corresponding to the test variables.
[0102] Determine the channels of the PLC modules corresponding to the signals in the test steps according to the signals in the test steps corresponding to the test variables, and the channels of the PLC modules corresponding to the test variables.
[0103] Sub-step S23: Test the channels of the PLC modules corresponding to the signals in the test steps according to the test steps.
[0104] After determining the channels of the PLC modules corresponding to the signals in the test steps, test the channels of the PLC modules corresponding to the signals in the test steps according to the test steps, realizing automatic testing according to the test plan and improving the test efficiency.
[0105] By determining the correspondence between the test variables on the PLC configuration page and the hardware module channels through the configuration file provided by the user, it can fully adapt to the test environments of different devices, different modules, and different methods, meet the test requirements of each PLC module, can fully adapt to the PLC configuration software of different manufacturers respectively, and when replacing the same type of modules of other manufacturers for testing later, only need to replace the configuration file to complete the environment switch, improving the usability.
[0106] In the embodiment of the present invention, the configuration file is further used to indicate the signals in the test record form corresponding to the test variables; step 103 of recording the variable values of the test variables in the test record form may specifically include the following sub-steps:
[0107] Sub-step S31: Parse the configuration file to obtain the signals in the test record form corresponding to the test variables.
[0108] After obtaining the configuration file, parse the configuration file to obtain the signals in the test record table corresponding to the test variables. Since the test record table is obtained by matching a preset knowledge base and the test variables are created by the user, and the names of the test variables are different from the names of the signals in the test record table, it is necessary to parse the configuration file to associate the test variables with the signals in the test record table.
[0109] In sub-step S32, use the variable value of the test variable as the signal value of the signal in the test record table corresponding to the test variable, and record it in the test record table.
[0110] After determining the signals in the test record table corresponding to the test variables, use the variable value of the test variable as the signal value of the signal in the test record table corresponding to the test variable, and record it in the test record table. It can be filled and sorted based on the variable record timestamp and the variable items in the test record table, thereby realizing the automatic recording of test data. For test items, automatic supplementation can also be achieved, and automatic testing and automatic collection can be carried out according to the test plan, realizing the automation of the entire test process, greatly reducing the waste of human resources in repeated testing work and the data distortion caused by manual collection, and ensuring the accuracy of test results.
[0111] In the embodiment of the present invention, the test steps include the expected values of the signals in the test steps, and the method further includes:
[0112] Compare the variable value of the test variable with the expected value of the signal in the test step corresponding to the test variable;
[0113] If the variable value of the test variable is different from the expected value of the signal in the test step corresponding to the test variable, determine that the variable value of the test variable is an outlier, and mark the outlier in the test record table.
[0114] In practical applications, the test steps may include the signals to be tested and the expected values of the signals. The variable value of the test variable can be compared with the expected value of the signal in the test step corresponding to the test variable. If the variable value of the test variable is different from the expected value of the signal in the test step corresponding to the test variable, determine that the variable value of the test variable is an outlier, and mark the outlier in the test record table. The test records with anomalies can be recorded and highlighted in the test record table to form a complete test table for display at the corresponding module of the workflow, facilitating the user to view all test records and anomaly records and clarify the test results.
[0115] In the embodiment of the present invention, the method further includes:
[0116] Determine the type of the outlier;
[0117] Input the type of the outlier into a preset knowledge base for matching to obtain the reason for generating the outlier.
[0118] The type of the outlier can be determined, all outlier records are counted, and the outlier records with the same type of outlier are merged. Combining with the standard industrial knowledge base, the type of the outlier is input into the standard industrial knowledge base to obtain the reason for generating the outlier and the subsequent test method. The relevant possible reasons for the outlier and the subsequent test method will also be displayed on the corresponding module page of the workflow. A final version of the test report can be generated for the user to export and save with one click, including all test plans, test record tables, outlier records, outlier record analysis, module performance determination conclusions, etc.
[0119] In an embodiment of the present invention, testing the channels of the PLC module corresponding to the signals in the test steps according to the test steps includes:
[0120] Test the channels of the PLC module corresponding to the signals in the test steps according to the test steps and repeat a preset number of times.
[0121] Test the channels of the PLC module corresponding to the signals in the test steps according to the test steps. After the current test is completed, repeat the test automatically for multiple times. After the current channel test is completed, automatically switch to the variables of the next group of channels for repeated testing. After the current module test is completed, automatically switch to the next module for repeated experiments, and at the same time synchronously update the highlighted display of the workflow until all module tests are finally completed, and automatically achieve the test work module by module, channel by channel, and step by step.
[0122] In an embodiment of the present invention, testing each channel of the PLC module according to the test steps to obtain the variable values of the test variables corresponding to the respective channels includes:
[0123] Test the channels of the PLC module corresponding to the signals in the test steps according to the test steps and repeat a preset number of times to obtain multiple candidate variable values of the test variables corresponding to the respective channels;
[0124] Determine the average value of the multiple candidate variable values of the test variable;
[0125] Use the average value as the variable value of the test variable.
[0126] In practical applications, the performance of some modules needs to be tested multiple times and the average value is taken as the final result. The preset number of times can be 20 times. Of course, the embodiments of the present invention do not limit the number of repetitions. Exemplarily, according to the test steps, the channels of the PLC module corresponding to the signals in the test steps are tested and repeated 20 times to obtain 20 candidate variable values of the test variables corresponding to each channel, and the average value of the 20 candidate variable values of the test variable is determined, and the average value is used as the variable value of the test variable.
[0127] In the embodiments of the present invention, through means such as user dragging, a test workflow can be constructed according to the actual module to be tested, and each link of the test work is standardized and arranged, which is applicable to various PLC tests with different design categories and different numbers of modules; by matching the standard industrial knowledge base, corresponding test plans can be generated for each specific module test link in the workflow, providing a reference for testers to connect the test circuit, which helps to realize the standardization and normalization of PLC module testing and reduces the need for testers' prior knowledge; by obtaining and parsing the configuration file constructed by the user, the corresponding relationship between the test variable and the hardware module channel can be determined, which can fully adapt to the test environments of different devices, different modules, and different methods and meet the test requirements of each PLC module; the test process is automatically executed, and according to the test plan, test circuit and configuration file, each module and each channel are tested for the current module, the corresponding input voltage, current and other values are controlled, and the real-time value change of the corresponding output variable is monitored. Multiple groups of experiments are carried out according to the steps specified in the test plan, which helps to ensure the accuracy of the experimental input and output, avoid experimental errors caused by humans, and ensure that the test results are more accurate; according to the corresponding variable values in the test process, a corresponding test record form is automatically generated, and the test results are compared with the expected output values in the test plan, and the abnormal records are marked and extracted to realize the automation and intelligence of the test results; according to the abnormal items in the test results and combined with the industrial knowledge base, a conclusion judgment is made to determine the possible abnormal reasons and subsequent test methods of the module, and finally a complete test report on the quality of each PLC module is generated to complete the entire test process.
[0128] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0129] Refer to Figure 2, showing a structural block diagram of a detection device for a PLC device according to an embodiment of the present invention. The PLC device includes a plurality of PLC modules, which may specifically include the following modules:
[0130] A test plan determination module 201, configured to determine the types of the respective PLC modules, and determine the test plans for the respective PLC modules according to the types of the respective PLC modules. The test plan includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection mode of the test circuit for the PLC module;
[0131] A configuration file acquisition module 202, configured to acquire a configuration file, where the configuration file is used to indicate the channels of the PLC module corresponding to the test variables;
[0132] A test module 203, configured to, when the test circuit connection of the PLC module is completed, sequentially perform tests on each channel of the PLC module according to the test steps for each of the PLC modules, obtain the variable values of the test variables corresponding to each channel, and record the variable values of the test variables in the test record form.
[0133] For a detection device for a programmable logic controller (PLC) device according to an embodiment of the present invention, first, the types of the respective PLC modules are determined, and according to the types of the respective PLC modules, the test plans for the respective PLC modules are determined. Among them, the test plan includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection mode of the test circuit for the PLC module. This way of determining the test plans for the respective PLC modules according to the types of the respective PLC modules does not require the tester to have professional PLC knowledge and be familiar with the characteristics of specific devices. Then, a configuration file is acquired. The configuration file is used to indicate the channels of the PLC module corresponding to the test variables. When the test circuit connection of the PLC module is completed, sequentially perform tests on each channel of the PLC module according to the test steps, obtain the variable values of the test variables corresponding to each channel, and record the variable values of the test variables in the test record form. The method of automatically performing tests on each channel of the PLC module according to the test steps and recording the test results in the test record form avoids the risk of omission or error in the test results in the case of manual item-by-item testing, and improves the test efficiency.
[0134] In the embodiment of the present invention, the test module includes:
[0135] A test sequence acquisition sub-module, which is used to acquire the test sequences of the respective PLC modules;
[0136] A test sub-module, which is used to successively test each channel of the PLC module according to the test steps for each PLC module according to the test sequence.
[0137] In an embodiment of the present invention, the test scheme determination module includes:
[0138] A test scheme determination sub-module, which is used to input the type of the PLC module into a preset knowledge base for matching for each PLC module to obtain the test scheme of the PLC module.
[0139] In an embodiment of the present invention, the test module includes:
[0140] A variable configuration sub-module, which is used to test each channel of the PLC module after the binding relationship between the test variable and the channel of the PLC module has been configured in the configuration page of the PLC device, and obtain the variable values of the test variables corresponding to the respective channels.
[0141] In an embodiment of the present invention, the configuration file is further used to indicate the signals in the test steps corresponding to the test variable, and the test module includes:
[0142] A first configuration file parsing sub-module, which is used to parse the configuration file to obtain the signals in the test steps corresponding to the test variable and the channels of the PLC module corresponding to the test variable;
[0143] A channel determination sub-module, which is used to determine the channels of the PLC module corresponding to the signals in the test steps according to the signals in the test steps corresponding to the test variable and the channels of the PLC module corresponding to the test variable;
[0144] A channel test sub-module, which is used to test the channels of the PLC module corresponding to the signals in the test steps according to the test steps.
[0145] In an embodiment of the present invention, the configuration file is further used to indicate the signals in the test record table corresponding to the test variable, and the test module includes:
[0146] A first configuration file parsing sub-module, which is used to parse the configuration file to obtain the signals in the test record table corresponding to the test variable;
[0147] A recording sub-module, configured to record the variable value of the test variable as the signal value of the signal in the test record table corresponding to the test variable in the test record table.
[0148] In an embodiment of the present invention, the test step includes the expected value of the signal in the test step, and the device further includes:
[0149] A comparison module, configured to compare the variable value of the test variable with the expected value of the signal in the test step corresponding to the test variable;
[0150] An outlier determination module, configured to determine that the variable value of the test variable is an outlier if the variable value of the test variable is different from the expected value of the signal in the test step corresponding to the test variable, and mark the outlier in the test record table.
[0151] In an embodiment of the present invention, the device further includes:
[0152] An outlier type determination module, configured to determine the type of the outlier;
[0153] A cause determination module, configured to input the type of the outlier into a preset knowledge base for matching to obtain the cause of generating the outlier.
[0154] In an embodiment of the present invention, the test module includes:
[0155] A repeated test sub-module, configured to test the channels of the PLC module corresponding to the signal in the test step according to the test step and repeat a preset number of times.
[0156] In an embodiment of the present invention, the test module includes:
[0157] A plurality of candidate variable value determination sub-modules, configured to test the channels of the PLC module corresponding to the signal in the test step according to the test step and repeat a preset number of times to obtain a plurality of candidate variable values of the test variable corresponding to each channel;
[0158] An average value determination sub-module, configured to determine the average value of the plurality of candidate variable values of the test variable;
[0159] A variable value determination sub-module, configured to use the average value as the variable value of the test variable.
[0160] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the related parts, please refer to the partial description of the method embodiment.
[0161] An embodiment of the present invention further provides an electronic device, including:
[0162] It includes a processor, a memory, and a computer program stored on the memory and capable of running on the processor. When the computer program is executed by the processor, it implements each process of the above-described embodiment of the detection method for a PLC device and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0163] The embodiment of the present invention also provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements each process of the above-described embodiment of the detection method for a PLC device and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0164] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other.
[0165] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0166] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowcharts and / or block diagrams can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0167] These computer program instructions can also be stored in a computer-readable memory that can guide the computer or other programmable data processing terminal devices to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one process or multiple processes and / or blocks Figure 1 one process or multiple processes and / or blocks Figure 1 or steps for implementing the functions specified in multiple blocks.
[0169] Although the preferred embodiments of the embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present invention.
[0170] Finally, it should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising the element.
[0171] The above has introduced in detail a detection method, device, electronic device and storage medium of a PLC device provided by the present invention. Specific examples are used in this article to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A detection method for a Programmable Logic Controller (PLC) device, characterized in that, The PLC device includes multiple PLC modules, and the method includes: Determine the types of the respective PLC modules, and based on the types of the respective PLC modules, determine the test schemes for the respective PLC modules. The test schemes include test steps, test record forms, and test circuit diagrams. The test steps are used to indicate the test steps for each channel of the PLC module. The test record form is used to record the test results for each channel of the PLC module. The test circuit diagram is used to indicate the connection method of the test circuit for the PLC module; Obtain a configuration file, which is used to indicate the channels of the PLC module corresponding to the test variables; When the connection of the test circuit of the PLC module is completed, for each of the PLC modules in sequence, according to the test steps, test each channel of the PLC module to obtain the variable values of the test variables corresponding to each channel, and record the variable values of the test variables in the test record form.
2. The detection method according to claim 1, wherein, The step of, for each of the PLC modules in sequence, testing each channel of the PLC module according to the test steps includes: Obtain the test sequence of each of the PLC modules; According to the test sequence, for each of the PLC modules in sequence, test each channel of the PLC module according to the test steps.
3. The detection method according to claim 1, characterized in that The step of determining the test schemes for the respective PLC modules based on the types of the respective PLC modules includes: For each of the PLC modules, input the type of the PLC module into a preset knowledge base for matching to obtain the test scheme of the PLC module.
4. The detection method according to claim 1, wherein The step of testing each channel of the PLC module to obtain the variable values of the test variables corresponding to each channel includes: After the binding relationship between the test variables and the channels of the PLC module has been configured on the configuration page of the PLC device, test each channel of the PLC module to obtain the variable values of the test variables corresponding to each channel.
5. The detection method according to claim 1, wherein The configuration file is further used to indicate the signals in the test steps corresponding to the test variables; the step of testing each channel of the PLC module according to the test steps includes: Parse the configuration file to obtain the signals in the test steps corresponding to the test variables and the channels of the PLC module corresponding to the test variables; Based on the signals in the test steps corresponding to the test variables and the channels of the PLC module corresponding to the test variables, determine the channels of the PLC module corresponding to the signals in the test steps; According to the test steps, test the channels of the PLC module corresponding to the signals in the test steps.
6. The detection method according to claim 1, wherein The configuration file is further used to indicate the signals in the test record form corresponding to the test variables; the step of recording the variable values of the test variables in the test record form includes: Parse the configuration file to obtain the signals in the test record form corresponding to the test variables; Record the variable value of the test variable as the signal value of the signal in the test record form corresponding to the test variable in the test record form.
7. The detection method according to claim 5, wherein The test step includes the expected value of the signal in the test step, and the method further includes: Compare the variable value of the test variable with the expected value of the signal in the test step corresponding to the test variable; If the variable value of the test variable is different from the expected value of the signal in the test step corresponding to the test variable, determine that the variable value of the test variable is an outlier, and mark the outlier in the test record form.
8. The detection method according to claim 7, wherein The method further includes: Determine the type of the outlier; Input the type of the outlier into a preset knowledge base for matching to obtain the reason for generating the outlier.
9. The detection method according to claim 5, wherein The testing of the channels of the PLC module corresponding to the signal in the test step according to the test step includes: Test the channels of the PLC module corresponding to the signal in the test step according to the test step and repeat a preset number of times.
10. The detection method according to claim 9, wherein The obtaining of the variable value of the test variable corresponding to each channel of the PLC module according to the test step includes: Test the channels of the PLC module corresponding to the signal in the test step according to the test step and repeat a preset number of times to obtain multiple candidate variable values of the test variable corresponding to each channel; Determine the average value of the multiple candidate variable values of the test variable; Use the average value as the variable value of the test variable.
11. A detection device for a programmable logic controller (PLC) device, characterized in that, The PLC device includes multiple PLC modules, and the apparatus includes: A test plan determination module, configured to determine the type of each PLC module, and determine the test plan for each PLC module according to the type of each PLC module. The test plan includes test steps, a test record form, and a test circuit diagram. The test steps are used to indicate the test steps for each channel of the PLC module, the test record form is used to record the test results for each channel of the PLC module, and the test circuit diagram is used to indicate the connection method of the test circuit for the PLC module; A configuration file acquisition module, configured to acquire a configuration file, where the configuration file is used to indicate the channel of the PLC module corresponding to the test variable; A test module, configured to, when the test circuit connection of the PLC module is completed, sequentially perform tests on each channel of each PLC module according to the test steps to obtain the variable value of the test variable corresponding to each channel, and record the variable value of the test variable in the test record form.
12. An electronic device, characterized in that, Including: A processor, a memory, and a computer program stored on the memory and capable of running on the processor. When the computer program is executed by the processor, the steps of the detection method of the programmable logic controller PLC device as described in any one of claims 1-10 are implemented.
13. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the detection method of the programmable logic controller (PLC) device as described in any one of claims 1 to 10 are implemented.