A PLC system, a PLC data transmission method and device

By introducing an IO scheduler and data service module into the PLC system, and utilizing configuration information and scheduling strategies, the complexity of modifying the PLC system when expanding to new industrial protocols is solved, achieving more efficient and convenient expansion.

CN117850328BActive Publication Date: 2026-11-27BEIJING WANSHENG INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310383251.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-17
Publication Date
2026-11-27
Estimated Expiration
2042-05-17

AI Technical Summary

Technical Problem

Existing PLC systems require large-scale software modifications to support new industrial protocols, making expansion inconvenient.

Method used

By introducing an IO scheduler, IO memory area, and data service module, data interaction with external access units is achieved through configuration information and preset scheduling strategies. When supporting new industrial protocols, only the data service module needs to be expanded without modifying the IO scheduler.

Benefits of technology

It reduces the need for PLC system modifications and improves the ease of expanding to new industrial protocols.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117850328B_ABST
    Figure CN117850328B_ABST
Patent Text Reader

Abstract

The application discloses a PLC system, a PLC data transmission method and device, and relates to the technical field of industrial control and the technical field of computers. In the PLC system, an IO scheduler is loaded with configuration information corresponding to an external access unit, wherein an IO memory area is used for buffering data exchanged between the IO scheduler and the external access unit; the IO scheduler is used for performing message interaction between a data service module connected with the external access unit according to a preset scheduling strategy based on the configuration information corresponding to the external access unit, so that the data service module exchanges data with the connected external access unit; and the data service module is used for performing message interaction with the IO scheduler and exchanging data with the connected external access unit by using an industrial protocol supported by the connected external access unit. By using the scheme, the convenience of extension when the PLC system needs to support a new industrial protocol is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of industrial control technology and computer technology, and in particular to a PLC system, a PLC data transmission method and device. Background Technology

[0002] A Programmable Logic Controller (PLC) is a digital electronic system specifically designed for industrial applications. It uses a programmable memory to store instructions for performing logical operations, sequential control, timing, counting, and arithmetic operations, controlling various types of machinery or production processes through digital or analog inputs and outputs.

[0003] During operation, PLC systems often need to periodically read and write data with external I / O circuit modules or devices. A typical PLC operation cycle includes several steps such as scanning I / O inputs, reading I / O inputs, executing program logic, and outputting data.

[0004] Currently, in practical applications, a PLC system needs to be able to connect to devices using dozens of different industrial protocols for data I / O (input / output) interaction. In the fields of IoT and industrial control, there are numerous industrial protocol standards. Developing a PLC system that supports multiple external industrial bus protocols presents significant challenges in the design of the PLC system's I / O modules.

[0005] Current PLC systems can support multiple industrial protocols using a system programming interface (SPI). The operating system provides the SPI through device drivers, and the PLC application calls this SPI to connect to and access external devices that use a specific industrial protocol.

[0006] However, when using the above-mentioned system programming interface, it is necessary to make corresponding modifications to the device driver, protocol layer and PLC application when supporting new industrial protocols. In other words, it requires significant changes at the software level, which is quite complex and inconvenient for expansion. Summary of the Invention

[0007] This application provides a PLC system, a PLC data transmission method, and an apparatus to solve the problem in the prior art where it is inconvenient to expand when the PLC system needs to support new industrial protocols.

[0008] This application provides a PLC system, including: an I / O scheduler, an I / O memory area, and a data service module. The data service module is connected to an external access unit, and the I / O scheduler is loaded with configuration information corresponding to the external access unit.

[0009] The IO memory area is used to cache the data exchanged between the IO scheduler and the external access unit;

[0010] The IO scheduler is used to perform message interaction between the data service module connected to the external access unit and the external access unit according to a preset scheduling strategy based on the configuration information corresponding to the external access unit, so that the data service module interacts with the connected external access unit for data.

[0011] The data service module is used to interact with the IO scheduler via messages, and to interact with the connected external access unit via an industrial protocol supported by the connected external access unit.

[0012] Furthermore, the configuration information corresponding to the external access unit includes: data caching information and access information;

[0013] The IO scheduler is used to obtain output data that needs to be sent to the external access unit from the IO memory area based on the data cache information, or to cache input data from the external access unit into the IO memory area; and specifically, it is used to perform message interaction with the data service module connected to the external access unit based on the access information, according to a preset scheduling strategy and the access method represented by the access information, so that the data service module interacts with the connected external access unit.

[0014] Furthermore, the data caching information includes: the storage location and data type of the IO memory area, and also includes: the data quantity and / or data key-value pairs;

[0015] The access information is a URL.

[0016] Furthermore, the IO memory area includes an IO memory input area and an IO memory output area. The IO memory input area is used to cache data from external access units, and the IO memory output area is used to cache data to be sent to external access units.

[0017] Furthermore, the data service module includes: a point-to-point data service module;

[0018] The IO scheduler is used to send a data acquisition request message to the point-to-point data service module when it needs to acquire data from an external access unit connected to the point-to-point data service module; and to acquire the output data to be sent from the IO memory area and send a data transmission request message carrying the output data to the point-to-point data service module when it needs to send data from an external access unit connected to the point-to-point data service module.

[0019] The point-to-point data service module is used to, upon receiving a data acquisition request message, acquire input data from the connected external access unit and forward the acquired input data to the IO scheduler; upon receiving a data transmission request message, acquire the output data carried therein and forward the acquired output data to the connected external access unit.

[0020] The IO scheduler is also used to cache the input data in the IO memory area after receiving the input data sent by the point-to-point data service module;

[0021] The data service module includes: a first-cycle data service module; the system also includes: shared memory.

[0022] The IO scheduler is used to periodically retrieve output data that needs to be sent to the external access unit connected to the first periodic data service module from the IO memory area, and cache the output data in the shared memory;

[0023] The first periodic data service module is used to periodically retrieve the output data from the shared memory and forward the retrieved output data to the connected external access unit; and to periodically retrieve the input data from the connected external access unit and cache the input data in the shared memory;

[0024] The IO scheduler is also used to periodically retrieve the input data from the shared memory and cache the input data in the IO memory area;

[0025] The data service module includes: a second-cycle data service module; the system also includes: a database.

[0026] The IO scheduler is used to periodically retrieve output data from the IO memory area that needs to be sent to an external access unit connected to the second periodic data service module, and cache the output data in the database.

[0027] The second periodic data service module is used to periodically retrieve the output data from the database and forward the retrieved output data to the connected external access unit; and to periodically retrieve the input data from the connected external access unit and cache the input data in the database;

[0028] The IO scheduler is also used to periodically retrieve the input data from the database and cache the input data in the IO memory area.

[0029] Furthermore, the IO scheduler is also used to send a memory location query request to the first periodic data service module, and to receive the storage location in the shared memory of the data interacted with the connected external access unit returned by the first periodic data service module.

[0030] The first periodic data service module is also used to return the storage location of the data interacted with the connected external access unit in the shared memory to the IO scheduler after receiving the memory location query request.

[0031] Furthermore, the IO scheduler is also used to obtain a version number representing the shared memory layout version from the header area of ​​the shared memory before sending the memory location query request to the first periodic data service module. If the obtained version number is inconsistent with the version number previously returned by the first periodic data service module, the step of sending the memory location query request to the first periodic data service module is executed.

[0032] The first periodic data service module is further configured to store the updated version number of the shared memory layout in the header area of ​​the shared memory after updating the shared memory layout version; and to return the updated version number of the shared memory layout to the IO scheduler after receiving the memory location query request.

[0033] This application embodiment also provides a PLC data transmission method applied to an IO scheduler in a PLC system. The PLC system further includes an IO memory area and a data service module. The data service module is connected to an external access unit. The IO scheduler loads configuration information corresponding to the external access unit. The IO memory area is used to cache data exchanged between the IO scheduler and the external access unit. The method includes:

[0034] Obtain the configuration information corresponding to the external access unit;

[0035] Based on the acquired configuration information, and in accordance with a preset scheduling strategy, the data service module connected to the external access unit performs message interaction, enabling the data service module to use the industrial protocol supported by the connected external access unit to interact with the connected external access unit for data.

[0036] Furthermore, the configuration information corresponding to the external access unit includes: data caching information and access information;

[0037] The method further includes:

[0038] Based on the data caching information, the output data that needs to be sent to the external access unit is obtained from the IO memory area, or the input data from the external access unit is cached in the IO memory area;

[0039] Based on the acquired configuration information, and according to a preset scheduling strategy, the data service module connected to the external access unit performs message interaction, including:

[0040] Based on the access information, and in accordance with a preset scheduling strategy and the access method indicated by the access information, the data service module connected to the external access unit performs message interaction.

[0041] Furthermore, the data caching information includes: the storage location and data type of the IO memory area, and also includes: the data quantity and / or data key-value pairs;

[0042] The access information is a URL.

[0043] Furthermore, the IO memory area includes an IO memory input area and an IO memory output area. The IO memory input area is used to cache data from external access units, and the IO memory output area is used to cache data to be sent to external access units.

[0044] Furthermore, the data service module includes at least one of the following service modules:

[0045] Point-to-point data service module, first-cycle data service module and second-cycle data service module;

[0046] When the first-cycle data service module is included, the system also includes shared memory;

[0047] When the second-cycle data service module is included, the system also includes a database;

[0048] Based on the acquired configuration information, and according to a preset scheduling strategy, the data service module connected to the external access unit performs message interaction, including:

[0049] When data needs to be obtained from an external access unit connected to the peer-to-peer data service module, a data acquisition request message is sent to the peer-to-peer data service module. Upon receiving the data acquisition request message, the peer-to-peer data service module obtains input data from the connected external access unit and forwards the obtained input data to the IO scheduler.

[0050] When it is necessary to send data to an external access unit connected to the point-to-point data service module, the output data to be sent is obtained from the IO memory area, and a data sending request message carrying the output data is sent to the point-to-point data service module. After receiving the data sending request message, the point-to-point data service module obtains the output data and forwards the obtained output data to the connected external access unit.

[0051] After receiving the input data sent by the point-to-point data service module, the input data is cached in the IO memory area;

[0052] The system periodically retrieves output data from the IO memory area that needs to be sent to the external access unit connected to the first periodic data service module, caches the output data in the shared memory, so that the first periodic data service module periodically retrieves the output data from the shared memory and forwards the retrieved output data to the connected external access unit.

[0053] The system periodically retrieves input data from the shared memory and caches the input data in the IO memory area. The input data in the shared memory is retrieved periodically from the connected external access unit by the first periodic data service module and cached in the shared memory.

[0054] The system periodically retrieves output data from the IO memory area that needs to be sent to an external access unit connected to the second periodic data service module, caches the output data in the database, and enables the second periodic data service module to periodically retrieve the output data from the database and forward the retrieved output data to the connected external access unit.

[0055] The system periodically retrieves input data from the database and caches the input data in the IO memory area. The input data in the database is retrieved periodically from the connected external access unit and cached in the database by the second periodic data service module.

[0056] This application embodiment also provides a PLC data transmission method applied to a data service module in a PLC system. The PLC system further includes an I / O scheduler and an I / O memory area. The data service module is connected to an external access unit. The I / O scheduler loads configuration information corresponding to the external access unit. The I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit. The method includes:

[0057] Message exchange with the I / O scheduler;

[0058] It uses industrial protocols supported by the connected external access unit to exchange data with the connected external access unit.

[0059] Furthermore, the data service module is a point-to-point data service module;

[0060] Message interaction with the IO scheduler, and data interaction with the connected external access unit using an industry protocol supported by the connected external access unit, including:

[0061] Receive a data retrieval request message sent by the IO scheduler when it needs to retrieve data from an external access unit connected to the point-to-point data service module;

[0062] After receiving a data acquisition request message, the system acquires input data from the connected external access unit and forwards the acquired input data to the IO scheduler, so that the IO scheduler caches the input data in the IO memory area after receiving the input data.

[0063] When the IO scheduler needs to send data to an external access unit connected to the point-to-point data service module, it sends a data sending request message carrying output data, which is the output data that the IO scheduler needs to send obtained from the IO memory area;

[0064] Upon receiving the data transmission request message, the system acquires the output data it carries and forwards the acquired output data to the connected external access unit.

[0065] Furthermore, the data service module is a first-cycle data service module, and the system also includes shared memory;

[0066] Message interaction with the IO scheduler, and data interaction with the connected external access unit using an industry protocol supported by the connected external access unit, including:

[0067] The system periodically retrieves output data from the shared memory and forwards the retrieved output data to the connected external access unit. The output data is the data that the IO scheduler periodically retrieves from the IO memory area and needs to be sent to the external access unit connected to the first periodic data service module, and is cached in the shared memory.

[0068] The system periodically retrieves input data from the connected external access unit and caches the input data in the shared memory, so that the IO scheduler periodically retrieves the input data from the shared memory and caches the input data in the IO memory area.

[0069] Furthermore, the data service module is a second-cycle data service module, and the system also includes a database;

[0070] Message interaction with the IO scheduler, and data interaction with the connected external access unit using an industry protocol supported by the connected external access unit, including:

[0071] The system periodically retrieves output data from the database and forwards the retrieved output data to the connected external access unit. This output data is the data that the IO scheduler periodically retrieves from the IO memory area, needs to be sent to the external access unit connected to the second periodic data service module, and is cached in the database.

[0072] The system periodically retrieves input data from the connected external access unit and caches the input data in the database, so that the IO scheduler periodically retrieves the input data from the database and caches the input data in the IO memory area.

[0073] This application embodiment also provides a PLC data transmission device applied to an IO scheduler in a PLC system. The PLC system further includes an IO memory area and a data service module. The data service module is connected to an external access unit. The IO scheduler loads configuration information corresponding to the external access unit. The IO memory area is used to cache data exchanged between the IO scheduler and the external access unit. The device includes:

[0074] The configuration information acquisition module is used to acquire configuration information corresponding to the external access unit;

[0075] The data interaction module is used to interact with the data service module connected to the external access unit based on the acquired configuration information and according to a preset scheduling strategy, so that the data service module uses the industrial protocol supported by the connected external access unit to interact with the connected external access unit for data.

[0076] This application embodiment also provides a PLC data transmission device applied to a data service module in a PLC system. The PLC system further includes an I / O scheduler and an I / O memory area. The data service module is connected to an external access unit. The I / O scheduler loads configuration information corresponding to the external access unit. The I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit. The device includes:

[0077] The first data interaction module is used for message interaction with the IO scheduler;

[0078] The second data interaction module is used to interact with the connected external access unit using an industrial protocol supported by the connected external access unit.

[0079] This application also provides an electronic device, characterized in that it includes a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to: implement any of the above-mentioned PLC data transmission methods applied to an IO scheduler, or implement any of the above-mentioned PLC data transmission methods applied to a data service module.

[0080] This application also provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements any of the above-mentioned PLC data transmission methods applied to an IO scheduler, or implements any of the above-mentioned PLC data transmission methods applied to a data service module.

[0081] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute any of the above-described PLC data transmission methods applied to an IO scheduler, or to execute any of the above-described PLC data transmission methods applied to a data service module.

[0082] The beneficial effects of this application include:

[0083] In the solution provided in this application embodiment, the PLC system includes an I / O scheduler, an I / O memory area, and a data service module. The data service module is connected to an external access unit. The I / O scheduler loads configuration information corresponding to the external access unit. The I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit. The I / O scheduler, based on the configuration information corresponding to the external access unit and according to a preset scheduling strategy, facilitates message exchange between the data service module and the connected external access unit, enabling data exchange. The data service module is used for message exchange with the I / O scheduler and for exchanging data with the connected external access unit using industrial protocols supported by the connected external access unit. In this PLC system, when support for a new industrial protocol is required, the data service module can be extended to enable data exchange with the external access unit using the new industrial protocol, and corresponding configuration information can be added. No modification to the I / O scheduler is required. Compared to existing technologies, this reduces modifications to the PLC system, thus improving the ease of expansion.

[0084] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0085] The accompanying drawings are provided to further illustrate the present application and form part of the specification. They are used together with the embodiments of the present application to explain the application and do not constitute a limitation thereof. In the drawings:

[0086] Figure 1 This is a schematic diagram of the structure of the PLC system provided in the embodiments of this application;

[0087] Figure 2 A flowchart illustrating a PLC data transmission method applied to an I / O scheduler, as provided in an embodiment of this application;

[0088] Figure 3 A flowchart illustrating a PLC data transmission method applied to a data service module, as provided in an embodiment of this application.

[0089] Figure 4 This is a schematic diagram of the structure of a PLC system provided in another embodiment of this application;

[0090] Figure 5 A flowchart of the PLC data transmission method provided in the embodiments of this application;

[0091] Figure 6 A flowchart of a PLC data transmission method provided in another embodiment of this application;

[0092] Figure 7 A flowchart of a PLC data transmission method provided in another embodiment of this application;

[0093] Figure 8 A schematic diagram of the structure of a PLC data transmission device applied to an I / O scheduler provided in an embodiment of this application;

[0094] Figure 9 A schematic diagram of the structure of a PLC data transmission device applied to a data service module, provided in an embodiment of this application;

[0095] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0096] To provide a solution for improving the ease of expansion when a PLC system needs to support new industrial protocols, this application provides a PLC system, a PLC data transmission method, and an apparatus. The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustrative and explanatory purposes only and are not intended to limit this application. Furthermore, the embodiments and features described in this application can be combined with each other unless otherwise specified.

[0097] This application provides a PLC system, such as Figure 1 As shown, it includes: an I / O scheduler, an I / O memory area, and a data service module. The data service module is connected to the external access unit. The I / O scheduler loads configuration information corresponding to the external access unit, wherein:

[0098] The I / O memory area is used to cache data exchanged between the I / O scheduler and external access units;

[0099] The IO scheduler is used to communicate with the data service module connected to the external access unit according to the configuration information corresponding to the external access unit and the preset scheduling strategy, so that the data service module can exchange data with the connected external access unit.

[0100] The data service module is used for message interaction with the IO scheduler and for interacting with connected external access units using industrial protocols supported by the connected external access units.

[0101] When the PLC system provided in the embodiments of this application needs to support a new industrial protocol, the data service module can be expanded so that the new industrial protocol can be used to interact with data with external access units and corresponding configuration information can be added. No changes to the IO scheduler are required. Compared with the prior art, this reduces the changes to the PLC system, thus improving the convenience of expansion.

[0102] Furthermore, the configuration information corresponding to the external access unit may include: data caching information and access information;

[0103] The IO scheduler can retrieve the output data that needs to be sent to the external access unit from the IO memory area based on the data cache information, or cache the input data from the external access unit into the IO memory area; and based on the access information, according to the preset scheduling strategy and the access method represented by the access information, it can perform message interaction with the data service module connected to the external access unit, so that the data service module can interact with the connected external access unit.

[0104] Furthermore, data caching information may include: storage location and data type, and may also include: data quantity and / or data key-value pairs; access information may be a URL (Uniform Resource Locator), and the various information carried in the URL may represent the corresponding access method.

[0105] In the PLC system described above, the user logic module can be any PLC application. It can obtain input data from the IO memory area from the external access unit based on application needs, and it can also cache the output data that needs to be sent to the external access unit in the IO memory area.

[0106] In the embodiments of this application, such as Figure 1 As shown, the IO memory area can include an IO memory input area and an IO memory output area. The IO memory input area is used to cache data from external access units, and the IO memory output area is used to cache data to be sent to external access units.

[0107] In this embodiment of the application, the external access unit belongs to an external I / O device, and an external I / O device may include multiple external access units.

[0108] Based on the PLC system provided in the embodiments of this application, correspondingly, this application also provides a PLC data transmission method applied to the IO scheduler in the PLC system. The PLC system further includes an IO memory area and a data service module. The data service module is connected to an external access unit. The IO scheduler loads configuration information corresponding to the external access unit. The IO memory area is used to cache data exchanged between the IO scheduler and the external access unit, such as... Figure 2 As shown, the method includes:

[0109] Step 21: Obtain the configuration information corresponding to the external access unit;

[0110] Step 22: Based on the acquired configuration information, according to the preset scheduling strategy, the data service module connected to the external access unit performs message interaction, so that the data service module uses the industrial protocol supported by the connected external access unit to interact with the connected external access unit.

[0111] Accordingly, this application also provides a PLC data transmission method applied to a data service module in a PLC system. The PLC system further includes an I / O scheduler and an I / O memory area. The data service module is connected to an external access unit. The I / O scheduler loads configuration information corresponding to the external access unit, and the I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit, such as... Figure 3 As shown, the method includes:

[0112] Step 31: Message exchange with the IO scheduler;

[0113] Step 32: Use the industrial protocol supported by the connected external access unit to exchange data with the connected external access unit.

[0114] The PLC system and corresponding methods provided in this application will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0115] In this embodiment of the application, an IO configuration file can be created for each external access unit connected to the PLC system. The IO configuration file contains configuration information corresponding to each external access unit. The configuration information can describe the correspondence between the storage location in the IO memory area and the external access unit. Specifically, it can describe the correspondence between the storage location in the IO memory area and the IO physical address of the external access unit, thereby realizing data interaction with the external access unit and the storage of the input and output data of the interaction in the IO memory area.

[0116] Specifically, in the IO configuration file, there is an access unit for each external access unit. The access unit can be understood as a piece of information that contains the corresponding configuration information.

[0117] The configuration information may specifically include: data caching information and access information;

[0118] Among them, data caching information is used to obtain output data and cache input data in the IO memory area, and access information is used to exchange data with external access units.

[0119] Furthermore, data caching information may include storage location, data type, and data quantity; or, data caching information may include storage location, data type, and data key-value pairs.

[0120] Access information can be a URL.

[0121] In other embodiments, the configuration information corresponding to the external access unit can also be provided through the source code.

[0122] The following is an example of the configuration information corresponding to the external access unit:

[0123] Configuration information example 1:

[0124]

[0125] In the above configuration information example one, "input" represents the cache of input data from the external access unit;

[0126] The field "location" indicates the storage location, which can be the starting address of the storage;

[0127] The field "type" indicates the data type, which can also represent the number of bytes occupied by the data in the I / O memory area;

[0128] The field "num" represents the number of data items, that is, the number of data items in a single data interaction with an external access unit;

[0129] Based on the configuration information of the above three fields, it is possible to determine the starting address and ending address of data storage in the IO memory area.

[0130] The field “access” represents access information, i.e., the URL. A URL can contain components such as protocol, host address, port, resource path, and query parameters.

[0131] In this embodiment of the application, the "protocol" type in the URL can include two types: standard protocol and custom protocol.

[0132] Standard protocols can include "http", "https", "coap", and "coaps", among others. These standard protocols can be used to exchange data with external access units through the peer-to-peer data service module.

[0133] Custom protocols can include three types: "static memory sharing", "dynamic memory sharing" and "database", which are used to interact with external access units through the periodic data service module.

[0134] Configuration information example two:

[0135]

[0136] In the above configuration information example two, "output" represents the cache of output data that needs to be sent to the external access unit;

[0137] The field "key" represents a data key-value pair, which describes the structure of the output data and is used to encode data using the JSON or CBOR protocol.

[0138] In this embodiment of the application, the data service module in the PLC system can adopt different data interaction methods based on the characteristics of data interaction between the user logic module of the PLC application and the external access unit. It can be point-to-point data interaction in a request manner or periodic data interaction.

[0139] like Figure 4 As shown, the PLC system provided in this application embodiment may include at least one of the following three data service modules:

[0140] Point-to-point data service module, first-cycle data service module and second-cycle data service module;

[0141] When the first cycle data service module is included, the PLC system also includes shared memory;

[0142] When the second-cycle data service module is included, the PLC system also includes a database.

[0143] The following section provides a detailed description of the data interaction between the PLC system and the external access unit for each data service module.

[0144] For point-to-point data service modules, embodiments of this application provide a PLC data transmission method, such as... Figure 5 As shown, it includes:

[0145] Step 501: The IO scheduler obtains the configuration information corresponding to the external access unit in the loaded IO configuration file according to the preset scheduling strategy. The external access unit is connected to the point-to-point data service module.

[0146] In this step, we will use the following configuration information example three as an example for description:

[0147]

[0148]

[0149] After loading the IO configuration file, the IO scheduler can sequentially obtain the configuration information corresponding to the external access unit according to the preset scheduling strategy. If the configuration information is of output type, step 502 is executed; if the configuration information is of input type, step 507 is executed.

[0150] Step 502: If the configuration information is of the output type, it means that output data needs to be sent to the external access unit based on the configuration information. The IO scheduler obtains the output data from the storage location indicated by the configuration information in the IO memory output area based on the configuration information.

[0151] Based on the information in the fields “location”, “type” and “num” in the configuration information above, the IO scheduler can obtain two output data entries from positions 1 and 2 of the IO memory output area in byte format.

[0152] Step 503: The IO scheduler encodes the acquired output data.

[0153] In this embodiment of the application, the output data can be encoded using an appropriate encoding method based on the needs of the actual application. For example, the output data can be encoded using a JSON array format, with the encoded format as [100, 200]; plain text format encoding can also be used. Typically, when the number of data is 1, plain text format encoding can be used.

[0154] If the configuration information contains data key-value pairs, the output data can be encoded according to the encoding format represented by the data key-value pairs. For example, encoding the output data using the JSON object format results in {"key1":100,"key2":200}.

[0155] Step 504: The IO scheduler sends a data transmission request message carrying output data to the point-to-point data service module connected to the external access unit.

[0156] In this step, a data sending request message (PUT message) carrying output data can be generated based on the URL of the "access" field in the configuration information above, and sent to the point-to-point data service module.

[0157] The data sending request message also includes this URL.

[0158] Step 505: After receiving the data sending request message, the point-to-point data service module retrieves the output data carried in it.

[0159] In this embodiment of the application, the point-to-point data service module can first determine whether the URL carried in the data sending request message meets the requirements, that is, whether it can be processed. If it does, it continues to execute the subsequent steps. If it does not meet the requirements, it can return an error code to the IO scheduler indicating that the URL does not meet the requirements, so that the IO scheduler can perform the corresponding processing.

[0160] Step 506: The point-to-point data service module uses the industrial protocol supported by the connected external access unit to forward the obtained output data to the connected external access unit.

[0161] Step 507: If the configuration information is of the input type, it means that input data needs to be requested from the external access unit based on the configuration information. The IO scheduler sends a data acquisition request message to the point-to-point data service module connected to the external access unit based on the configuration information.

[0162] In this step, a data retrieval request message (GET message) can be generated based on the URL of the "access" field in the configuration information above, and then sent to the peer-to-peer data service module.

[0163] A URL can be included in a data retrieval request message.

[0164] Step 508: After receiving the data acquisition request message, the point-to-point data service module obtains input data from the connected external access unit.

[0165] In this step, input data can be obtained from the connected external access unit based on the carried URL and using the industrial protocol supported by the external access unit.

[0166] In this embodiment of the application, the point-to-point data service module can first determine whether the URL carried in the data acquisition request message meets the requirements, that is, whether it can be processed. If it does, it continues to execute the subsequent steps. If it does not, it can return an error code indicating that the URL does not meet the requirements to the IO scheduler for the IO scheduler to perform the corresponding processing.

[0167] Step 509: The point-to-point data service module forwards the acquired input data to the IO scheduler.

[0168] Specifically, a request-response message carrying the input data can be sent to the I / O scheduler.

[0169] Step 510: After receiving the request-response message, the IO scheduler obtains the input data carried in it.

[0170] In this step, the IO scheduler can complete the data decoding according to the format indicated by "type" in configuration information 3. For example, if it is plain text format, it will complete the decoding of a single piece of data; if it is JSON array format, it will decode to obtain several pieces of data.

[0171] In this step, if the configuration information contains data key-value pairs, the structure represented by the data key-value pairs in the configuration information can also be decoded and the input data obtained.

[0172] Step 511: After determining that the acquired input data meets the data type and data quantity in the configuration information, the IO scheduler caches the acquired input data in the storage location indicated by the configuration information in the IO memory input area.

[0173] For example, the storage location of the first piece of data starts from the first address, and the storage location of the second piece of data is the first address plus the number of bytes occupied by the first piece of data.

[0174] The embodiments provided in this application are described above. Figure 5 The PLC data transmission method shown is based on a point-to-point data service module to realize data interaction with external access units. Furthermore, the PLC system can include multiple point-to-point data service modules, each used to support data interaction for various industrial protocols.

[0175] For the first-cycle data service module, embodiments of this application provide a PLC data transmission method, such as... Figure 6 As shown, it includes:

[0176] Step 601: The IO scheduler obtains the configuration information corresponding to the external access unit in the loaded IO configuration file. The external access unit is connected to the first cycle data service module.

[0177] In this step, we will use the following configuration information example four as an example for description:

[0178]

[0179] Based on the information in the above configuration example four, the storage location in the IO memory area is 1, the data type is "INT", one piece of data occupies 2 bytes in memory, the data quantity is 1, and the protocol information "shm2" in the URL can indicate that the data is exchanged with the first cycle data service module in the form of shared memory.

[0180] The shared memory approach can further include "static memory sharing" and "dynamic memory sharing," where:

[0181] For "static memory sharing", the URL can include information about the location of the data in the shared memory. For example, the URL format can be as follows:

[0182] [Protocol flag]: / / [Shared memory name] / [Offset location]

[0183] [Protocol flag]: / / [Shared memory name]?[Offset lookup]

[0184] For example: shm: / / shared-mem / 100, or shm: / / shared-mem?offset=100;

[0185] For "dynamic memory sharing," the URL does not contain the address of the data in shared memory. However, it can provide necessary information for the I / O scheduler to request the address query from the first-cycle data service module. For example, the URL can contain information such as the shared memory name, port, path, and query parameters. The URL format can be as follows:

[0186] [Protocol flag]: / / [Shared memory name]:port / path?[Offset lookup]

[0187] Example: shm2: / / shared-mem:5555 / ethercat?master=100&slave=1®=100;

[0188] This configuration information can be either an output type or an input type.

[0189] Step 602: The IO scheduler creates memory nodes (ANs) based on the configuration information. Each memory node (AN) can contain the following information:

[0190] URL: Obtained from the loaded configuration information;

[0191] LOC: The location in which input or output data is stored in shared memory.

[0192] In this embodiment of the application, if the protocol in the URL indicates "static memory sharing", its initial value can be obtained from the URL. If it indicates "dynamic memory sharing", its initial value can be set to an invalid value (such as -1) first, and then the LOC can be obtained through the LOC acquisition process.

[0193] In the LOC acquisition process, the IO scheduler can construct a memory location query request based on the URL and send it to the first cycle data service module. Based on the memory location query request, the first cycle data service module determines the storage location of the data exchanged with the connected external access unit in the shared memory, and carries the storage location in the memory location query response and returns it to the IO scheduler.

[0194] Furthermore, the version number V (representing the shared memory layout version) can also be returned simultaneously, and version number V can be added to the shared memory header. Correspondingly, if it is "dynamic memory sharing", the created memory node AN can also contain version number V. If version number V is consistent with version number V in the shared memory header, it means that the shared memory layout has not changed, and LOC also remains unchanged. Otherwise, it means that LOC has changed, and the LOC acquisition process needs to be re-executed, that is, a memory location query request is sent to the first cycle data service module.

[0195] Step 603: The IO scheduler periodically executes input data acquisition tasks or output data storage tasks based on the information in memory node AN.

[0196] The process for executing the input data acquisition task is as follows:

[0197] Step 1: Check if the shared memory object contained in the URL of the current memory node AN has been opened. If it has not been opened, attempt to open it and map it to the current process space. If opening fails, exit the execution of the current task.

[0198] Step 2: Acquire the synchronization lock in the shared memory header;

[0199] Step 3: Based on the LOC in memory node AN, obtain the input data from the external access unit from the storage location represented by the LOC in shared memory, and release the synchronization lock;

[0200] The input data is obtained periodically from the connected external access unit by the first-cycle data service module and cached in shared memory;

[0201] Step 4: Cache the acquired input data into the corresponding location in the IO memory input area according to the storage location indicated in the configuration information.

[0202] The process for executing the output data storage task is as follows:

[0203] Step 1: Check if the shared memory object contained in the URL of the current memory node AN has been opened. If it has not been opened, attempt to open it and map it to the current process space. If opening fails, exit the execution of the current task.

[0204] Step 2: Based on the storage location indicated in the configuration information, obtain the output data that needs to be sent to the external access unit connected to the first cycle data service module from the IO memory output area;

[0205] Step 3: Acquire the synchronization lock in the shared memory header;

[0206] Step 4: Based on the LOC in memory node AN, cache the output data to the storage location represented by the LOC in shared memory, and release the synchronization lock.

[0207] Step 604: After the first cycle data service module starts, it loads a private configuration, which is used to interact with the external access unit using an industrial protocol supported by the connected external access unit.

[0208] Step 605: The first cycle data service module creates shared memory.

[0209] Shared memory can consist of a header area and a data area. The header area may contain a length synchronization lock for the data area, while the data area is used to store data for interaction with external access units.

[0210] Based on the above description, when using "dynamic memory sharing", the header area can also include the version number V of the memory layout version.

[0211] Step 606: The first cycle data service module periodically executes input data storage tasks or output data acquisition tasks.

[0212] The process for executing the input data storage task is as follows:

[0213] Step 1: Obtain input data from the external access unit using the industrial protocol supported by the connected external access unit;

[0214] Step 2: Acquire the synchronization lock in the shared memory header;

[0215] Step 3: Cache the acquired input data in the corresponding location in shared memory and release the synchronization lock.

[0216] The process for executing the output data acquisition task is as follows:

[0217] Step 1: Acquire the synchronization lock in the shared memory header;

[0218] The second step is to retrieve the output data that needs to be sent to the external access unit from the corresponding location in the shared memory. This output data is stored in the shared memory by the IO scheduler, and the synchronization lock is released.

[0219] Step 3: Using the industrial protocol supported by the connected external access unit, forward the acquired output data to the connected external access unit.

[0220] The execution order of steps 601-603 and 604-606 follows the logical sequence between the steps, rather than strictly following the order described above.

[0221] The embodiments provided in this application are described above. Figure 6 The PLC data transmission method shown is based on the first cycle data service module and shared memory to realize data interaction with external access units. Furthermore, the PLC system may include multiple first cycle data service modules, which are used to support data interaction of various industrial protocols.

[0222] For the second-cycle data service module, embodiments of this application provide a PLC data transmission method, such as... Figure 7 As shown, it includes:

[0223] Step 701: The IO scheduler obtains the configuration information corresponding to the external access unit in the loaded IO configuration file. The external access unit is connected to the second cycle data service module.

[0224] In this step, we will use the following configuration information example five as an example for description:

[0225]

[0226] Based on the information in configuration information five above, the storage location in the IO memory area is 10, the data type is "DINT", one piece of data occupies 4 bytes in memory, the data quantity is 1, and the protocol information "redis" in the URL can indicate that the data is exchanged with the second cycle data service module in a database manner.

[0227] For databases, the URL can also include the database's IP address and port number, as well as the data's key-value pairs. For example, the URL format can be as follows:

[0228] [Protocol Marker]: / / [Database IP]:Port / [Data Key Value]

[0229] Example: redis: / / 192.168.1.11:6666 / 1 / 1 / 1.

[0230] Step 702: The IO scheduler creates memory nodes (ANs) based on the configuration information. Each memory node (AN) can contain the following information:

[0231] URL: Obtained from the loaded configuration information;

[0232] The connection information for memory data can also be obtained from the configuration information.

[0233] Step 703: The IO scheduler periodically executes input data acquisition tasks or output data storage tasks based on the information in memory node AN.

[0234] The process for executing the input data acquisition task is as follows:

[0235] Step 1: Check if the database pointed to by the URL in the current memory node AN is already connected. If not, attempt to connect. If the connection fails, exit the execution of the current task.

[0236] Step 2: Use the data key-value pairs in the URL of the memory node AN to retrieve the input data from the external access unit from the database;

[0237] The input data is periodically obtained from the connected external access unit by the second-cycle data service module and cached in the database;

[0238] Step 3: Cache the acquired input data into the corresponding location in the IO memory input area according to the storage location indicated in the configuration information.

[0239] The process for executing the output data storage task is as follows:

[0240] Step 1: Check if the database pointed to by the URL in the current memory node AN is already connected. If not, attempt to connect. If the connection fails, exit the execution of the current task.

[0241] Step 2: Based on the storage location indicated in the configuration information, obtain the output data that needs to be sent to the external access unit connected to the second cycle data service module from the IO memory output area;

[0242] Step 3: Cache the output data in the corresponding location in the database according to the data key value in the URL of the memory node AN.

[0243] Step 704: After the second cycle data service module is started, it loads a private configuration, which is used to interact with the external access unit using an industrial protocol supported by the connected external access unit.

[0244] Step 705: The second-cycle data service module establishes a network connection with the database.

[0245] Step 706: The second-cycle data service module periodically executes input data storage tasks or output data acquisition tasks.

[0246] The process for executing the input data storage task is as follows:

[0247] Step 1: Obtain input data from the external access unit using the industrial protocol supported by the connected external access unit;

[0248] Step 2: Cache the obtained input data into the corresponding data key in the database.

[0249] The process for executing the output data acquisition task is as follows:

[0250] Step 1: Retrieve the output data that needs to be sent to the external access unit from the corresponding data key value in the database. This output data is stored in the database by the IO scheduler.

[0251] Step 2: Using the industrial protocol supported by the connected external access unit, forward the acquired output data to the connected external access unit.

[0252] The execution order of steps 701-703 and 704-706 is based on the logic between the steps, and is not strictly in the order described above.

[0253] The embodiments provided in this application are described above. Figure 7 The PLC data transmission method shown is based on a second-cycle data service module and a database to realize data interaction with external access units. Furthermore, the PLC system may include multiple second-cycle data service modules, each used to support data interaction for various industrial protocols.

[0254] Based on the same inventive concept, and according to the PLC data transmission method applied to an IO scheduler provided in the above embodiments of this application, another embodiment of this application also provides a PLC data transmission device applied to an IO scheduler in a PLC system. The PLC system further includes an IO memory area and a data service module. The data service module is connected to an external access unit. The IO scheduler loads configuration information corresponding to the external access unit. The IO memory area is used to cache data exchanged between the IO scheduler and the external access unit. Its structural schematic diagram is shown below. Figure 8 As shown, it specifically includes:

[0255] The configuration information acquisition module 81 is used to acquire configuration information corresponding to the external access unit;

[0256] The data interaction module 82 is used to perform message interaction with the data service module connected to the external access unit based on the acquired configuration information and according to the preset scheduling strategy, so that the data service module uses the industrial protocol supported by the connected external access unit to interact with the connected external access unit.

[0257] Furthermore, the configuration information corresponding to the external access unit includes: data caching information and access information;

[0258] The data interaction module 82 is also used to obtain output data that needs to be sent to the external access unit from the IO memory area based on the data cache information, or to cache input data from the external access unit into the IO memory area.

[0259] Specifically, it is used to perform message interaction with the data service module connected to the external access unit based on the access information, according to a preset scheduling strategy and the access method represented by the access information.

[0260] Furthermore, the data caching information includes: the storage location and data type of the IO memory area, and also includes: the data quantity and / or data key-value pairs; the access information is a URL.

[0261] Furthermore, the IO memory area includes an IO memory input area and an IO memory output area. The IO memory input area is used to cache data from external access units, and the IO memory output area is used to cache data to be sent to external access units.

[0262] Furthermore, the data service module includes at least one of the following service modules:

[0263] Point-to-point data service module, first-cycle data service module and second-cycle data service module;

[0264] When the first-cycle data service module is included, the system also includes shared memory;

[0265] When the second-cycle data service module is included, the system also includes a database;

[0266] The data interaction module 82 is specifically used to send a data acquisition request message to the point-to-point data service module when it needs to acquire data from an external access unit connected to the point-to-point data service module, so that the point-to-point data service module acquires input data from the connected external access unit after receiving the data acquisition request message, and forwards the acquired input data to the IO scheduler.

[0267] When it is necessary to send data to an external access unit connected to the point-to-point data service module, the output data to be sent is obtained from the IO memory area, and a data sending request message carrying the output data is sent to the point-to-point data service module. After receiving the data sending request message, the point-to-point data service module obtains the output data and forwards the obtained output data to the connected external access unit.

[0268] After receiving the input data sent by the point-to-point data service module, the input data is cached in the IO memory area;

[0269] The system periodically retrieves output data from the IO memory area that needs to be sent to the external access unit connected to the first periodic data service module, caches the output data in the shared memory, so that the first periodic data service module periodically retrieves the output data from the shared memory and forwards the retrieved output data to the connected external access unit.

[0270] The system periodically retrieves input data from the shared memory and caches the input data in the IO memory area. The input data in the shared memory is retrieved periodically from the connected external access unit by the first periodic data service module and cached in the shared memory.

[0271] The system periodically retrieves output data from the IO memory area that needs to be sent to an external access unit connected to the second periodic data service module, caches the output data in the database, and enables the second periodic data service module to periodically retrieve the output data from the database and forward the retrieved output data to the connected external access unit.

[0272] The system periodically retrieves input data from the database and caches the input data in the IO memory area. The input data in the database is retrieved periodically from the connected external access unit and cached in the database by the second periodic data service module.

[0273] Furthermore, the data interaction module 82 is also used to send a memory location query request to the first periodic data service module; and to receive the storage location in the shared memory of the data interacted with the connected external access unit, returned by the first periodic data service module after receiving the memory location query request.

[0274] Furthermore, the data interaction module 82 is also used to obtain a version number representing the shared memory layout version from the header area of ​​the shared memory before sending the memory location query request to the first periodic data service module. If the obtained version number is inconsistent with the version number previously returned by the first periodic data service module, the step of sending the memory location query request to the first periodic data service module is executed.

[0275] The system receives the updated version number of the shared memory layout version returned by the first periodic data service module after receiving the memory location query request. The updated version number is the updated version number of the shared memory layout version stored in the header area of ​​the shared memory after the first periodic data service module updates the shared memory layout version.

[0276] Based on the same inventive concept, and according to the PLC data transmission method applied to a data service module provided in the above embodiments of this application, another embodiment of this application also provides a PLC data transmission device applied to a data service module in a PLC system. The PLC system further includes an I / O scheduler and an I / O memory area. The data service module is connected to an external access unit. The I / O scheduler loads configuration information corresponding to the external access unit. The I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit. Its structural diagram is shown below. Figure 9 As shown, it specifically includes:

[0277] The first data interaction module 91 is used to perform message interaction with the IO scheduler;

[0278] The second data interaction module 92 is used to interact with the connected external access unit using an industrial protocol supported by the connected external access unit.

[0279] Furthermore, the data service module is a point-to-point data service module;

[0280] The first data interaction module 91 is specifically used to receive a data acquisition request message sent by the IO scheduler when it needs to obtain data from an external access unit connected to the point-to-point data service module.

[0281] The second data interaction module 92 is specifically used to obtain input data from the connected external access unit after receiving a data acquisition request message;

[0282] The first data interaction module 91 is also used to forward the acquired input data to the IO scheduler, so that the IO scheduler caches the input data in the IO memory area after receiving the input data.

[0283] The first data interaction module 91 is specifically used to receive a data transmission request message carrying output data sent by the IO scheduler when it needs to send data to an external access unit connected to the point-to-point data service module. The output data is the output data that the IO scheduler needs to send obtained from the IO memory area.

[0284] The second data interaction module 92 is specifically used to obtain the output data carried in the data sending request message after receiving it, and to forward the obtained output data to the connected external access unit.

[0285] Furthermore, the data service module is a first-cycle data service module, and the system also includes shared memory;

[0286] The first data interaction module 91 is specifically used to periodically obtain output data from the shared memory;

[0287] The second data interaction module 92 is specifically used to forward the obtained output data to the connected external access unit. The output data is the data that the IO scheduler obtains from the IO memory area in the IO cycle and needs to be sent to the external access unit connected to the first cycle data service module, and is cached in the shared memory.

[0288] The second data interaction module 92 is also used to periodically obtain input data from the connected external access unit;

[0289] The first data interaction module 91 is further configured to cache the input data in the shared memory, so that the IO scheduler periodically retrieves the input data from the shared memory and caches the input data in the IO memory area.

[0290] Furthermore, the first data interaction module 91 is also used to receive the memory location query request sent by the IO scheduler; and to return to the IO scheduler the storage location of the data interacted with the connected external access unit in the shared memory.

[0291] Furthermore, the memory location query request is sent by the IO scheduler when the version number representing the shared memory layout version obtained from the header area of ​​the shared memory is inconsistent with the version number returned by the first periodic data service module.

[0292] The first data interaction module 91 is further configured to store the updated version number of the shared memory layout in the header area of ​​the shared memory after updating the shared memory layout version; and to return the updated version number of the shared memory layout to the IO scheduler after receiving the memory location query request.

[0293] Furthermore, the data service module is a second-cycle data service module, and the system also includes a database;

[0294] The first data interaction module 91 is specifically used to periodically obtain output data from the database;

[0295] The second data interaction module 92 is specifically used to forward the obtained output data to the connected external access unit. The output data is the data that the IO scheduler obtains from the IO memory area periodically, needs to be sent to the external access unit connected to the second periodic data service module, and is cached in the database.

[0296] The second data interaction module 92 is specifically used to periodically obtain input data from the connected external access unit;

[0297] The first data interaction module 91 is specifically used to cache the input data in the database, so that the IO scheduler periodically retrieves the input data from the database and caches the input data in the IO memory area.

[0298] The functions of the above modules can be corresponding to Figures 1 to 7 The corresponding processing steps in the process shown.

[0299] The PLC data transmission device described in the embodiments of this application can be implemented by a computer program. Those skilled in the art should understand that the above-described module division method is only one of many module division methods. Whether it is divided into other modules or not divided into modules, as long as the PLC data transmission device has the above-described functions, it should be within the protection scope of this application.

[0300] This application also provides an electronic device, such as... Figure 10 As shown, it includes a processor 101 and a machine-readable storage medium 102. The machine-readable storage medium 102 stores machine-executable instructions that can be executed by the processor 101. The processor 101 is prompted by the machine-executable instructions to: implement any of the above-mentioned PLC data transmission methods applied to the IO scheduler, or implement any of the above-mentioned PLC data transmission methods applied to the data service module.

[0301] This application also provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements any of the above-mentioned PLC data transmission methods applied to an IO scheduler, or implements any of the above-mentioned PLC data transmission methods applied to a data service module.

[0302] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute any of the above-described PLC data transmission methods applied to an IO scheduler, or to execute any of the above-described PLC data transmission methods applied to a data service module.

[0303] The machine-readable storage medium in the aforementioned electronic device may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0304] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0305] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of devices, electronic devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0306] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0307] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A PLC system, characterized in that, include: The system includes an I / O scheduler, an I / O memory area, and a data service module. The data service module is connected to an external access unit. The I / O scheduler is loaded with configuration information corresponding to the external access unit. The data service module includes a first-cycle data service module. The system also includes shared memory, wherein: The IO memory area is used to cache the data exchanged between the IO scheduler and the external access unit; The IO scheduler is used to periodically retrieve output data that needs to be sent to the external access unit connected to the first periodic data service module from the IO memory area based on the configuration information corresponding to the external access unit, and cache the output data in the shared memory. The first periodic data service module is used to periodically obtain the output data from the shared memory and forward the obtained output data to the connected external access unit using an industrial protocol supported by the connected external access unit; and to periodically obtain input data from the connected external access unit using an industrial protocol supported by the connected external access unit and cache the input data in the shared memory. The I / O scheduler is also used to periodically retrieve the input data from the shared memory and cache the input data in the I / O memory area.

2. The system as described in claim 1, characterized in that, Configuration information corresponding to the external access unit includes: data caching information and access information; The IO scheduler is configured to, based on the data caching information, retrieve output data that needs to be sent to the external access unit from the IO memory area, or cache input data from the external access unit in the IO memory area; and specifically, to periodically retrieve output data that needs to be sent to the external access unit connected to the first periodic data service module from the IO memory area according to the access method indicated by the access information, cache the output data in the shared memory, and periodically retrieve the input data from the shared memory, cache the input data in the IO memory area.

3. The system as described in claim 2, characterized in that, The data caching information includes: the storage location and data type of the IO memory area, and also includes: the data quantity and / or data key-value pairs; The access information is a URL.

4. The system as described in claim 1, characterized in that, The IO memory area includes an IO memory input area and an IO memory output area. The IO memory input area is used to cache data from external access units, and the IO memory output area is used to cache data to be sent to external access units.

5. The system as described in claim 1, characterized in that, The data service module also includes a second-cycle data service module; The system also includes: a database; The IO scheduler is also used to periodically retrieve output data that needs to be sent to an external access unit connected to the second periodic data service module from the IO memory area, and cache the output data in the database; The second periodic data service module is used to periodically retrieve the output data from the database and forward the retrieved output data to the connected external access unit; and to periodically retrieve the input data from the connected external access unit and cache the input data in the database; The IO scheduler is also used to periodically retrieve the input data from the database and cache the input data in the IO memory area.

6. The system as described in claim 1, characterized in that, The IO scheduler is also used to send a memory location query request to the first periodic data service module, and to receive the storage location in the shared memory of the data interacted with the connected external access unit returned by the first periodic data service module. The first periodic data service module is also used to return the storage location of the data interacted with the connected external access unit in the shared memory to the IO scheduler after receiving the memory location query request.

7. The system as described in claim 6, characterized in that, The IO scheduler is further configured to obtain a version number representing the shared memory layout version from the header area of ​​the shared memory before sending the memory location query request to the first periodic data service module. If the obtained version number is inconsistent with the version number previously returned by the first periodic data service module, the step of sending the memory location query request to the first periodic data service module is executed. The first periodic data service module is further configured to store the updated version number of the shared memory layout in the header area of ​​the shared memory after updating the shared memory layout version; and to return the updated version number of the shared memory layout to the IO scheduler after receiving the memory location query request.

8. A PLC data transmission method, characterized in that, An I / O scheduler is applied in a PLC system. The PLC system further includes an I / O memory area and a data service module. The data service module is connected to an external access unit and includes a first-cycle data service module. The system also includes shared memory. The I / O scheduler is loaded with configuration information corresponding to the external access unit. The I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit. The method includes: Obtain the configuration information corresponding to the external access unit; Based on the acquired configuration information, the system periodically retrieves output data that needs to be sent to the external access unit connected to the first periodic data service module from the IO memory area, caches the output data in the shared memory, so that the first periodic data service module periodically retrieves the output data from the shared memory, and forwards the retrieved output data to the connected external access unit using the industrial protocol supported by the connected external access unit. Based on the acquired configuration information, input data is periodically retrieved from the shared memory and cached in the IO memory area. The input data in the shared memory is obtained periodically from the connected external access unit using an industrial protocol supported by the first periodic data service module and cached in the shared memory.

9. The method as described in claim 8, characterized in that, Configuration information corresponding to the external access unit includes: data caching information and access information; The method further includes: Based on the data caching information, the output data that needs to be sent to the external access unit is obtained from the IO memory area, or the input data from the external access unit is cached in the IO memory area; Based on the acquired configuration information, periodically retrieving output data that needs to be sent to the external access unit connected to the first periodic data service module from the IO memory area, and caching the output data in the shared memory, includes: According to the access method indicated by the access information, the output data that needs to be sent to the external access unit connected to the first periodic data service module is periodically obtained from the IO memory area, and the output data is cached in the shared memory; The step of periodically retrieving input data from the shared memory based on the acquired configuration information and caching the input data in the IO memory area includes: According to the access method indicated by the access information, input data is periodically retrieved from the shared memory and cached in the IO memory area.

10. The method as described in claim 9, characterized in that, The data caching information includes: the storage location and data type of the IO memory area, and also includes: the data quantity and / or data key-value pairs; The access information is a URL.

11. The method as described in claim 8, characterized in that, The IO memory area includes an IO memory input area and an IO memory output area. The IO memory input area is used to cache data from external access units, and the IO memory output area is used to cache data to be sent to external access units.

12. The method as described in claim 8, characterized in that, The data service module also includes a second-cycle data service module; The system also includes a database; The method further includes: The system periodically retrieves output data from the IO memory area that needs to be sent to an external access unit connected to the second periodic data service module, caches the output data in the database, and enables the second periodic data service module to periodically retrieve the output data from the database and forward the retrieved output data to the connected external access unit. Input data is periodically retrieved from the database and cached in the IO memory area. The input data in the database is periodically retrieved from the connected external access unit and cached in the database by the second periodic data service module.

13. The method as described in claim 8, characterized in that, Also includes: Send a memory location query request to the first periodic data service module; The first periodic data service module receives the memory location query request and returns the storage location in the shared memory of the data interacted with the connected external access unit.

14. The method as described in claim 13, characterized in that, Before sending the memory location query request to the first periodic data service module, the method further includes: Obtain the version number representing the shared memory layout version from the header area of ​​the shared memory. If the obtained version number is inconsistent with the version number returned by the first periodic data service module, then execute the step of sending a memory location query request to the first periodic data service module. The system receives the updated version number of the shared memory layout version returned by the first periodic data service module after receiving the memory location query request. The updated version number is the updated version number of the shared memory layout version stored in the header area of ​​the shared memory after the first periodic data service module updates the shared memory layout version.

15. A PLC data transmission method, characterized in that, A data service module applied in a PLC system, wherein the data service module is a first-cycle data service module, the PLC system further includes an I / O scheduler, an I / O memory area, and shared memory, the data service module is connected to an external access unit, the I / O scheduler is loaded with configuration information corresponding to the external access unit, and the I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit, the method comprising: The system periodically retrieves output data from the shared memory and forwards the retrieved output data to the connected external access unit using an industrial protocol supported by the connected external access unit. The output data is the data that the IO scheduler periodically retrieves from the IO memory area and needs to be sent to the external access unit connected to the first periodic data service module, and is cached in the shared memory. Using an industrial protocol supported by a connected external access unit, input data is periodically retrieved from the connected external access unit and cached in the shared memory, so that the IO scheduler periodically retrieves the input data from the shared memory and caches the input data in the IO memory area.

16. The method as described in claim 15, characterized in that, Also includes: Receive the memory location query request sent by the IO scheduler; The I / O scheduler returns the storage location in the shared memory of the data interacted with by the connected external access unit.

17. The method as described in claim 16, characterized in that, The memory location query request is sent by the IO scheduler when the version number representing the shared memory layout version obtained from the header area of ​​the shared memory is inconsistent with the version number returned by the first periodic data service module. The method further includes: After updating the shared memory layout version, the updated version number of the shared memory layout version is stored in the header area of ​​the shared memory. After receiving the memory location query request, the system also returns the updated version number of the shared memory layout version to the IO scheduler.

18. A PLC data transmission device, characterized in that, An I / O scheduler applied in a PLC system, the PLC system further including an I / O memory area and a data service module, the data service module being connected to an external access unit, the data service module including a first-cycle data service module, the system further including shared memory, the I / O scheduler loading configuration information corresponding to the external access unit, the I / O memory area being used to cache data exchanged between the I / O scheduler and the external access unit, the device comprising: The configuration information acquisition module is used to acquire configuration information corresponding to the external access unit; The data interaction module is used to periodically obtain output data that needs to be sent to the external access unit connected to the first periodic data service module from the IO memory area, cache the output data in the shared memory, so that the first periodic data service module periodically obtains the output data from the shared memory, and forwards the obtained output data to the connected external access unit using the industrial protocol supported by the connected external access unit. Based on the acquired configuration information, input data is periodically retrieved from the shared memory and cached in the IO memory area. The input data in the shared memory is obtained periodically from the connected external access unit using an industrial protocol supported by the first periodic data service module and cached in the shared memory.

19. A PLC data transmission device, characterized in that, A data service module applied in a PLC system, wherein the data service module is a first-cycle data service module, the PLC system further includes an I / O scheduler, an I / O memory area, and shared memory, the data service module is connected to an external access unit, the I / O scheduler is loaded with configuration information corresponding to the external access unit, and the I / O memory area is used to cache data exchanged between the I / O scheduler and the external access unit, the device comprising: The first data interaction module is used to periodically obtain output data from the shared memory. This output data is data that the IO scheduler periodically obtains from the IO memory area and needs to be sent to an external access unit connected to the first periodic data service module, and is cached in the shared memory. The second data interaction module is used to forward the acquired output data to the connected external access unit using an industrial protocol supported by the connected external access unit; and to periodically acquire input data from the connected external access unit using an industrial protocol supported by the connected external access unit. The first data interaction module is further configured to cache the input data in the shared memory, so that the IO scheduler periodically retrieves the input data from the shared memory and caches the input data in the IO memory area.

20. An electronic device, characterized in that, The device includes a processor and a machine-readable storage medium storing machine-executable instructions that can be executed by the processor, the processor being prompted by the machine-executable instructions to: implement the method of any one of claims 8-14, or implement the method of any one of claims 15-17.

21. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 8-14, or implements the method of any one of claims 15-17.

Citation Information

Patent Citations

  • Equipment communication protocol converter

    CN111698268A

  • Memory database access method, device and system, server and storage medium

    CN114357046A