Method and system for dynamically expanding IO equipment control through PLC

By abstracting field devices into an OPC UA information model and utilizing a three-tier architecture to achieve dynamic expansion of I/O device control in the PLC system, the adaptability of the PLC controller in the face of equipment changes and business requirement adjustments is solved, thereby improving the system's flexibility and efficiency.

CN121209409APending Publication Date: 2025-12-26CHINA UNICOM (GUANGDONG) IND INTERNET CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511397533.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2025-12-26

AI Technical Summary

Technical Problem

Existing PLC controllers are unable to dynamically adapt to equipment changes and business needs adjustments, resulting in longer system debugging cycles, reduced production efficiency, and even potential equipment failures and safety accidents.

Method used

The PLC dynamic expansion I/O device control method is adopted. The field devices are abstracted into OPC UA information models through device agents, which monitor business needs in real time, automatically update control logic, and realize plug-and-play and automatic configuration of devices using a three-layer architecture.

Benefits of technology

It enables the PLC system to dynamically adapt to equipment changes and business needs adjustments, reduces manual configuration workload, improves the efficiency of adding or changing equipment, and ensures the flexibility and sustainability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121209409A_ABST
    Figure CN121209409A_ABST
Patent Text Reader

Abstract

The invention discloses a PLC (Programmable Logic Controller) dynamic extension IO (Input / Output) equipment control method, which comprises a registration stage, a system planning and configuration stage and a control execution stage, and is characterized in that equipment is abstracted into an information model by an equipment agent, and a registration request is sent to an equipment manager; the equipment manager sends an equipment resource updating notice to the PLC IDE, the PLC IDE adds new equipment and function blocks according to the notice, when a service demand change is monitored, available equipment resources are obtained, an application program is generated and issued to the PLC RTE, a mapping table is generated and issued to the equipment manager, the equipment manager carries out configuration, the PLC RTE initializes the application program, and a circular scanning mode is entered; and the system is updated next time. The PLC dynamic connection expansion I / O equipment control method provided by the invention not only ensures stable operation of the system, but also realizes dynamic control by controlling an execution closed loop, and provides a technical solution for rapid deployment of equipment and dynamic reconstruction of a production line in an intelligent manufacturing scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of industrial automation control systems, and more particularly, to a method and system for dynamically expanding IO device control of a PLC. BACKGROUND

[0002] Industrial automation control systems usually use PLC controllers to control field devices such as sensors and actuators. PLCs can accurately receive sensor signals and quickly and reliably control actuator actions according to pre-set programs, ensuring stable and efficient operation of production processes and adapting to complex industrial environments. However, during industrial automation, there are often problems such as dynamic changes in business requirements and device replacement. Changes in business requirements may cause the control logic, data acquisition range, or production rhythm of the original automation system to deviate from actual requirements, requiring frequent adjustments to PLC programs or reconstruction of control architectures. Device replacement may cause interface protocol incompatibility (such as differences in communication protocols between new and old devices), control logic conflicts (such as inconsistencies between the response characteristics of new devices and the original system logic), and other problems. These problems may cause the system debugging period to be extended, production efficiency to be reduced, devices to fail, production to be interrupted, and even safety accidents, while increasing additional modification costs and technical adaptation difficulties, seriously affecting the flexibility and sustainability of the automation system.

[0003] There are three existing solutions for PLC controllers to control field devices: traditional PLC centralized control, industrial Internet of Things platforms, and OPC UA gateways. Traditional PLC control systems connect devices through industrial buses or industrial real-time Ethernet, and the control logic of the devices is fixed in the PLC. Devices and PLCs communicate based on a special protocol, and expansion requires downtime deployment and reprogramming. Industrial Internet of Things platforms use MQTT / HTPP protocols to implement device cloud access, but lack standardized semantic modeling, have poor device interoperability, and rely on cloud-based centralized control, which lacks real-time edge-side control. The OPC UA gateway solution converts device raw data to OPC UA nodes through a hardware gateway, but is limited to static information models and requires manual intervention in the modeling process, such as reconfiguring gateway parameters for new devices, which cannot support dynamic device access and control logic reconstruction. The gateway only implements data acquisition and has high hardware costs.

[0004] Therefore, there is an urgent need for a new method for PLC controllers to control field devices that can detect devices in real time, update device information in a timely manner, monitor business requirements, and automatically update control logic according to changes in requirements to adapt to device changes and business requirement adjustments. SUMMARY

[0005] The present application aims to overcome at least one of the defects in the prior art, and provides a PLC dynamic expansion IO device control method, which is used to solve the problem that the prior art is difficult to dynamically adapt to device changes and business demand adjustment.

[0006] The technical scheme adopted by the present application is a PLC dynamic expansion IO device control method, which includes three stages, namely a registration stage, a system planning and configuration stage, and a control execution stage, the registration stage is a process of dynamically registering new devices, the system planning and configuration stage is a process of configuring new devices and generating application programs and mapping tables for new devices, and the control execution stage is a process of executing application programs, the registration stage, the system planning and configuration stage, and the control execution stage are executed in sequence. The steps of the registration stage include: Step S1, when a new device is accessed, the device agent detects and abstracts the device into an OPC UA information model; Step S2, the device agent sends a registration request to the device manager; Step S3, the device manager receives the registration request and updates the OPC UA information model and the aggregated address space in the device registration list; Step S4, after registration is completed, the device manager sends a device resource update notification to a PLC development environment, i.e., a PLC IDE; Step S5, the PLC IDE receives the device resource update notification, and updates the device function block library according to the device information in the device resource update notification; Step S6, the device agent regularly updates the time of the last communication between the device agent and the device manager, and maintains the communication state; Step S7, the device manager monitors the time of the last communication with the device agent in real time to monitor the device state, and if no heartbeat is received for a long time, the state of the device in the registration list is updated, and a device exception event is triggered.

[0007] The device is abstracted into an information model by the device agent, which can be compatible with different protocols and different types of devices, and the device agent is dynamically registered with the device manager, which reduces the workload of manually adding or updating devices and improves the efficiency of device addition or change.

[0008] In order to realize automatic configuration of devices, the steps of the system planning and configuration stage include: Step T1, the PLC IDE monitors business demand in real time, and when a change in business demand is monitored, the registration list and the aggregated address space of the device manager are browsed to obtain currently available device resources; Step T2, based on the device resources, selecting and instantiating the control function block corresponding to the device from the function block library, and writing control logic according to the business requirements, generating an application program conforming to the IEC61131-3 standard; at the same time, the PLC IED automatically generates a mapping table, which records the correspondence between the variables and methods of the application program and the nodes in the device agent; Step T3, the PLC IDE issues the application program to the PLC RTE and issues the mapping table to the device manager; Step T4, the device manager parses the mapping table and maps the variables and methods in the application program to the nodes of the device agent.

[0009] Through real-time monitoring of business requirements by the PLC IDE, available devices are found according to the requirements, the devices are controlled, an application program is generated to meet the business requirements, and is issued to the PLC RTE for execution, while a mapping table is generated and issued to realize automatic configuration of the device, avoiding the need for downtime and redeployment during configuration.

[0010] In order to obtain device data, the steps of the control execution phase include: Step Q1, the PLC RTE loads and activates the application program; Step Q2, in the application initialization phase, the PLC RTE connects the device manager and establishes a session; Step Q3, after initialization, the PLC RTE enters a loop scanning mode; Step Q4, the PLC RTE periodically executes control tasks until the next system reconstruction.

[0011] The PLC RTE connects the device manager to establish a session, and indirectly connects between the device agent through the device manager to obtain the data and methods of the device, thereby executing the application.

[0012] In order to continuously control the device, the loop scanning mode includes an input sampling, program execution and output scanning phase; In the input sampling phase, the PLC RTE requests the device variable node value from the device manager, and updates the variable value to the internal input image table; In the program execution phase, the PLC RTE executes the control logic and calls the method node of the device; after the device agent accepts the request, it controls the underlying device to perform the corresponding operation; after the device performs the operation, it feeds back the new state and data to the device agent, which updates its node value; In the output refresh phase, the PLC RTE writes the control result to the variable node of the device through the device manager, updating the data of the device.

[0013] Each operation of the device has the possibility to affect the state or data of the device, by continuous sampling, execution and output, the state and data of the device can be obtained in real time, and the communication state of the device can be monitored.

[0014] In order to facilitate management, the OPC UA information model follows the "OPC 30000: PLC Model based on IEC61131-3 companion specification".

[0015] By standardizing the information model, the device manager can integrate the information model into a unified address space, and provide a unified information model access interface for the PLC IDE, which is independent of the device bottom protocol and type.

[0016] In order to facilitate management and adjustment of the system, a PLC dynamic expansion IO device control system is constructed based on the above-mentioned PLC dynamic expansion IO device control method, adopts a three-layer architecture, including an application planning layer, a management and control layer and an execution layer, the application planning layer integrates a PLC IDE, is responsible for application program development, device resource browsing and configuration generation; the management and control layer is composed of a device manager and a PLC RTE, the device manager interacts with the PLC IDE and the device agent, and configures node access between the PLC RTE and the device agent; the PLC RTE loads and executes the application program issued by the PLC IDE, indirectly establishes connection with the device agent according to the configuration of the device manager, and accesses device data and device methods; the execution layer is composed of field devices and device agents; the device agent abstracts the attributes and functions of the device into an OPC UA information model, displays device data and functions to the device manager, and interacts with the management and control layer.

[0017] By dividing the system into three layers of architecture, application planning layer, management and control layer and execution layer, each architecture layer is responsible for a specific duty, so that the system architecture is clear, the function is clear, and the later management and adjustment are facilitated.

[0018] In order to enable the PLC IDE to realize the functions of program development, device resource acquisition and configuration generation, the PLC IDE includes an application editor, a device resource browser, a function block library, a mapping table generator and an OPC UA client, the application editor is used for developing application programs; the device resource browser is used for browsing the registration list of the device manager; the function block library is used for instantiating the function blocks of the device; the mapping table generator is used for generating a mapping table, and the OPC UA client is used for communicating with the device manager, acquiring device resources and OPC UA information model, issuing application programs and mapping tables.

[0019] The PLC IDE integrates an application editor, a device resource browser, a function block library, a mapping table generator and an OPC UA client, realizes monitoring business requirements, instantiates device function blocks according to the business requirements, generates a mapping table corresponding to the application program and the device, and issues the application program and the mapping table.

[0020] In order to enable the management and control layer to realize the function of automatically configuring the device, the device manager comprises an OPC UA server, a configuration manager, a device aggregator, a discovery server and an OPC UA client, the OPC UA server is used for interacting with the PLC IDE and the device agent, configuring node access between the PLC RTE and the device agent; the configuration manager is used for parsing the mapping table, coordinating connection configuration of the PLC RTE and the device agent; the device aggregator is used for aggregating the information model of the device agent, and providing a unified device model access interface; the discovery server is used for managing registration and deregistration of the device agent, and monitoring the device state; the OPC UA client is used for establishing connection with the device agent, receiving exception events and updating the state of the device object.

[0021] The device manager realizes interaction with the device agent through the OPC UA server, the configuration manager, the device aggregator, the discovery server and the OPC UA client, receives registration or deregistration requests sent by the device agent in real time, and monitors the communication state with the device; aggregates the information model to a unified address space and provides a unified access interface for the PLC IDE, parses the mapping table issued by the PLC IDE and configures node access of the PLC RTE and the device agent.

[0022] In order to enable the management and control layer to realize the function of automatically configuring the device, the device manager comprises an OPC UA server, a configuration manager, a device aggregator, a discovery server and an OPC UA client, the OPC UA server is used for interacting with the PLC IDE and the device agent, configuring node access between the PLC RTE and the device agent; the configuration manager is used for parsing the mapping table, coordinating connection configuration of the PLC RTE and the device agent; the device aggregator is used for aggregating the information model of the device agent, and providing a unified device model access interface; the discovery server is used for managing registration and deregistration of the device agent, and monitoring the device state; the OPC UA client is used for establishing connection with the device agent, receiving exception events and updating the state of the device object.

[0023] The device manager realizes interaction with the device agent through the OPC UA server, the configuration manager, the device aggregator, the discovery server and the OPC UA client, receives registration or deregistration requests sent by the device agent in real time, and monitors the communication state with the device; aggregates the information model to a unified address space and provides a unified access interface for the PLC IDE, parses the mapping table issued by the PLC IDE and configures node access of the PLC RTE and the device agent.

[0024] In order to enable the management and control layer to realize the function of automatically configuring the device, the device manager comprises an OPC UA server, a configuration manager, a device aggregator, a discovery server and an OPC UA client, the OPC UA server is used for interacting with the PLC IDE and the device agent, configuring node access between the PLC RTE and the device agent; the configuration manager is used for parsing the mapping table, coordinating connection configuration of the PLC RTE and the device agent; the device aggregator is used for aggregating the information model of the device agent, and providing a unified device model access interface; the discovery server is used for managing registration and deregistration of the device agent, and monitoring the device state; the OPC UA client is used for establishing connection with the device agent, receiving exception events and updating the state of the device object.

[0025] The device agent abstracts the device into an information model through the OPC UA server, the device information model and the protocol adapter, and provides the data and functions of the device for the device manager and the PLC RTE.

[0026] Compared with the prior art, the application has the following beneficial effects: Solve the problem that the prior art is difficult to dynamically adapt to device changes and business demand adjustments 1. Dynamically adapt to new devices or changed devices The device agent abstracts the field device into an information model, solving problems such as incompatible underlying protocols and mismatched device types; the device agent sends a registration request to the device manager, the registration request containing detailed information of the device and the information model, the device manager receiving the registration request, changing the registration list and the aggregation address space, adding new devices or changed devices, and realizing dynamic registration; and the device manager sends a device resource update notification to the PLC IDE after registration is completed, the PLC IDE adding function blocks of new devices or changed devices according to the notification for subsequent instantiation; the device manager monitors the last communication time with the device agent in real time, monitors the device state once, and discovers abnormalities in time.

[0027] 2. Automatic configuration and execution When the PLC IDE detects a change in business demand, it browses the registration list of the device manager to obtain available device resources, instantiates the control function blocks corresponding to the devices in the function block library, writes an application program, and issues it to the PLC RTE for execution, at the same time, generates a mapping table and issues it to the device manager, which configures the variables and methods in the application program with the nodes of the device agent, realizing automatic configuration of the PLC and the field device; The PLC RTE receives and initializes the application program, at the same time, establishes a session with the device manager, after initialization, enters a loop scanning mode (input sampling-program execution-output scanning), until the next system update, through continuous sampling, execution and output, the state and data of the device can be obtained in real time, and the device manager can also monitor the communication state with the device. BRIEF DESCRIPTION OF DRAWINGS

[0028] The drawings of the application are only used for illustrative description, and cannot be understood as a limitation of the application. In order to more clearly illustrate the technical scheme of the embodiments of the application, the drawings needed for the embodiment description will be briefly introduced below, and obviously, the drawings in the following description can also obtain other drawings according to the drawings without creative labor for those skilled in the art.

[0029] Figure 1 It is a framework diagram of a PLC dynamic expansion IO device control system of the application.

[0030] Figure 2 Flow chart of the registration phase of the method for PLC dynamic extension IO device control according to the present application.

[0031] Figure 3 Flow chart of the registration phase of the method for PLC dynamic extension IO device control according to the present application. Figure 1 .

[0032] Figure 4 Flow chart of the registration phase of the method for PLC dynamic extension IO device control according to the present application. Figure 2 .

[0033] Figure 5 Flow chart of the system planning and configuration phase of the method for PLC dynamic extension IO device control according to the present application.

[0034] Figure 6 Flow chart of the control execution phase of the method for PLC dynamic extension IO device control according to the present application.

[0035] Figure 7 Flow chart of the dynamic registration, configuration and control according to the present application.

[0036] Figure 8 Information model of the device agent of the method for PLC dynamic extension IO device control according to the present application.

[0037] Figure 9 Information model of the device manager of the method for PLC dynamic extension IO device control according to the present application. DETAILED DESCRIPTION

[0038] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0039] It should be noted that the technical terms or scientific terms used in the present application should be the usual meanings understood by those skilled in the art to which the present application belongs, unless otherwise defined. The "first", "second" and similar words used in the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Include" or "contain" and similar words mean that the elements or objects before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to represent relative positional relationships, and when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0040] Embodiment 1 Please refer to Figure 1 A PLC dynamic expansion IO device control system includes a three-layer architecture, which is an application planning layer, a management and control layer, and an execution layer. The application planning layer integrates a PLC IDE, is responsible for application program development, device resource browsing, and configuration generation. The management and control layer includes a device manager and a PLC RTE. The device manager interacts with the PLC IDE and a device agent, and configures node access between the PLC RTE and the device agent. The PLC RTE loads and executes an application program issued by the PLC IDE, indirectly establishes a connection with the device agent according to the configuration of the device manager, and accesses device data and device methods. The execution layer includes field devices and device agents. The device agent abstracts the properties and functions of the device into an OPC UA information model, displays device data and functions to the device manager, and interacts with the management and control layer.

[0041] The PLC IDE includes an application editor, a device resource browser, a function block library, a mapping table generator, and an OPC UA client, the application editor is used for developing an application program; the device resource browser is used for browsing a registration list of a device manager; the function block library is used for instantiating function blocks of a device; the mapping table generator is used for generating a mapping table; and the OPC UA client is used for communicating with the device manager, obtaining device resources and an OPC UA information model, and issuing an application program and a mapping table. The device manager includes an OPC UA server, a configuration manager, a device aggregator, a discovery server, and an OPC UA client, the OPC UA server is used for interacting with the PLC IDE and a device agent, and configuring node access between the PLC RTE and the device agent; the configuration manager is used for parsing a mapping table, and coordinating connection configuration of the PLC RTE and the device agent; the device aggregator is used for aggregating an information model of the device agent, and providing a unified device model access interface; the discovery server is used for managing registration and deregistration of the device agent, and monitoring a device state; and the OPC UA client is used for establishing a connection with the device agent, receiving an exception event, and updating a state of a device object. The PLC RTE includes an OPC UA server, an application program executor, and an OPC UA client, the OPC UA server is used for interacting with the PLC IDE and the device agent, and configuring node access between the PLC RTE and the device agent; the OPC UA client is used for accessing device data and methods, and receiving an application program. The device agent includes an OPC UA server, a device information model, and a protocol adapter, the OPC UA server is used for providing data and functions of the device, and interacting with a management and control layer; the device information model is used for abstracting attributes and functions of the device into an OPC UA model; and the protocol adapter is used for communication between the device and the device agent.

[0042] The device manager is used as an intermediate coordination layer, a complex many-to-many connection between a traditional PLC and a device is simplified into a standardized single-point access mode, all device agent connections are uniformly managed through an aggregation server, and system topology complexity is reduced. Secondly, a complete device management system is constructed based on a unified information model of the OPC UA, a cloud planning layer can monitor a device state in real time, uniformly configure parameters, and the manageability and operation efficiency of the system are improved. Finally, through a dynamic registration and deregistration mechanism, in cooperation with an intelligent mapping function of the configuration manager, plug-and-play of the device is implemented, the system can dynamically adjust a connection relationship of the device without interrupting operation. In addition, a protocol conversion engine built in the aggregation server can automatically process communication protocols and data format differences of different device agents, a standardized device view is provided for the PLC, and a compatibility problem of multiple source heterogeneous devices is solved.

[0043] Embodiment 2 As Figures 2-3As shown in 5-7, the method for controlling the PLC dynamic expansion IO device provided in this embodiment is implemented based on the system for controlling the PLC dynamic expansion IO device described in Embodiment 1 and includes three stages: a registration stage, a system planning and configuration stage, and a control execution stage. The registration stage includes: Step S1, when the device proxy detects the access of a new device, the device is abstracted as an OPC UA information model; Step S2, the device proxy sends a registration request to the device manager; Step S3, the device manager receives the registration request and updates the OPC UA information model and the aggregated address space in the device registration list; Step S4, after the registration is completed, the device manager sends a failed resource update notification to the PLC development environment, i.e., the PLC IDE; Step S5, the device manager monitors the time of the last communication with the device proxy in real time to monitor the device state, and if no heartbeat is received for a long time, the state of the device in the registration list is updated to trigger the abnormal time of the device.

[0044] Through the device proxy, the device manager, the PLC IDE, and the PLC RTE, plug-and-play of the device is realized. The device proxy automatically detects the joining, replacement, and exit of the device. When the device joins, the device proxy communicates with the device through a private protocol, obtains device information, abstracts the device as an OPC UA information model, and sends a registration request to the device manager. When the device changes, the device proxy communicates with the device through a private protocol, obtains device information, abstracts the device as an OPC UA information model, deletes the old OPC UA information model, and sends a new device registration request and an old device deregistration request to the device manager. When the device exits, the information model of the undetected device is deleted, and a deregistration request is sent to the device manager, so that the PLC IDE avoids obtaining the old device or the exited device when browsing the available device resources.

[0045] The steps of the deregistration stage are as follows: Step R1, the device proxy detects the disconnection of the device and deletes the corresponding OPC UA information model; Step R2, the device proxy sends a deregistration request to the device manager; Step R3, the device manager receives the deregistration request, deletes the corresponding OPC UA information model in the device registration list, and deletes the aggregated address space of the corresponding information model; Step R4, after the deregistration is completed, the device manager sends a device resource update notification to the PLC IDE; Step R5, the PLC IDE receives the device resource update notification, and deletes the corresponding device function block in the function block library according to the device information in the device resource update notification.

[0046] The system planning and configuration phase includes: Step T1, the PLC IDE monitors the business requirements in real time, and when a change in the business requirements is monitored, the registration list and the aggregation address space of the device manager are browsed to obtain the currently available device resources; Step T2, based on the device resources, the PLC IDE selects and instantiates the control function block corresponding to the device from the function block library, and writes the control logic according to the business requirements to generate an application program conforming to the IEC61131-3 standard; at the same time, the PLC IDE automatically generates a mapping table, which records the correspondence between the variables and methods of the application program and the nodes in the device agent; Step T3, the PLC IDE issues the application program to the PLC RTE and issues the mapping table to the device manager; Step T4, the device manager parses the mapping table and maps the variables and methods in the application program to the nodes of the device agent; The control execution phase includes: Step Q1, the PLC RTE loads and activates the application program; Step Q2, in the application initialization phase, the PLC RTE connects the device manager and establishes a session; Step Q3, after initialization, the PLC RTE enters a loop scanning mode; Step Q4, the PLC RTE periodically executes the control task until the next system reconstruction.

[0047] The loop scanning mode includes an input sampling phase, a program execution phase, and an output scanning phase; In the input sampling phase, the PLC RTE requests the device variable node value from the device manager, and updates the variable value to the internal input image table; In the program execution phase, the PLC RTE executes the control logic and calls the method node of the device; after the device agent accepts the request, the control of the underlying device is executed to perform the corresponding operation; after the device performs the operation, the new state and data are fed back to the device agent, and the device agent updates the node value; In the output refreshing phase, the PLC RTE writes the control result to the variable node of the device through the device manager to update the data of the device.

[0048] As shown in Figure 8 The information model complies with the “OPC 30000: PLC Model based on IEC 61131-3 companion specification”. The device proxy uses a custom DeviceProxyType object type, which inherits from BaseObjectType and contains the following core nodes: DeviceID: A unique identifier for the storage device, such as a UUID or device serial number, ensuring the uniqueness of the device agent within the network.

[0049] DeviceType: The specific type of the device being proxied. Enumerated values ​​include device types such as Conveyor and RobotArm.

[0050] EndpointURL: The OPC UA server address of the storage device agent itself, such as opc.tcp: / / 192.168.1.10:4804, is the key information for establishing a connection between the client and the device agent.

[0051] DeviceStatus: Represents the device's operating status. The enumeration values ​​are Online / Offline / Error. This variable is automatically updated by the device agent to reflect the device's real-time status.

[0052] LastHeartBeat: Last active timestamp, records the time of the last successful communication between the device agent and the device manager, used to detect the activity of the device agent.

[0053] PhysicalDevice: This is the actual physical device object associated with the device agent. It is the main interface for client-physical device interaction. The child nodes of the device object contain the device's configuration parameters, variables, and methods. The device's real data is bound to these node values. The client can obtain the node structure of the conveyor belt object by browsing the device agent's address space, and read and write device data in real time or call method nodes to control the device to perform corresponding operations.

[0054] like Figure 9 As shown, the Device Manager uses a custom DeviceManagerType object type to manage the registration, information aggregation, and dynamic configuration of all device agents, and includes the following core nodes: DeviceRegistry: Dynamically maintains information about registered device agents. When a device agent is registered with the Device Manager, the Device Manager creates a DeviceEntry object under this object. Each DeviceEntry object represents a registered device agent and contains four variable child nodes: DeviceID, DeviceTypeStatus, EndpointURL, and DeviceStatus. It supports the dynamic addition, deletion, and status update of devices. Clients can browse this node to obtain a list of devices.

[0055] DeviceAggregator: The information model of the aggregated device agent. When the device agent registers to the device manager, the device manager creates a DeviceProxyLink object under this object, which points to the PhysicalDevice object in the device agent through the Originazs reference. Through the DeviceProxyLink and Origanizes reference, the address space of the device agent can be aggregated into the device manager. The client only needs to establish a connection with the device manager to access the information model of all device agents. When the device agent registers or unregisters, the device manager dynamically adds or deletes DeviceProxyLink to maintain the real-time of the address space.

[0056] ConfigurationManager: Provides dynamic configuration services to manage the mapping between PLC application variables and actual device nodes according to the application issued by the IDE. Contains the ConfigureConnection method node. This method configures the connection between the PLC and the device agent according to the application. The input parameter is the mapping list between the PLC and the device, and the output parameter is the configuration result, such as Sucess or Failure.

[0057] DiscoveryService object: Registers / unregisters the device agent to the DeviceRegistry, containing two method nodes RegisterDevice and UnregisterDevice, the input parameter is the EndpointURL of the device agent, and the output parameter is the registration / unregistration result.

[0058] In order to realize the dynamic connection expansion of the system, the event notification and subscription mechanism between each component is designed, and three event types "DeviceStatusChangeEvent", "DeviceRegistryChangeEvent", "ApplicationUpdateEvent" are defined.

[0059] (1) DeviceStatusChangeEvent: When the value of "DeviceStatus" of the device agent changes, the device agent triggers this event. The event source is "DeviceProxy", and the event fields include "DeviceID", "OldStatus", "NewStatus". The device manager as an OPC UA client subscribes to this event after establishing a connection with the device agent. After receiving the event notification, update the status of the corresponding "DeviceEntry" object in "DeviceRegistry".

[0060] (2) DeviceRegistryChangeEvent: When a device agent is registered or unregistered by the "RegisterDevice" or "UnregisterDevice" method, the device manager adds or deletes the "DeviceEntry" object in the "DeviceRegistry" and triggers this event. The event source is "DeviceRegistry", and the event fields include "DeviceID", "Action", and "EndpointURL". The PLC RTE, as an OPC UA client, connects to the OPC UA server of the device manager and subscribes to this event. After receiving the event, the PLC RTE updates the connection with the device agent according to the event content.

[0061] (3) ApplicationUpdateEvent: This event is triggered when the PLC IDE issues a new application. The event source is the PLC IDE, and the event fields include the new application code "Application Code" and the mapping list between the PLC and the device "MappingList". The PLC RTE and the device manager, as OPC UA clients, subscribe to this event from the PLC IDE. After receiving the event, the device manager calls the "ConfigureConnection" method to configure the connection between the PLC RTE and the device agent according to the "MappingList". After receiving the event, the PLC RTE loads the new application and runs it.

[0062] The working process of PLC dynamic expansion of I / O device control includes three stages: device agent registration, system planning and configuration, and control execution.

[0063] In the device proxy registration phase, the device proxy acts as an OPC UA client and initiates a registration request by calling the RegisterDevice method in the DiscoveryService object of the device manager, passing key parameters such as Endpoint, DeviceID, and DeviceType. After receiving the request, the device manager creates a DeviceEntry object under the DeviceRegistry object to record the device's identifier, type, and communication terminal information, and generates a DeviceProxyLink through the DeviceAggregator object to reference the PhysicalDevice object of the device proxy, thereby aggregating its address space to the device manager's address space and achieving unified management of device information. After registration is complete, the device manager triggers the DeviceRegisteredEvent event to notify the PLC IDE of the addition of a new device and provide detailed device information to update the device function block library. Subsequently, the device proxy maintains communication status by periodically updating the LastHeattBeat variable in the PhysicalDevice object, and the device manager monitors device status in real time based on this information. If no heartbeat is received for a long time, the status is updated to Offline, and the DeviceStatusChangeEvent event is triggered.

[0064] In the system planning and configuration phase, the PLC IDE connects to the device manager through an OPC UA client and browses its address space to obtain current available device resource information, providing accurate device data for application development. Based on the obtained device resource information, engineers select and instantiate control function blocks corresponding to the device from the function block library and write control logic according to business requirements to generate an application program that meets the IEC 61131-3 standard. While developing the application program, the PLC IDE automatically generates a mapping table that records the correspondence between variables or methods in the PLC application program and specific nodes in the device proxy, ensuring accurate interaction between the PLC RTE and the device proxy. After completing application program development and mapping table generation, the PLC IDE downloads the generated application program to the PLC RTE through the OPC UA client and synchronizes the mapping table to the device manager. After receiving the mapping table, the ConfigurationManager object of the device manager parses it and accurately maps the variables and methods in the application program to specific nodes of the device.

[0065] During the control execution phase, the PLC RTE loads and activates the new application. During the initialization phase, the PLC connects to the device manager as a UA client and establishes a session. After initialization, the PLC RTE enters a cyclic scan mode. During the input sampling phase, the PLC RTE calls the Read method to request the device's variable node values ​​from the device manager and updates the variable values ​​in its internal input map table. During the program execution phase, the PLC RTE executes the control logic by calling the device's method node via the Call method. Upon receiving the request, the device agent controls the underlying device to perform the corresponding operation. After performing the specific operation, the device feeds back the new status and data to the device agent. The device agent updates its node values. During the output refresh phase, the PLC calls the Write method to write the control results to the device's variable nodes through the device manager, updating the device's data. The PLC periodically executes control tasks until the next system refactoring.

[0066] Example 3 like Figure 2 and 4 As shown in Figure 7, this embodiment provides a method for controlling PLC dynamic expansion I / O devices, based on the system implementation of PLC dynamic expansion I / O device control described in Embodiment 1, which includes three stages: The registration phase, system planning and configuration phase, and control execution phase; Registration phase: Step S1: When the device agent detects a new device being connected, it abstracts the device into an OPC UA information model; Step S2: The device agent sends a registration request to the device manager; Step S3: The Device Manager receives the registration request and updates the OPC UA information model and aggregated address space in the device registration list; Step S4: After registration is complete, the Device Manager sends a failure resource update notification to the PLC Development Environment, i.e., the PLC IDE. Step S5: The Device Manager monitors the last communication time with the Device Agent in real time to monitor the device status. If no heartbeat is received for a long time, the device status in the registration list is updated, triggering a device abnormality event.

[0067] Plug and play of the device is realized through the device agent, device manager, PLC IDE and PLC RTE. The device agent automatically detects the joining, replacement and exiting of the device. When the device joins, the device agent communicates with the device through a private protocol, obtains device information, abstracts the device into an OPC UA information model, the information model complies with the "OPC 30000: PLC Model based on IEC61131-3 supporting specification", and sends a registration request to the device manager. When the device changes, the device agent communicates with the device through a private protocol, obtains device information, abstracts the device into an OPC UA information model, changes the state of the old OPC UA information model of the device to unavailable, and sends a new device registration request and an old device state change request to the device manager. When the device exits, the state of the information model of the undetected device is changed to unavailable, and a state change request is sent to the device manager, so that the PLC IDE avoids obtaining the old device or the exited device when browsing the available device resources.

[0068] The state change steps are as follows: Step G1, the device agent detects that the device is disconnected, updates the state of the corresponding OPC UA information model, and changes the state to unavailable. Step G2, the device agent sends a state change request to the device manager. Step G3, the device manager receives the state change request, changes the state of the corresponding OPC UA information model in the device registration list to unavailable. The system planning and configuration phase includes: Step T1, the PLC IDE monitors business requirements in real time, browses the registration list and aggregation address space of the device manager, and obtains the current available device resources when monitoring that the business requirements change. Step T2, based on the device resources, the PLC IDE selects and instantiates the control function block corresponding to the device from the function block library, and writes the control logic according to the business requirements to generate an application program conforming to the IEC61131-3 standard. At the same time, the PLC IDE automatically generates a mapping table, which records the correspondence between the variables and methods of the application program and the nodes in the device agent. Step T3, the PLC IDE sends the application program to the PLC RTE and sends the mapping table to the device manager. Step T4, the device manager parses the mapping table and maps the variables and methods in the application program to the nodes of the device agent. The control execution phase includes: Step Q1, the PLC RTE loads and activates the application program. Step Q2, during the application initialization phase, the PLC RTE connects to the device manager and establishes a session; Step Q3, after initialization, the PLC RTE enters a cyclic scan mode; Step Q4, the PLC RTE periodically performs control tasks until the next system reconfiguration.

[0069] The cyclic scan mode includes input sampling, program execution, and output scanning phases. During the input sampling phase, the PLC RTE requests the device manager for the variable node values of the device and updates the variable values to the internal input image table. During the program execution phase, the PLC RTE executes the control logic and calls the method nodes of the device. The device agent accepts the request and controls the underlying device to perform the corresponding operation. After the device performs the operation, it feeds back the new state and data to the device agent, which updates its node values. During the output refresh phase, the PLC RTE writes the control results to the variable nodes of the device through the device manager, updating the data of the device.

[0070] As shown in Figure 8 The information model complies with "OPC 30000: PLC Model based on IEC 61131-3 Companion Specification": The device agent uses a custom DeviceProxyType object type, which inherits from BaseObjectType, and contains the following core nodes: DeviceID: stores the unique identifier of the device, such as UUID or device serial number, ensuring the uniqueness of the device agent in the network.

[0071] DeviceType: the specific type of the agent device, with enumeration values such as Conveyor, RobotArm, and other device types.

[0072] EndpointURL: stores the OPC UA server address of the device agent itself, such as opc.tcp: / / 192.168.1.10:4804, which is the key information for the client to establish a connection with the device agent.

[0073] DeviceStatus: indicates the running status of the device, with enumeration values Online / Offline / Error, which is automatically updated by the device agent to reflect the real-time status of the device.

[0074] LastHeartBeat: the last active timestamp, recording the time of the last successful communication between the device agent and the device manager, used to detect the activity of the device agent.

[0075] PhysicalDevice: Mounts the actual physical device object associated with the device proxy, which is the main interface for clients to interact with the physical device. The child nodes of the device object include configuration parameters, variables, and method nodes of the device. The real data of the device is bound in the values of these nodes. Clients can obtain the node structure of the tape object by browsing the address space of the device proxy, read and write device data in real time, or call method nodes to control the device to perform corresponding operations.

[0076] As shown in Figure 9 , the device manager uses a custom DeviceManagerType object type to manage the registration, information aggregation, and dynamic configuration of all device proxies. It contains the following core nodes: DeviceRegistry: Dynamically maintains information about registered device proxies. When a device proxy registers with the device manager, the device manager creates a DeviceEntry object under this object. Each DeviceEntry object represents a registered device proxy and contains four variable sub-nodes: DeviceID, DeviceTypeStatus, EndpointURL, and DeviceStatus. It supports dynamic addition, deletion, and status update of devices. Clients can browse this node to obtain a list of devices.

[0077] DeviceAggregator: Aggregates the information model of device proxies. When a device proxy registers with the device manager, the device manager creates a DeviceProxyLink object under this object. DeviceProxyLink points to the PhysicalDevice object in the device proxy through the Originazs reference. Through DeviceProxyLink and Origanizes reference, the address space of the device proxy can be aggregated into the device manager. Clients only need to establish a connection with the device manager to access the information model of all device proxies. When a device proxy registers or deregisters, the device manager dynamically adds or deletes DeviceProxyLink to maintain the real-time nature of the address space.

[0078] ConfigurationManager: Provides dynamic configuration services to manage the mapping between PLC application variables and actual device nodes based on the application program issued by the IDE. It contains the ConfigureConnection method node. This method configures the connection between the PLC and the device proxy based on the application program. The input parameter is the mapping list between the PLC and the device, and the output parameter is the configuration result, such as Sucess or Failure.

[0079] DiscoveryService object: register / unregister device proxy to DeviceRegistry, contains two method nodes RegisterDevice and UnregisterDevice, input parameter is EndpointURL of device proxy, output parameter is the result of registration / unregistration.

[0080] In order to realize the dynamic connection extension of the system, the event notification and subscription mechanism between components is designed, and three event types "DeviceStatusChangeEvent", "DeviceRegistryChangeEvent", "ApplicationUpdateEvent" are defined.

[0081] (1) DeviceStatusChangeEvent: when the value of "DeviceStatus" of device proxy changes, the device proxy triggers the event. The event source is "DeviceProxy", and the event fields include "DeviceID", "OldStatus", "NewStatus". The device manager, as an OPC UA client, subscribes to this event after establishing a connection with the device proxy. After receiving the event notification, it updates the status of the corresponding "DeviceEntry" object in "DeviceRegistry".

[0082] (2) DeviceRegistryChangeEvent: when the device proxy is registered or unregistered through the "RegisterDevice" or "UnregisterDevice" method, the device manager adds or deletes the "DeviceEntry" object in "DeviceRegistry", and triggers the event. The event source is "DeviceRegistry", and the event fields include "DeviceID", "Action", "EndpointURL". The PLC RTE, as an OPC UA client, connects to the OPC UA server of the device manager and subscribes to this event. After receiving the event, the PLC RTE updates the connection with the device proxy according to the event content.

[0083] (3) ApplicationUpdateEvent: This event is triggered when the PLC IDE issues a new application. The event source is the PLC IDE, and the event fields include the new application code "Application Code" and the mapping list between the PLC and the device "MappingList". The PLC RTE and the device manager subscribe to this event as OPC UA clients. After receiving the event, the device manager calls the "ConfigureConnection" method to configure the connection between the PLC RTE and the device proxy based on the "MappingList". After receiving the event, the PLC RTE loads the new application and runs it.

[0084] The workflow of PLC dynamic expansion I / O device control includes three stages: device proxy registration, system planning and configuration, and control execution.

[0085] In the device proxy registration stage, the device proxy acts as an OPC UA client and initiates a registration request by calling the RegisterDevice method in the DiscoveryService object of the device manager, passing key parameters such as Endpoint, DeviceID, and DeviceType. After receiving the request, the device manager creates a DeviceEntry object under the DeviceRegistry object to record the device's identifier, type, and communication terminal, and generates a DeviceProxyLink through the DeviceAggregator object to reference the PhysicalDevice object of the device proxy, thereby aggregating its address space to the address space of the device manager, achieving unified management of device information. After registration is complete, the device manager triggers the DeviceRegisteredEvent event to notify the PLC IDE of the addition of a new device and provides detailed information about the device to update the device function block library. Subsequently, the device proxy maintains communication status by periodically updating the LastHeattBeat variable in the PhysicalDevice object, and the device manager monitors the device status in real time based on this information. If no heartbeat is received for a long time, the status is updated to Offline, and the DeviceStatusChangeEvent event is triggered.

[0086] In the system planning and configuration phase, the PLC IDE connects to the device manager through the OPC UA client, browses its address space to obtain the current available device resource information, and provides accurate device data for application development. Based on the obtained device resource information, engineers select and instantiate the control function blocks corresponding to the devices from the function block library, and write control logic according to business requirements to generate application programs that meet the IEC 61131-3 standard. While developing the application program, the PLC IDE will automatically generate a mapping table that records the correspondence between variables or methods in the PLC application program and specific nodes in the device agent, ensuring accurate interaction between the PLC RTE and the device agent. After completing application development and mapping table generation, the PLC IDE downloads the generated application program to the PLC RTE through the OPC UA client, and synchronizes the mapping table to the device manager. After receiving the mapping table, the ConfigurationManager object calls the ConfigureConnection method to parse it, and accurately maps the variables and methods in the application program to the specific nodes of the device.

[0087] In the control execution phase, the PLC RTE loads the new application program and activates it. In the initialization phase, the PLC connects to the device manager as a UA client and establishes a session. After initialization, the PLC RTE enters a cyclic scanning mode. In the input sampling phase, the PLC RTE calls the Read method to request the device variable node values from the device manager, and updates the variable values to its internal input image table. In the program execution phase, the PLC RTE executes the control logic and calls the device method node through the Call method. The device agent receives the request and controls the underlying device to perform the corresponding operation. After the device performs the specific operation, it feeds back the new state and data to the device agent. The device agent updates its node values. In the output refresh phase, the PLC calls the Write method to write the control results to the device variable node through the device manager, updating the device data. The PLC periodically executes the control task until the next system reconstruction.

[0088] The method of the present application not only ensures the stable operation of the system, but also realizes real dynamic control through the control execution closed loop, i.e. input sampling-program execution-output refresh, providing an ideal technical solution for rapid deployment of devices and dynamic reconstruction of production lines in intelligent manufacturing scenarios, especially suitable for industrial automation, logistics and warehousing and other application scenarios that require frequent adjustment of production line configuration.

[0089] The preferred embodiments of the application disclosed above are only to facilitate the elucidation of the application. The preferred embodiments do not describe all the details of the application, nor limit the application to the specific embodiments. Obviously, many modifications and variations can be made in light of the above teachings, the preferred embodiments selected and described are for the purpose of explanation and understanding of the principles and practical application of the application, so that those skilled in the art can well understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims

1. A method for PLC dynamic expansion IO device control, characterized in that, The three stages include a registration stage, a system planning and configuration stage, and a control execution stage, the registration stage is a process of dynamically registering a new device, the system planning and configuration stage is a process of configuring the new device and generating an application and a mapping table for the new device, and the control execution stage is a process of executing the application; The control execution stage is a process of executing the application; The registration stage, the system planning and configuration stage, and the control execution stage are executed in sequence; The steps of the registration stage include: Step S1, when a new device is accessed, the device agent detects the new device and abstracts the device into an OPC UA information model; Step S2, the device agent sends a registration request to the device manager; Step S3, the device manager receives the registration request, updates the OPC UA information model and the aggregated address space in the device registration list, and sends a device resource update notification to a PLC integrated development environment (PLC IDE); Step S4, the PLC IDE receives the device resource update notification, updates the device function block library according to the device information in the device resource update notification, and periodically updates the time of the last communication between the device agent and the device manager to maintain the communication state; Step S5, the device manager monitors the time of the last communication with the device agent in real time to monitor the device state, and if a heartbeat is not received for a long time, the state of the device in the registration list is updated to trigger an abnormal event of the device. The steps of the system planning and configuration stage include: Step T1, the PLC IDE monitors business requirements in real time, and when a change in the business requirements is monitored, the registration list and the aggregated address space of the device manager are browsed to obtain currently available device resources; 2. The method of claim 1, wherein, Step T2, based on the device resources, a control function block corresponding to the device is selected and instantiated from the function block library, control logic is written according to the business requirements, and an application program conforming to the IEC61131-3 standard is generated; at the same time, a mapping table is automatically generated by the PLC IED, and the mapping table records the correspondence between variables and methods of the application program and nodes in the device agent; Step T3, the PLC IDE downloads the application program to the PLC RTE and downloads the mapping table to the device manager; Step T4, the device manager parses the mapping table and maps the variables and methods in the application program to the nodes of the device agent. The steps of the control execution stage include: Step Q1, the PLC RTE loads and activates the application program; 3. The method of claim 1, wherein, Step Q2, in the application initialization stage, the PLC RTE connects the device manager and establishes a session; Step Q3, after the initialization is completed, the PLC RTE enters a cyclic scanning mode; Step Q4, the PLC RTE periodically executes a control task until the next system reconstruction. The cyclic scanning mode includes an input sampling stage, a program execution stage, and an output scanning stage; In the input sampling stage, the PLC RTE requests the variable node values of the device from the device manager, and updates the variable values to an internal input image table; 4. The method of claim 3, wherein, ​ ​ In the program execution phase, the PLC RTE executes the control logic and calls the method nodes of the device; the device agent accepts the request, controls the underlying device to perform the corresponding operation; after the device performs the operation, the new state and data are fed back to the device agent, and the device agent updates the node value thereof; In the output refresh phase, the PLC RTE writes the control result into the variable node of the device through the device manager, and updates the data of the device.

5. The method of claim 1, wherein the PLC dynamic expansion IO device control is characterized by, The OPC UA information model complies with "OPC 30000: PLC Model based on IEC 61131-3".

6. A system for PLC dynamic expansion IO device control, constructed based on the method for PLC dynamic expansion IO device control according to any one of claims 1-5, characterized in that, A three-layer architecture is adopted, including an application planning layer, a management and control layer and an execution layer; the application planning layer integrates a PLC IDE, is responsible for application program development, device resource browsing and configuration generation; the management and control layer is composed of a device manager and a PLC RTE; the device manager interacts with the PLC IDE and the device agent, and configures node access between the PLC RTE and the device agent; the PLC RTE loads and executes the application program issued by the PLC IDE, indirectly establishes a connection with the device agent according to the configuration of the device manager, and accesses device data and device methods; The execution layer is composed of field devices and device agents; the device agent abstracts the attributes and functions of the device into an OPC UA information model, displays device data and functions to the device manager, and interacts with the management and control layer.

7. The method of claim 6, wherein, The PLC IDE includes an application editor, a device resource browser, a function block library, a mapping table generator and an OPC UA client; the application editor is used for developing an application program; the device resource browser is used for browsing the registration list of the device manager; the function block library is used for instantiating the function block of the device; the mapping table generator is used for generating a mapping table; and the OPC UA client is used for communicating with the device manager, obtaining device resources and an OPC UA information model, issuing an application program and a mapping table.

8. The method of claim 6, wherein the PLC dynamic expansion IO device control is characterized by, The device manager includes an OPC UA server, a configuration manager, a device aggregator, a discovery server and an OPC UA client; the OPC UA server is used for interacting with the PLC IDE and the device agent, and configuring node access between the PLC RTE and the device agent; the configuration manager is used for parsing a mapping table and coordinating connection configuration of the PLC RTE and the device agent; the device aggregator is used for aggregating the information model of the device agent and providing a unified device model access interface; the discovery server is used for managing registration and deregistration of the device agent and monitoring the state of the device; and the OPC UA client is used for establishing a connection with the device agent, receiving an abnormal event and updating the state of a device object.

9. The method of claim 6, wherein the PLC dynamic expansion IO device control is characterized by, The PLC RTE includes an OPC UA server, an application program executor and an OPC UA client; the OPC UA server is used for interacting with the PLC IDE and the device agent, and configuring node access between the PLC RTE and the device agent; and the OPC UA client is used for accessing device data and methods and receiving an application program.

10. The method of claim 6, wherein, The device agent comprises an OPC UA server, a device information model and a protocol adapter, the OPC UA server is used for providing data and functions of the device and interacting with the management layer; The device information model is used for abstracting attributes and functions of the device into an OPC UA model; and the protocol adapter is used for communication between the device and the device agent.

Citation Information

Patent Citations

  • OPC UA dynamic deployment method for field device

    CN116088867A

  • Cloud PLC multi-protocol I / O device remote control method and system

    CN117234146A

  • Industrial equipment plug and play method and system based on OPC UA

    CN119030868A

  • Programmable function block generation method and system based on equipment information model

    CN119960366A

  • PLC integrated digital twinning control enhancement system and method

    CN120540183A