[go: up one dir, main page]

CN107168264B - The serial ports shared system and method for environmental monitoring - Google Patents

The serial ports shared system and method for environmental monitoring Download PDF

Info

Publication number
CN107168264B
CN107168264B CN201710478043.4A CN201710478043A CN107168264B CN 107168264 B CN107168264 B CN 107168264B CN 201710478043 A CN201710478043 A CN 201710478043A CN 107168264 B CN107168264 B CN 107168264B
Authority
CN
China
Prior art keywords
industrial control
serial ports
time
serial port
network data
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.)
Active
Application number
CN201710478043.4A
Other languages
Chinese (zh)
Other versions
CN107168264A (en
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.)
Beijing Municipal Environmental Monitoring Center
Original Assignee
Beijing Municipal Environmental Monitoring Center
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 Beijing Municipal Environmental Monitoring Center filed Critical Beijing Municipal Environmental Monitoring Center
Priority to CN201710478043.4A priority Critical patent/CN107168264B/en
Publication of CN107168264A publication Critical patent/CN107168264A/en
Application granted granted Critical
Publication of CN107168264B publication Critical patent/CN107168264B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/418Total factory control, i.e. centrally controlling a plurality of machines, e.g. direct or distributed numerical control [DNC], flexible manufacturing systems [FMS], integrated manufacturing systems [IMS] or computer integrated manufacturing [CIM]
    • G05B19/4185Total factory control, i.e. centrally controlling a plurality of machines, e.g. direct or distributed numerical control [DNC], flexible manufacturing systems [FMS], integrated manufacturing systems [IMS] or computer integrated manufacturing [CIM] characterised by the network communication
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/30Nc systems
    • G05B2219/31From computer integrated manufacturing till monitoring
    • G05B2219/31088Network communication between supervisor and cell, machine group
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Manufacturing & Machinery (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Automation & Control Theory (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明提供了一种环境监测的串口共享系统,所述系统包括:串口、至少一个环境监测仪、多个工业控制机和处理模块。处理模块对各环境监测仪和对应的工业控制机会话所占用的串口时间进行划分,得到多个时隙,且在一时隙中,一工业控制机通过所述串口传送网络数据至对应的环境监测仪,该环境监测仪接收并响应该网络数据,并将所述网络数据返回至工业控制机。此外,本发明还提供了一种环境监测的串口共享方法,本发明实现了多仪器同时采集数据和操控,同时也支持多台工业控制机对至少一台环境监测仪的串口通讯访问。

The invention provides a serial port sharing system for environmental monitoring. The system includes: a serial port, at least one environmental monitoring instrument, multiple industrial control machines and a processing module. The processing module divides the serial port time occupied by each environmental monitoring instrument and the corresponding industrial control machine session to obtain multiple time slots, and in one time slot, an industrial control machine transmits network data to the corresponding environmental monitoring machine through the serial port instrument, the environmental monitoring instrument receives and responds to the network data, and returns the network data to the industrial control machine. In addition, the present invention also provides a serial port sharing method for environmental monitoring. The present invention realizes data collection and control of multiple instruments at the same time, and also supports serial port communication access of multiple industrial control machines to at least one environmental monitoring instrument.

Description

环境监测的串口共享系统及方法Serial port sharing system and method for environmental monitoring

技术领域technical field

本发明涉及环境监测的串口通讯技术领域,尤其涉及一种环境监测的串口共享系统及方法。The invention relates to the technical field of serial port communication for environmental monitoring, in particular to a serial port sharing system and method for environmental monitoring.

背景技术Background technique

在环境监测领域,目前由于各类环境监测仪器生产厂家均提供了自己的串口通讯控制软件,但是通讯标准各自不同,程序操作设计复杂,参数设置也各不相同。In the field of environmental monitoring, at present, various environmental monitoring instrument manufacturers provide their own serial communication control software, but the communication standards are different, the program operation design is complicated, and the parameter settings are also different.

当前环境监测仪器的主要通讯方式为串口通讯(RS232),并且只有一个通讯串口接口提供数据通讯服务。由于串口设计是独占性的,这样的结构只能满足一个数据采集设备与监测仪器进行通讯。The main communication mode of current environmental monitoring instruments is serial port communication (RS232), and only one communication serial port interface provides data communication service. Because the serial port design is exclusive, such a structure can only satisfy a data acquisition device to communicate with the monitoring instrument.

发明内容Contents of the invention

(一)要解决的技术问题(1) Technical problems to be solved

本发明的目的在于提供一种环境监测的串口共享系统及方法,以解决上述的至少一项技术问题。The object of the present invention is to provide a serial port sharing system and method for environmental monitoring, so as to solve at least one of the above technical problems.

(二)技术方案(2) Technical solution

本发明提供了一种环境监测的串口共享系统,包括:The invention provides a serial port sharing system for environmental monitoring, comprising:

串口,包括第一端,所述第一端包括至少一个第一接口;以及第二端,所述第二端包括多个第二接口;The serial port includes a first end, the first end includes at least one first interface; and a second end, the second end includes a plurality of second interfaces;

至少一个环境监测仪,用于电性连接所述第一接口;At least one environmental monitor, used to electrically connect to the first interface;

多个工业控制机,用于电性连接所述的第二接口,且每一个环境监测仪与多个工业控制机对应,通过所述串口进行会话;A plurality of industrial control machines are used to electrically connect the second interface, and each environmental monitor corresponds to a plurality of industrial control machines, and communicates through the serial port;

处理模块,与所述串口电性连接,用于对各工业控制机和对应的环境监测仪会话所占用的串口时间进行划分,得到多个时隙t,且在一时隙中,一工业控制机通过所述串口传送网络数据至对应的环境监测仪,该环境监测仪接收并响应该网络数据,并将所述网络数据返回至该工业控制机。The processing module is electrically connected to the serial port, and is used to divide the serial port time occupied by each industrial control machine and the corresponding environmental monitor session to obtain multiple time slots t, and in one time slot, an industrial control machine The network data is transmitted to the corresponding environmental monitoring instrument through the serial port, and the environmental monitoring instrument receives and responds to the network data, and returns the network data to the industrial control machine.

可选地,所述处理模块还用于设置工业控制机的优先权等级,以实现不同优先权等级的各工业控制机分别在不同的时隙与相应的环境监测仪进行会话。Optionally, the processing module is also used to set the priority levels of the industrial control machines, so that the industrial control machines of different priority levels have conversations with the corresponding environmental monitors in different time slots.

可选地,所述时隙t=串口传输数据所需时间t1+串口响应等待时间t2+网络传输时间t3+数据处理时间t4+串口返回数据时间t5,其中t2≤50ms。Optionally, the time slot t=time required for serial port data transmission t1 +serial port response waiting time t2 +network transmission time t3 + data processing time t4 + serial port return data time t5, wherein t2≤50ms .

可选地,所述处理模块还用于:若串口在t2时间段内响应工业控制机,则将该网络数据放入缓冲区,并在t3与t4时间段内,将所述网络数据返回至对应的环境监测仪,该环境监测仪接收并响应该网络数据,并将所述网络数据返回至该工业控制机,从而结束此次会话并释放串口,进行下一次会话;若串口未在t2时间段内未响应工业控制机,则直接结束此次会话,并释放串口,进行下一次会话。Optionally, the processing module is also used for: if the serial port responds to the industrial control machine within the time period t2 , then put the network data into the buffer, and within the time period t3 and t4 , send the network data The data is returned to the corresponding environmental monitoring instrument, the environmental monitoring instrument receives and responds to the network data, and returns the network data to the industrial control machine, thereby ending the session and releasing the serial port for the next session; if the serial port is not If the industrial control machine does not respond within the time period of t2 , the session will be terminated directly, and the serial port will be released for the next session.

可选地,该系统还具有通信日志记录功能:可查看各串口的通讯状态,指令间隔时间,串口是否空闲,以及通讯失败的记录。Optionally, the system also has a communication log recording function: you can check the communication status of each serial port, the command interval time, whether the serial port is idle, and the record of communication failure.

基于同一发明构思,本发明还提供了一种环境监测的串口共享方法,所述方法应用于前述环境监测的串口共享系统,包括步骤:Based on the same inventive concept, the present invention also provides a serial port sharing method for environmental monitoring, the method is applied to the aforementioned serial port sharing system for environmental monitoring, including steps:

处理模块对各工业控制机及对应的环境监测仪会话所占用的串口时间进行划分,得到多个时隙t;The processing module divides the serial port time occupied by the sessions of each industrial control machine and the corresponding environmental monitor to obtain multiple time slots t;

在每个时隙中,一工业控制机通过串口传送网络数据至对应的环境监测仪,环境监测仪接收并响应所述网络数据,且将所述网络数据返回至该工业控制机。In each time slot, an industrial control machine transmits network data to the corresponding environmental monitor through the serial port, and the environmental monitor receives and responds to the network data, and returns the network data to the industrial control machine.

可选地,所述时隙t=串口传输数据所需时间t1+串口响应等待时间t2+网络传输时间t3+数据处理时间t4+串口返回数据时间t5,其中t2≤50ms。Optionally, the time slot t=time required for serial port data transmission t1 +serial port response waiting time t2 +network transmission time t3 + data processing time t4 + serial port return data time t5, wherein t2≤50ms .

可选地,若串口在t2时间段内响应工业控制机,则将该网络数据放入缓冲区,并在t3与t4时间段内,将所述网络数据返回至对应的环境监测仪,该环境监测仪接收并响应该网络数据,并将所述网络数据返回至该工业控制机,从而结束此次会话并释放串口,进行下一次会话;若串口未在t2时间段内未响应工业控制机,则直接结束此次会话,并释放串口,进行下一次会话。Optionally, if the serial port responds to the industrial control machine within the time period of t2 , put the network data into the buffer, and return the network data to the corresponding environmental monitoring instrument within the time period of t3 and t4 , the environmental monitoring instrument receives and responds to the network data, and returns the network data to the industrial control machine, thereby ending the session and releasing the serial port for the next session; if the serial port does not respond within the t2 time period The industrial control machine directly ends the session, and releases the serial port for the next session.

可选地,在一个时隙中,一工业控制机正在进行会话时,未进行会话的工业控制机发送网络数据至串口,该网络数据进入队列,依次等待下一个时隙传输。Optionally, in a time slot, when an industrial control machine is having a session, the industrial control machine not in the session sends network data to the serial port, and the network data enters a queue and waits for transmission in the next time slot in turn.

可选地,所述未进行会话的工业控制机的等待的时隙会话队列最大延迟=单时隙占用串口时间*访问此串口的队列数量,其中,所述时隙会话队列最大延迟≤1s。Optionally, the maximum delay of the waiting time-slot conversation queue of the industrial control machine that is not in conversation = the serial port time occupied by a single time-slot * the number of queues accessing this serial port, wherein the maximum delay of the time-slot conversation queue is ≤ 1s.

(三)有益效果(3) Beneficial effects

本发明相较于现有技术具有以下优点:Compared with the prior art, the present invention has the following advantages:

1、本发明提供的环境监测的串口共享系统,针对环境监测仪器进行通讯优化和调试,并提供完备的环境监测仪器通讯协议栈库,实现对专有通讯协议的支持。可对通讯的数据进行智能化选择与判定,确保数据通讯稳定可靠,满足各种工业化生产环境工作需要。1. The serial port sharing system for environmental monitoring provided by the present invention performs communication optimization and debugging for environmental monitoring instruments, and provides a complete communication protocol stack library for environmental monitoring instruments to realize support for proprietary communication protocols. The communication data can be intelligently selected and judged to ensure stable and reliable data communication and meet the needs of various industrial production environments.

2、本发明提供的环境监测的串口共享方法,采用时分通讯技术,进行时隙的划分,确保了数据间的分离传输,满足多仪器同时采集数据和操控支持多台工业控制机对至少一台环境监测仪的串口通讯访问,轻松实现多仪器同时数据采集和操作控制。2. The serial port sharing method for environmental monitoring provided by the present invention adopts time-division communication technology to divide time slots, ensuring the separate transmission of data, satisfying the simultaneous data collection and control of multiple instruments and supporting multiple industrial control machines for at least one The serial port communication access of the environmental monitoring instrument can easily realize simultaneous data acquisition and operation control of multiple instruments.

3、本发明提供管理软件访问控制,可以通过LAN(局域网)口完成通讯参数设置,方便操作。3. The present invention provides management software access control, which can complete the communication parameter setting through the LAN (Local Area Network) port, which is convenient for operation.

附图说明Description of drawings

图1为本发明实施例的环境监测的串口共享系统的总体结构示意图;Fig. 1 is the overall structural representation of the serial port sharing system of the environmental monitoring of the embodiment of the present invention;

图2为本发明实施例的一详细实施例的环境监测的串口共享系统的结构示意图;2 is a schematic structural diagram of a serial port sharing system for environmental monitoring in a detailed embodiment of an embodiment of the present invention;

图3为本发明实施例的访问队列的串口占用时间的示意图;Fig. 3 is the schematic diagram of the serial port occupation time of the access queue of the embodiment of the present invention;

图4为本发明实施例的时隙示意图;FIG. 4 is a schematic diagram of time slots according to an embodiment of the present invention;

图5为本发明实施例的环境监测的串口共享方法的步骤示意图。FIG. 5 is a schematic diagram of steps of a serial port sharing method for environmental monitoring according to an embodiment of the present invention.

具体实施方式Detailed ways

在现有技术中,当前环境监测仪器的主要通讯方式为串口通讯(RS232),并且只有一个通讯串口接口提供数据通讯服务,由于串口设计的独占性,一个串口一般只能实现数据在一个上位机与一个下位机之间的传输。但是在实际生产应用场景中,往往需要多台采集设备与监测仪器实现数据交换,即多个上位机需要通过一个串口实现与一个甚至多个下位机之间的数据通信的情况,因此,本发明提供了一种环境监测的串口共享系统及方法,从而完成通过一个串口实现一对多甚至多对多的串口通讯需要。其设计满足环境监测仪器的数据采集需求,用来解决多台工业控制数据采集设备对至少一台监测仪器间的共享通讯的实际问题,可广泛应用于环境自动化监测领域。In the prior art, the main communication mode of current environmental monitoring instruments is serial port communication (RS232), and there is only one communication serial port interface to provide data communication services. Transmission with a lower computer. However, in actual production and application scenarios, it is often necessary to exchange data between multiple acquisition devices and monitoring instruments, that is, multiple upper computers need to realize data communication with one or even multiple lower computers through a serial port. Therefore, the present invention A serial port sharing system and method for environmental monitoring are provided, thereby fulfilling the requirement of realizing one-to-many or even many-to-many serial port communication through one serial port. Its design meets the data acquisition requirements of environmental monitoring instruments, and is used to solve the practical problem of shared communication between multiple industrial control data acquisition equipment and at least one monitoring instrument, and can be widely used in the field of environmental automation monitoring.

为使本发明的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本发明进一步详细说明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be described in further detail below in conjunction with specific embodiments and with reference to the accompanying drawings.

图1为本发明实施例的环境监测的串口共享系统的总体结构示意图,如图1所示,本发明实施例的一方面提供了一种环境监测的串口共享系统,包括:Figure 1 is a schematic diagram of the overall structure of a serial port sharing system for environmental monitoring according to an embodiment of the present invention. As shown in Figure 1 , an aspect of the embodiment of the present invention provides a serial port sharing system for environmental monitoring, including:

串口,包括第一端,所述第一端包括至少一个第一接口;以及第二端,所述第二端包括多个第二接口;The serial port includes a first end, the first end includes at least one first interface; and a second end, the second end includes a plurality of second interfaces;

至少一个环境监测仪,用于电性连接所述第一接口;At least one environmental monitor, used to electrically connect to the first interface;

多个工业控制机,用于电性连接所述的第二接口,且每一个环境监测仪与多个工业控制机对应,通过所述串口进行会话;A plurality of industrial control machines are used to electrically connect the second interface, and each environmental monitor corresponds to a plurality of industrial control machines, and communicates through the serial port;

处理模块,与所述串口电性连接,用于对各工业控制机和对应的环境监测仪会话所占用的串口时间进行划分,得到多个时隙t,且在一时隙中,一工业控制机通过所述串口传送网络数据至对应的环境监测仪,该环境监测仪接收并响应该网络数据,并将所述网络数据返回至该工业控制机。一般来说,该处理模块可以由软件程序或者其他可编程数据处理装置等实现。此外,一个环境监测的串口共享系统中也可以有多个串口与控制其的处理模块,从而实现更多的设备之间的监控通信。The processing module is electrically connected to the serial port, and is used to divide the serial port time occupied by each industrial control machine and the corresponding environmental monitor session to obtain multiple time slots t, and in one time slot, an industrial control machine The network data is transmitted to the corresponding environmental monitoring instrument through the serial port, and the environmental monitoring instrument receives and responds to the network data, and returns the network data to the industrial control machine. Generally speaking, the processing module can be realized by software programs or other programmable data processing devices. In addition, a serial port sharing system for environmental monitoring may also have multiple serial ports and processing modules controlling them, so as to realize monitoring communication between more devices.

在本发明的一种实施例中,选择两个环境监测仪,以及与该两个环境监测仪分别对应的四个工业控制机,图2为本发明实施例的一详细实施例的环境监测的串口共享系统的结构示意图,如图2所示,该串口共享系统,包括一个串口,该串口的第一端包括2个第一接口(COM1和COM2),其第二端有4个第二接口(COM11、COM12、COM21和COM22)。COM1、COM2分别连接环境监测仪1和工业控制机2,COM11和COM12分别与环境监测仪1连接进行通信会话,COM21和COM22分别与工业控制机2连接进行通信会话。其中,设备的各连接方式均采用RS232串口线缆,该串口通讯9600波特率,8位,无校验。In one embodiment of the present invention, two environmental monitoring instruments are selected, and four industrial control machines respectively corresponding to the two environmental monitoring instruments, Fig. 2 is a detailed embodiment of the environmental monitoring of the embodiment of the present invention The structural diagram of the serial port sharing system, as shown in Figure 2, the serial port sharing system includes a serial port, the first end of the serial port includes 2 first interfaces (COM1 and COM2), and the second end has 4 second interfaces (COM11, COM12, COM21 and COM22). COM1 and COM2 are respectively connected to the environmental monitoring instrument 1 and the industrial control machine 2, COM11 and COM12 are respectively connected to the environmental monitoring instrument 1 for a communication session, and COM21 and COM22 are respectively connected to the industrial control machine 2 for a communication session. Among them, each connection mode of the equipment adopts RS232 serial port cable, the serial port communication is 9600 baud rate, 8 bits, no parity.

此外,处理模块也与所述串口相连,用于对环境监测仪1和其对应的工业控制机11和工业控制机12、以及工业控制机2和其对应的工业控制机21和工业控制机22会话时所占用的串口时间进行划分,得到4个时隙t,且在一个时隙中,一工业控制机通过所述串口传送网络数据至对应的环境监测仪,该环境监测仪接收并响应该网络数据,并将所述网络数据返回至工业控制机。此外,该系统还可以具有通信日志记录功能:可查看各串口的通讯状态,指令间隔时间,串口是否空闲,通讯失败的记录等。In addition, the processing module is also connected to the serial port, and is used for the environmental monitoring instrument 1 and its corresponding industrial control machine 11 and industrial control machine 12, as well as the industrial control machine 2 and its corresponding industrial control machine 21 and industrial control machine 22. The serial port time occupied during the conversation is divided to obtain 4 time slots t, and in one time slot, an industrial control machine transmits network data to the corresponding environmental monitoring instrument through the serial port, and the environmental monitoring instrument receives and responds to the network data, and return the network data to the industrial control machine. In addition, the system can also have a communication log recording function: you can check the communication status of each serial port, the command interval time, whether the serial port is idle, the record of communication failure, etc.

该处理模块还可以用于设置工业控制机的优先权等级,处理模块可以设置工作参数,如:TimeOut,环境监测仪的型号,通讯结束标识符等等例如可以设置在与环境监测仪通信中的工业控制机11的优先权高于工业控制机12,则可以确保工业控制机11优先通讯。当工业控制机11和工业控制机12同时接收指令准备发送数据启动会话时,工业控制机11优先;工业控制机12的指令缓存阻塞,等串口空闲时发送。当工业控制机11响应数据结束标志时(如0D),后500ms没有其它数据时可视为仪器空闲;当仪器空闲时,空闲的串口可转发工业控制机22的数据。The processing module can also be used to set the priority level of the industrial control machine. The processing module can set working parameters, such as: TimeOut, the model of the environmental monitoring instrument, the identifier of the end of communication, etc. For example, it can be set in the communication with the environmental monitoring instrument The priority of the industrial control machine 11 is higher than that of the industrial control machine 12, so that the priority communication of the industrial control machine 11 can be ensured. When the industrial control machine 11 and the industrial control machine 12 receive instructions at the same time and prepare to send data to start the session, the industrial control machine 11 takes priority; the command cache of the industrial control machine 12 is blocked, and the serial port is idle to send. When the industrial control machine 11 responds to the data end mark (such as 0D), the instrument can be regarded as idle when there is no other data in the last 500ms; when the instrument is idle, the idle serial port can forward the data of the industrial control machine 22.

本发明利用时分通讯技术,将一次查询式串口访问定义为一次会话,一次会话占用的串口时间,定义为一个时隙。通过为不同设备合理分配时隙,即可实现多设备的串口访问。本发明还适用于查询式串口访问,上位机发送网络数据即启动一个时隙会话,在此时隙会话完成前,不可以被其他设备打断,确保了串口数据的完整性。另外,一个时隙会话完成串口发收过程后,会立即将得到数据返回给对应设备,如果没有得到数据,则等待设备启动下次时隙会话。无论有没有得到数据,时隙会话完成后,都会为其他设备让出串口。为确保所有设备都可以公平的得到数据,即使串口被一个时隙会话占用,其他设备也可以发送网络数据给共享式串口服务器,此时数据将进入队列,当正在工作的时隙会话完成后,即可用此数据为其他设备启动新会话。图3为本发明实施例的访问队列的串口占用时间的示意图,如图3所示,4台工业控制机同时访问一个串口,时隙会话A-D对应4台工业控制机分别与环境监测仪的会话,4台工业控制机之间的数据传输完全隔离。The invention utilizes time-division communication technology to define a query serial port access as a session, and the serial port time occupied by a session is defined as a time slot. By reasonably allocating time slots for different devices, the serial port access of multiple devices can be realized. The invention is also applicable to query-type serial port access. The upper computer starts a time slot session when it sends network data. Before the time slot session is completed, it cannot be interrupted by other devices, ensuring the integrity of the serial port data. In addition, after a time slot session completes the serial port sending and receiving process, it will immediately return the obtained data to the corresponding device. If no data is obtained, it will wait for the device to start the next time slot session. Regardless of whether data is obtained or not, after the slot session is completed, the serial port will be released for other devices. In order to ensure that all devices can get data fairly, even if the serial port is occupied by a time slot session, other devices can also send network data to the shared serial port server. At this time, the data will enter the queue. When the working time slot session is completed, That is, this data can be used to start new sessions for other devices. Fig. 3 is the schematic diagram of the serial port occupation time of the access queue of the embodiment of the present invention, as shown in Fig. 3, 4 industrial control machines visit a serial port at the same time, time slot session A-D corresponds to the conversation of 4 industrial control machines with the environmental monitoring instrument respectively , The data transmission between the 4 industrial control machines is completely isolated.

在一个时隙中,一工业控制机正在进行会话时,其他工业控制机发送网络数据至串口,该网络数据进入队列,依次等待下一个时隙传输。且工业控制机的等待的时隙会话队列最大延迟=单时隙占用串口时间*访问此串口的队列数量,其中,所述时隙会话队列最大延迟≤1s。若时隙会话队列的最大延时>1s,该工业控制机的在队列的等待时间超时,此时该工业控制机需要再次重新进入队列等待。In a time slot, when an industrial control machine is having a conversation, other industrial control machines send network data to the serial port, and the network data enters the queue, waiting for transmission in the next time slot in turn. And the maximum delay of the waiting time slot session queue of the industrial control machine=single time slot occupied serial port time*the number of queues accessing this serial port, wherein, the maximum delay of the time slot session session queue is ≤1s. If the maximum delay of the time slot session queue is greater than 1s, the waiting time of the industrial control machine in the queue is overtime, and at this time, the industrial control machine needs to re-enter the queue to wait again.

目前由于各类环境监测仪器生产厂家均提供了自己的串口通讯控制软件,但是通讯标准各自不同,程序操作设计复杂,参数设置也各不相同。本发明提供的环境监测的串口共享系统可以将专门目前主流的仪器通讯协议,集成封装当前各种监测设备的底层通讯协议,统一规划设备数据采集、控制、通讯、处理的通讯接口,统一抽象监测设备管理控制模型,为上层业务系统的数据调取,提供稳定可靠的核心数据通讯核心框架。该工业控制机可以采用ARM7TDMI嵌入式处理器和Linux操作系统,实际运行环境Linux的监测仪2台,采用CentOS 6.5管理系统。At present, all kinds of environmental monitoring instrument manufacturers provide their own serial communication control software, but the communication standards are different, the program operation design is complicated, and the parameter settings are also different. The serial port sharing system for environmental monitoring provided by the present invention can integrate and package the current mainstream instrument communication protocols with the underlying communication protocols of various current monitoring equipment, uniformly plan the communication interfaces for equipment data collection, control, communication, and processing, and unify abstract monitoring The equipment management control model provides a stable and reliable core data communication core framework for the data retrieval of the upper-level business system. The industrial control machine can use ARM7TDMI embedded processor and Linux operating system, two monitors with actual operating environment Linux, and use CentOS 6.5 management system.

在环境自动化监测系统应用为中,本发明提供的环境监测的串口共享系统,提供了管理软件访问控制,通过LAN口完成通讯参数设置,已经封装完成的环境监测设备如下:Thermo 42i(NO/NO2/Nox监测仪)、Thermo 43i(SO2监测仪)、Thermo 48i(CO监测仪)、Thermo 49i(O3监测仪)、T-API M100E(SO2监测仪)、T-API M200E(NO/NO2/Nox监测仪)、T-API M300E(CO监测仪)、T-API M400E(O3监测仪)、Thermo 1400ab(PM10监测仪)和Thermo1405F(PM2.5监测仪)。在其他实施例中还有其他的环境监测设备可以基于本发明提供的环境监测的串口共享系统进行构建,在此不再赘述。In the application of environmental automation monitoring system, the serial port sharing system of environmental monitoring provided by the present invention provides management software access control, completes communication parameter setting through LAN port, and the environmental monitoring equipment that has been packaged is as follows: Thermo 42i (NO/NO2 /Nox monitor), Thermo 43i (SO2 monitor), Thermo 48i (CO monitor), Thermo 49i (O3 monitor), T-API M100E (SO2 monitor), T-API M200E (NO/NO2/Nox monitor), T-API M300E (CO monitor), T-API M400E (O3 monitor), Thermo 1400ab (PM10 monitor) and Thermo1405F (PM2.5 monitor). In other embodiments, other environmental monitoring devices can be constructed based on the serial port sharing system for environmental monitoring provided by the present invention, which will not be repeated here.

图4为本发明实施例的时隙示意图,如图4所示,所述时隙t=串口传输数据所需时间t1+串口等待响应时间t2+网络传输时间t3+设备处理数据时间t4+串口返回数据至环境监测仪时间t5,一般来说,串口传输数据所需时间t1与串口返回数据至环境监测仪时间t5相等。另外,所述t2≤50ms。若串口在t2时间段内响应工业控制机,则将该网络数据放入缓冲区,并在t3与t4时间段内,将所述网络数据返回给与之会话的环境监测仪,该环境监测仪接收并响应该网络数据,并将所述网络数据返回至工业控制机,从而结束此次会话并释放串口,进行下一次会话;若串口未在t2时间段内(即串口等待响应超过50ms)未响应工业控制机,不再传送该网络数据,则直接结束此次会话,并释放串口,进行下一次会话。Fig. 4 is the time slot schematic diagram of the embodiment of the present invention, as shown in Fig. 4, described time slot t=serial port transmits data required time t1 +serial port waits for response time t2 +network transmission time t3 +device processing data time t 4 + the time t 5 when the serial port returns data to the environmental monitoring instrument. Generally speaking, the time t 1 required for the serial port to transmit data is equal to the time t 5 for the serial port to return the data to the environmental monitoring instrument. In addition, the t 2 is ≤50ms. If the serial port responds to the industrial control machine within the t2 time period, the network data is put into the buffer, and within the t3 and t4 time period, the network data is returned to the environmental monitoring instrument in conversation with it, the The environmental monitoring instrument receives and responds to the network data, and returns the network data to the industrial control machine, thereby ending the session and releasing the serial port for the next session ; More than 50ms) does not respond to the industrial control machine, and no longer transmits the network data, the session will be ended directly, and the serial port will be released for the next session.

本发明实施例的另一方面还提供了一种环境监测的串口共享方法,所述方法应用于上述的串口共享系统,图5为本发明实施例的环境监测的串口共享方法的步骤示意图,如图5所示,该方法包括步骤:Another aspect of the embodiment of the present invention also provides a serial port sharing method for environmental monitoring. The method is applied to the above-mentioned serial port sharing system. FIG. 5 is a schematic diagram of the steps of the serial port sharing method for environmental monitoring in the embodiment of the present invention, as As shown in Figure 5, the method includes steps:

S1、处理模块对各工业控制机及对应的环境监测仪会话所占用的串口时间进行划分,得到多个时隙t;S1. The processing module divides the serial port time occupied by the sessions of each industrial control machine and the corresponding environmental monitoring instrument to obtain multiple time slots t;

步骤S1利用时分通讯技术,将一次查询式串口访问定义为一次会话,一次会话占用的串口时间,定义为一个时隙。通过为不同设备合理分配时隙,即可实现多设备的串口访问。其中,该时隙t=串口传输数据所需时间t1+串口等待响应时间t2+网络传输时间t3+设备处理数据时间t4+串口返回数据至环境监测仪时间t5,且t2≤50ms,若串口等待响应超过50ms,则直接结束此次会话,并释放串口,进行下一次会话。Step S1 uses time-division communication technology to define a query serial port access as a session, and the serial port time occupied by a session is defined as a time slot. By reasonably allocating time slots for different devices, the serial port access of multiple devices can be realized. Among them, the time slot t = the time required for serial port to transmit data t 1 + serial port waiting response time t 2 + network transmission time t 3 + device processing data time t 4 + time for serial port to return data to environmental monitoring instrument t 5 , and t 2 ≤50ms, if the serial port waits for a response for more than 50ms, the session will be ended directly, and the serial port will be released for the next session.

S2、在每个时隙中,一工业控制机通过串口传送网络数据至对应的环境监测仪,环境监测仪接收并响应所述网络数据,且将所述网络数据返回至该工业控制机。S2. In each time slot, an industrial control machine transmits network data to the corresponding environmental monitor through the serial port, and the environmental monitor receives and responds to the network data, and returns the network data to the industrial control machine.

此外,本发明还可以确保所有设备都可以公平的得到数据。即使串口被一个时隙会话占用,其他设备也可以发送网络数据给共享式串口服务器,此时数据将进入队列,当正在工作的时隙会话完成后,即可用此数据为其他设备启动新会话。该环境监测的串口共享方法采用时分通讯技术,进行时隙的划分,确保了数据间的分离传输,满足多仪器同时采集数据和操控支持多台工业控制机对至少一台环境监测仪的串口通讯访问,实现了多仪器同时数据采集和操作控制。In addition, the present invention can also ensure that all devices can obtain data fairly. Even if the serial port is occupied by a time slot session, other devices can send network data to the shared serial port server. At this time, the data will enter the queue. When the working time slot session is completed, this data can be used to start a new session for other devices. The serial port sharing method for environmental monitoring adopts time-division communication technology to divide the time slots, ensuring the separate transmission of data, satisfying the simultaneous data collection and control of multiple instruments, and supporting the serial port communication of multiple industrial control machines to at least one environmental monitoring instrument Access to realize simultaneous data acquisition and operation control of multiple instruments.

以上所述的具体实施例,对本发明的目的、技术方案和有益效果进行了进一步详细说明,应理解的是,以上所述仅为本发明的具体实施例而已,并不用于限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The specific embodiments described above have further described the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above descriptions are only specific embodiments of the present invention, and are not intended to limit the present invention. Within the spirit and principles of the present invention, any modifications, equivalent replacements, improvements, etc., shall be included in the protection scope of the present invention.

Claims (9)

1. a kind of serial ports shared system of environmental monitoring characterized by comprising
Serial ports, including first end, the first end include at least one first interface;And second end, the second end include Multiple second interfaces;
At least one environment monitor, for being electrically connected the first interface;
Multiple Industrial Control Computers, for being electrically connected the second interface, and each environment monitor and multiple industry are controlled Machine processed is corresponding, is conversated by the serial ports;
Processing module is electrically connected with the serial ports, for shared by each Industrial Control Computer and corresponding environment monitor session The serial ports time is divided, and multiple time slot t are obtained;And the priority level of setting Industrial Control Computer, to realize difference Each Industrial Control Computer of priority level conversates in different time slots with corresponding environment monitor respectively;
And in a time slot, an Industrial Control Computer transmits network data to corresponding environment monitor, the ring by the serial ports Border monitor receives and responds the network data, and the network data is back to the Industrial Control Computer.
2. system according to claim 1, which is characterized in that t the time required to the time slot t=serial ports transmission data1+ string Mouth response waiting time t2+ network latency t3+ data processing time t4+ serial ports returned data time t5, wherein t2≤50ms。
3. system according to claim 2, which is characterized in that the processing module is also used to: if serial ports is in t2In period Industrial Control Computer is responded, then the network data is put into buffer area, and in t3With t4In period, the network data is returned To corresponding environment monitor, which receives and responds the network data, and the network data is back to this Industrial Control Computer carries out session next time to terminate this session and discharge serial ports;If serial ports is not in t2It is not rung in period Industrial Control Computer is answered, then directly terminates this session, and discharge serial ports, carries out session next time.
4. system according to claim 1, which is characterized in that the system also has communication log writing function: can check The communication state of each serial ports, the command interval time, whether serial ports idle and record of Communications failure.
5. a kind of serial ports sharing method of environmental monitoring, which is characterized in that the method is applied to as Claims 1-4 is any The serial ports shared system of the environmental monitoring, comprising steps of
Processing module divides each Industrial Control Computer and corresponding environment monitor session occupied serial ports time, obtains Multiple time slot t;And the priority level of setting Industrial Control Computer, to realize each Industrial Control Computer point of different priority levels It does not conversate in different time slots with corresponding environment monitor;
In each time slot, an Industrial Control Computer transmits network data to corresponding environment monitor, environmental monitoring by serial ports Instrument receives and responds the network data, and the network data is back to the Industrial Control Computer.
6. according to the method described in claim 5, it is characterized in that, time slot t=serial ports transmission data required time t1+ string Mouth response waiting time t2+ network latency t3+ data processing time t4+ serial ports returned data time t5, wherein t2≤50ms。
7. according to the method described in claim 6, it is characterized in that, if serial ports is in t2Industrial Control Computer is responded in period, then will The network data is put into buffer area, and in t3With t4In period, the network data is back to corresponding environment monitor, The environment monitor receives and responds the network data, and the network data is back to the Industrial Control Computer, to terminate This time session simultaneously discharges serial ports, carries out session next time;If serial ports is not in t2Industrial Control Computer is not responded in period, then directly Terminate this session, and discharge serial ports, carries out session next time.
8. according to the method described in claim 5, it is characterized in that, in one time slot, an Industrial Control Computer is being understood When words, the Industrial Control Computer not conversated sends network data to serial ports, which enters queue, successively waits next A slot transmission.
9. according to the method described in claim 8, it is characterized in that, the waiting of the Industrial Control Computer not conversated when Gap session queue maximum delay=mono- Time Slot Occupancy serial ports time * accesses the number of queues of this serial ports, wherein the time slot session Queue maximum delay≤1s.
CN201710478043.4A 2017-06-21 2017-06-21 The serial ports shared system and method for environmental monitoring Active CN107168264B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710478043.4A CN107168264B (en) 2017-06-21 2017-06-21 The serial ports shared system and method for environmental monitoring

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710478043.4A CN107168264B (en) 2017-06-21 2017-06-21 The serial ports shared system and method for environmental monitoring

Publications (2)

Publication Number Publication Date
CN107168264A CN107168264A (en) 2017-09-15
CN107168264B true CN107168264B (en) 2019-09-24

Family

ID=59820023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710478043.4A Active CN107168264B (en) 2017-06-21 2017-06-21 The serial ports shared system and method for environmental monitoring

Country Status (1)

Country Link
CN (1) CN107168264B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111585697B (en) * 2020-04-03 2023-06-30 河南翔宇医疗设备股份有限公司 A communication method, device and multi-module communication system

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1964263A (en) * 2006-11-20 2007-05-16 中国移动通信集团江苏有限公司 Application of IP networking mode in environment monitoring
CN101567822A (en) * 2008-04-23 2009-10-28 大诚电讯(深圳)有限公司 Networking integrated service equipment of dynamic environment centralized monitoring system and operating method thereof
CN101699421A (en) * 2009-10-28 2010-04-28 深圳华为通信技术有限公司 Method and server for sharing serial port
CN201919003U (en) * 2010-11-02 2011-08-03 杭州初灵信息技术股份有限公司 Multi-channel serial port and Ethernet service time slot select transmission equipment
CN102238608A (en) * 2011-06-23 2011-11-09 无锡物联网产业研究院 Wireless device testing method based on wireless ad hoc network
CN102591278A (en) * 2012-02-01 2012-07-18 天津市电力公司 Microgrid control system having power generation and load forecast functions and microgrid control method
US8699424B2 (en) * 2008-06-27 2014-04-15 Microsoft Corporation Adapting channel width for improving the performance of wireless networks
CN203644032U (en) * 2013-12-16 2014-06-11 彭富明 Serial port extender circuit
CN104422298A (en) * 2013-08-27 2015-03-18 广西麦莎电气集团有限公司 Submerged arc furnace reactive compensation remote wireless communication control system
CN104853451A (en) * 2015-03-13 2015-08-19 扬州工业职业技术学院 Aquarium fish culture environment monitoring system based on wireless sensor network
US10009979B2 (en) * 2015-05-01 2018-06-26 Hubbell Incorporated Devices, systems, and methods for controlling electrical loads

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1964263A (en) * 2006-11-20 2007-05-16 中国移动通信集团江苏有限公司 Application of IP networking mode in environment monitoring
CN101567822A (en) * 2008-04-23 2009-10-28 大诚电讯(深圳)有限公司 Networking integrated service equipment of dynamic environment centralized monitoring system and operating method thereof
US8699424B2 (en) * 2008-06-27 2014-04-15 Microsoft Corporation Adapting channel width for improving the performance of wireless networks
CN101699421A (en) * 2009-10-28 2010-04-28 深圳华为通信技术有限公司 Method and server for sharing serial port
CN201919003U (en) * 2010-11-02 2011-08-03 杭州初灵信息技术股份有限公司 Multi-channel serial port and Ethernet service time slot select transmission equipment
CN102238608A (en) * 2011-06-23 2011-11-09 无锡物联网产业研究院 Wireless device testing method based on wireless ad hoc network
CN102591278A (en) * 2012-02-01 2012-07-18 天津市电力公司 Microgrid control system having power generation and load forecast functions and microgrid control method
CN104422298A (en) * 2013-08-27 2015-03-18 广西麦莎电气集团有限公司 Submerged arc furnace reactive compensation remote wireless communication control system
CN203644032U (en) * 2013-12-16 2014-06-11 彭富明 Serial port extender circuit
CN104853451A (en) * 2015-03-13 2015-08-19 扬州工业职业技术学院 Aquarium fish culture environment monitoring system based on wireless sensor network
US10009979B2 (en) * 2015-05-01 2018-06-26 Hubbell Incorporated Devices, systems, and methods for controlling electrical loads

Also Published As

Publication number Publication date
CN107168264A (en) 2017-09-15

Similar Documents

Publication Publication Date Title
CN103888293B (en) Data channel scheduling method of multichannel FC network data simulation system
US6434626B1 (en) Method and apparatus for low latency network performance monitoring
CN101957808B (en) Communication method among various CPUs (Central Processing Units), system and CPU
US7797445B2 (en) Dynamic network link selection for transmitting a message between compute nodes of a parallel computer
CN109672627A (en) Method for processing business, platform, equipment and storage medium based on cluster server
US7266625B2 (en) Data communication system
CN112039722B (en) A kind of MQTT protocol simulation method and simulation device
HUE035735T2 (en) Data redirection for universal serial bus devices
CN104899170A (en) Distributed intelligent platform management bus (IPMB) connection method and ATCA (Advanced Telecom Computing Architecture) machine frame
CN110557432B (en) Cache pool balance optimization method, system, terminal and storage medium
WO2024113704A1 (en) Pcie data transmission method and related apparatus
CN117896381A (en) Industrial equipment communication link switching method and device and electronic equipment
CN100351824C (en) Bus systems and bus interfaces for connection to the bus
CN107066413A (en) A kind of method and its bus system for being used to handle multiple bus apparatus data
CN107168264B (en) The serial ports shared system and method for environmental monitoring
CN109547274A (en) A kind of enclosure board switching method, device and first network equipment
CN114629741A (en) Data exchange method, device and system of vehicle bus communication network
CN116028234B (en) A distributed database load balancing method, device, equipment and storage medium
CN111064768B (en) Printer data transmission control method, device, equipment and storage medium
CN118295954A (en) Data transmission method and communication system of processing card based on PCIe protocol
CN114356830B (en) Bus terminal control method, device, computer equipment and storage medium
CN117857310A (en) Method, system and device for supporting double network cards to support diversified loads by TCP user mode protocol stack
CN104980319A (en) Serial-parallel combination efficient multi-target IP end performance monitoring and scheduling method
CN113032054B (en) Service execution method and device, storage medium and electronic device
CN111556043B (en) A message processing method, device, system, equipment and readable storage medium

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
GR01 Patent grant
GR01 Patent grant