CN112698973A - System, method and device for automatic registration and management of modbus equipment - Google Patents

System, method and device for automatic registration and management of modbus equipment Download PDF

Info

Publication number
CN112698973A
CN112698973A CN202110004988.9A CN202110004988A CN112698973A CN 112698973 A CN112698973 A CN 112698973A CN 202110004988 A CN202110004988 A CN 202110004988A CN 112698973 A CN112698973 A CN 112698973A
Authority
CN
China
Prior art keywords
modbus
equipment
list
management
management center
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110004988.9A
Other languages
Chinese (zh)
Inventor
罗凡
李城城
王予宽
刘一凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN202110004988.9A priority Critical patent/CN112698973A/en
Publication of CN112698973A publication Critical patent/CN112698973A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/547Messaging middleware

Abstract

The invention relates to the field of equipment management, in particular to a system, a method and a device for automatic registration and management of modbus equipment. The system comprises a modbus device management center and at least one modbus application program; the method comprises the steps that a modbus device management center obtains the change state of modbus slave station equipment according to the change of an equipment configuration file, maintains an equipment list and an equipment address list according to the change state of the modbus slave station equipment, and sends a state change message of the modbus slave station equipment to a modbus application program; when the modbus application program is started and a state change message of the modbus slave station equipment is received, the current equipment list and the equipment address list are obtained, and interaction is carried out on the modbus slave station equipment according to the current equipment list and the equipment address list. Unified registration and management are carried out on the devices through the modbus device management center, the load of modbus application programs is reduced, and the working efficiency of the system is improved.

Description

System, method and device for automatic registration and management of modbus equipment
[ technical field ] A method for producing a semiconductor device
The invention relates to the field of equipment management, in particular to a system, a method and a device for automatic registration and management of modbus equipment.
[ background of the invention ]
The Modbus protocol is a master/slave architecture protocol. The Modbus master station is a master node, and the other devices participating in communication by using the Modbus protocol are slave nodes. Each device acting as a slave node, also referred to as a slave, has a unique address.
Currently, in the application of the industrial internet of things, most of the modes for managing modbus slave station equipment are to configure an address for terminal equipment to be accessed through an upper computer serving as a master station before a program is started, determine an equipment configuration file according to the configured address, and access the equipment according to a communication address and connection attributes in the configuration file. In the above scheme, the online and offline detection and the device initialization function of the device are both put into the application program, which adds burden to the operation of the application program, and the application program needs to spend a large amount of consumption on maintaining the online and offline monitoring of the device, and register and initialize each newly online device, thereby affecting the service execution efficiency of the application program.
In view of this, how to overcome the defects in the prior art, and solve the problem that the system service efficiency is reduced due to direct management and registration of the modbus application program on the device, are problems to be solved in the technical field.
[ summary of the invention ]
Aiming at the defects or improvement requirements of the prior art, the invention solves the problems of resource consumption and inconvenient management caused by managing the equipment through a modbus application program in the current modbus equipment management scheme.
The embodiment of the invention adopts the following technical scheme:
in a first aspect, the invention provides a system for automatic registration and management of modbus devices, which specifically comprises: the system comprises a modbus device management center and at least one modbus application program; the method comprises the steps that a modbus device management center obtains the change state of modbus slave station equipment according to the change of an equipment configuration file, maintains an equipment list and an equipment address list according to the change state of the modbus slave station equipment, and sends a state change message of the modbus slave station equipment to a modbus application program; when the modbus application program is started and a state change message of the modbus slave station equipment is received, the current equipment list and the equipment address list are obtained, and interaction is carried out on the modbus slave station equipment according to the current equipment list and the equipment address list.
Preferably, when the equipment is online, the modbus equipment management center automatically allocates slave station addresses for the equipment, issues the slave station addresses to the equipment by using a modbus protocol, and writes the slave station addresses into an equipment address list; and when the equipment is offline, deleting the equipment address from the equipment address list.
Preferably, the obtaining the current device list and the device address list includes: the method comprises the steps that a modbus application program obtains a current equipment list and/or an equipment address list through a message pushed by a modbus equipment management center; or, the modbus application program obtains the current device list and/or device address list through the shared memory.
Preferably, the modbus device management center judges whether the device has a corresponding object model when the modbus slave station device is on line; if the corresponding object model exists, equipment is established under the object model, corresponding equipment attribute information is obtained through an equipment configuration file, and the equipment attribute information is written into an equipment list; and if no corresponding object model exists, establishing a corresponding object model, then establishing equipment under the object model, acquiring corresponding equipment attribute information by the equipment configuration file, and writing the equipment attribute information into an equipment list.
Preferably, the method further comprises the following steps: after the devices are online, the modbus device management center checks the connection condition of the devices through heartbeat detection, and if the connection abnormal times reach a preset abnormal upper limit, an alarm message is sent to the abnormal detection module.
Preferably, if multiple modbus applications are communicating with a modbus slave device at the same time, the communicating communication connection is locked to ensure that the modbus applications communicate with the modbus slave device via only one fixed communication connection at a time.
Preferably, when the device is on line, the modbus device management center configures the starting position of the register and the sensor data type supported by the device for the device, and writes the starting position of the register and the sensor data type supported by the device as the device information into the configuration file.
Preferably, the modbus device management center sends the device status change message to the modbus application using the mqtt protocol, the amqp protocol, the stomp protocol, or the xmpp protocol.
In a second aspect, the invention provides a method for automatic registration and management of modbus devices, which specifically comprises the following steps: the automatic modbus device registration and management system is used for achieving the automatic modbus device registration and management function.
In a third aspect, the present invention provides an apparatus for automatically registering and managing modbus devices, which specifically includes: the modbus device automatic registration and management system comprises at least one processor and a memory, wherein the at least one processor and the memory are connected through a data bus, and the memory stores instructions executable by the at least one processor, and the instructions, when executed by the processor, are used for completing the functions of a modbus device management center and/or a modbus application program in the modbus device automatic registration and management system of the first aspect.
Compared with the prior art, the embodiment of the invention has the beneficial effects that: the modbus master station and the modbus application program access the devices through the local device list and the device address list acquired by the modbus device management center. The devices are uniformly registered and managed through the modbus device management center, so that the modbus master station and the modbus application program do not need to pay attention to the connection change situation of the devices, and only need to adjust the local device list through the device on-line and off-line and the updating message sent by the modbus device management center to respond to the connection change of the devices, the load of the modbus master station and the modbus application program is reduced, and the working efficiency of the system is improved. In addition, in the preferred scheme of the invention, the devices are grouped according to the object model, so that the configuration management of subsequent device acquisition and data processing work is facilitated according to the object model.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described below. It is obvious that the drawings described below are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a system structural diagram of automatic registration and management of a modbus device according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for automatic registration and management of a modbus device according to an embodiment of the present invention;
FIG. 3 is a flow chart of another method for automatic modbus device registration and management according to an embodiment of the present invention;
FIG. 4 is a flow chart of another method for automatic modbus device registration and management according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus for automatically registering and managing modbus devices according to an embodiment of the present invention;
fig. 6 is an architectural diagram of a usage scenario of a device for automatically registering and managing modbus devices according to an embodiment of the present invention.
[ detailed description ] embodiments
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The present invention is a system structure of a specific function system, so the functional logic relationship of each structural module is mainly explained in the specific embodiment, and the specific software and hardware implementation is not limited.
In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other. The invention will be described in detail below with reference to the figures and examples.
Example 1:
in a general modbus system, a modbus application program needs to perform device registration and device initialization configuration on all devices to be connected when the program is started, and first confirms whether connection and communication with the devices are normal or not when a control command is sent to the devices or a value is acquired by the devices each time, so as to avoid communication failure caused by device connection errors. The device registration, the device initialization and the device connection confirmation all need to consume certain time and resources, in the field of industrial internet of things, more devices generally need to be managed simultaneously, the device on-line or off-line situation frequently occurs, and the device registration, the initialization and the connection confirmation need to be carried out repeatedly, so that a large amount of time and resources are occupied by the device management work, and the response speed and the service execution efficiency of the modbus application program are influenced. Therefore, in this embodiment, by providing a system for automatically registering and managing modbus devices, separation between device management and device usage is achieved, so that a modbus application program does not need to pay attention to management work such as device connection state change, connection maintenance and address setting, and focuses on work in a business layer, thereby facilitating the use of the modbus application program on the devices, and improving the work efficiency of the modbus application program. In the embodiment of the invention, the modbus slave station equipment which can communicate with the modbus master station, receive the instruction sent by the modbus master station and return data or status to the modbus master station is simply referred to as equipment.
As shown in fig. 1, the system for automatically registering and managing modbus devices provided by the embodiment of the present invention specifically includes a modbus device management center and a modbus application program, and a dashed line in the figure represents message and data interaction. In a specific implementation process, a plurality of modbus applications with the same or different functions can exist in the system at the same time. However, to ensure unified management of devices, there is one and only one modbus device management center per system.
In actual use, the modbus device management center and the modbus application program can be respectively operated in a plurality of physical devices or virtual devices, or can be integrated in one physical device or virtual device according to specific scene and system load requirements.
In general application of the modbus communication system, the condition that the device attribute changes or the device communication attribute changes occur when the device is on line, off line, updated and the like is regarded as the state change of the device. In the system provided by this embodiment, a modbus device management center obtains a change state of a modbus slave station device according to a change of a device configuration file, maintains a device list and a device address list according to the change state of the modbus slave station device, and sends a state change message of the modbus slave station device to a modbus application program, the modbus application program subscribes to an asynchronous message issued by the modbus device management center to obtain a device state, when the modbus application program is started and receives the state change message of the modbus slave station device, obtains a current device list and a current device address list, and interacts with the modbus slave station device according to the current device list and the device address list.
The modbus equipment management center writes the initialized equipment attributes into the equipment configuration file in the specified path of the system when the equipment is online, deletes the equipment attributes from the equipment configuration file when the equipment is offline, modifies the equipment attributes in the equipment configuration file when the equipment parameters change, and changes the equipment state related to communication to cause the equipment configuration file to generate corresponding changes. Therefore, the modbus device management center can obtain the online, offline and updating of the device according to the change of the device configuration file in a mode of monitoring the storage directory of the device configuration file, and does not need to communicate with the device again, so that the communication time and resource consumption are reduced. When the state of the equipment changes, the modbus equipment management center can reload the converted equipment configuration file, the equipment added in the file is the new on-line equipment, the reduced equipment is the off-line equipment, and the equipment with the changed parameters is the updated equipment.
When the device is on-line, the device also needs to be initialized. In general use of the modbus system, the master station performs device initialization configuration on the devices, and under the condition of more devices or frequent on-line and off-line of the devices, the starting time of the master station is longer or the efficiency is reduced. In practical use of this embodiment, the project implementer performs initial configuration on the accessed devices according to a specific scenario, and the device access information refers to the start register address, the end register address, the number of register addresses, and the like of the modbus devices, which are determined by the manufacturer of each modbus device. After the device is initialized, corresponding device configuration information is written into the device configuration file, and the modbus device management center can acquire access information of the device by monitoring the change of the path configuration file specified by the system. And then, the modbus device management center acquires the basic information of the devices from the configuration file, writes the basic attribute information of each device as the device information into a device list, and completes the registration of the devices in the modbus device management center. The device information includes inherent properties of device connection, such as device type, device access information, device and communication protocol related setting information, and the like. In practice, the configuration file may use various data exchange formats that are easily machine readable and writable, such as json, xml, ftl, etc. In this embodiment, a json-format configuration file is adopted, and the json format is a clear lightweight plain text data exchange format, so that machine analysis and generation are easy, and network transmission efficiency is effectively improved.
In the application of the conventional modbus system, after the device is on-line and initialized, the master station needs to allocate a unique device code and a station number of the slave station, and the station number is issued to the device through a modbus protocol, so that the master station and an application program can complete communication identification of different slave stations according to the station number. In this embodiment, when a device is online, the modbus device management center allocates a device unique code to the online device, and writes device information into a device list, so that a modbus application program can determine the connection state of the device according to the device list, and the modbus application program can determine whether the device is online or not and can perform communication only according to the device information in the device list.
The modbus device management center writes the device information into the device list when the device is online, modifies the devices in the device list when the device is updated, and changes the device list when the device is offline and deletes the device from the device list. In order to ensure that the modbus application program can timely acquire the changed device list, the modbus device management center is used. When the device is on line, a device on-line message needs to be sent to the modbus application program; and when the equipment is updated, sending an equipment updating message to the modbus application program, and when the equipment is offline, sending an equipment offline message to the modbus application program equipment, so that the modbus application program can acquire the changed equipment list in time.
Further, in this embodiment, to facilitate communication between the modbus application and the devices, the modbus device management center manages the communication addresses of the devices using a list of device addresses. When the device is on line, the modbus device management center automatically allocates slave station addresses for the device, the slave station addresses are expressed in the form of station numbers, and the slave station addresses are written into a device address list. The slave station addresses of all the devices are not repeated, and the slave station addresses are issued to all the slave station devices by using a modbus protocol. And when the device is offline, the modbus device management center deletes the address of the device from the device address list. The modbus equipment management center manages the equipment address list in a unified manner, and equipment in the equipment address list is updated according to the state change of the equipment, so that a modbus application program can communicate with the equipment directly through address information stored in the equipment address list conveniently without paying attention to the state change condition of the management equipment and the generation of a specific address of the equipment, the system consumption of the modbus application program is reduced, and the working efficiency is improved.
In a typical implementation scenario, when a device address changes, the modbus device management center may send a device address list to the modbus application in a manner similar to sending the device address list, which the modbus application saves to local use via the message reading device address list.
In a preferred embodiment of this embodiment, in order to facilitate a modbus application to obtain a state change and a device address change of a device in time, the modbus application and the modbus device management center may also share a same set of physical memory or virtual memory, and store a device list and a device address list using the shared memory. The specific implementation mode is that a specified shared area storage device address list is created in the memory, the modbus device management center enjoys the read-write permission of the area, and the modbus application program enjoys the read permission of the area. Under the condition of using the shared memory, the modbus application program can synchronously acquire all modifications of the device address list by the modbus device management center, and communication errors caused by the fact that the modbus application program cannot acquire the change of the device address list in time are avoided. In actual use, when the modbus device management center and the modbus application program are located in the same physical device, the shared memory may be directly located in the same physical memory, or may be located in a virtual memory regarded as the same physical memory; when the modbus device management center and the modbus application are located in different physical devices, this may be accomplished using remote shared memory or distributed shared memory.
After the devices are on-line, off-line and updated, and necessary initialization is performed, the modbus application program can obtain the latest device information through a device list generated by the modbus device management center, obtain the latest device address and device address according to the device address list, and directly communicate with the devices by using the data in the device list and the device address list. The devices in the device list and the device address list are all devices which are currently on-line, so that the condition that whether the devices are on-line or not is confirmed by sending instructions to the devices before communicating with the devices every time as in the current common use is not needed, and the communication burden and the communication delay of the modbus application program are reduced.
In order to avoid communication consumption caused by the fact that a modbus application program needs to access a modbus device management center when using a device list every time, or because the modbus device management center cannot respond in time and cannot acquire data immediately, the modbus application program can store the device list in a local memory of the application program and store the device list as a local device list. The modbus application program directly interacts the equipment according to the local equipment list; and meanwhile, according to the storage of the modbus application program in the local device list and the device address list, the communication with the devices is completed. After the device list is stored locally, under the condition that the connection state of the devices is not changed, the modbus application program does not need to communicate with the modbus device management center, and the modbus device management center does not respond for a short time or does not interfere with the communication of the devices even when the device management center is restarted.
Further, because in the solution of this embodiment, there may be multiple modbus applications communicating with the modbus slave devices at the same time, in order to avoid multiple communication connections sending commands to the slave devices at the same time and causing the slave devices to respond to the wrong modbus application, the communication connection being communicated needs to be locked to ensure that the modbus applications communicate with the modbus slave devices through only one fixed communication connection at the same time. Specifically, a hardware latch or a software flag bit may be used to lock the communication connection, or other common software and hardware exclusive locking methods may be used.
In order to ensure that a device list in a local memory of a modbus application program is updated in time, a modbus device management center needs to send device state change messages such as device online, offline and update messages to the modbus application program when the device state changes, so that the modbus application program can update the device list and a device address list even if the device list and the device address list are updated, the modbus application program performs message subscription when starting, and timely acquires a new device list when receiving device state update messages such as device online, offline and update messages, so that the actual condition of connection between the device list and the current device is consistent, and connection errors caused by untimely update of the device list are avoided. The device list of the modbus application program is triggered to be updated in a message mode, and the device state query or the device list change condition query of the modbus application program is not required to be actively carried out, so that the modbus application program can be concentrated on the service of the modbus application program, and the system efficiency is improved. After receiving the device online or device parameter update message, the modbus application program acquires a device list and a device address list pushed by a modbus device management center, or acquires a current device list and a current device address list from a virtual memory, stores the device list and the device address list as a local device list and a device address list of the application program, interacts with devices in the local device list and the device address list of the application program, and deletes device information from the local device list and the device address list of the application program when receiving the device offline message.
In particular, a modbus device management center may send messages to a modbus application using message middleware that has a range of functional advantages including low coupling, reliable delivery, broadcast, flow control, final consistency, etc. Common Message middleware protocols include a Message queue Telemetry Transport (mqtt), an Advanced Message Queuing Protocol (amqp), a Streaming Text oriented Message Protocol (store), or an Extensible Messaging and Presence Protocol (xmpp). In an application scenario of the industrial internet of things, a variety of platforms and devices need to be connected, and therefore, in a preferred scheme of this embodiment, an mqtt protocol suitable for the internet of things is adopted, and the mqtt protocol supports all platforms, almost all networked articles and external applications can be connected, and communication connection between sensors and actuators can be supported, so that the application range of the system for automatically registering and managing modbus devices provided by this embodiment is wider. In this embodiment, the attribute information of the modbus device, including the serial port and the portal information of the device, and the register information of the device, etc. may be sent through the mqtt message.
In the system, the modbus device management center monitors the storage directory of the device configuration file, obtains the device state changes such as online, offline and updating of the device according to the change of the device configuration file, and sends a corresponding device state change message to the modbus application program. The modbus application program receives the device list and the device address list pushed by the modbus device management center, stores the device list and the device address list as local device lists of the application program, interacts according to the devices of the local device lists of the application program, and deletes device information from the local device lists of the application program when receiving a device offline message. Through the system, the modbus application program only needs to obtain the local equipment list again when receiving the equipment change message, and interacts with the equipment according to the local equipment list and the equipment address list without paying attention to the equipment change condition, so that the time and resource consumption for confirming the equipment connection condition are saved, and the system efficiency is improved.
In actual industrial internet of things application, the same type of equipment or equipment with common attributes can be classified together to form a virtual model file, and the virtual model file is called an object model. The object model digitalizes an entity in a physical space, and a data model of the entity is constructed at the cloud end and used for describing the function of the entity. The object model digitally represents entities in a physical space, such as a sensor, a vehicle-mounted device, a building, a factory and the like, at the cloud, and each entity is a piece of equipment. The object model describes what the entity is, what it can do, and what information can be provided externally from three dimensions, namely attributes, services and events. The three dimensions of the object model are defined, namely the definition of the product function is completed. Even if a new device is not used by the system, the new device can be directly used as a slave device as long as the new device can be abstracted to an object model supported by the system, and the new device does not need to be configured separately. In this embodiment, devices with the same attributes, services, and events in three dimensions can be managed through the same object model. The three dimensions of attributes, services and events of the object model may be stored in the json format used by the device profile in this embodiment, and the information of each device is associated with the object model. When the modbus equipment management center is on line, the information in the equipment configuration file is read, and whether the equipment has a corresponding object model is judged according to the equipment type defined and set in the equipment configuration file according to the information in the configuration file. If the corresponding object model exists, equipment is established under the object model, corresponding equipment information is generated, added into an equipment information list and written into an equipment configuration file; if no corresponding object model exists, the object model modeling is carried out on the equipment, the corresponding object model is created, then the equipment is created under the object model, corresponding equipment information is generated, the corresponding equipment information is added into an equipment information list and written into an equipment configuration file. The equipment is grouped according to different object models, so that the equipment of the same class or the equipment with the commonality can be grouped, the configuration management can be carried out according to the object models during the subsequent acquisition and data processing, the equipment under the same object model only needs to be configured once or the same set of configuration files are used, the configuration of each equipment is not needed, the configuration process of the equipment is simplified, and the communication error of the equipment caused by the configuration error is avoided. Further, if the configuration attribute of a certain created device is updated, it is necessary to first determine whether the device still belongs to the corresponding object model, and if the object model changes, the device needs to be moved to the changed corresponding object model.
In actual use, the devices may be connected abnormally due to self failure or communication failure, and therefore, the modbus device management center needs to maintain the connection condition of the devices. In this embodiment, a heartbeat detection mode may be used to perform connection maintenance, that is, a connection confirmation command is sent to the device according to a preset heartbeat beat. If the equipment returns normally, the connection is normal; if the equipment does not reply normally, the connection is abnormal. Furthermore, during heartbeat detection, misjudgment of abnormal connection may be caused due to system noise or busy equipment, and therefore, during heartbeat detection, a preset abnormal upper limit number of times may be set, and when the number of times of continuous abnormal connection is greater than the preset abnormal upper limit number of times, the connection is considered to be abnormal, and in actual use, the number of times of preset abnormal upper limit is generally 3 times. In this embodiment, after the device is online, the modbus device management center checks the device connection condition through heartbeat detection, and sends an alarm message to the abnormality detection module if the connection abnormality reaches a preset abnormality upper limit. Specifically, the mqtt protocol may also be used to send the alarm information to the anomaly detection module. Furthermore, after the abnormality detection module processes the connection abnormality, the modbus device management center correspondingly processes the device state change according to the processing result of the abnormality detection module. For example: processing according to the equipment offline, wherein the connection abnormality is caused by the equipment offline abnormally; and processing the connection abnormity caused by the change of the equipment connection parameters according to the equipment update. The method and the device can maintain and handle the connection condition of the equipment, can ensure that each equipment can normally communicate at present, and avoid equipment communication failure or equipment data acquisition failure caused by abnormal connection. In specific implementation, due to the fact that the types of the exceptions of different devices, scenes and application programs are various, in this embodiment, the modbus device management center only sends the alarm information and changes the device state according to the processing result of the exception handling module, and does not directly perform exception handling, so that the exception handling does not occupy system resources and affect the normal operation of the device state management function. Specifically, the module for exception handling determines according to a specific service scene and an implementation scene, different modules respond to exceptions differently, and specifically, an electric control system or a software platform where the modbus device is located can be automatically registered and managed, and an application layer program of a modbus application program can respectively handle corresponding exceptions.
According to the system for automatically registering and managing the modbus devices, an independent modbus device management center manages the on-line and off-line of the modbus slave station devices, heartbeat maintenance, address allocation, device classification and the like, and generates a device list and a device address list in real time.
Example 2:
based on the system for automatically registering and managing the modbus devices provided in embodiment 1, this embodiment further provides a method for automatically registering and managing the modbus devices, and when the devices are online, offline, and updated, the devices can be automatically registered and managed through the following steps.
As shown in fig. 2, the steps performed by the modbus device management center when a device comes online are illustrated.
Step 101: the modbus device management center listens for device configuration files.
After the device is on line, the device information can be written into the device configuration file, and whether the device is on line can be known by monitoring the change of the device configuration file.
Step 102: and judging whether the device information is added in the configuration file. If yes, turning to step 103, continuing online processing; if not, corresponding processing of other conditions is carried out.
The equipment configuration file is changed by the equipment online, offline and updating, and the equipment information is added in the configuration file when the equipment is online. Therefore, if the device information is added to the configuration file, it indicates that the device is online.
Step 103: and judging whether the equipment has an object model. And if not, establishing an object model.
In order to group the devices, which facilitates the acquisition and data processing of the subsequent configuration management devices, each device needs to be classified according to the corresponding object model. If the equipment has a corresponding object model, the equipment is directly added into the corresponding object model. If no corresponding object model exists, the object model needs to be established first, and equipment is added into the object model.
Step 104: and acquiring online equipment information and adding the online equipment information into an equipment list.
After the device is online, device information can be written into a device configuration file through device initialization. Therefore, the device information of the online device can be acquired from the device configuration file, and the device information is added into the device list for use.
Step 105: and acquiring the address of the equipment and adding the address into an equipment address list.
In order to communicate with the devices, device addresses need to be used in addition to the device information, and the modbus device management center also needs to maintain a list of device addresses.
Step 106: and sending the device on-line message to the modbus application program.
After the modbus device management center adds the newly online device to the device list and the device address list, the modbus application program needs to be informed to obtain the new device list. To facilitate message delivery, the mqtt protocol is used for message publishing.
Through steps 101-106, the modbus device management center completes online management of the devices, and provides a list of available device and device addresses for the modbus application, so that the modbus application can directly use the device information and device addresses therein to interact with the devices.
Further, after step 106, the modbus device management center continues to execute the step of detecting the abnormal connection of the devices in a loop, and sends an alarm message to the abnormal processing module when the number of times of abnormal connection exceeds the preset abnormal upper limit.
As shown in fig. 3, the steps performed by the modbus device management center are performed when a device is offline.
Step 201: the modbus device management center listens for device configuration files.
After the device is offline, the device information is deleted from the device configuration file, and whether the device is offline can be known by monitoring the change of the device configuration file.
Step 202: and judging whether the device information is deleted in the configuration file. If yes, turning to step 103, continuing offline processing; if not, corresponding processing of other conditions is carried out.
And when the equipment is offline, the equipment information can be deleted from the configuration file. Therefore, if the existing device file in the configuration file is deleted, it indicates that the device is offline.
Step 203: and acquiring offline device information, and deleting the offline device information from the device list.
And after the equipment is offline, the equipment information can be deleted from the equipment configuration file. Comparing the previous device list with the current device configuration file, the device information of the offline device can be obtained, and the device information is deleted from the device list.
Step 204: the device address is deleted from the device address list.
To avoid a modbus application from misusing an offline device address, the modbus device management center also needs to maintain a list of device addresses.
Step 205: a device logoff message is sent to the modbus application.
After the modbus device management center deletes the offline device from the device list and the device address list, the modbus application program needs to be informed to acquire a new device list, so as to avoid communication errors caused by communication with the offline device. The message is also published in this step using the mqtt protocol.
After steps 201-205, the modbus device management center completes offline management of the devices, and deletes the offline devices from the device list and the device address list, so that the modbus application program knows that the devices are offline and does not interact with the devices any more.
The steps during device update are similar to those during device online and device offline, whether device information in the device configuration file changes or not is judged, if yes, the device information of the corresponding devices in the device list and the device address list is changed, and a device update message is sent to the modbus application program.
The steps performed for a modbus application are shown in FIG. 4.
Step 301: subscribing to the device change message.
In the system for automatically registering and managing modbus devices provided in embodiment 1, the device change messages that are online, offline, and updated are issued using the mqtt protocol, and a modbus application program only needs to subscribe to relevant messages when starting, and can obtain the device change messages broadcast by the modbus device management center in time, and perform corresponding processing for different device changes.
Step 302: and judging the type of the received equipment change message. If the message is an online message, turning to step 303; if the message is an equipment update message, go to step 304; if the device is offline, go to step 305.
When the device is on-line, off-line and updated, the modbus application program receives the device change message, and the modbus application program needs to perform corresponding processing according to different message types.
Step 303: and when the equipment is online, acquiring equipment information of the new equipment, and adding the equipment information into the local equipment list.
When the device is online, the device information needs to be added to the local device list so as to be conveniently communicated with the device.
Step 304: and when the equipment is updated, acquiring the updated equipment information and modifying the equipment information in the local equipment list.
When the device is updated, the device information in the local device list needs to be replaced by the updated device information, so that communication abnormity caused by using the old device information is avoided.
Step 305: and when the equipment is offline, acquiring the offline equipment information, and removing the offline equipment information from the local equipment list.
When the device is offline, the information of the offline device needs to be deleted from the local device list, so that communication abnormity caused by communication with the offline device is avoided.
Step 306: interacting with the device using the updated device list.
After targeted processing is performed according to the message type, the local device list is consistent with the latest device list of the modbus device management center, the current device connection condition is met, and interaction with the devices can be performed by using the local device list.
Through the step 301 plus 306, based on the processing of the modbus device management center on the device, the modbus application program can interact with the device based on the convenient local device list, and the on-line and off-line and updating of the device are not required to be specifically processed, so that the load of the modbus application program is reduced, and the service efficiency of the modbus application program is improved.
The embodiment provides a specific method for automatically registering and managing modbus devices, which is executed by each device in a system, based on the system for automatically registering and managing the modbus devices. In the method, a modbus equipment management center performs management work such as equipment configuration maintenance, address setting and the like, and a modbus application program can concentrate on the work of a service level, so that the working efficiency of the system is improved. Furthermore, the device management is facilitated through the object model modeling, and communication errors caused by connection abnormity are avoided through connection abnormity detection.
Example 3:
on the basis of the system for automatically registering and managing the modbus devices provided in embodiment 1 or the method for automatically registering and managing the modbus devices provided in embodiment 2, the present invention further provides an apparatus for automatically registering and managing the modbus devices.
Fig. 5 is a schematic diagram of a device architecture according to an embodiment of the present invention. The apparatus provided in this embodiment comprises one or more processors 21 and a memory 22. In fig. 5, one processor 21 is taken as an example. The processor 21 and the memory 22 may be connected by a bus or other means, and fig. 5 illustrates the connection by a bus as an example. Memory 22, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the functions performed by the modbus device management center or the modbus application of embodiments 1 and 2. The processor 21 executes various functional applications and data processing of the modbus device automatic registration and management system of embodiment 1, or implements the method of modbus device automatic registration and management of embodiment 2, by executing non-volatile software programs, instructions, and modules stored in the memory 22. The memory 22 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 22 may optionally include memory located remotely from the processor 21, and these remote memories may be connected to the processor 21 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. Program instructions/modules are stored in the memory 22, and when executed by the one or more processors 21, can perform the functions of the modbus device management center and the modbus applications of embodiment 1, and at most one modbus device management center, but multiple modbus applications, can be run simultaneously on the same apparatus for automatic registration and management of modbus devices; the method of modbus device auto-registration and management in embodiment 2 may also be performed, for example, performing the various steps shown in fig. 2, 3, and 4 described above. Those of ordinary skill in the art will appreciate that all or part of the steps of the various methods of the embodiments may be implemented by associated hardware as instructed by a program, which may be stored on a computer-readable storage medium, which may include: a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like.
Further, in a scenario with a device for automatically registering and managing a plurality of modbus devices, in order to ensure that all the modbus slave station devices are uniformly managed, the modbus device management center is operated on one and only one device for automatically registering and managing the modbus devices, and the modbus device management centers on the other devices for automatically registering and managing the modbus devices are kept in a dormant or disabled state, and only modbus applications are operated. When any one of the modbus devices automatically registers and manages and communicates with the modbus slave devices, the communicating modbus master device is locked, and communication confusion is avoided.
In actual use, as shown in fig. 6, the modbus slave station device and the device for automatic registration and management of the modbus device are connected through the modbus bus, and the device for automatic registration and management through the modbus device interacts with the modbus device management center and the modbus application program. When the device state of each modbus slave station device changes, the modbus device automatically registers and manages the device, and a modbus device management program running on the device sends a device change message to the modbus application program, and updates the corresponding device list and device address list. The slave address of each modbus slave station device is assigned by a modbus device management center running on the device in which the modbus devices are automatically registered and managed, and is managed by a device address list.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A system for automatic registration and management of modbus devices is characterized in that:
the system comprises a modbus device management center and at least one modbus application program;
the method comprises the steps that a modbus device management center obtains the change state of modbus slave station equipment according to the change of an equipment configuration file, maintains an equipment list and an equipment address list according to the change state of the modbus slave station equipment, and sends a state change message of the modbus slave station equipment to a modbus application program;
when the modbus application program is started and a state change message of the modbus slave station equipment is received, the current equipment list and the equipment address list are obtained, and interaction is carried out on the modbus slave station equipment according to the current equipment list and the equipment address list.
2. The system for automated modbus device registration and management of claim 1, further comprising:
when the equipment is on line, the modbus equipment management center automatically allocates slave station addresses for the equipment, issues the slave station addresses to the equipment by using a modbus protocol, and writes the slave station addresses into an equipment address list;
and when the equipment is offline, deleting the equipment address from the equipment address list.
3. The system for automatic modbus device registration and management of claim 2, wherein the obtaining of the current device list and device address list specifically comprises:
the method comprises the steps that a modbus application program obtains a current equipment list and/or an equipment address list through a message pushed by a modbus equipment management center;
or, the modbus application program obtains the current device list and/or device address list through the shared memory.
4. The system for automated modbus device registration and management of claim 1, further comprising:
when the modbus slave station equipment is on-line, the modbus equipment management center judges whether the equipment has a corresponding object model;
if the corresponding object model exists, equipment is established under the object model, corresponding equipment attribute information is obtained through an equipment configuration file, and the equipment attribute information is written into an equipment list;
and if no corresponding object model exists, establishing a corresponding object model, then establishing equipment under the object model, acquiring corresponding equipment attribute information by the equipment configuration file, and writing the equipment attribute information into an equipment list.
5. The system for automated modbus device registration and management of claim 1, further comprising:
after the devices are online, the modbus device management center checks the connection condition of the devices through heartbeat detection, and if the connection abnormal times reach a preset abnormal upper limit, an alarm message is sent to the abnormal detection module.
6. The system for automated modbus device registration and management of claim 1, further comprising:
if multiple modbus applications are communicating with a modbus slave device at the same time, the communicating communication connection is locked to ensure that the modbus applications communicate with the modbus slave device through only one fixed communication connection at the same time.
7. The system for automated modbus device registration and management of claim 1, further comprising:
when the equipment is online, the modbus equipment management center configures the initial position of the register and the sensor data type supported by the equipment for the equipment, and writes the initial position of the register and the sensor data type supported by the equipment as the equipment information into a configuration file.
8. A modbus device auto-registration and management system as recited in claim 1, wherein:
the modbus device management center sends the device's status change message to the modbus application using the mqtt protocol, the amqp protocol, the stomp protocol, or the xmpp protocol.
9. A method for automatic registration and management of modbus devices is characterized in that:
the automated modbus device registration and management system of any of claims 1-8, implemented the function of automated modbus device registration and management.
10. A device for automatic registration and management of modbus devices is characterized in that:
including at least one processor and a memory coupled via a data bus, the memory storing instructions executable by the at least one processor for performing the functions of a modbus device management center and/or a modbus application in a modbus device automatic registration and management system of any of claims 1-8 after execution by the processor.
CN202110004988.9A 2021-01-04 2021-01-04 System, method and device for automatic registration and management of modbus equipment Pending CN112698973A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110004988.9A CN112698973A (en) 2021-01-04 2021-01-04 System, method and device for automatic registration and management of modbus equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110004988.9A CN112698973A (en) 2021-01-04 2021-01-04 System, method and device for automatic registration and management of modbus equipment

Publications (1)

Publication Number Publication Date
CN112698973A true CN112698973A (en) 2021-04-23

Family

ID=75514584

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110004988.9A Pending CN112698973A (en) 2021-01-04 2021-01-04 System, method and device for automatic registration and management of modbus equipment

Country Status (1)

Country Link
CN (1) CN112698973A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114896188A (en) * 2022-04-26 2022-08-12 深圳市科陆电子科技股份有限公司 Method and system for network sharing automatic adaptation of USB (universal serial bus) equipment
CN115174664A (en) * 2022-05-31 2022-10-11 宁波三星智能电气有限公司 Registration method of ammeter

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159614A (en) * 2007-10-23 2008-04-09 中兴通讯股份有限公司 Gateway and method of implementing centralized management to equipment
CN201805556U (en) * 2010-08-30 2011-04-20 深圳市宏电技术股份有限公司 Information inquiry device, wireless transmission apparatus and MODBUS slave station
US8260872B1 (en) * 2011-03-29 2012-09-04 Data Flow Systems, Inc. Modbus simulation system and associated transfer methods
CN105227397A (en) * 2015-09-02 2016-01-06 广东欧珀移动通信有限公司 Method for discovering equipment, main equipment, from equipment and corresponding system
CN106790222A (en) * 2017-01-12 2017-05-31 重庆邮电大学 A kind of MODBUS/ interconnects manufacture network information service adapter and its implementation entirely
CN111491001A (en) * 2019-01-28 2020-08-04 李成林 Gateway system and method for supporting multi-type equipment to access Internet of things

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159614A (en) * 2007-10-23 2008-04-09 中兴通讯股份有限公司 Gateway and method of implementing centralized management to equipment
CN201805556U (en) * 2010-08-30 2011-04-20 深圳市宏电技术股份有限公司 Information inquiry device, wireless transmission apparatus and MODBUS slave station
US8260872B1 (en) * 2011-03-29 2012-09-04 Data Flow Systems, Inc. Modbus simulation system and associated transfer methods
CN105227397A (en) * 2015-09-02 2016-01-06 广东欧珀移动通信有限公司 Method for discovering equipment, main equipment, from equipment and corresponding system
CN106790222A (en) * 2017-01-12 2017-05-31 重庆邮电大学 A kind of MODBUS/ interconnects manufacture network information service adapter and its implementation entirely
CN111491001A (en) * 2019-01-28 2020-08-04 李成林 Gateway system and method for supporting multi-type equipment to access Internet of things

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114896188A (en) * 2022-04-26 2022-08-12 深圳市科陆电子科技股份有限公司 Method and system for network sharing automatic adaptation of USB (universal serial bus) equipment
CN115174664A (en) * 2022-05-31 2022-10-11 宁波三星智能电气有限公司 Registration method of ammeter
CN115174664B (en) * 2022-05-31 2023-09-01 宁波三星智能电气有限公司 Registration method of ammeter

Similar Documents

Publication Publication Date Title
CN112698973A (en) System, method and device for automatic registration and management of modbus equipment
CN102144382A (en) Method and systems for redundant server automatic failover
US11709620B2 (en) Methods and systems for memory management in a publish and subscribe system
CN112887356A (en) System for sharing memory data distribution service and operation method thereof
CN111078238A (en) Centralized processing method and device for application configuration in container environment
CN107786350B (en) Method and device for restoring factory configuration of network equipment and network equipment
CN115865564A (en) Edge computing gateway device supporting high-speed power line carrier communication
JP2016005275A (en) Method and system for managing interconnection network
CN109257396A (en) A kind of distributed lock dispatching method and device
EP3804233B1 (en) Method and apparatus for performing communication in internet of things
CN109450757B (en) Method for starting CANopen master station and overall management device thereof
CN108089968A (en) A kind of method of host's machine monitoring virtual-machine data storehouse state
CN109245979B (en) CANopen master-slave station reliability control method and overall management device thereof
CN111917588A (en) Edge device management method, device, edge gateway device and storage medium
CN115987872A (en) Cloud system based on resource routing
CN115499300A (en) Embedded equipment clustering operation architecture, method and device
CN115695073A (en) Communication method, device, equipment and storage medium
US11363099B2 (en) Methods and systems for enabling publish-subscribe message transmission in a distributed environment
CN113918640A (en) ETL flow execution method based on asynchronous mode
JP2003529847A (en) Construction of component management database for role management using directed graph
CN113923142A (en) Method, system and medium for monitoring state of equipment of Internet of things
CN113515458A (en) Method and system for reducing resource consumption of test environment based on Envoy plug-in
CN109361586B (en) CANopen slave station starting method and overall planning manager thereof
CN113535413B (en) Transaction request processing method and semiconductor production system
CN114489598B (en) Storm task management and scheduling method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210423

RJ01 Rejection of invention patent application after publication