Plc device management system and method, electronic device and storage medium

By employing a dual message queue and message container mechanism with different priorities in the PLC device management system, the problems of large-scale device access and high latency in traditional PLC device management systems are solved, achieving more efficient device management and stability.

CN118646708BActive Publication Date: 2025-11-18INSPUR COMM TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410531492.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-29
Publication Date
2025-11-18
Estimated Expiration
2044-04-29

AI Technical Summary

Technical Problem

Traditional PLC equipment management systems struggle to handle large-scale device access and management, and their high communication latency affects system response speed and stability.

Method used

A dual message queue and message container mechanism with different priorities is adopted to store heartbeat messages and user messages respectively. Response messages are processed through retransmission mechanism and receive buffer to ensure that user messages are processed first and device status is monitored.

Benefits of technology

It reduces message queuing time and improves the efficiency of PLC device management, as well as the system's real-time performance, response speed, and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118646708B_ABST
    Figure CN118646708B_ABST
Patent Text Reader

Abstract

The application relates to the field of device management, and provides a PLC device management system and method, an electronic device and a storage medium, the method comprising the following steps: storing power line communication (PLC) data into a first message queue; if it is detected that there is a message in the first message queue, taking out the PLC data from the first message queue and putting the PLC data into a message container; if the response time of the message in the message container is greater than a set time length, sending the PLC data to a PLC master device, so that the PLC master device controls a PLC slave device according to the PLC data. Through the message queue and the message container, the queuing jam problem caused by insufficient message processing speed can be avoided, the queuing jam time is reduced, the time delay of message execution is further reduced, and the management efficiency of the PLC device is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of equipment management, and more particularly to a PLC equipment management system and method thereof, electronic equipment and storage medium. Background Technology

[0002] With the development of the Internet of Things, PLC (Power Line Communication) communication has attracted widespread attention. PLC communication technology refers to the communication method that uses power lines as the information transmission medium to realize data, voice and video signals.

[0003] For scenarios requiring the management of numerous PLC sub-devices, such as smart homes, smart grids, smart lighting, and industrial control, traditional systems struggle to handle the large-scale access and management of these devices. Furthermore, PLC device control demands high real-time performance, and traditional communication methods suffer from significant latency, impacting system response speed and stability. Therefore, effectively managing PLC devices has become a pressing issue that needs to be addressed. Summary of the Invention

[0004] This application provides a PLC device management system and method, electronic device and storage medium to solve the problem of low efficiency in the distribution of business configuration information in the prior art.

[0005] This application provides a PLC device management method, including:

[0006] The power line communication PLC data is stored in the first message queue; the PLC data is obtained by converting user data sent from the user side.

[0007] If a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into the message container.

[0008] If the message response duration in the message container exceeds the set duration, the PLC data is sent to the power line communication PLC master device, so that the PLC master device sends the PLC data to the PLC slave device.

[0009] According to the PLC device management method provided in this application, after storing the power line communication PLC data in the first message queue, the method further includes:

[0010] If the first message queue is detected to be empty and the second message queue contains messages, then the heartbeat message of the PLC sub-device is retrieved from the second message queue, and the connection status of the PLC sub-device is monitored based on the heartbeat message.

[0011] The first message queue has a higher priority than the second message queue, and the priority represents the priority of message processing; the first message queue is used to store the PLC data, and the second message queue is used to store the heartbeat messages of the PLC sub-devices.

[0012] According to the PLC device management method provided in this application, after sending the PLC data to the power line communication PLC master device, the method further includes:

[0013] Receive the response message sent by the PLC master device and store the response message in the receive buffer;

[0014] Based on the start and end identifiers of the response message, determine the complete response data packet in the receive buffer;

[0015] If the message container stores a request message associated with the response data packet, then delete the request message associated with the response data packet from the message container, and delete the response data packet from the receive cache.

[0016] According to the PLC device management method provided in this application, after sending the PLC data to the power line communication PLC master device, the method further includes:

[0017] If no response message from the PLC sub-device is received from the PLC master device within the set time, and the number of retransmissions is less than the set number, then the PLC data will be sent to the PLC master device again.

[0018] According to the PLC device management method provided in this application, after sending the PLC data to the power line communication PLC master device, the method further includes:

[0019] Receive the response message from the PLC sub-device fed back by the PLC master device;

[0020] The response message is sent to the user data processing module, so that the user data processing module sends the response message to the user.

[0021] This application provides a PLC device management system, including: a gateway CPU and a PLC main device connected to the gateway CPU; the gateway CPU includes a user data processing module and a PLC data processing module; the PLC main device is connected to at least one PLC sub-device;

[0022] The user data processing module is used to receive user data sent by the user side, convert the user data into PLC data, and send the PLC data to the PLC data processing module.

[0023] The PLC data processing module is used to store the PLC data in a first message queue; if a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into a message container; if the message response time in the message container is longer than a set time, the PLC data is sent to the PLC master device.

[0024] The PLC master device is used to control the PLC sub-devices based on the PLC data.

[0025] According to a PLC device management system provided in this application, the gateway CPU includes multiple user interfaces, and the user side sends PLC data to the gateway CPU through the user interfaces.

[0026] The user interface includes an interface for adding the PLC sub-device, an interface for deleting the PLC sub-device, an interface for controlling the PLC sub-device, an interface for obtaining the status of the PLC sub-device, a scene management interface, and a group management interface.

[0027] According to the PLC device management system provided in this application, the gateway CPU further includes a system module, which is used to provide network functions, basic system functions, and OTA upgrade functions.

[0028] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the PLC device management methods described above.

[0029] This application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the PLC device management method as described above.

[0030] The PLC device management system, method, electronic device, and storage medium provided in this application store power line communication PLC data in a first message queue. If a message is detected in the first message queue, PLC data is retrieved from the first message queue and placed into a message container. If the message response time in the message container exceeds a set time, the PLC data is sent to the power line communication PLC master device, enabling the PLC master device to control the PLC sub-devices based on the PLC data. By setting up message queues and message containers, this application's embodiments can avoid queuing and congestion problems caused by insufficient message processing speed, reduce message queuing and congestion time, further reduce message execution latency, and thus improve the management efficiency of the PLC device. Attached Figure Description

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

[0032] Figure 1 This is a flowchart illustrating the PLC device management method provided in this application;

[0033] Figure 2 This is a schematic diagram of the structure of the PLC equipment management system provided in this application;

[0034] Figure 3 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0036] It should be noted that in the description of the embodiments of this application, 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 includes 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. The terms "upper," "lower," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Unless otherwise expressly specified and limited, the terms "installed," "connected," and "linked" should be interpreted broadly, for example, they can be fixed connections, detachable connections, or integral connections; they can be mechanical connections or electrical connections; they can be direct connections or indirect connections through an intermediate medium; and they can be internal connections between two elements. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0037] The terms "first," "second," etc., used in this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.

[0038] The following is combined Figures 1-3 This application describes the PLC device management system and method thereof, electronic equipment and storage medium.

[0039] Specifically, this application provides a PLC device management method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the PLC equipment management method provided in this application.

[0040] The PLC device management method provided in this application embodiment is applied to a PLC data processing module, including:

[0041] Step 100: Store the power line communication PLC data in the first message queue.

[0042] Step 200: If a message is detected in the first message queue, retrieve the PLC data from the first message queue and put the PLC data into the message container.

[0043] Step 300: If the message response duration in the message container is longer than the set duration, the PLC data is sent to the power line communication PLC master device so that the PLC master device sends the PLC data to the PLC slave device.

[0044] refer to Figure 2 The user side can be understood as the end-user equipment or application that communicates with the gateway CPU (Central Processing Unit). Through these devices or applications, users can interact with and control PLC (Power Line Communication) sub-devices. The gateway CPU includes a user data processing module and a PLC data processing module. The user data processing module provides various interfaces with the user side for receiving user data sent by the user side.

[0045] The user sends user data to the gateway CPU by calling the gateway CPU's interface. The user response data includes, but is not limited to, the following:

[0046] Various instructions / requests / commands / operations: such as control instructions, configuration instructions, query instructions, update instructions, etc.

[0047] b. Configuration information: such as device configuration or parameter settings data, used to adjust the behavior or characteristics of the device.

[0048] c. Equipment data: such as sensor data, equipment status information, etc., used to monitor, analyze or record the operation of equipment or systems.

[0049] d. Alarm notification: An urgent or important notification that alerts the user to information about device status or system events.

[0050] The gateway CPU and the PLC master device communicate via the Uapps (Uniform Application Support) protocol, which is an application layer protocol. To ensure data consistency between the gateway CPU and the PLC master device and reduce communication errors or anomalies caused by inconsistent data formats, the user data processing module receives user data from the user side, converts it into the data format defined in the Uapps protocol, obtains PLC data that the PLC master device can recognize, and then passes it to the PLC data processing module.

[0051] To reduce congestion of heartbeat and user messages, a dual-queue system with different priorities is used in the PLC data processing module. Heartbeat messages enter the lower-priority first message queue, while user messages enter the higher-priority second message queue. This ensures that user messages are processed first, guaranteeing timely system responses to user operations and requests, thus improving user experience. Furthermore, since heartbeat messages are used to maintain connections or monitor device status, they have a lower processing priority than user messages. This lower-priority queue ensures that heartbeat messages do not affect user message processing under high system load, thereby preventing message congestion.

[0052] After receiving PLC data from the user data processing module, the PLC data processing module stores the PLC data in the first message queue. This PLC data is obtained by converting user data sent from the user side according to the data protocol. The purpose of this conversion is to ensure that the user data can communicate with the PLC master device according to the Uapps protocol requirements, thereby achieving effective data transmission and parsing. Therefore, during the conversion process, the content of the user data is not modified or changed; only the data format is adjusted and converted according to the communication protocol requirements. Based on this, the PLC data retrieved from the first message queue can be understood as user messages, i.e., user data after data format transformation, including various user requests or operations, such as user-sent commands or instructions, user-requested data queries or updates, user-triggered events or alarms, etc. The system prioritizes processing these user messages to ensure that user operations are responded to promptly and to guarantee the normal operation of the system.

[0053] The PLC data processing module continuously monitors the first message queue for messages. If a message is found, it retrieves the PLC data (user message) from the first message queue and places it into the message container. The message container is a temporary storage area used to store messages waiting to be sent to the PLC master device. It can be a data structure such as a queue, stack, or buffer to manage messages awaiting transmission.

[0054] If the PLC data placed in the message container is the first data item, it is directly sent to the PLC master device so that the master device can control the PLC slave device based on the data. If the PLC data placed in the message container is not the first data item, it is necessary to determine whether the current message sent in the message container has exceeded the set time limit without receiving a response message from the PLC master device. If so, the remaining messages in the message container are sent. That is, if the message response time in the message container is longer than the set time limit, the PLC data is sent to the power line communication PLC master device. For example, if the current message in the message container is waiting for a response and the message response time is longer than the set time limit, the next message can be sent, and both messages wait for a response together. Specifically, after a message is sent, the system starts timing, waiting for the receiver's response. If the time this message waits in the message container exceeds the set waiting time threshold, the system will consider that there may be a communication problem or that the receiver cannot respond in time. At this time, the system can choose to send the next message, letting it wait for the receiver's response along with the current message. This strategy can effectively reduce message transmission waiting time and improve system response speed.

[0055] After receiving PLC data, the PLC master device sends the PLC data to the PLC slave device via the power line. The PLC slave device then performs the corresponding operation based on the PLC data to achieve management of the PLC slave device.

[0056] Furthermore, the system receives response messages from the PLC slave device from the PLC master device and sends these response messages to the user data processing module, which then forwards them to the user side. Specifically, after the PLC slave device performs the corresponding operation based on the received PLC data, it sends a response message to the PLC master device. The PLC master device then sends this response message to the PLC data processing module via a serial port. The PLC data processing module then forwards the response message to the user data processing module. The user data processing module converts the received response message into user data that can be recognized by the user side and then sends this user data to the user side via the gateway interface.

[0057] The PLC device management method provided in this application embodiment stores power line communication PLC data in a first message queue. If a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into a message container. If the message response time in the message container exceeds a set time, the PLC data is sent to the power line communication PLC master device, so that the PLC master device controls the PLC sub-devices based on the PLC data. By setting up a message queue and a message container, this application embodiment can avoid queuing and congestion problems caused by insufficient message processing speed, reduce message queuing and congestion time, further reduce message execution latency, and thus improve the management efficiency of PLC devices.

[0058] Based on the above embodiments, after storing the power line communication PLC data in the first message queue, the method further includes:

[0059] Step 111: If the first message queue is detected to be empty and the second message queue contains messages, then retrieve the heartbeat message of the PLC sub-device from the second message queue and monitor the connection status of the PLC sub-device based on the heartbeat message.

[0060] A heartbeat mechanism has been added to the PLC data processing module. The gateway CPU periodically polls the PLC sub-devices to check their online status, providing feedback on the sub-device status to the user. Specifically, the gateway CPU periodically sends heartbeat signals to connected PLC sub-devices to confirm their online status. If a PLC sub-device fails to respond to the heartbeat signal in time, the system marks it as offline. The gateway CPU polls the connected PLC sub-devices one by one according to a predetermined period, sending a heartbeat signal to each sub-device sequentially and waiting for a response. Through polling, the system can monitor the status of each PLC sub-device. The heartbeat period is dynamically adjusted based on the number of PLC sub-devices and the number of messages in the first message queue to ensure message priority and low latency. For example, if the number of connected PLC sub-devices or the number of messages in the first message queue increases, the heartbeat period can be increased to check device status more frequently, meeting user requirements for real-time performance and low latency. By dynamically adjusting the heartbeat cycle, the system can minimize the consumption of system resources while ensuring the priority of user messages, thereby reducing communication latency. This means that even when the system is performing heartbeat detection, it will prioritize processing user messages to ensure that the user experience is not affected.

[0061] The system monitors the first and second message queues in real time to see if there are any messages. If there are messages in the first message queue, the messages in the first message queue are processed first. If the first message queue is empty, but there are messages in the second message queue, the heartbeat message is retrieved from the second message queue. Then, the connection status of the PLC sub-device is monitored based on the heartbeat message, that is, whether the PLC sub-device is online.

[0062] This application embodiment stores user messages and heartbeat messages in different queues, ensuring that while prioritizing user message processing, it can also monitor and handle device connection status in a timely manner. This helps the system promptly detect and respond to device disconnections or abnormal states, improving system stability and reliability. Furthermore, using a dual-queue scheme with different priorities can effectively improve the system's real-time performance, response speed, and stability.

[0063] Based on the above embodiments, after sending the PLC data to the power line communication PLC master device, the method further includes:

[0064] Step 311: Receive the response message sent by the PLC master device and store the response message in the receive buffer;

[0065] Step 312: Determine the complete response data packet in the receive buffer based on the start identifier and end identifier of the response message;

[0066] Step 313: If the message container stores a request message associated with the response data packet, then delete the request message associated with the response data packet in the message container, and delete the response data packet in the receive cache.

[0067] In network communication, multiple messages may be combined into a single response data packet for transmission, or a single message may be split into multiple response data packets for transmission, leading to the problem of packet merging. To solve this problem, a receive buffer is set up in the PLC data processing module to receive data received from the network and to identify and extract complete messages based on the message's start and end identifiers (such as specific start and end characters, fixed length, etc.).

[0068] The receive buffer uses a moving pointer to locate each complete response data packet. This pointer, which can be a pointer to the current processing position in the buffer, moves with the processing to pinpoint the start and end positions of each response data packet. Once the receive buffer successfully retrieves a complete response data packet, the PLC data processing module matches it with the request message in the message container. If a match is found, it means the message container stores the request message associated with the response data packet. At this point, the request message associated with the response data packet needs to be deleted from the message container, and the response data packet itself needs to be deleted from the receive buffer. This avoids processing the same message repeatedly, ensuring consistency and correctness in message processing. Simultaneously, it frees up storage space, preventing processed messages from occupying storage space.

[0069] By working together with the message container and the receive buffer, when a received response message is stored in the receive buffer, messages already existing in the message container can be processed simultaneously. This means that even if a message is waiting for a response, the next message can still be processed, thus achieving parallel message processing and reducing message queuing time.

[0070] This embodiment of the application, by setting a receive buffer in the PLC data processing module, can process received response messages more efficiently and reduce message queuing time. Simultaneously, through the cooperation of the message container and the receive buffer, parallel message processing, advance preparation, and rapid matching can be achieved, thereby effectively reducing message queuing time and further reducing message execution latency.

[0071] Based on the above embodiments, after sending the PLC data to the power line communication PLC master device, the method further includes:

[0072] Step 321: If no response message from the PLC sub-device is received from the PLC master device within the set time, and the number of retransmissions is less than the set number, then the PLC data is sent to the PLC master device again.

[0073] To improve the success rate of controlling PLC sub-devices, a retransmission mechanism is added to the PLC data processing module. When the gateway CPU sends a command and no response is received from the PLC sub-device after the response time threshold is reached, the command is retransmitted until the maximum number of retransmissions is reached.

[0074] The retransmission process includes the following steps:

[0075] (1) First, the gateway CPU sends instructions to the PLC master device through the PLC data processing module, such as requesting to read sensor data or perform a certain task.

[0076] (2) The PLC master device sends the instruction to the PLC slave device. After receiving the instruction, the PLC slave device will perform the corresponding operation and send the response message to the PLC data processing module through the PLC master device.

[0077] (3) Within the set response time threshold, the PLC data processing module waits to receive the response message from the PLC sub-device.

[0078] (4) If the PLC data processing module does not receive a response message from the PLC sub-device within the response time threshold, it indicates that there may be a problem with communication, and a response timeout has occurred.

[0079] (5) When a response timeout occurs, the PLC data processing module will start the command retransmission mechanism, which means that the same instruction will be resent to the PLC sub-device.

[0080] (6) The retransmission mechanism may be performed multiple times until the preset retransmission limit is reached. If no response is received from the PLC sub-device within the retransmission limit, it indicates a serious communication failure and other measures need to be taken.

[0081] This application embodiment enhances the fault tolerance capability for communication failures by adding a retransmission mechanism to the PLC data processing module. Even in the event of network instability or problems with the PLC sub-device, it can ensure the smooth execution of instructions as much as possible, thereby improving the success rate of controlling the PLC sub-device.

[0082] This application provides a PLC device management system, referring to... Figure 2 , Figure 2 This is a schematic diagram of the structure of the PLC equipment management system provided in this application.

[0083] The PLC device management system provided in this application includes a gateway CPU and a PLC main device connected to the gateway CPU; the gateway CPU includes a user data processing module and a PLC data processing module; the PLC main device is connected to at least one PLC sub-device.

[0084] The user data processing module is used to receive user data sent by the user side, convert the user data into PLC data, and send the PLC data to the PLC data processing module.

[0085] The PLC data processing module is used to store PLC data in the first message queue; if a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into the message container; if the message response time in the message container is longer than the set time, the PLC data is sent to the PLC master device.

[0086] The PLC master device is used to control PLC sub-devices based on PLC data.

[0087] It should be noted that the PLC device management system is a master control system that allows multiple PLC sub-devices to connect and communicate with low-blocking communication. It is also easy to interface with the user side, enabling them to operate and access the PLC sub-devices. The system includes a gateway CPU and PLC master devices. Communication between the gateway CPUs and the PLC master devices is via serial port using the Uapps protocol. The gateway CPU includes a system module, a user data processing module, and a PLC data processing module. The functions of each module are as follows:

[0088] System Modules: These modules provide network functions, basic system functions, and OTA (Over-The-Air) upgrade capabilities. The network functions handle communication with external networks, including connecting to a local area network (LAN) or the internet via Ethernet, Wi-Fi, or other communication methods. Network functions may involve network configuration, connection management, and data transmission, ensuring the gateway CPU can communicate with other devices or services. Basic system functions include system startup and initialization, runtime status monitoring, and resource management. These fundamental functions ensure the stable operation of the gateway CPU and efficient resource utilization, while also providing management and control over various system components. The OTA upgrade function allows the gateway CPU to remotely download and install new firmware versions via a network connection without a physical connection to a computer or other device.

[0089] User data processing module: Provides various interfaces with the user side for receiving user data, converting user data into data recognizable by the PLC master device and sending it to the PLC data processing module, and converting data sent by the PLC master device into user data and sending it to the user side.

[0090] PLC Data Processing Module: This module enables data interaction with the PLC master device via a serial port. A heartbeat mechanism is included in this module, where the gateway CPU periodically polls the PLC sub-devices to check their offline status and sends the sub-device status back to the gateway CPU for user monitoring.

[0091] To improve the success rate of controlling PLC sub-devices, a retransmission mechanism has been added to the PLC data processing module. When the gateway CPU sends a command and no response is received from the PLC sub-device after the response time threshold is reached, the command is retransmitted until the maximum number of retransmissions is reached.

[0092] To reduce congestion of heartbeat and user messages, a dual queue with different priorities is used in the PLC data processing module. Heartbeat messages go into the low-priority queue, while user messages go into the high-priority queue.

[0093] To reduce message queuing congestion time, a message container and a receive buffer were added to the PLC data processing module. Messages retrieved from the queue are placed into the message container. While the current message in the container is waiting for a response, as long as the waiting time threshold is exceeded, the next message can still be sent, with two messages waiting for a response simultaneously. The receive buffer is used to resolve packet merging of multiple response messages. The receive buffer uses start and end movement indicators to find each complete response data packet, then matches it with the message in the message container. If a match is found, the message in the message container and the corresponding response in the receive buffer are cleared.

[0094] The PLC master device consists of PLC modules and peripheral circuits. The physical layer employs OFDM orthogonal multicarrier technology to ensure robust network communication, supporting point-to-point, broadcast, multicast, master-slave, and slave-slave communication. A gateway CPU is connected via a serial port. The gateway CPU can then query, configure, manage the network, send data, and receive active reports from the PLC sub-devices through the serial port. Communication between the gateway CPU and the PLC master device uses the Uapps interface protocol.

[0095] The gateway CPU includes multiple user interfaces, through which users send PLC data to the gateway CPU. These user interfaces include interfaces for adding PLC sub-devices, deleting PLC sub-devices, controlling PLC sub-devices, obtaining PLC sub-device status, scene management, and group management. Users can develop applications based on these interfaces to effectively control PLC devices.

[0096] SQLite is an open-source embedded relational database that implements a self-sufficient, serverless, configuration-free, transactional SQL database engine. The gateway CPU utilizes SQLite technology to maintain local data tables, storing information and status of the PLC master and PLC slave devices for user querying and management.

[0097] refer to Figure 2 The operation flow of the PLC device management system is as follows: The user side sends instructions to the gateway CPU by calling the gateway CPU's interface. The user data processing module analyzes the user data, converts it into the data format defined in the Uapps protocol, and then passes it to the PLC data processing module. The PLC data processing module sends the received data to the PLC master device via a serial port. The PLC master device then sends data of the corresponding format to the PLC slave device via the power line.

[0098] In one specific embodiment, the explanation will be based on adding a PLC sub-device to the circuit:

[0099] Step 1: The user calls the gateway CPU to search for and add the device interface.

[0100] Step 2: After the gateway CPU receives the message from the user adding a device, the user data processing module converts it into the data format @0. / _srch defined in the Uapps protocol and sends it to the PLC data processing module; the PLC data processing module sends the message @0. / _srch to the PLC master device.

[0101] Step 3: After receiving @0. / _srch, the PLC master device sends @0.FFFFFFFFFFFF / _srch to the line.

[0102] Step 4: The PLC sub-device feeds back the frame information to the PLC master device, which then feeds it back to the gateway CPU.

[0103] Step 5: The gateway CPU sends the PLC sub-device information to the user through the interface. The user confirms the addition of this sub-device and sends the confirmation result to the gateway CPU.

[0104] Step 6: The gateway CPU informs the PLC master device that the sub-device has been added, and the PLC master device informs the PLC master device of the unique identifier of the PLC network to which the sub-device has joined.

[0105] At this point, the PLC sub-device has been added to the PLC network.

[0106] The PLC device management system provided in this application embodiment has a comprehensive user interface reserved through the gateway CPU for user-side development and invocation, resulting in strong user compatibility. The retransmission mechanism improves the success rate of user messages, while the addition of a dynamic heartbeat mechanism not only obtains the status of PLC sub-devices but also ensures the priority and low latency of user messages. Furthermore, the cooperation of dual queues with different priorities, message containers, and receive buffers reduces message queuing and blocking time, further reducing message execution latency and thus improving PLC device management efficiency.

[0107] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call logic instructions in the memory 330 to execute a PLC device management method, which includes:

[0108] The power line communication PLC data is stored in the first message queue; the PLC data is obtained by converting user data sent from the user side.

[0109] If a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into the message container.

[0110] If the message response duration in the message container exceeds the set duration, the PLC data is sent to the power line communication PLC master device, so that the PLC master device sends the PLC data to the PLC slave device.

[0111] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0112] On the other hand, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the PLC device management method provided by the above methods, the method comprising:

[0113] The power line communication PLC data is stored in the first message queue; the PLC data is obtained by converting user data sent from the user side.

[0114] If a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into the message container.

[0115] If the message response duration in the message container exceeds the set duration, the PLC data is sent to the power line communication PLC master device, so that the PLC master device sends the PLC data to the PLC slave device.

[0116] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A PLC equipment management method, characterized in that, include: Store the power line communication PLC data in the first message queue; The PLC data is obtained by converting user data sent from the user side; If a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into the message container. If the message response duration in the message container exceeds the set duration, the PLC data is sent to the power line communication PLC master device, so that the PLC master device sends the PLC data to the PLC slave device. Receive the response message sent by the PLC master device and store the response message in the receive buffer; Based on the start and end identifiers of the response message, determine the complete response data packet in the receive buffer; If the message container stores a request message associated with the response data packet, then delete the request message associated with the response data packet in the message container, and delete the response data packet in the receive cache; Receive the response message from the PLC sub-device fed back by the PLC master device; The response message is sent to the user data processing module, so that the user data processing module sends the response message to the user side; Specifically, the heartbeat cycle used to monitor the connection status of PLC sub-devices is dynamically adjusted based on the number of PLC sub-devices and the number of messages in the first message queue.

2. The PLC equipment management method according to claim 1, characterized in that, After storing the power line communication PLC data in the first message queue, the process further includes: If the first message queue is detected to be empty and the second message queue contains messages, then the heartbeat message of the PLC sub-device is retrieved from the second message queue, and the connection status of the PLC sub-device is monitored based on the heartbeat message. The first message queue has a higher priority than the second message queue, and the priority represents the priority of message processing; the first message queue is used to store the PLC data, and the second message queue is used to store the heartbeat messages of the PLC sub-devices.

3. The PLC equipment management method according to claim 1, characterized in that, After sending the PLC data to the power line communication PLC master device, the method further includes: If no response message from the PLC sub-device is received from the PLC master device within the set time, and the number of retransmissions is less than the set number, then the PLC data will be sent to the PLC master device again.

4. A PLC equipment management system, characterized in that, The system includes a gateway CPU and a PLC main device connected to the gateway CPU; the gateway CPU includes a user data processing module and a PLC data processing module; the PLC main device is connected to at least one PLC sub-device. The user data processing module is used to receive user data sent by the user side, convert the user data into PLC data, and send the PLC data to the PLC data processing module. The PLC data processing module is used to store the PLC data in a first message queue; if a message is detected in the first message queue, the PLC data is retrieved from the first message queue and placed into a message container; if the message response time in the message container is longer than a set time, the PLC data is sent to the PLC master device. The PLC master device is used to control the PLC sub-devices according to the PLC data; The PLC data processing module is used to execute the PLC equipment management method as described in any one of claims 1 to 3.

5. The PLC equipment management system according to claim 4, characterized in that, The gateway CPU includes multiple user interfaces, and the user side sends the PLC data to the gateway CPU through the user interfaces. The user interface includes an interface for adding the PLC sub-device, an interface for deleting the PLC sub-device, an interface for controlling the PLC sub-device, an interface for obtaining the status of the PLC sub-device, a scene management interface, and a group management interface.

6. The PLC equipment management system according to claim 4, characterized in that, The gateway CPU also includes a system module, which provides network functions, basic system functions, and OTA upgrade functions.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the PLC device management method as described in any one of claims 1 to 3.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the PLC device management method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Data processing method and device, equipment and medium

    CN114138838A

  • Asynchronous task execution method and system

    CN117056049A

  • Method for controlling PLC (Programmable Logic Controller) equipment and electronic equipment

    CN117170297A