Industrial bus protocol system capable of being flexibly configured and implementation method
Through the unified management of graphical communication protocol configuration module and controller, the flexible configuration problem of multiple communication protocols in industrial control and power systems is solved, the configuration efficiency and stability are improved, the CPU resource consumption is reduced, and the difficulty of protocol development is simplified.
Patent Information
- Application Number
- CN202510400706.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-29
AI Technical Summary
In the prior art, the communication protocol configuration in industrial control and power system control scenarios is complex, and it is impossible to meet the flexible configuration requirements of multiple communication protocols at the same time, resulting in low on-site debugging efficiency, wasted equipment CPU resources, and low communication efficiency.
It adopts graphical communication protocol configuration module and controller to provide a visual configuration interface and supports flexible configuration of multiple communication protocols. Through protocol selection modules, protocol unified management and scheduling of communication protocols, reduces CPU resource consumption and improves configuration efficiency.
It realizes flexible configuration of multiple communication protocols on the same controller, improves communication configuration efficiency and stability, reduces CPU resource loss, simplifies the difficulty of protocol development, and improves development convenience and reusability.
Smart Images

Figure CN120390043A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of communication protocols, and particularly relates to a flexible configurable industrial bus protocol system and an implementation method thereof. Background Art
[0002] In industrial control and power system control scenarios, a large number of various communication protocols need to be configured. The communication protocol configuration process of traditional controllers is too complex, and the types of communication protocols are also too single, unable to meet the on-site requirements of a single controller to configure multiple communication protocols.
[0003] Prior art document 1 (CN105785905A) discloses a configurable fieldbus system and a configuration method. The fieldbus system includes a configuration unit, a master controller, and a fieldbus. A protocol library is set in the configuration unit. The configuration unit is used to select a corresponding protocol from the protocol library according to the user's needs, configure instructions and operating parameters for the protocol, and send the selected protocol and the instructions and operating parameters corresponding to the protocol to the master controller. The master controller is used to form a field protocol stack according to the protocol selected by the configuration unit and the instructions and operating parameters corresponding to the protocol, and perform hardware interface configuration on the fieldbus according to the field protocol stack.
[0004] Prior art document 2 (CN109725575A) discloses an application system that can be compatible and adaptive with multiple field industrial bus communications, including a designed communication interface logic module for realizing protocol transmission, identification, and classification; a designed control processor module for realizing the communication protocol conversion between Devic Net or CAN open or CCLINK or Modubus and CAN; a CAN controller module for configuring the communication rate, flow control mode, data bits, stop bits, and parity bits of the UART bus; a core CPU controller module for configuring the drivers of multiple buses to realize the integrated design of the master and slave stations.
[0005] The deficiency of prior art document 1 is that it cannot provide a good visual communication protocol configuration interface. When configuring the communication protocol, it is impossible to well match and declare the input and output data and logic during the communication process, resulting in low efficiency of subsequent on-site debugging and use of the communication protocol.
[0006] The deficiencies of the prior art document 2 are that it requires all communication buses connected to the device to have a unified interface encapsulation, and requires data transmission in the form of differential pairs, which greatly reduces the usability of on-site device construction and connection. At the same time, requiring communication to be transmitted in the form of differential pairs reduces communication efficiency. And it will start multiple different communication protocols simultaneously. The device judges which communication protocol the data on the actual bus is through diagnosis, and then processes the data. All communication protocols are started simultaneously, but only several communication protocols are actually used, resulting in serious waste of the device's CPU resources. After the device diagnoses the types of communication protocols, it then transmits the data to the communication protocol for parsing, reducing the efficiency of communication transmission. Summary of the Invention
[0007] To solve the deficiencies in the prior art, the present invention proposes a method and system for implementing a flexible configurable industrial bus protocol, which can configure multiple different types of communication protocols on the same controller, solves the problem of implementing multiple different types of communication protocols on the same controller, and meets the flexible configuration requirements of a large number of various communication protocols on site.
[0008] The present invention adopts the following technical solutions.
[0009] In the first aspect of the present invention, a flexible configurable industrial bus protocol system is provided, including:
[0010] A graphical communication protocol configuration module, the graphical communication protocol configuration module includes a protocol configuration module and a database configuration module. The protocol configuration module is used to obtain communication protocol operation configuration parameters and communication protocol hardware configuration parameters. The database configuration module is used to obtain database configuration parameters for database initialization, generate a communication protocol configuration file according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters and database configuration parameters, and send the communication protocol configuration file to the controller;
[0011] A controller, which is used to parse the communication protocol configuration file and configure the corresponding industrial bus and database according to the obtained communication protocol operation configuration parameters, communication protocol hardware configuration parameters and database configuration parameters.
[0012] Optionally, the graphical communication protocol configuration module further includes a protocol selection module. The protocol selection module is used to provide the user with the option to select the protocol to be configured and extract the types of protocols selected by the user, and select the corresponding protocol configuration module according to the types of protocols to provide the user for communication protocol configuration.
[0013] Optionally, the controller includes a protocol unified management module and a driver module;
[0014] The protocol unified management module includes a protocol interface and thread scheduling sub-module and hardware initialization configuration interface sub-modules corresponding to multiple protocols. The protocol interface and thread scheduling sub-module is used to obtain a communication protocol configuration file, parse the communication protocol configuration file, and schedule different communication protocol threads. The hardware initialization configuration interface sub-module is used to initialize the corresponding hardware driver according to the obtained hardware configuration parameters;
[0015] The driver module is used to receive the hardware configuration parameters sent by the hardware initialization configuration interface sub-module and complete the initialization configuration of the corresponding industrial bus according to the hardware configuration parameters.
[0016] Optionally, the protocol interface and thread scheduling sub-module includes a protocol initialization unit, a protocol cycle scheduling unit, a protocol status detection unit, a protocol data receiving unit, a protocol data sending unit, and a database access unit;
[0017] The protocol initialization unit is used to initialize the communication protocol thread according to the obtained communication protocol configuration file;
[0018] The communication protocol operation configuration parameters include a scheduling period. The protocol cycle scheduling unit schedules the corresponding communication protocol thread periodically according to the scheduling period;
[0019] The protocol status detection unit is used to detect the running status of the communication protocol thread and upload the running status of the communication protocol thread to the database;
[0020] The protocol data receiving unit is used to receive the received message sent by the driver unit, parse the received message, and transfer the parsing result to the communication protocol thread. After being processed by the communication protocol thread, the corresponding data is obtained and uploaded to the database;
[0021] The protocol data sending unit is used to send the data sending message to the database. The data sending message is composed of the corresponding communication protocol thread according to the obtained database data;
[0022] The database access unit includes a data storage unit and a data retrieval unit. The data storage unit is used to write the data received by the protocol data receiving unit into the database. The data retrieval unit is used to read the database data and send the read database data to the communication protocol thread.
[0023] Optionally, when the protocol status detection unit is used to detect the running status of the communication protocol thread, it includes:
[0024] Count the protocol data transmission and reception volumes and TCP connection status corresponding to the protocol data sending unit and the protocol data receiving unit of different communication protocol threads;
[0025] Judge the running state of the communication protocol thread according to the protocol data transceiver volume and the TCP connection state;
[0026] Update the running state of the communication protocol thread to the corresponding thread statistical table in the database.
[0027] Optionally, the communication protocol operation configuration parameter further includes a protocol priority. The protocol cycle scheduling unit is used to schedule the corresponding communication protocol thread periodically according to the scheduling cycle, including:
[0028] Judge whether multiple communication protocols are configured for the same bus port. If so, the protocol interface and the thread scheduling sub-module start a communication protocol thread, and the communication protocol thread exclusively occupies the corresponding driver module and polls multiple communication protocols. Otherwise, judge the protocol priority of the scheduled communication protocol thread;
[0029] When the protocol priorities of the communication protocol threads are the same, schedule the communication protocol threads in a polling manner and run them periodically according to the running cycle of the communication protocol threads;
[0030] When the protocol priorities of the communication protocol threads are different, determine the scheduling order according to the protocol priorities and run the corresponding communication protocol threads in sequence according to the scheduling order.
[0031] The second aspect of the present invention provides a method for implementing a flexible configurable industrial bus protocol. The method includes:
[0032] The graphical communication protocol configuration module obtains the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters corresponding to the protocol types that the user needs to configure, generates a communication protocol configuration file according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters, and sends the communication protocol configuration file to the controller;
[0033] The controller parses the communication protocol configuration file and configures the corresponding industrial bus and database according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters obtained by the parsing.
[0034] Optionally, the controller includes a protocol unified management module and a driver module. The protocol unified management module includes a protocol interface and a thread scheduling sub-module and a hardware initialization configuration interface sub-module corresponding to multiple protocols. The controller parses the communication protocol configuration file and configures the corresponding industrial bus and database according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters obtained by the parsing, including:
[0035] The protocol unified management module parses the communication protocol configuration file, obtains the database configuration parameters, generates a data table corresponding to the protocol according to the database configuration parameters, and the data table includes the data in the protocol data interaction process;
[0036] The protocol interface and thread scheduling sub-module obtains the communication protocol configuration file, parses the communication protocol configuration file and schedules different communication protocol threads, and sends the scheduling result to the corresponding hardware initialization configuration interface sub-module;
[0037] The hardware initialization configuration interface sub-module generates corresponding hardware configuration parameters according to the scheduling result, and sends the hardware configuration parameters to the driver module;
[0038] The driver module receives the hardware configuration parameters sent by the hardware initialization configuration interface sub-module and completes the initialization configuration of the corresponding industrial bus according to the hardware configuration parameters.
[0039] Optionally, the graphical communication protocol configuration module generates a communication protocol configuration file according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters and database configuration parameters, including:
[0040] Obtain the initial configuration file corresponding to the protocol type that the user needs to configure, and the initial configuration file includes a first data area, a second data area and a third data area;
[0041] Fill the communication protocol operation configuration parameters and the communication protocol hardware configuration parameters into the first data area and the second data area of the initial configuration file corresponding to the protocol type respectively;
[0042] Add the database configuration parameters into the third data area of the initial configuration file to generate a communication protocol configuration file.
[0043] Optionally, the protocol interface and thread scheduling sub-module includes a protocol initialization unit, a protocol cycle scheduling unit, a protocol status detection unit, a protocol data receiving unit, a protocol data sending unit and a database access unit. The database access unit includes a data storage unit and a data retrieval unit. The protocol interface and thread scheduling sub-module obtains the communication protocol configuration file, parses the communication protocol configuration file and schedules different communication protocol threads, and sends the scheduling result to the corresponding hardware initialization configuration sub-interface module, including:
[0044] The protocol initialization unit initializes the communication protocol thread according to the obtained communication protocol configuration file;
[0045] The communication protocol operation configuration parameters include a scheduling period. The protocol cycle scheduling unit schedules the corresponding communication protocol thread periodically according to the scheduling period;
[0046] The protocol status detection unit detects the running status of the communication protocol thread and uploads the running status of the communication protocol thread to the database;
[0047] The protocol data receiving unit receives the received message sent by the driver module, parses the received message and passes the parsing result to the communication protocol thread. After processing, the communication protocol thread obtains the corresponding data and uploads it to the database;
[0048] The protocol data sending unit sends the data sending message to the database, and the data sending message is composed by the corresponding communication protocol thread according to the data obtained from the database;
[0049] The data storage module writes the data received by the protocol data receiving unit into the database. The data retrieval module reads the database data and sends the read database data to the communication protocol thread.
[0050] Optionally, the communication protocol running configuration parameter further includes a protocol priority. The protocol cycle scheduling unit schedules the corresponding communication protocol thread periodically according to the scheduling cycle, including:
[0051] Judge whether multiple communication protocols are configured for the same bus port. If so, the protocol interface and thread scheduling sub-module starts a communication protocol thread, and the communication protocol thread exclusively occupies the corresponding driver module and polls multiple communication protocols. Otherwise, judge the protocol priority of the scheduled communication protocol thread;
[0052] When the protocol priorities of the communication protocol threads are the same, the communication protocol threads are scheduled in a polling manner and run periodically according to the running cycle of the communication protocol thread;
[0053] When the protocol priorities of the communication protocol threads are different, determine the scheduling order according to the protocol priority and run the corresponding communication protocol threads in sequence according to the scheduling order.
[0054] Compared with the prior art, the beneficial effects of the present invention at least include:
[0055] The present invention provides a visual graphic configuration module, which provides corresponding communication protocol lists for selection according to different communication hardware protocol ports. After selecting different protocols, it can jump to the protocol configuration interface and the hardware parameter configuration interface; it is convenient to select different communication methods and communication protocols in the configuration interface according to the actual communication protocol on site, improving the efficiency of communication configuration. When configuring the communication protocol selection, the configuration of input and output data of relevant protocols can be directly carried out, the data in the database can be initialized visually, and the database mapping between data can be directly realized, facilitating the data interaction between logic and communication protocols and improving the development efficiency; after the communication protocol configuration is completed, a configuration file of the database is generated, and when the configuration is downloaded, the communication protocol and the database configuration can be downloaded to the controller together. All configured communication protocols are uniformly scheduled in the same process. Targeted scheduling is carried out according to the communication rate requirements of different communication protocols to improve the stability and reliability when different communication protocols are running.
[0056] The present invention can select a specific communication protocol for configuration according to the actual communication protocol and hardware interface used on site, meeting the flexible configuration of different communication protocols in different occasions and improving the usability and convenience on site; the device only runs the communication protocol thread configured by the configuration software, reducing unnecessary CPU resource consumption, directly processing communication data, and improving the reliability of communication.
[0057] The present invention realizes the standardization of communication protocol development through a unified platform interface, facilitating the reuse of communication protocols among multiple similar platform devices, improving the development convenience, reducing the difficulty of protocol development, accelerating the progress of protocol development, and improving the reusability of protocols; and uses a graphical configuration method to reduce the difficulty of communication protocol configuration, improve the work efficiency of protocol configuration, and directly realize the database mapping between data to facilitate the data interaction between logic and communication protocols. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for description in the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. Among them:
[0059] Figure 1 It is a schematic diagram of a flexible configurable industrial bus protocol system architecture provided by an embodiment of the present invention;
[0060] Figure 2 It is a schematic diagram of a communication scheduling structure provided by an embodiment of the present invention;
[0061] Figure 3Another schematic diagram of a flexibly configurable industrial bus protocol system architecture provided by an embodiment of the present invention;
[0062] Figure 4 A schematic diagram of a thread scheduling process provided by an embodiment of the present invention. Detailed implementation manners
[0063] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. The embodiments described in this application are only a part of the embodiments of the present invention, rather than all embodiments. Based on the spirit of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0064] Combined with Figures 1 to 3 As shown, Embodiment 1 of the present invention provides a flexibly configurable industrial bus protocol system, including:
[0065] A graphical communication protocol configuration module, which includes a plurality of protocol configuration modules and a database configuration module. The protocol configuration module is used to obtain the communication protocol operation configuration parameters and communication protocol hardware configuration parameters of the user. The database configuration module is used to obtain the database configuration parameters for the user to initialize the database, generate a communication protocol configuration file according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters, and send the communication protocol configuration file to the controller;
[0066] A controller, which is used to parse the communication protocol configuration file and configure the corresponding industrial bus and database according to the obtained communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters.
[0067] Among them, the communication protocol operation configuration parameters are the parameters required for the normal operation of the communication protocol, including: protocol type, physical port, scheduling period, scheduling priority, diagnosis information and communication data configuration during the protocol operation, and specific configuration parameters of the protocol itself.
[0068] The communication protocol hardware configuration parameters are hardware driver configuration parameters used to configure specific hardware devices, including: network-related communication protocol parameters, serial port-related communication protocol parameters, and CAN-related communication protocol parameters. Among them, the network-related communication protocol parameters include IP address, subnet mask, communication port, etc.; the serial port-related communication protocol parameters include baud rate, parity bit, stop bit; the CAN-related communication protocol includes communication speed, etc.
[0069] The database configuration parameters are used for database initialization configuration, including remote control, telemetry, tele-signaling, and remote regulation, which are used to add database configuration parameters to the corresponding data areas in the protocol selected by the user. Telemetry and tele-signaling data are the data obtained from the protocol in the communication, and remote control and remote regulation are the data to be sent out by the communication protocol. All of them are stored in the database. The database configuration parameters also include byte combination mode, data storage type, etc.
[0070] It can be understood that the controller is a general programmable logic controller, which can be logically developed according to different on-site applications.
[0071] Optionally, the graphical communication protocol configuration module further includes a protocol selection module, which is used to provide the user with the option to select the protocol to be configured and extract the type of protocol selected by the user, and select the corresponding protocol configuration module according to the protocol type and provide it to the user for communication protocol configuration.
[0072] Specifically, the graphical communication protocol configuration module is implemented by a programmable configuration module. For example, it can be implemented by using configuration software set on an intelligent device (such as a PC).
[0073] In this way, the user first selects the type of communication protocol to be used, configures the communication protocol according to the protocol type, and meets the flexible configuration requirements of a large number of various communication protocols on-site.
[0074] Optionally, the controller includes a protocol unified management module and a driver module;
[0075] The protocol unified management module includes a protocol interface and thread scheduling sub-module and hardware initialization configuration interface sub-modules corresponding to multiple protocols. The protocol interface and thread scheduling sub-module is used to obtain the communication protocol configuration file, parse the communication protocol configuration file and schedule different communication protocol threads, and send the scheduling result to the corresponding hardware initialization configuration interface sub-module. The hardware initialization configuration interface sub-module is used to initialize the corresponding hardware driver according to the hardware configuration parameters obtained from the unified management platform;
[0076] The driver module is used to receive the hardware configuration parameters sent by the hardware initialization configuration interface sub-module and complete the initialization configuration of the corresponding industrial bus according to the hardware configuration parameters.
[0077] It can be understood that the driver module refers to the driver for external hardware buses, such as TCP / IP interfaces, 485 interfaces, CAN device interfaces, etc.
[0078] Specifically, the communication protocol hardware configuration parameters are saved as files and transmitted to the controller for hardware initialization. After the communication protocol operation parameters are saved as files, they are transmitted to the controller, and the controller stores the configuration information in the communication protocol operation parameters in the real-time database. The database configuration parameters are used for database initialization to initialize the point tables of each communication protocol, that is, the data configurations such as telemetry, telecontrol, telecommand, and teleadjustment used when the communication protocol interacts with the database. For example, after a corresponding communication protocol is configured with telemetry, when the database is initialized, corresponding telemetry points are added to the table corresponding to the protocol for data entry during protocol operation.
[0079] Specifically, the graphical communication protocol configuration module supports configuring at least one of the following communication protocols: 101 protocol, 102 protocol, 103 protocol, 104 protocol, ModBus-RTU protocol, ModBus-TCP protocol, CAN2.0 protocol, CANOpen protocol, ProfiBus-DP protocol, EtherCat protocol, PMU protocol, and 61850 protocol.
[0080] Optionally, during the communication protocol configuration process, the metadata method is used to store and transmit the data configured by the user.
[0081] Specifically, in combination with Figure 3 As shown, the upper computer software configuration is used to construct a graphical communication protocol configuration interface. During the communication protocol configuration process, corresponding hardware parameter metadata, communication parameter metadata, and interaction data configuration parameter metadata are generated for each communication protocol according to the communication protocol hardware configuration parameters, communication protocol operation parameters, and database configuration parameters. The above metadata is downloaded to the controller through the upper computer software configuration. The controller loads the metadata into the database according to the protocol configuration of each channel. The database creates separate hardware parameter tables, communication parameter tables, and interaction data tables for the protocol configuration of each channel for the front-end process to access and call. Among them, the hardware parameter table is used to store the hardware parameter metadata, the communication parameter table is used to store the communication parameter metadata, and the interaction data table is used to store the interaction data configuration parameter metadata.
[0082] Specifically, a list can be set in the upper computer software configuration. This list lists the communication protocols currently supported by the controller, and at the same time marks the corresponding configuration files for each communication protocol. When the upper computer software configuration is started, this table is loaded. When the communication protocol is configured for the corresponding hardware interface on the upper computer software configuration, the user only needs to double-click the corresponding communication protocol, and the upper computer software configuration will generate an icon on the configuration. This icon links to the corresponding communication protocol and binds to the corresponding hardware interface. Clicking the icon can complete the configuration of the parameters of the communication protocol. The link information between the protocol of the icon and the hardware port is finally stored in a communication protocol configuration file and downloaded to the controller when the configuration is downloaded.
[0083] Taking the 104 protocol as an example, the specific parameters of the communication protocol will be described below.
[0084] The hardware configuration parameters of TCP / IP include: the channel type, i.e., the TCP / IP address; the channel configuration parameters include the local IP address, the remote IP address, the subnet mask, and the server port.
[0085] The protocol operation parameters include: the channel communication address, the protocol scheduling period, i.e., the protocol scheduling period time interval, the protocol waiting time, including the communication timeout time, the time for sending the heartbeat message, the time for sending the test probe, etc., the four-shake data capacity, including the data capacities of telemetry, telecontrol, telecommand, and telesetpoint adjustment, the starting addresses of the four-shake data, including the starting addresses of the data descriptions of telemetry, telecontrol, telecommand, and telesetpoint adjustment, and the protocol word standards, including the South Grid standard, the State Grid standard, the Guangdong standard, etc.
[0086] The database configuration parameters: The telemetry data table includes the number of telemetry data, the telemetry data address, the data type of the telemetry data, the data upload function code, etc.; the telecontrol data table includes the number of telecontrol data, the telecontrol data address, the data type of the telecontrol data, etc.; the telecommand data table includes the number of telecommand data, the telecommand data address, the data type of the telecommand data, etc.; the telesetpoint adjustment data table includes the number of telesetpoint adjustment data, the telesetpoint adjustment data address, the data type of the telesetpoint adjustment data, the telesetpoint adjustment control type, etc.
[0087] In this embodiment, by configuring the physical port used for the corresponding communication protocol and filling in the corresponding parameters according to the characteristics of each protocol, such as the IP address and port for network port communication; the port, baud rate, parity bit, stop bit, etc. for the 485 bus, specific parameter configurations, and generating a specific file for storage and transmission of these protocol configuration parameters. The database configuration of the protocol corresponding data can be added in the data area corresponding to the protocol, and the corresponding data such as telecommand, telesetpoint adjustment, telemetry, telecontrol, and telepulse can be added in the corresponding protocol data area. It is convenient for visual configuration of the database, and at the same time, the configuration items are generated into a specific file. When performing configuration download, the configuration of the communication protocol and the configuration file of the database are transmitted to the corresponding controller. After the controller receives the file, it parses the file to complete the initialization configuration of the communication protocol and the database.
[0088] The graphical communication protocol configuration method of the embodiment of the present invention simplifies the configuration process of the communication protocol, provides the necessary configuration parameters required for the communication protocol, shields the operations irrelevant to the communication protocol configuration, uses a unified configuration interface for various communication protocols, generates a communication configuration file, and downloads it to the device for communication configuration. The hardware of the communication protocol is mapped through the graphical communication protocol configuration interface, and according to the hardware settings of different protocols, the hardware configuration parameters are generated and downloaded to the device to complete the initialization of various hardware buses.
[0089] The present invention can perform customized database configuration according to the characteristics of different communication protocols. For example, during the communication process, the telemetry data received is selected in combination modes such as single-byte, double-byte, and four-byte according to the actual data format on-site, and the data can be set as integer or floating-point type, and functions such as meaning annotation of telemetry data can be performed; for tele-signaling, tele-control, tele-adjustment, etc., similar to telemetry, personalized settings can be made. In this way, it is convenient to directly read data during logic development and operation, without having to recombine the data according to the byte offset based on the communication message. That is, the logic developer does not need to understand the communication method of the protocol and can complete the logic development by focusing on the data in the database. Moreover, when sending data, it only needs to be stored in the database, and the byte combination is also completed in the protocol, which facilitates logic development, improves the development efficiency, and reduces the ability threshold of logic developers.
[0090] Through the combined method of database and protocol configuration, the present invention facilitates the completion of protocol configuration and database configuration at one time, and realizes the decoupling of protocol operation and logic operation through database configuration.
[0091] Optionally, the protocol interface and thread scheduling sub-module includes a protocol initialization unit, a protocol cycle scheduling unit, a protocol status detection unit, a protocol data receiving unit, a protocol data sending unit, and a database access unit;
[0092] The protocol initialization unit is used to initialize the communication protocol thread according to the obtained communication protocol configuration file;
[0093] The communication protocol operation configuration parameters include a scheduling period, and the protocol cycle scheduling unit schedules the corresponding communication protocol thread periodically according to the scheduling period;
[0094] The protocol status detection unit is used to detect the running status of the communication protocol thread and upload the running status of the communication protocol thread to the database;
[0095] The protocol data receiving unit is used to receive the received message sent by the driver module, parse the received message, and transfer the parsing result to the communication protocol thread. After being processed by the communication protocol thread, the corresponding data (i.e., business data such as telemetry, tele-signaling, tele-control, and tele-adjustment) is uploaded to the database; the communication protocol thread processes the business data in the received message according to the database configuration parameters in the received message (such as data combination mode, data type, meaning annotation, etc.).
[0096] The protocol data sending unit is used to send the data sending message to the database, and the data sending message is composed of the corresponding communication protocol thread according to the obtained database data after processing;
[0097] The database access unit includes a data storage module and a data retrieval module. The data storage module is used to write the data received by the protocol data receiving unit into the database, and the data retrieval module is used to read the database data and send the read database data to the communication protocol thread.
[0098] Specifically, the protocol interface and thread scheduling sub-module is used to read various configuration item parameters of the communication protocol in the communication configuration file issued by the graphical configuration module, such as the station address, the IP and port of the TCP communication protocol, or the COM port of communication protocols such as ModBus and ProfiBus-DP, or the CAN bus of protocols such as CANOpen, the protocol call period, and the protocol call timeout.
[0099] Specifically, the protocol unified management module provides unified communication data reception (i.e., the protocol data receiving unit) and sending interfaces (i.e., the protocol data sending unit) for each communication protocol, and provides corresponding buffer queues (i.e., the drive send data buffer and the drive receive data buffer) for each interface to effectively control the data reception and sending of the communication protocol; and provides a unified interface for interacting with the database (i.e., the database access unit) to decouple the data interaction between the communication protocol and the logic, facilitating the implementation of storing received data in the database and retrieving data from the database for sending.
[0100] The threads of each communication protocol are scheduled in the same process (i.e., the front-end process). According to the parameters of the graphical communication protocol configuration interface, the scheduling methods of various communication protocols are determined to meet the performance requirements of different communication protocols. At the same time, the process can also obtain the running status of the communication protocol during scheduling, and the on-site logic can view the communication operation situation when it is online, facilitating on-site debugging.
[0101] Optionally, when the protocol status detection unit is used to detect the running status of the communication protocol thread, it includes:
[0102] Statistical protocol data transmission and reception volumes and TCP connection statuses corresponding to the protocol data sending unit and the protocol data receiving unit of different communication protocol threads;
[0103] Judging the running status of the communication protocol thread according to the protocol data transmission and reception volumes and the TCP connection status;
[0104] Updating the running status of the communication protocol thread to the corresponding thread statistical table in the database.
[0105] Specifically, if the communication protocol is a bus-type communication protocol, it is necessary to count whether the protocol can receive data normally within a specific cycle of protocol operation. If the data cannot be received normally, the protocol is considered offline. If it is a TCP-type protocol, in addition to detecting whether the protocol can receive data normally within a specific cycle, it is also necessary to judge the TCP connection status. If there is no TCP connection, the protocol is considered offline. For example, the socket connection status obtained from the TCP / IP driver can be used to judge whether the protocol is running normally or in a stopped state.
[0106] Optionally, the communication protocol operation configuration parameter further includes a protocol priority. The protocol cycle scheduling unit is used to schedule the corresponding communication protocol thread periodically according to the scheduling cycle, including:
[0107] Judge whether multiple communication protocols are configured for the same bus port. If so, the protocol interface and the thread scheduling sub-module start a communication protocol thread, and the communication protocol thread exclusively occupies the corresponding driver module and polls multiple communication protocols. Otherwise, judge the protocol priority of the scheduled communication protocol thread;
[0108] When the protocol priorities of the communication protocol threads are the same, the communication protocol threads are scheduled in a polling manner and run periodically according to the running cycles of the communication protocol threads;
[0109] When the protocol priorities of the communication protocol threads are different, determine the scheduling order according to the protocol priorities, and run the corresponding communication protocol threads in sequence according to the scheduling order.
[0110] Specifically, for bus-related protocols such as CAN / 485, a thread corresponding to one protocol runs on the same hardware bus, and the operation status of the protocol is judged according to the messages of the corresponding slave stations in the received messages for multiple connected slave stations. For example, in the 485-bus Profibus-DP master station protocol, each slave station is polled periodically. If no response from the slave station is received within a specific time after sending the slave station inquiry message, the slave station is considered offline, and the protocol operation status of the slave station is updated to the database thread statistics table.
[0111] Optionally, when the hardware initialization configuration interface sub-module is occupied, the current thread enters the first queue to wait in line for the corresponding hardware initialization configuration interface sub-module to be released. The thread with the highest priority in the first queue uses the corresponding hardware initialization configuration interface sub-module after the previous thread is released.
[0112] It can be understood that the occupation of the hardware initialization configuration interface sub-module occurs in the TCP / IP communication protocol. When the sending or receiving interface of the TCP / IP driver is occupied, the current thread enters the first queue to wait in line for the driver interface to be released, and the thread with the highest priority in the queue immediately uses the driver interface after the previous thread is released.
[0113] Optionally, if the current database is performing a read or write operation, the database data status is locked. When the database data status is available, the data operations in the second queue are sequentially executed.
[0114] Specifically, the front-end process (i.e., the communication protocol management process of the protocol unified management module) encapsulates the interfaces of functions such as adding, deleting, modifying, and querying database functions. When performing database operations, the interfaces encapsulated by the protocol unified management module are called. The protocol unified management module queues and executes the data operations according to the second queue based on the data access situation in the database, thereby preventing database access conflict problems. The data access situation refers to whether there is a read or write operation in progress in the database. If the current database is performing a read or write operation, the database status is locked. When the database status is not locked (i.e., available), the data operations in the second queue are sequentially executed.
[0115] It can be understood that except for the driver interface and the database interface, the protocol threads run independently and there is no other thread access conflict situation.
[0116] In this embodiment, the protocol unified management module starts a separate process for the communication protocol to manage the scheduling of various communication protocols. It manages the initialization, periodic scheduling, etc. of each communication protocol thread, provides a unified data sending and receiving interface, and provides a unified database access interface to ensure the normal operation of various communication protocols. The protocol initialization unit obtains the configuration parameters according to the type of communication protocol obtained by the graphical communication protocol configuration module, and initializes the bus on which the communication protocol depends, including the 458 bus, CAN bus, TCP / IP protocol stack, etc. The communication protocol management process provides a message passing interface between communication protocols to meet the communication requirements between daily operation threads.
[0117] Combined with Figure 4 As shown in
[0118] Step 1: The graphical communication protocol configuration module obtains the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters corresponding to the protocol type that the user needs to configure, generates a communication protocol configuration file according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters, and sends the communication protocol configuration file to the controller.
[0119] Specifically, in the graphical communication protocol configuration module, at the corresponding hardware port, select the communication protocol to be configured from the protocol list. After the protocol is selected, configure the protocol hardware configuration parameters, protocol operation configuration parameters, and database configuration parameters corresponding to the protocol. After the protocol configuration is completed, save it to the configuration file according to the function fields.
[0120] Specifically, the configuration download can send the protocol hardware configuration parameters, protocol operation configuration parameters, and database configuration parameters to the controller in the form of protocol hardware parameter metadata, communication parameter metadata, and interaction data configuration parameter metadata respectively through the ONet protocol.
[0121] Step 2: The controller parses the communication protocol configuration file and configures the corresponding industrial bus and database according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters obtained by parsing.
[0122] The controller includes a protocol unified management module and a driver module. The protocol unified management module includes a protocol interface and a thread scheduling sub-module and hardware initialization configuration interface sub-modules corresponding to multiple protocols. Step 2 includes:
[0123] Step 2.1: The protocol unified management module parses the communication protocol configuration file to obtain the database configuration parameters, and generates a data table corresponding to the protocol according to the database configuration parameters. The data table includes the data in the protocol data interaction process.
[0124] Step 2.2: The protocol interface and thread scheduling sub-module obtains the communication protocol configuration file, parses and schedules different communication protocol threads for the communication protocol configuration file, and sends the scheduling result to the corresponding hardware initialization configuration interface sub-module.
[0125] Step 2.3: The hardware initialization configuration interface sub-module generates the corresponding hardware configuration parameters according to the scheduling result and sends the hardware configuration parameters to the driver module.
[0126] Step 2.4: The driver module receives the hardware configuration parameters sent by the hardware initialization configuration interface sub-module and completes the initialization configuration of the corresponding industrial bus according to the hardware configuration parameters.
[0127] Specifically, after the controller receives the configuration downloaded by the graphical communication protocol, the protocol unified management module parses the corresponding protocol hardware parameter metadata (i.e., protocol hardware configuration parameters), protocol communication parameter metadata (i.e., protocol operation configuration parameters), protocol interaction data configuration metadata (database configuration parameters), etc., and stores them in the configuration tables corresponding to each piece of information according to the configuration of each protocol. The protocol unified management module reads the protocol hardware configuration parameters during the initialization of each protocol to complete the initialization of multiple protocols; subsequently, it performs polling scheduling on the protocol according to the protocol communication configuration parameters and protocol data configuration parameters.
[0128] Optionally, the graphical communication protocol configuration module generates a communication protocol configuration file according to the communication protocol operation configuration parameters, the communication protocol hardware configuration parameters, and the database configuration parameters, including:
[0129] Obtain an initial configuration file corresponding to the protocol type that the user needs to configure, where the initial configuration file includes a first data area, a second data area, and a third data area;
[0130] Fill the communication protocol operation configuration parameters and the communication protocol hardware configuration parameters into the first data area and the second data area of the initial configuration file corresponding to the protocol type respectively;
[0131] Add the database configuration parameters to the third data area of the initial configuration file to generate a communication protocol configuration file.
[0132] Optionally, the protocol interface and the thread scheduling sub-module include a protocol initialization unit, a protocol cycle scheduling unit, a protocol status detection unit, a protocol data receiving unit, a protocol data sending unit, and a database access unit. The database access unit includes a data storage module and a data retrieval module. The protocol interface and the thread scheduling sub-module obtain the communication protocol configuration file, parse the communication protocol configuration file, schedule different communication protocol threads, and send the scheduling result to the corresponding hardware initialization configuration interface sub-module, including:
[0133] The protocol initialization unit initializes the communication protocol thread according to the obtained communication protocol configuration file;
[0134] The communication protocol operation configuration parameters include a scheduling period. The protocol cycle scheduling unit schedules the corresponding communication protocol thread periodically according to the scheduling period;
[0135] The protocol status detection unit detects the running status of the communication protocol thread and uploads the running status of the communication protocol thread to the database;
[0136] The protocol data receiving unit receives the received message sent by the driver module, parses the received message, and passes the parsing result to the communication protocol thread. After being processed by the communication protocol thread, the corresponding data is obtained and uploaded to the database;
[0137] The protocol data sending unit sends the data sending message to the database, and the data sending message is composed of the corresponding communication protocol thread according to the obtained database data;
[0138] The data storage module writes the data received by the protocol data receiving unit into the database. The data retrieval module reads the database data and sends the read database data to the communication protocol thread.
[0139] Optionally, the communication protocol operation configuration parameter further includes a protocol priority. The protocol cycle scheduling unit schedules the corresponding communication protocol threads periodically according to the scheduling cycle, including:
[0140] Determine whether multiple communication protocols are configured for the same bus port. If so, the protocol interface and the thread scheduling sub-module start a communication protocol thread, and the communication protocol thread exclusively occupies the corresponding driver module and polls multiple communication protocols. Otherwise, determine the protocol priority of the scheduled communication protocol thread;
[0141] In the case where the protocol priorities of the communication protocol threads are the same, schedule the communication protocol threads in a polling manner and run them periodically according to the running cycles of the communication protocol threads;
[0142] In the case where the protocol priorities of the communication protocol threads are different, determine the scheduling order according to the protocol priorities and run the corresponding communication protocol threads in sequence according to the scheduling order.
[0143] The present invention realizes the standardization of communication protocol development through a unified platform interface, facilitates the reuse of communication protocols among multiple similar platform devices, improves the development convenience, reduces the difficulty of protocol development, speeds up the progress of protocol development, and improves the reusability of protocols; and uses a graphical configuration method to reduce the difficulty of communication protocol configuration, improve the work efficiency of protocol configuration, and directly realize the database mapping between data to facilitate the data interaction between logic and communication protocols.
[0144] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution is prior or subsequent. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0145] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: still can modify the specific implementation manners of the present invention or make equivalent replacements, and any modification or equivalent replacement without departing from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.
Claims
1. A flexible configurable industrial bus protocol system, characterized in that, Comprising: A graphical communication protocol configuration module, which includes a protocol configuration module and a database configuration module. The protocol configuration module is used to obtain communication protocol operation configuration parameters and communication protocol hardware configuration parameters. The database configuration module is used to obtain database configuration parameters for database initialization, generate a communication protocol configuration file according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters, and send the communication protocol configuration file to the controller. A controller, which is used to parse the communication protocol configuration file and configure the corresponding industrial bus and database according to the obtained communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters.
2. The flexible configurable industrial bus protocol system according to claim 1, wherein: The graphical communication protocol configuration module further includes a protocol selection module. The protocol selection module is used to provide the user with the option to select the protocol to be configured, extract the type of protocol selected by the user, and select the corresponding protocol configuration module according to the protocol type to provide the user for communication protocol configuration.
3. The flexible configurable industrial bus protocol system according to claim 1, wherein: The controller includes a protocol unified management module and a driver module; The protocol unified management module includes a protocol interface and thread scheduling sub-module and hardware initialization configuration interface sub-modules corresponding to multiple protocols. The protocol interface and thread scheduling sub-module is used to obtain the communication protocol configuration file, parse the communication protocol configuration file, and schedule different communication protocol threads. The hardware initialization configuration interface sub-module is used to initialize the corresponding hardware driver according to the obtained hardware configuration parameters. The driver module is used to receive the hardware configuration parameters sent by the hardware initialization configuration interface sub-module and complete the initialization configuration of the corresponding industrial bus according to the hardware configuration parameters.
4. The flexible configurable industrial bus protocol system according to claim 3, wherein: The protocol interface and thread scheduling sub-module includes a protocol initialization unit, a protocol cycle scheduling unit, a protocol status detection unit, a protocol data reception unit, a protocol data transmission unit, and a database access unit; The protocol initialization unit is used to initialize the communication protocol thread according to the obtained communication protocol configuration file; The communication protocol operation configuration parameters include a scheduling cycle. The protocol cycle scheduling unit schedules the corresponding communication protocol thread periodically according to the scheduling cycle; The protocol status detection unit is used to detect the running status of the communication protocol thread and upload the running status of the communication protocol thread to the database; The protocol data reception unit is used to receive the received message sent by the driver unit, parse the received message, and transfer the parsing result to the communication protocol thread. After the communication protocol thread processes it, the corresponding data is uploaded to the database; The protocol data transmission unit, which is used to send the data transmission message to the database. The data transmission message is composed of the corresponding communication protocol thread according to the obtained database data. The database access unit includes a data storage unit and a data retrieval unit. The data storage unit is used to write the data received by the protocol data reception unit into the database, and the data retrieval unit is used to read the database data and send the read database data to the communication protocol thread.
5. The flexible configurable industrial bus protocol system according to claim 4, wherein: When the protocol status detection unit is used to detect the running status of the communication protocol thread, it includes: Counting the protocol data transmission and reception volume and the TCP connection status corresponding to the protocol data transmission unit and the protocol data reception unit of different communication protocol threads; Judging the running status of the communication protocol thread according to the protocol data transmission and reception volume and the TCP connection status; Updating the running status of the communication protocol thread to the corresponding thread statistical table in the database.
6. The flexible configurable industrial bus protocol system according to claim 4, wherein: The communication protocol running configuration parameters further include a protocol priority. The protocol cycle scheduling unit is used to schedule the corresponding communication protocol thread periodically according to the scheduling cycle, including: Judging whether multiple communication protocols are configured for the same bus port. If so, the protocol interface and the thread scheduling sub-module start a communication protocol thread, and the communication protocol thread exclusively occupies the corresponding driver module and polls multiple communication protocols. Otherwise, judge the protocol priority of the scheduled communication protocol thread; When the protocol priorities of the communication protocol threads are the same, the communication protocol threads are scheduled in a polling manner and run periodically according to the running cycle of the communication protocol threads; When the protocol priorities of the communication protocol threads are different, determine the scheduling order according to the protocol priorities and run the corresponding communication protocol threads in sequence according to the scheduling order.
7. A method for implementing a flexibly configurable industrial bus protocol, which is applied to the flexibly configurable industrial bus protocol system according to any one of claims 1 to 6, characterized in that, The method includes: The graphical communication protocol configuration module obtains the communication protocol running configuration parameters, the communication protocol hardware configuration parameters, and the database configuration parameters corresponding to the protocol types that the user needs to configure, generates a communication protocol configuration file according to the communication protocol running configuration parameters, the communication protocol hardware configuration parameters, and the database configuration parameters, and issues the communication protocol configuration file to the controller; The controller parses the communication protocol configuration file and configures the corresponding industrial bus and database according to the communication protocol running configuration parameters, the communication protocol hardware configuration parameters, and the database configuration parameters obtained by the parsing.
8. The flexible configurable industrial bus protocol implementation method according to claim 7, wherein: The controller includes a protocol unified management module and a driver module. The protocol unified management module includes a protocol interface and a thread scheduling sub-module and a hardware initialization configuration interface sub-module corresponding to multiple protocols. The controller parses the communication protocol configuration file and configures the corresponding industrial bus and database according to the communication protocol running configuration parameters, the communication protocol hardware configuration parameters, and the database configuration parameters obtained by the parsing, including: The protocol unified management module parses the communication protocol configuration file, obtains the database configuration parameters, generates a data table corresponding to the protocol according to the database configuration parameters, and the data table includes the data in the protocol data interaction process; The protocol interface and thread scheduling sub-module obtains the communication protocol configuration file, parses the communication protocol configuration file, schedules different communication protocol threads, and sends the scheduling result to the corresponding hardware initialization configuration interface sub-module; The hardware initialization configuration interface sub-module generates corresponding hardware configuration parameters according to the scheduling result and sends the hardware configuration parameters to the driver module; The driver module receives the hardware configuration parameters sent by the hardware initialization configuration interface sub-module and completes the initialization configuration of the corresponding industrial bus according to the hardware configuration parameters.
9. The method for implementing a flexibly configurable industrial bus protocol according to claim 7, characterized in that: The graphical communication protocol configuration module generates a communication protocol configuration file according to the communication protocol operation configuration parameters, communication protocol hardware configuration parameters, and database configuration parameters, including: Obtain the initial configuration file corresponding to the protocol type that the user needs to configure, and the initial configuration file includes a first data area, a second data area, and a third data area; Fill the communication protocol operation configuration parameters and the communication protocol hardware configuration parameters into the first data area and the second data area of the initial configuration file corresponding to the protocol type respectively; Add the database configuration parameters to the third data area in the initial configuration file to generate a communication protocol configuration file.
10. The method for implementing a flexibly configurable industrial bus protocol according to claim 7, characterized in that: The protocol interface and thread scheduling sub-module includes a protocol initialization unit, a protocol cycle scheduling unit, a protocol status detection unit, a protocol data receiving unit, a protocol data sending unit, and a database access unit. The database access unit includes a data storage unit and a data retrieval unit. The protocol interface and thread scheduling sub-module obtains the communication protocol configuration file, parses the communication protocol configuration file, schedules different communication protocol threads, and sends the scheduling result to the corresponding hardware initialization configuration sub-interface module, including: The protocol initialization unit initializes the communication protocol thread according to the obtained communication protocol configuration file; The communication protocol operation configuration parameters include a scheduling period. The protocol cycle scheduling unit schedules the corresponding communication protocol thread periodically according to the scheduling period; The protocol status detection unit detects the running status of the communication protocol thread and uploads the running status of the communication protocol thread to the database; The protocol data receiving unit receives the received message sent by the driver module, parses the received message, and passes the parsing result to the communication protocol thread. After being processed by the communication protocol thread, the corresponding data is uploaded to the database; The protocol data sending unit sends the data sending message to the database, and the data sending message is composed of the corresponding communication protocol thread according to the obtained database data; The data storage module writes the data received by the protocol data receiving unit into the database. The data retrieval module reads the database data and sends the read database data to the communication protocol thread.
11. The method for implementing a flexibly configurable industrial bus protocol according to claim 10, characterized in that: The operating configuration parameters of the communication protocol further include protocol priorities. The protocol cycle scheduling unit schedules the corresponding communication protocol threads according to the scheduling cycle, including: Determine whether multiple communication protocols are configured for the same bus port. If so, the protocol interface and the thread scheduling sub-module start a communication protocol thread, and the communication protocol thread exclusively occupies the corresponding driver module and polls multiple communication protocols. Otherwise, determine the protocol priority of the scheduled communication protocol thread; When the protocol priorities of the communication protocol threads are the same, schedule the communication protocol threads in a polling manner and run them periodically according to the operating cycles of the communication protocol threads; When the protocol priorities of the communication protocol threads are different, determine the scheduling order according to the protocol priorities and run the corresponding communication protocol threads in sequence according to the scheduling order.
Citation Information
Patent Citations
Configurable field bus system and configuration method thereof
CN105785905A
Application system compatible with adaptive multi-field industrial bus communication
CN109725575A