Virtual debugging system, method and equipment and storage medium
Through the combination of server and signal coupler, the compatibility problem between PLC and virtual debugging software is solved, virtual debugging of different PLC brands is realized, cost is reduced and efficiency is improved.
Patent Information
- Application Number
- CN202410606026.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-10-01
AI Technical Summary
In the existing virtual debugging technology, the communication between PLC and virtual debugging software relies on hardware, which results in high cost, incompatibility, and low efficiency. Moreover, different PLC brands have different communication protocols, making virtual debugging impossible.
Data interaction between external devices and virtual debugging software is carried out through the server, and signal couplers are used for data conversion and coupling to achieve compatible communication between different PLCs and virtual debugging software, reducing debugging costs and improving efficiency.
It realizes compatible communication between different PLC brands and virtual debugging software, reduces virtual debugging costs, improves debugging efficiency and convenience, supports online debugging without changing PLC programming habits.
Smart Images

Figure CN118740639A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtual debugging, and in particular to a virtual debugging system, method, device and storage medium. Background Art
[0002] PLC (Programmable Logic Controller) is an industrial controller that is widely used in various fields of modern industrial automation control and serves as the control hub of automation systems such as automation equipment and automated assembly lines. During virtual debugging, in order to adapt to different PLC brands, the communication between PLC and virtual debugging software often needs to be transferred with the help of third-party software, and most of them need to rely on hardware PLC and hardware HMI (Human Machine Interface) for virtual debugging. That is, the existing technology mainly uses hardware in the loop for virtual debugging, which not only increases the debugging cost, but also is not friendly to companies whose virtual environment design and PLC program engineers are not in the same area. The early stage of debugging requires a more cumbersome preparation process and is limited by site factors. At the same time, due to the communication transfer of third-party software, when the device signal volume is large, it will cause serious signal delay and screen freeze, affecting the debugging speed and effect. There are also different communication protocols for different PLC brands, which makes it impossible to connect and make virtual debugging impossible. Summary of the invention
[0003] The main purpose of the present invention is to solve the technical problems of high cost, incompatibility and low efficiency in the existing virtual debugging between the controller and the virtual debugging software in a hardware-in-the-loop manner.
[0004] A first aspect of the present invention provides a virtual debugging system, the system comprising: an external device for sending a debugging signal; a server connected to the external device, for establishing a data interaction channel between the external device and the server according to device parameters of the external device, and receiving the debugging signal sent by the external device through the data interaction channel, and sending the debugging signal to a signal coupler; a signal coupler connected to the server through a communication protocol, for receiving the debugging signal sent by the server, and coupling the debugging signal to obtain a debugging signal corresponding to virtual debugging software; and virtual debugging software connected to the signal coupler, for performing simulation debugging based on the debugging signal sent by the signal coupler.
[0005] Optionally, in a first implementation of the first aspect of the present invention, the external device includes at least one of a PLC, a host computer and a human-machine interface, the server is independent software, and the signal coupler is embedded in the virtual debugging software.
[0006] Optionally, in a second implementation method of the first aspect of the present invention, the server is specifically used to obtain device parameters of the external device to be connected, and to call an interface instantiation based on the device parameters to establish a data interaction channel between the external device and the server; the server is also used to receive a debug signal sent by the external device, and to perform data conversion on the debug signal using a protocol converter in the server, and to send the converted debug signal to the signal coupler.
[0007] Optionally, in a third implementation of the first aspect of the present invention, the signal coupler is specifically used to determine the corresponding connection interface according to the type of virtual debugging software, and to establish a communication connection between the virtual debugging software and the signal coupler based on the connection interface; the signal coupler is also used to receive a debugging signal sent by the server, and to perform association mapping on the debugging signal, to couple the control signal with the signal within the virtual debugging software, and to send the obtained debugging signal based on the virtual debugging software to the simulation debugging software.
[0008] A second aspect of the present invention provides a virtual debugging method, which is applied to a virtual debugging system, and the method includes: a server receives a debugging signal sent by an external device, performs data conversion on the debugging signal, and pushes the converted debugging signal to a signal coupler, wherein the data conversion includes data format conversion and data type conversion on the debugging signal; the signal coupler receives the converted debugging signal, performs data coupling on the converted debugging signal, determines the correspondence between the converted debugging signal and the control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence.
[0009] Optionally, in a first implementation method of the second aspect of the present invention, the server receives a debug signal sent by an external device, performs data conversion on the debug signal, and pushes the converted debug signal to a signal coupler, including: the server receives a debug signal sent by an external device through a communication channel with the external device, and uses a protocol converter in the server to convert the format of the debug signal, and uses a communication driver in the server to perform data type conversion on the debug signal after the format conversion, to obtain a converted debug signal, and pushes the converted debug signal to the signal coupler.
[0010] Optionally, in a second implementation method of the second aspect of the present invention, the signal coupler receives the converted debug signal, performs data coupling on the converted debug signal, determines the correspondence between the converted debug signal and the control signal in the virtual debugging software, and sends the coupled debug signal to the virtual debugging software based on the correspondence, including: the coupler receives the converted debug signal, and obtains the signal properties of the simulation signal in the virtual debugging software, wherein the signal properties include the signal name and the signal type; based on the signal properties, performs association mapping on the converted debug signal, determines the signal properties of the simulation signal corresponding to the converted debug signal, and sends the coupled debug signal to the virtual debugging software.
[0011] Optionally, in a third implementation manner of the second aspect of the present invention, the method further includes: a signal coupler reads feedback data pushed by virtual debugging software, and sends the feedback data to a server, wherein the feedback data is generated by the virtual debugging software after virtual debugging based on a debugging signal; the server performs data conversion on the feedback data, and pushes the converted feedback data to an external device.
[0012] A third aspect of the present invention provides a virtual debugging device, comprising a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the virtual debugging device executes the virtual debugging method as described above.
[0013] A fourth aspect of the present invention provides a computer-readable storage medium, on which instructions are stored, and when the instructions are executed by a processor, the virtual debugging method as described above is implemented.
[0014] In the technical solution provided by the present invention, the debugging signal sent by the external device is converted by the server and pushed to the signal coupler. The signal coupler couples the converted debugging signal, determines the correspondence between the converted debugging signal and the control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence. This solution enables different PLCs and virtual debugging software to communicate and debug virtually through the virtual debugging system, and does not need to change the PLC programming usage habits during virtual debugging, and directly imports the online debugging into the PLC for use, which reduces the cost of virtual debugging and improves the efficiency and convenience of virtual debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A schematic diagram of a first embodiment of a virtual debugging system provided by an embodiment of the present invention;
[0016] Figure 2A schematic diagram of a second embodiment of a virtual debugging system provided by an embodiment of the present invention;
[0017] Figure 3 A schematic diagram of a first embodiment of a virtual debugging method provided by an embodiment of the present invention;
[0018] Figure 4 A schematic diagram of a second embodiment of a virtual debugging method provided by an embodiment of the present invention;
[0019] Figure 5 A schematic diagram of a third embodiment of a virtual debugging method provided by an embodiment of the present invention;
[0020] Figure 6 A schematic diagram of the structure of a virtual debugging device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] With respect to the existing virtual debugging methods, the present application performs data conversion on the debugging signal sent by the received external device through the server, and pushes it to the signal coupler. The signal coupler performs data coupling on the converted debugging signal, determines the correspondence between the converted debugging signal and the control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence, thereby improving the efficiency of virtual debugging.
[0022] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention 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 the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0023] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , a schematic diagram of a first embodiment of a virtual debugging system provided by an embodiment of the present invention, the virtual debugging system comprises:
[0024] An external device 101 is used to send a debugging signal; a server 102 connected to the external device 101 is used to establish a data interaction channel between the external device and the server according to the device parameters of the external device, and receive the debugging signal sent by the external device through the data interaction channel, and send the debugging signal to the signal coupler; a signal coupler 103 connected to the server 102 through a communication protocol is used to receive the debugging signal sent by the server, and couple the debugging signal to obtain a debugging signal corresponding to the virtual debugging software; and a virtual debugging software 104 connected to the signal coupler 103 is used to perform simulation debugging based on the debugging signal sent by the signal coupler.
[0025] This solution implements simulation operations between external devices and virtual debugging software through a virtual debugging system. Specifically, communication with external devices is implemented through a server in the virtual debugging system, and communication with virtual debugging software is implemented through a signal coupler in the virtual debugging system, so that different external devices and virtual debugging software can achieve compatible communication.
[0026] See also Figure 2 , a schematic diagram of a second embodiment of a virtual debugging system provided by an embodiment of the present invention, the virtual debugging system comprises:
[0027] An external device 201 is used to send a debugging signal; a server 202 connected to the external device 201 is used to establish a data interaction channel between the external device and the server according to the device parameters of the external device, and receive the debugging signal sent by the external device through the data interaction channel, and send the debugging signal to the signal coupler; a signal coupler 203 connected to the server 202 through a communication protocol is used to receive the debugging signal sent by the server, and couple the debugging signal to obtain a debugging signal corresponding to the virtual debugging software; and a virtual debugging software 204 connected to the signal coupler 203 is used to perform simulation debugging based on the debugging signal sent by the signal coupler.
[0028] The external device 201 includes at least one of a PLC, a host computer and a human-machine interface. The server 202 is independent software. The signal coupler 203 is embedded in the virtual debugging software 204 .
[0029] The server 202 is specifically used to obtain the device parameters of the external device 201 to be connected, and to call the interface instantiation based on the device parameters to establish a data interaction channel between the external device 201 and the server 202; the server 202 is also used to receive the debugging signal sent by the external device, and use the protocol converter in the server 202 to perform data conversion on the debugging signal, and send the converted debugging signal to the signal coupler 203.
[0030] The server 202 connects the external device and the signal coupler through a communication protocol, wherein the communication protocol includes TCP, EIP, etc. The communication protocol between the server and the external device corresponds to the category of the external device. For example, some PLCs communicate through the TCP protocol, and some PLCs communicate through the EIP protocol. The server 202 includes a protocol converter and a communication driver. The protocol converter is used to receive the debug signal transmitted by the external device through any communication protocol, and convert the debug signal into a debug signal of a corresponding format that the server can transmit through the communication protocol between the signal coupler. The communication driver is used to convert the data type of the converted debug signal and convert the debug signal into a binary debug signal.
[0031] The signal coupler 203 is specifically used to determine the corresponding connection interface according to the type of the virtual debugging software 204, and to establish a communication connection between the virtual debugging software 204 and the signal coupler 203 based on the connection interface; the signal coupler 203 is also used to receive the debugging signal sent by the server 202, and to associate and map the debugging signal, couple the control signal with the signal in the virtual debugging software 204, and send the obtained debugging signal based on the virtual debugging software 204 to the simulation debugging software 204.
[0032] The data interaction mode between the signal coupler 203 and the virtual debugging software 204 is established by the type of virtual debugging software. The data interaction mode includes API and shared memory. For example, when the virtual debugging software is PS, data interaction is achieved through API, and when the virtual debugging software is MCD, data interaction is achieved through shared memory. The simulation communication refers to configuring signals in the simulation and writing them through the network memory. Specifically, the virtual debugging software creates a storage area in the model, establishes an address in the storage area, and sends the address to an external device to write it, and writes the data in the PLC into the virtual debugging software.
[0033] This solution implements simulation operations between external devices and virtual debugging software through a virtual debugging system. Specifically, communication with external devices is implemented through a server in the virtual debugging system, and communication with virtual debugging software is implemented through a signal coupler in the virtual debugging system, so that different external devices and virtual debugging software can achieve compatible communication.
[0034] See also Figure 3 , a schematic diagram of a first embodiment of a virtual debugging method provided by an embodiment of the present invention, the method specifically comprises the following steps:
[0035] 301. The server receives a debugging signal sent by an external device, performs data conversion on the debugging signal, and pushes the converted debugging signal to a signal coupler.
[0036] The data conversion includes data format conversion and data type conversion of the debugging signal. For establishing connections with different PLCs based on the PLC variable read and write module, first set the IP address on the PLC end, set a folder for multi-file transfer on the PLC end, and establish a set of file reading, writing, searching and processing programs. When a PLC issues an instruction, it can send data to another PLC, and the other PLC responds after receiving it.
[0037] 302. The signal coupler receives the converted debugging signal, performs data coupling on the converted debugging signal, determines a correspondence between the converted debugging signal and a control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence.
[0038] The signal coupler couples the signals in the debugging software, that is, the external signal cannot be directly input into the virtual debugging software, and the signal coupler needs to correspond the debugging signal to the virtual debugging software. Specifically, first clarify the type of debugging signal (such as digital signal, analog signal, pulse signal, etc.) and signal parameters (such as voltage range, frequency, data format, etc.), and at the same time determine the signal type and parameters that the virtual debugging software expects to receive, configure the signal coupler according to the requirements of the debugging signal and the virtual debugging software, that is, configure the parameters of the signal coupler, including setting the input / output range, sampling rate, trigger conditions, etc., and establish communication between the signal coupler and the virtual debugging software, and determine the communication method between the signal coupler and the virtual debugging software (such as serial communication, network communication, etc.).
[0039] In this solution, the external device is a PLC simulator. The PLC simulator is a tool that allows the simulation of PLC (Programmable Logic Controller) operation on a computer. The PLC simulator provides configuration options for setting hardware devices, input signals and output signals, etc., and supports multiple PLC programming languages. It can simulate input and output signals, write and test PLC programs, and in addition, the PLC simulator also provides a visual interface for PLC internal variables, input and output signals and system parameters. In the server, enter the IP and address of the PLC simulator that needs to communicate, the IP and address of the PS server, and the IP and address of the human-machine interface to start the server service. Configure IP addresses for the PLC simulator, PS server and human-machine interface respectively. The IP addresses should be located in the same network segment. Open the server interface, find the configuration options related to the network connection, enter the IP address and port number of the PLC simulator, and realize the communication between the server and the PLC simulator. Enter the IP address and port number of the human-machine interface to realize that the server displays data on the human-machine interface and receives input from the human-machine interface. After confirming that the IP address and port number are applicable and the connection is correct, start the server service and start running, waiting for connection requests from the PLC simulator and the human-machine interface. After the server is started, you can send test data or commands through the PLC simulator and the human-machine interface to verify whether the communication is working properly.
[0040] PLC variable reading and writing establishes a connection based on the PLC IP, that is, reading variable values from the PLC or writing data into the PLC variables. Specifically, a read request is sent to the PLC, specifying the address or identifier of the variable to be read, and the PLC will respond and send the value of the variable; a write request is sent to the PLC, specifying the address or identifier of the variable to be written and the value to be written, and the PLC will confirm whether the write operation is successful. The operation configuration module is directly coupled to the PLC IP, so the server will receive the configuration data from the front end, and the operation configuration module will transmit the signal corresponding to the ID to the signal coupler based on the PLC ID. Specifically, the front end collects the configuration data input by the user and sends it to the server through a request. The server receives the configuration data sent by the front end and parses the configuration data. It determines the PLC that needs to be operated according to the PLC ID or other identifiers in the configuration data. The server sends the parsed configuration data to the operation configuration module. The operation configuration module receives the configuration data from the server, determines the PLC that needs to communicate according to the PLC ID in the configuration data, and establishes communication with the PLC through IP direct coupling. The operation configuration module converts the configuration data into signals or instructions that the PLC can understand, and transmits it to the PLC through the signal coupler. After the PLC receives the signal or instruction from the operation configuration module, it performs the corresponding configuration operation. For example, the human-machine interface triggers the Y value, the signal coupler pushes the X value, axis number, axis parameters, etc. Find the PLC with the corresponding ID, take the PLC signal name and signal status sent from the front end as parameters, and instantiate it. You can then establish instance connection objects for different PLCs, and read and write specific data in the PLC through methods such as write() and read() in the connection object. That is, determine the IP address and communication port of the PLC, configure the network settings of the PLC, select or develop a communication library / API, write code to establish a connection, read and write PLC variables, handle exceptions, and disconnect.
[0041] After the PLC variable read and write module successfully establishes a connection with different PLCs, according to the communication method in the present invention, to achieve communication between two PLCs, it is necessary to introduce a communication protocol middleware. The communication protocol middleware here is a pure software module based on assisting the communication between the virtual debugging software and the PLC. This module is mainly implemented based on the Client / Server architecture of the EIP protocol, in which the server will classify devices from different IPs and ports, and push and subscribe to data analysis. Specifically, in terms of associating and mapping the debug signal in the signal coupler, the value of a signal is written to the corresponding register.
[0042] This solution provides a method that supports multi-protocol communication between simulation software and PLC, directly connecting with different virtual PLCs to achieve software-in-the-loop connection. This method does not require the use of hardware and digital debugging.
[0043] See also Figure 4 , a schematic diagram of a second embodiment of a virtual debugging method provided by an embodiment of the present invention, the method specifically comprises the following steps:
[0044] 401. The server obtains the device parameters of the PLC, sets the port and IP according to the device parameters, and starts the server.
[0045] When the external device is a PLC, run the PLC simulator, the server sets the port and IP according to the IP of the device, click to set the human-machine interface IP, and start the server. Start the PLC simulator and enter the main program interface, which includes the input / output (IO) interface, CPU interface, ladder diagram interface, etc. Set the IP and port on the server, open the network setting interface of the server, select the corresponding property settings, and enter the IP address, subnet mask and gateway of the server, and configure the DNS server address. Then open the firewall settings of the server and add the corresponding ports to allow incoming network connections. For human-machine interface (HMI) devices, enter the IP address, subnet mask and gateway in the corresponding network settings. Install and configure the server software on the server, and configure related parameters, such as data storage path, security settings, etc.
[0046] 402. The signal coupler sets the IP of the PLC, selects the PLC type, and establishes a connection with the PLC.
[0047] Run the virtual environment engine, set the PLC IP in the signal coupler, select the PLC type, click Connect, and a prompt will appear indicating that the connection is successful, along with PLC-related information. Open a virtual environment engine, such as VMware, VirtualBox, etc., load or create a new virtual machine instance to simulate the PLC's operating environment, and enter the specified PLC IP address, subnet mask, gateway and other PLC parameters in the signal coupler's network settings or IP settings options. Set the signal coupler's IP address, subnet mask and other network parameters for the signal coupler connected to the PLC, ensure that it is in the same network segment as the PLC, and configure other parameters of the signal coupler, such as port mapping, network forwarding rules, etc. In the signal coupler's configuration software, find the option to connect to the PLC, enter the PLC's IP address and port number, and select the correct PLC type to establish a connection with the PLC.
[0048] 403. The server sets the IP address and port of the human-machine interface, runs the human-machine interface, and determines the connection status of the server and the running status of the human-machine interface.
[0049] The purpose of this step is to achieve the connection between the server and the human-machine interface. The server sets the IP address and port of the human-machine interface, runs the human-machine interface online, and checks the server connection status and the operation status of the human-machine interface. Enter the IP address and subnet mask of the PLC in the server in the network setting option of the human-machine interface device. After the network connection between the human-machine interface and the server is established, the human-machine interface displays the data or information from the server to determine whether the connection between the human-machine interface and the server is stable.
[0050] In actual application, first determine the signals of PLC and human-machine interface, for example, use Omron NX701-1700 PLC and Weiluntong human-machine interface program for online operation, set PLC simulator and human-machine interface to default IP, for example, it can be set to a special IP address, such as loopback address, i.e. 127.0.0.1. For starting the server, play the debugging environment in the virtual debugging software. Specifically, first configure the server, including installing the operating system, configuring the network environment, installing the server software, etc., then install and configure the virtual debugging software. The configuration of the virtual debugging software includes setting the port number, file path, database connection, etc., creating or loading the debugging environment in the virtual debugging software, including importing project files, setting parameters and connecting external devices, etc., and finally start the server, play the debugging environment in the virtual debugging software, that is, start the debugging session in the virtual debugging software, and start playing the debugging environment.
[0051] In the connection pop-up window of the server, select the PLC model, fill in the IP address of the PLC, and connect to the PLC. The connection pop-up window is the connection configuration information about the PLC connection that pops up on the server. At this time, call the interface instantiation, that is, establish a connection with the PLC socket. After the PLC is successfully connected, it will prompt that the connection is successful and display relevant information. After the connection is successful, you can query the relevant PLC signal information. Specifically, first determine the communication protocol used by the PLC and the port number that the PLC listens to, and write code to establish a Socket (instance) connection. After the Socket connection is successfully established, construct a data packet that complies with the PLC communication protocol and send it through the Socket. Listen to the Socket to receive the response from the PLC to realize data transmission and communication between the PLC and the server.
[0052] In the service settings of the server, set the PLC simulator ID and port parameters, and the ID and port of the human-machine interface need to be connected. In the configuration of the PLC simulator, set a unique simulator ID and the port it listens on, which can be a TCP or UDP port. Find the configuration interface of the server and add the PLC simulator connection, that is, in the server configuration, add a connection pointing to the PLC simulator according to the IP address, port number and other possible connection parameters of the PLC simulator. Similarly, if the server needs to communicate with the human-machine interface, for example, for data synchronization or command transmission, it is necessary to add the connection information of the human-machine interface in the server configuration, including the IP address, port number and other connection parameters of the human-machine interface, start the human-machine interface, set the ID and port of the human-machine interface, and in the configuration of the human-machine interface, add a connection pointing to the server according to the IP address and port number of the server. After the connection is completed, use appropriate tools or interfaces, such as the console of the human-machine interface or the monitoring tool of the server to verify whether the connection between the PLC simulator, the human-machine interface and the server is successfully established.
[0053] Set the IP and port of the coupler. After setting the corresponding parameters, you can start the server service to realize remote and local communication of the human-machine interface. After starting the communication service, it will automatically generate and display the connected device information, and you can also obtain the device operation status.
[0054] 404. The trigger input data of the human-machine interface is received by the server and transmitted to the signal coupler. The signal coupler receives the output data sent by the virtual debugging software and feeds it back to the server and pushes it to the human-machine interface.
[0055] First, define the protocols and interfaces for communication between the human-machine interface, server, signal coupler, and virtual debugging software, then configure the human-machine interface, set input fields on the human-machine interface, and send data to the server. The server receives and forwards data. The server needs to configure a receiving port or API interface to receive data from the human-machine interface. After receiving the data, the server forwards the data to the signal coupler according to predefined logic and rules. The signal coupler receives and sends data. The signal coupler needs to configure a receiving port or interface to receive data from the server. After receiving the data, the signal coupler converts it into the format required by the virtual debugging software and sends it to the virtual debugging software through an appropriate interface. At the same time, the signal coupler also needs to monitor the output data of the virtual debugging software, and after receiving the data, convert it back to a format that the server and the human-machine interface can understand. The virtual debugging software needs to configure a receiving port or interface to receive input data from the signal coupler. The virtual debugging software processes the received data according to the preset logic and algorithm and generates corresponding output data. The virtual debugging software sends the output data to the signal coupler. The server receives the output data of the virtual debugging software, and the signal coupler sends the output data of the virtual debugging software back to the server. The server pushes the output data of the virtual debugging software to the human-machine interface, and the human-machine interface displays the output data.
[0056] This solution enables different PLCs and virtual debugging software to communicate and perform virtual debugging through the virtual debugging system. There is no need to change the PLC programming usage habits during virtual debugging, and online debugging can be directly imported into the PLC for use, which improves the efficiency of virtual debugging.
[0057] See also Figure 5 , a schematic diagram of a third embodiment of a virtual debugging method provided by an embodiment of the present invention, the method specifically comprises the following steps:
[0058] 501. The server receives a debugging signal sent by an external device, performs data conversion on the debugging signal, and pushes the converted debugging signal to a signal coupler.
[0059] The server receives a debugging signal sent by an external device through a communication channel with the external device, and converts the format of the debugging signal using a protocol converter in the server, and converts the data type of the debugging signal after the format conversion using a communication driver in the server to obtain a converted debugging signal, and pushes the converted debugging signal to a signal coupler. The server receives a debugging signal sent by an external device, performs data conversion on the debugging signal, and pushes the converted debugging signal to a signal coupler. The signal coupler receives the converted debugging signal, performs data coupling on the converted debugging signal, determines the correspondence between the converted debugging signal and the control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence.
[0060] 502. The signal coupler receives the converted debugging signal, performs data coupling on the converted debugging signal, determines the correspondence between the converted debugging signal and the control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence.
[0061] The coupler receives the converted debugging signal and obtains the signal attributes of the simulation signal in the virtual debugging software, wherein the signal attributes include the signal name and the signal type; based on the signal attributes, the converted debugging signal is associated and mapped, the signal attributes of the simulation signal corresponding to the converted debugging signal are determined, and the coupled debugging signal is sent to the virtual debugging software.
[0062] 503. The signal coupler reads the feedback data pushed by the virtual debugging software, and sends the feedback data to the server.
[0063] Among them, the feedback data is generated by the virtual debugging software after virtual debugging based on the debugging signal. The output data obtained by the simulation software based on the output value usually represents various parameters, states or results of the simulation process or system. These data are obtained through the calculation, simulation and analysis process inside the simulation software. Specifically, the simulation software will simulate the operation process of the system according to factors such as the input parameters, system model, initial conditions and simulation time step set by the user. During the simulation process, the software will continuously calculate the state changes of the system and record these state changes to form output data. In general, the simulation software will provide a series of data export and visualization tools, through which users can obtain output data. For example, the simulation software usually has a data export function, and the user can export the simulation results to files in formats such as CSV, Excel, PDF, etc. These files contain various output data recorded during the simulation process, and the user can view, analyze and process these data in the file; or, the simulation software usually also provides a graphical display function, and the user can view the simulation results in the form of charts, curves, etc.; or, during the simulation process, the state changes and output data of the system can be viewed in real time through the monitoring system. After receiving the feedback data from the signal coupler, the server parses and processes it, including verifying the integrity of the data, parsing the specific meaning of the data (such as temperature, pressure, speed, etc.), and interacting with other systems or applications.
[0064] 504. The server performs data conversion on the feedback data, and pushes the converted feedback data to an external device.
[0065] The server first receives raw feedback data from the signal coupler or other source. This data may be transmitted in a specific format or encoding. The server needs to parse the received feedback data and convert it from the original format to a format that the server can understand and process. This may involve steps such as decoding, decryption, and format conversion. As needed, the server converts the parsed feedback data. This may include data format conversion (such as converting JSON to XML), data unit conversion (such as converting temperature from Celsius to Fahrenheit), data aggregation or filtering, etc. In some cases, the server may store the converted feedback data in a local database or external storage system for subsequent analysis, query or backup. According to the needs and protocols of the external device, the server prepares the data to be pushed. This may include re-encoding, encryption, packaging or formatting of the data into a specific message format. The server pushes the converted feedback data to the external device through the appropriate communication protocol and interface. This may involve the use of API calls, WebSocket connections, MQTT protocols, serial port communications, etc. Throughout the process, the server should implement error handling and logging mechanisms. This includes capturing and handling any errors that occur during data parsing, conversion, storage or pushing, and recording relevant log information for subsequent analysis and debugging.
[0066] In actual applications, the human-machine interface triggers the cylinder Y value, the PLC simulates receiving the Y signal, the server sends the Y signal to the signal coupler, the signal coupler receives the Y value and pushes it to the virtual debugging software, the virtual debugging software triggers the PS / MCD model action, and after the action is completed, the PS / MCD model X value is output, the virtual debugging software pushes the X value to the signal coupler, the signal coupler pushes the X value to the server and notifies, the server receives the X value, and controls the PLC simulator X value change, realizing the human-machine interface light X value feedback. Specifically, the user inputs instructions through the human-machine interface (such as a touch screen, computer interface, etc.) to trigger the action of the cylinder. This instruction is converted into a specific Y value (usually a digital signal or an analog signal), which represents a certain state or action of the cylinder. In the simulation environment, the PLC simulator will receive the Y value signal from the human-machine interface. The PLC simulator will simulate the real PLC behavior and perform corresponding logic or control operations according to the received Y value signal. The server, as an intermediate layer, forwards the Y value signal sent by the human-machine interface or PLC simulator to the signal coupler. The server is also responsible for signal conversion, routing or other processing tasks. The signal coupler receives the Y value and pushes it to the virtual debugging software. The signal coupler is a hardware device or software module that is responsible for receiving the Y value signal from the server and then forwarding this signal to the virtual debugging software for simulating or testing the behavior of the physical system. The virtual debugging software uses PS / MCD to simulate the behavior of the physical system. When receiving the Y value signal from the signal coupler, the virtual debugging software triggers the PS / MCD model to perform the corresponding action or state change. After the action or state change simulated by the PS / MCD model is completed, it will generate an X value as a feedback signal. The X value represents the current state or result of the model or simulation system. The virtual debugging software sends the generated X value signal to the signal coupler. The signal coupler forwards the received X value signal to the server and sends a notification or confirmation signal to the server, indicating that the X value has been successfully received and forwarded. After receiving the X value signal from the signal coupler, the server forwards it to the PLC simulator. The PLC simulator updates its internal state or simulation result according to the received X value. Finally, the PLC simulator or server feeds the X value back to the human-machine interface to display the current state or result of the physical system or simulation system.
[0067] This solution provides a method for simulation software to communicate with PLC software, so that different PLCs can achieve communication functions and virtual debugging through this system.
[0068] The virtual debugging device in the embodiment of the present invention is described in detail from the perspective of hardware processing. Figure 6As shown, the virtual debugging device includes a processor 600 and a memory 601 . The memory 601 stores machine executable instructions that can be executed by the processor 600 . The processor 600 executes the machine executable instructions to implement the above virtual debugging method.
[0069] Further, Figure 6 The virtual debugging device shown further includes a bus 602 and a communication interface 603 , and the processor 600 , the communication interface 603 and the memory 601 are connected via the bus 602 .
[0070] The memory 601 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), for example, at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 603 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 602 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0071] The processor 600 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 600. The above processor 600 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 601 , and the processor 600 reads the information in the memory 601 and completes the method steps of the above-mentioned embodiment in combination with its hardware.
[0072] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the various steps of the virtual debugging method provided in the above embodiments.
[0073] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described equipment, devices, and units can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0074] 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 this understanding, the technical solution of the present invention is essentially 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. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0075] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A virtual debugging system, characterized in that: The virtual commissioning system comprises: External device, used to send debugging signals; A server connected to the external device, used to establish a data interaction channel between the external device and the server according to the device parameters of the external device, receive a debugging signal sent by the external device through the data interaction channel, and send the debugging signal to the signal coupler; A signal coupler connected to the server through a communication protocol, used to receive a debugging signal sent by the server and couple the debugging signal to obtain a debugging signal corresponding to the virtual debugging software; The virtual debugging software connected to the signal coupler is used for performing simulation debugging based on the debugging signal sent by the signal coupler.
2. The virtual commissioning system according to claim 1, characterized in that: The external device includes at least one of a PLC, a host computer and a human-machine interface, the server is independent software, and the signal coupler is embedded in the virtual debugging software.
3. The virtual commissioning system according to claim 2, characterized in that: The server is specifically used to obtain device parameters of the external device to be connected, and call the interface instantiation based on the device parameters to establish a data interaction channel between the external device and the server; The server is also used to receive a debugging signal sent by an external device, and use a protocol converter in the server to perform data conversion on the debugging signal, and send the converted debugging signal to the signal coupler.
4. The virtual commissioning system according to claim 2, characterized in that: The signal coupler is specifically used to determine the corresponding connection interface according to the type of the virtual debugging software, and establish a communication connection between the virtual debugging software and the signal coupler based on the connection interface; The signal coupler is also used to receive the debugging signal sent by the server, and associate and map the debugging signal, couple the control signal with the signal in the virtual debugging software, and send the obtained debugging signal based on the virtual debugging software to the simulation debugging software.
5. A virtual debugging method, applied to the virtual debugging system according to any one of claims 1 to 4, characterized in that: The virtual debugging method comprises: The server receives the debugging signal sent by the external device, performs data conversion on the debugging signal, and pushes the converted debugging signal to the signal coupler, wherein the data conversion includes performing data format conversion and data type conversion on the debugging signal; The signal coupler receives the converted debugging signal, performs data coupling on the converted debugging signal, determines the correspondence between the converted debugging signal and the control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence.
6. The virtual debugging method according to claim 5, characterized in that: The server receives a debugging signal sent by an external device, performs data conversion on the debugging signal, and pushes the converted debugging signal to a signal coupler, including: The server receives a debugging signal sent by an external device through a communication channel with the external device, converts the format of the debugging signal using a protocol converter in the server, and converts the data type of the debugging signal after format conversion using a communication driver in the server to obtain a converted debugging signal, and pushes the converted debugging signal to a signal coupler.
7. The virtual debugging method according to claim 5, characterized in that: The signal coupler receives the converted debugging signal, performs data coupling on the converted debugging signal, determines the correspondence between the converted debugging signal and the control signal in the virtual debugging software, and sends the coupled debugging signal to the virtual debugging software based on the correspondence, including: The coupler receives the converted debugging signal and obtains the signal attributes of the simulation signal in the virtual debugging software, wherein the signal attributes include the signal name and the signal type; Based on the signal attribute, the converted debugging signal is associated and mapped, the signal attribute of the simulation signal corresponding to the converted debugging signal is determined, and the coupled debugging signal is sent to the virtual debugging software.
8. The virtual debugging method according to claim 5, characterized in that: Also includes: The signal coupler reads the feedback data pushed by the virtual debugging software, and sends the feedback data to the server, wherein the feedback data is generated by the virtual debugging software after virtual debugging based on the debugging signal; The server performs data conversion on the feedback data, and pushes the converted feedback data to an external device.
9. A virtual debugging device, characterized in that: The virtual debugging device includes a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory, so that the virtual debugging device executes the virtual debugging method according to any one of claims 5 to 8.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by a processor, the virtual debugging method according to any one of claims 5 to 8 is implemented.
