CN-122019434-A - Multi-serial device identification method, system and terminal device
Abstract
The application relates to the technical field of the Internet of things and discloses a multi-serial device identification method, a multi-serial device identification system and terminal devices. The multi-serial port equipment identification method comprises the steps of sending a monitoring instruction to a monitoring module, triggering the monitoring module to identify a plurality of effective serial ports in a main control system to obtain an effective serial port list, creating a plurality of parallel running serial port channels based on the effective serial port list, sending a test command to equipment to be identified through the serial port channels to each serial port channel, sending a test verification instruction to a protocol module, triggering the protocol module to receive test response data of the equipment to be identified, analyzing the test response data, and if equipment types and equipment numbers of the equipment to be identified are obtained through analysis, establishing communication connection between the equipment to be identified and the serial port channels to be identified. By adopting the method, the device identification operation on a plurality of serial ports can be simultaneously carried out, and the matching speed under a multi-device scene is greatly improved.
Inventors
- LI NING
- WEI ZHENGWEN
- WANG ZHENG
- WANG JILE
Assignees
- 安徽养和医疗器械设备有限公司
- 深圳市中核海得威生物科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260128
Claims (10)
- 1. The multi-serial device identification method is characterized by being applied to a multi-serial device identification system, wherein the system comprises a management module, a monitoring module and a protocol module, and the management module executes the following identification method and comprises the following steps: Sending a monitoring instruction to the monitoring module, and triggering the monitoring module to identify a plurality of effective serial ports in a main control system to obtain an effective serial port list; based on the effective serial port list, creating a plurality of serial port channels running in parallel, and sending a test command to the equipment to be identified through the serial port channel aiming at each serial port channel; Sending a test verification instruction to the protocol module, triggering the protocol module to receive test response data of the equipment to be identified, and analyzing the test response data; if the equipment type and the equipment number of the equipment to be identified are obtained through analysis, establishing communication connection between the equipment to be identified and the serial port channel.
- 2. The method of claim 1, wherein the sending, for each serial port channel, a test command to the device to be identified through the serial port channel for which the test command is intended comprises: Creating a plurality of matching pairs based on a plurality of serial channels and a plurality of devices to be identified; based on each matching pair, creating an identification thread, and sending a test command to the corresponding equipment to be identified through the serial port channel corresponding to each identification thread.
- 3. The method according to claim 2, wherein creating an identification thread based on each matching pair and sending a test command to a corresponding device to be identified through a serial port channel corresponding to each identification thread comprises: creating a plurality of identification threads, wherein each identification thread corresponds to a serial port channel and a device to be identified; And in each round of identification scheduling, a plurality of identification threads are executed concurrently, and a test command is sent to the corresponding equipment to be identified through the serial port channel corresponding to each identification thread.
- 4. A method according to claim 3, wherein in each round of identification scheduling, a plurality of identification threads are executed concurrently, and a test command is sent to the device to be identified through a serial port channel corresponding to each identification thread, including: in the first round of scheduling, a plurality of first round of identification threads are executed concurrently, and a test command is sent to the equipment to be identified through a serial port channel corresponding to each first round of identification thread; Determining a failed serial port channel of identification failure in a first round of scheduling, and creating a plurality of secondary round of identification threads again in a secondary round of scheduling, wherein each secondary round of identification thread corresponds to one failed serial port channel; And in secondary round scheduling, a plurality of secondary round identification threads are executed concurrently, a test command is sent to the equipment to be identified which is not successfully identified through a serial port channel corresponding to each secondary round identification thread until all the equipment to be identified reach the preset maximum retry times, and the secondary round scheduling comprises each next round scheduling except the first round scheduling.
- 5. The method of claim 2, wherein creating a plurality of matching pairs based on the plurality of serial channels and the plurality of devices to be identified comprises: for each device to be identified, reading a locally stored device configuration file, and determining a serial port history matching record corresponding to the device to be identified; if the serial port history matching record exists, a first matching pair is established based on a serial port channel corresponding to the serial port number stored in the serial port history matching record and the equipment to be identified; And randomly selecting an unassigned effective serial port from the effective serial port list, and creating a second matching pair based on the selected effective serial port and the equipment to be identified.
- 6. The method of claim 2, wherein creating a plurality of matching pairs based on the plurality of serial channels and the plurality of devices to be identified comprises: for each device to be identified, reading a locally stored device configuration file, and determining a serial port history matching record corresponding to the device to be identified; If the serial port history matching record does not exist, an unassigned effective serial port is randomly selected from the effective serial port list, and a third matching pair is created based on the selected effective serial port and the equipment to be identified.
- 7. The method according to any one of claims 1-6, further comprising: sending a heartbeat request message to the connected equipment to be identified according to a preset time interval through the serial port channel which is established to be connected; And detecting a heartbeat response message returned by the equipment to be identified, if the heartbeat response message is not received for a continuous preset number of times, determining that the equipment to be identified is abnormal in connection, triggering reconnection and generating an offline alarm signal.
- 8. A multi-serial device identification system, comprising: The monitoring module is used for receiving the monitoring instruction and identifying a plurality of effective serial ports in the main control system based on the monitoring instruction to obtain an effective serial port list; The protocol module is used for receiving a test verification instruction, receiving test response data of equipment to be identified based on the test verification instruction, and analyzing the test response data; The management module is used for sending the monitoring instruction and the test verification instruction; based on the effective serial port list, creating a plurality of serial port channels running in parallel, and sending a test command to the equipment to be identified through the serial port channel aiming at each serial port channel; if the equipment type and the equipment number of the equipment to be identified are obtained through analysis, establishing communication connection between the equipment to be identified and the serial port channel.
- 9. A terminal device, characterized in that it comprises a processor and a memory, the memory storing a computer program, the processor being adapted to execute the computer program to implement the multi-serial device identification method of any one of claims 1-7.
- 10. A computer readable storage medium, characterized in that it stores a computer program which, when executed on a processor, implements the multi-serial device identification method according to any one of claims 1-7.
Description
Multi-serial device identification method, system and terminal device Technical Field The application relates to the technical field of the internet of things, in particular to a multi-serial device identification method, a multi-serial device identification system and terminal equipment. Background With the rapid development of industrial automation, intelligent manufacturing and Internet of things technologies, various serial devices are widely applied to industrial control systems, data acquisition systems and embedded devices. These devices typically access the host system via a serial port and rely on a serial communication protocol for data interaction. In the conventional multi-serial device management method, a user needs to manually configure a serial number connected to each device and specify corresponding communication parameters in upper computer software. When a plurality of devices are connected into the system, because the physical connection relation of serial ports is not visual, users often need to judge the actual connection position by trying different serial ports one by one and combining the feedback information of the devices, the operation process is complex, errors are easy to occur, and the usability and maintenance efficiency of the system are seriously affected. Disclosure of Invention In view of the above, the embodiments of the present application provide a method, a system, and a terminal device for identifying multiple serial devices, which can effectively solve the technical problems of complicated operation process and easy error of the conventional multiple serial device management method. In a first aspect, an embodiment of the present application provides a method for identifying multiple serial devices, where the method includes: Sending a monitoring instruction to the monitoring module, and triggering the monitoring module to identify a plurality of effective serial ports in a main control system to obtain an effective serial port list; based on the effective serial port list, creating a plurality of serial port channels running in parallel, and sending a test command to the equipment to be identified through the serial port channel aiming at each serial port channel; Sending a test verification instruction to the protocol module, triggering the protocol module to receive test response data of the equipment to be identified, and analyzing the test response data; if the equipment type and the equipment number of the equipment to be identified are obtained through analysis, establishing communication connection between the equipment to be identified and the serial port channel. In a second aspect, an embodiment of the present application provides a multi-serial device identification system, including: The monitoring module is used for receiving the monitoring instruction and identifying a plurality of effective serial ports in the main control system based on the monitoring instruction to obtain an effective serial port list; The protocol module is used for receiving a test verification instruction, receiving test response data of equipment to be identified based on the test verification instruction, and analyzing the test response data; The management module is used for sending the monitoring instruction and the test verification instruction; based on the effective serial port list, creating a plurality of serial port channels running in parallel, and sending a test command to the equipment to be identified through the serial port channel aiming at each serial port channel; if the equipment type and the equipment number of the equipment to be identified are obtained through analysis, establishing communication connection between the equipment to be identified and the serial port channel. In a third aspect, the present application also provides a terminal device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program: Sending a monitoring instruction to the monitoring module, and triggering the monitoring module to identify a plurality of effective serial ports in a main control system to obtain an effective serial port list; based on the effective serial port list, creating a plurality of serial port channels running in parallel, and sending a test command to the equipment to be identified through the serial port channel aiming at each serial port channel; Sending a test verification instruction to the protocol module, triggering the protocol module to receive test response data of the equipment to be identified, and analyzing the test response data; if the equipment type and the equipment number of the equipment to be identified are obtained through analysis, establishing communication connection between the equipment to be identified and the serial port channel. In a fourth aspect, the present application also provides a computer readable storage medium having store