IO simulation debugging method for PLC

By simulating PLC I/O signals in a virtual environment, the problems of time-consuming, labor-intensive, and equipment-damaging traditional PLC I/O debugging are solved, achieving efficient and safe I/O debugging, and applicable to a variety of PLC devices and I/O modules.

CN120993818APending Publication Date: 2025-11-21BENGANG STEEL PLATES CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511112200.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Traditional PLC I/O debugging methods require execution in an actual hardware environment, which is time-consuming, labor-intensive, and carries the risk of equipment damage.

Method used

The IO simulation debugging method in a virtual environment is adopted. By writing PLC programs and upper computer screens, the data in the debugging table is written into the virtual controller using dynamic link libraries to simulate field signals, and operation verification is performed on the upper computer screen.

Benefits of technology

It reduces hardware costs, improves debugging efficiency, avoids the risk of equipment damage, shortens the debugging cycle, and is suitable for various PLC devices and IO modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120993818A_ABST
    Figure CN120993818A_ABST
Patent Text Reader

Abstract

The invention provides an IO simulation debugging method for a PLC, and the method comprises the following steps: writing a PLC program and an upper computer picture, downloading the PLC program into a virtual controller, and completing the communication between the virtual controller and the upper computer picture; newly establishing a debugging table, wherein the debugging table is used for debugging personnel to write variables and formulas of a debugging algorithm; linking the table to a dynamic link library by using a development language of the table, writing a calculation result value into a virtual controller by using the dynamic link library, and simulating a real instrument sensor signal on site; after the debugging table is filled, compiling is executed, and the dynamic link library automatically checks grammar errors until the grammar errors are completely correct; and verification of the PLC control logic is completed. According to the method, the PLC program is debugged in the virtual environment by simulating the function of the PLC IO module, so that the debugging efficiency is improved, the debugging cost is reduced, the table and the PLC simulator are deeply integrated for the first time, and low-code IO modeling is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial automation technology, and more particularly to an I / O simulation debugging method for PLCs. Background Technology

[0002] In industrial automation control systems, programmable logic controllers (PLCs) play a crucial role. PLCs communicate with external devices through input / output (I / O) modules to control various industrial processes. During the development of a PLC control system, debugging the PLC I / O is a key step in ensuring the system's normal operation.

[0003] However, traditional PLC I / O debugging methods typically require execution in an actual hardware environment, which is not only time-consuming and labor-intensive but also prone to equipment damage due to misoperation. Therefore, developing an efficient PLC I / O simulation debugging method is of significant practical importance. Summary of the Invention

[0004] In view of this, the purpose of this invention is to propose an I / O simulation debugging method for PLCs, so as to solve the technical problem that existing PLC I / O debugging methods cannot be performed in a virtual environment.

[0005] The technical means employed in this invention are as follows: A method for simulating and debugging the I / O of a PLC includes the following steps: Write the PLC program and host computer screen, and download the PLC program to the virtual controller to complete the communication between the virtual controller and the host computer screen; Create a new debugging table, which is used by the debugging personnel to write variables and formulas for the debugging algorithm; use the table's development language to link the table to a dynamic link library, and use the dynamic link library to write the calculation results into the virtual controller to simulate the real instrument sensor signals on site. After completing the debugging form, execute the compilation. The dynamic link library will automatically check for syntax errors until it is completely correct. The compiled code is executed, and the program refreshes once per second. During the refresh cycle, the program automatically calls the string parsing formula function to parse the contents of the three tables into formulas that the virtual controller can recognize. At the same time, the logic calculation data written by the debugging personnel is substituted into the formulas. The calculation results are directly written into the analog input PIW point and digital input I point image area of ​​the virtual controller to simulate the real instrument sensor signals in the field. At this time, the bad points on the host computer screen will show values. The debugging personnel simulate operation on the host computer screen, observe the data variables on the screen, and complete the verification of the PLC control logic.

[0006] Furthermore, the debugging tables include a status feedback table, an analog quantity feedback table, and a linear variable feedback table; In the status feedback table, the address of the switch output Q point is written in column A, and the address of the switch input I point is written in the corresponding column B. The status of the I point changes synchronously with the value of the Q point, simulating the status feedback signal of the device. In the analog signal feedback table, the address of the switch output Q point is written in column A, and the address and value of the analog input PIW point are written in the corresponding column B. The value of the PIW point changes synchronously with the value of the Q point, thereby realizing the simulation of the analog signal. In the linear variable feedback table, the address of the analog input PIW point is written in column A, and the linear formula of the analog output PQW point is written in the corresponding column B. The value of the PIW point changes with the linear change of the value of the PQW point, thus simulating a linear variable signal. The linear formula for the PQW point is as follows:

[0007] Where a is the proportional coefficient of the analog quantity PQW point, and b is the deviation coefficient of the analog quantity PQW point.

[0008] Furthermore, the dynamic link library is used to convert the data and formulas in the table into signals that the virtual controller can recognize.

[0009] Furthermore, the virtual controller is a software simulation environment for PLC program testing.

[0010] Furthermore, the debugging table is developed in a programming language that can interact with dynamic link libraries and implement data reading and writing.

[0011] Furthermore, after the compiled code is executed, the program automatically calls the function of parsing formulas into strings, so that the contents of the table are accurately converted into formulas that the virtual controller can recognize.

[0012] The present invention also provides a storage medium comprising a stored program, wherein, when the program is executed, the aforementioned method for IO simulation debugging of a PLC is performed.

[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes any of the above-described methods for IO simulation debugging of a PLC through the computer program.

[0014] Compared with the prior art, the present invention has the following advantages: This invention offers a low-cost alternative. Traditional methods rely on physical I / O test benches for debugging, which is costly. In contrast, this invention only requires Excel and PLC simulation software for debugging, eliminating the need to purchase a large amount of expensive hardware, thus significantly reducing hardware costs. At the same time, debugging efficiency is improved. Under the same debugging tasks, this invention can significantly shorten the debugging cycle, improve project development progress, and save enterprises time and labor costs.

[0015] This invention excels in safety risk control. By writing the calculated values ​​into the virtual controller provided by the PLC manufacturer through a dynamic link library, virtual signal isolation is achieved, completely avoiding the risk of malfunctions in field equipment. During debugging, all operations are performed in a virtual environment, without affecting the actual industrial equipment, effectively preventing equipment damage or production accidents caused by debugging errors, and ensuring the safety of personnel and equipment. Furthermore, the virtual PLC I / O module model of this invention is highly flexible and configurable, capable of being flexibly adjusted and configured according to different needs of actual industrial control scenarios. It is applicable to various types of PLC devices and I / O modules, exhibiting broad applicability and versatility. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0018] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0019] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0020] like Figure 1 As shown, this invention provides a method for IO simulation debugging of a PLC, comprising the following steps: Write the PLC program and the host computer screen, and download the PLC program to the virtual controller to complete the communication between the virtual controller and the host computer screen. At this time, no data is transmitted to the screen, and all data are bad values. A new debugging table is created, which is used by debugging personnel to write variables and formulas for the debugging algorithm. The table is linked to a dynamic link library using the table's development language. The dynamic link library is then used to write the calculated values ​​into the virtual controller to simulate the actual instrument sensor signals in the field. Through the table, technicians can simulate a signal environment similar to that of the actual equipment without complicated operations.

[0021] The debugging tables include a status feedback table, an analog quantity feedback table, and a linear variable feedback table; Status Feedback Table: In industrial control scenarios, many devices need to provide corresponding status signals after operation. For example, a motor should provide a running signal after starting; a valve needs to provide a signal indicating whether it is fully open or fully closed after operation. Column A contains the address of the digital output Q point, and the corresponding column B contains the address of the digital input I point. The state of the I point changes synchronously with the value of the Q point, simulating the status feedback signal of the device. Analog Feedback Table: After the motor starts, it will generate analog signals such as vibration, displacement, and temperature. Write the address of the digital output Q point in column A, and the address and value of the analog input PIW point in the corresponding column B. The value of the PIW point changes synchronously with the value of the Q point, thus simulating the analog signals. Linear Variable Feedback Table: After the valve is opened, subsequent signals such as pressure and flow rate will change linearly with the valve opening degree. Enter the analog input PIW point address in column A, and the corresponding linear formula for the analog output PQW point in column B. The value of the PIW point changes linearly with the value of the PQW point, simulating a linear variable signal. The linear formula for the PQW point is as follows:

[0022] Where a is the proportional coefficient of the analog quantity PQW point, and b is the deviation coefficient of the analog quantity PQW point.

[0023] After completing the debugging form, execute the compilation. The dynamic link library will automatically check for syntax errors until it is completely correct. The compiled code is executed, and the program refreshes once per second. During the refresh cycle, the program automatically calls the string parsing formula function to parse the contents of the three tables into formulas that the virtual controller can recognize. At the same time, the logic calculation data written by the debugging personnel is substituted into the formulas. The calculation results are directly written into the analog input PIW point and digital input I point image area of ​​the virtual controller to simulate the real instrument sensor signals in the field. At this time, the bad points on the host computer screen will show values. The debugging personnel simulate operation on the host computer screen, observe the data variables on the screen, and complete the verification of the PLC control logic.

[0024] With this invention, technicians do not need to add debugging code to the PLC logic, nor do they need to know the programming language for copying. They only need to fill in the PLC variable address and a simple linear formula in the table to complete the logic verification of the PLC.

[0025] Example In the oxygen production system renovation project of the Benxi Steel Plate Energy Management Center, the debugging method proposed in this invention was successfully applied to debug the Siemens S7-400 program. The specific implementation steps are as follows: 1. Environment Configuration First, activate the PLC emulator (e.g., S7 - PLCSIM) and load the PLC program to be tested into the emulator; simultaneously, initialize the Excel-VBA communication interface. The tools used in this process are Step 7 software and the S7PROSIMLIB.dll dynamic link library. These operations establish the basic environment for subsequent debugging work.

[0026] 2. Signal mapping Create three worksheets in Excel and configure signal mapping for each: Sheet1: Used to implement the state feedback mapping from Q point to I point, involving Boolean signals. This configuration allows for the simulation of feedback signals indicating device status (such as running, stopped, etc.).

[0027] Sheet2: Used to implement analog feedback mapping from Q point to PIW point, with the signal type being integer. It can simulate various analog signals generated by equipment (such as pressure, temperature, etc.).

[0028] Sheet3: Used to implement a linear transformation mapping from point PQW to point PIW, with the transformation formula: PIW = a*PQW + b. This configuration can simulate linearly changing signals (such as the relationship between valve opening and flow rate, pressure, etc.).

[0029] 3. Logical verification The controls in Excel are triggered to simulate various actions of the field equipment (such as motor starting). Simultaneously, the WinCC online monitoring function is used to observe the response of the host computer screen and the changes in the PLC's internal logic state. This method comprehensively verifies the logical correctness of the PLC program in a real-world operating scenario. The tools used in this process are Excel buttons and the WinCC online monitoring system.

[0030] 4. Anomaly Testing Pre-set faults are manually injected (e.g., setting the PIW value to exceed the limit in Sheet2) to verify the accuracy and effectiveness of the PLC program's alarm logic and interlock protection actions. Through anomaly testing, it can be ensured that the PLC program can respond according to preset requirements when faced with sudden faults, guaranteeing the safe and stable operation of the system.

[0031] During this debugging process, 87 I / O point relationships were configured in Excel, including 32 linear formulas. These configurations successfully simulated complex operating conditions such as air compressor start-up and shutdown, and oxygen purity adjustment. During the debugging phase, 23 logical errors were identified and resolved in advance, saving 28 person-days of debugging time. After the system went live, it has achieved over 120 days of stable, fault-free operation, fully demonstrating the effectiveness and reliability of the method described in this invention.

[0032] Through the above implementation steps, this invention successfully achieves efficient and safe simulation debugging of PLC programs in a virtual environment. This method not only enables the early detection of potential problems in the program, reducing actual debugging risks, but also significantly shortens the debugging cycle, improves project implementation efficiency, and provides solid support for the development of industrial automation control systems.

[0033] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for simulating and debugging the I / O of a PLC, characterized in that, Includes the following steps: Write the PLC program and host computer screen, and download the PLC program to the virtual controller to complete the communication between the virtual controller and the host computer screen; Create a new debugging table, which is used by the debugging personnel to write variables and formulas for the debugging algorithm; use the table's development language to link the table to a dynamic link library, and use the dynamic link library to write the calculation results into the virtual controller to simulate the real instrument sensor signals on site. After completing the debugging form, execute the compilation. The dynamic link library will automatically check for syntax errors until it is completely correct. The compiled code is executed, and the program refreshes once per second. During the refresh cycle, the program automatically calls the string parsing formula function to parse the contents of the three tables into formulas that the virtual controller can recognize. At the same time, the logic calculation data written by the debugging personnel is substituted into the formulas. The calculation results are directly written into the analog input PIW point and digital input I point image area of ​​the virtual controller to simulate the real instrument sensor signals in the field. At this time, the bad points on the host computer screen will show values. The debugging personnel simulate operation on the host computer screen, observe the data variables on the screen, and complete the verification of the PLC control logic.

2. The method for IO simulation debugging of PLC according to claim 1, characterized in that, The debugging tables include a status feedback table, an analog quantity feedback table, and a linear variable feedback table; In the status feedback table, the address of the switch output Q point is written in column A, and the address of the switch input I point is written in the corresponding column B. The status of the I point changes synchronously with the value of the Q point, simulating the status feedback signal of the device. In the analog signal feedback table, the address of the switch output Q point is written in column A, and the address and value of the analog input PIW point are written in the corresponding column B. The value of the PIW point changes synchronously with the value of the Q point, thereby realizing the simulation of the analog signal. In the linear variable feedback table, the address of the analog input PIW point is written in column A, and the linear formula of the analog output PQW point is written in the corresponding column B. The value of the PIW point changes with the linear change of the value of the PQW point, thus simulating a linear variable signal. The linear formula for the PQW point is as follows: Where a is the proportional coefficient of the analog quantity PQW point, and b is the deviation coefficient of the analog quantity PQW point.

3. The method for IO simulation debugging of PLC according to claim 1, characterized in that, The dynamic link library is used to convert the data and formulas in the table into signals that the virtual controller can recognize.

4. The method for IO simulation debugging of PLC according to claim 1, characterized in that, The virtual controller is a software simulation environment for PLC program testing.

5. The method for IO simulation debugging of PLC according to claim 1, characterized in that, The debugging table is developed in a programming language that can interact with dynamic link libraries and perform data reading and writing.

6. The method for IO simulation debugging of a PLC according to claim 1, characterized in that, After the compiled code is executed, the program automatically calls the function of parsing formulas into strings, so that the contents of the table are accurately converted into formulas that the virtual controller can recognize.

7. A storage medium, characterized in that, The storage medium includes a stored program, wherein when the program is executed, it performs the I / O simulation debugging method for a PLC as described in any one of claims 1 to 6.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the I / O simulation debugging method for PLC as described in any one of claims 1 to 6 through the computer program.

Citation Information

Cited By

  • PLC hardware resource processing method and electronic equipment

    CN121657559A