TW202209856A - The redundant method and system of the rs485 ring network therefor - Google Patents

The redundant method and system of the rs485 ring network therefor Download PDF

Info

Publication number
TW202209856A
TW202209856A TW109128720A TW109128720A TW202209856A TW 202209856 A TW202209856 A TW 202209856A TW 109128720 A TW109128720 A TW 109128720A TW 109128720 A TW109128720 A TW 109128720A TW 202209856 A TW202209856 A TW 202209856A
Authority
TW
Taiwan
Prior art keywords
ring network
interface
main control
target device
control terminal
Prior art date
Application number
TW109128720A
Other languages
Chinese (zh)
Inventor
林宏洲
林忠杰
Original Assignee
三泰科技股份有限公司
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 三泰科技股份有限公司 filed Critical 三泰科技股份有限公司
Priority to TW109128720A priority Critical patent/TW202209856A/en
Publication of TW202209856A publication Critical patent/TW202209856A/en

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The redundant method and system of the RS485 ring network therefor are provided. The method comprises of steps: a host is connected to multiple RS485 devices in a ring network. In the initial state, a first port of the host sends the first signal. The second port receives the first signal via the ring network. The host determines whether the ring network is break at second intervals. If the ring network is interrupted, the host sends the second command to the second target device with the first port. The host sends the second command to the second target device with the second after the third interval. The second target device sends the third response message to the host according to the second command.

Description

RS485環狀網路的備援處理方法與系統 Backup Processing Method and System of RS485 Ring Network

一種訊號的備援處理方法與系統,特別有關RS485環狀網路的備援處理方法與系統。 A method and system for redundant processing of signals, particularly related to the method and system for redundant processing of RS485 ring network.

RS485(或稱EIA485)是隸屬於OSI模型實體層的電氣特性規定為2線、半雙工、平衡傳輸線多點通訊的標準。是由電信行業協會(Telecommunications Industry Association,TIA)及電子工業聯盟(Electronic Industries Alliance,EIA)聯合發布的標準。RS485協議使用纜線兩端的電壓差值來表示傳遞訊號。RS485協議可以應用於組態便宜的區域網和採用單機傳送,多機接受通訊連結。因此RS485協議除了以串接多個設備的方式外,也可以透過環狀網路的方式連接各種設備。 RS485 (or EIA485) is a standard for multi-point communication of 2-wire, half-duplex, balanced transmission line whose electrical characteristics belong to the physical layer of the OSI model. It is a standard jointly issued by the Telecommunications Industry Association (TIA) and the Electronic Industries Alliance (EIA). The RS485 protocol uses the voltage difference between the two ends of the cable to represent the transmission signal. The RS485 protocol can be applied to configure inexpensive local area networks and to use single-machine transmission, and multiple machines to accept communication links. Therefore, in addition to connecting multiple devices in series, the RS485 protocol can also connect various devices through a ring network.

在環狀網路的架構中,主控端(host)提供兩連接接口且兩連接接口分別連接環狀網路的兩端。因此主控端可以透過任一接口發送訊號並由另一接口接收訊號。環狀網路的優勢在於主控端可以透過任一接口發送訊號至目標設備。 In the structure of the ring network, the host provides two connection interfaces, and the two connection interfaces are respectively connected to two ends of the ring network. Therefore, the host can send signals through either interface and receive signals through the other interface. The advantage of the ring network is that the host can send signals to the target device through any interface.

但環狀網路的路徑發生中斷時,習知技術的主控端無法得知路徑中斷點位於路徑上的何處。若主控端選錯發送訊號的接口,則控制訊號可能無法順利的發送至目標設備。而習知技術為能確保目標設備可以收到訊號,所以會透過兩連接接口發出訊號至目標設備。 However, when the path of the ring network is interrupted, the master of the prior art cannot know where the path interruption point is located on the path. If the host chooses the wrong interface for sending the signal, the control signal may not be sent to the target device smoothly. In the prior art, in order to ensure that the target device can receive the signal, the signal is sent to the target device through two connection interfaces.

此外,主控端也無相關機制可以得知環狀網路是否恢復正常。當環狀網路恢復連接時,主控端仍會透過兩個連接接口發出訊號至目標設備。因此目標設備會分別接到兩個相同的訊號,使得目標設備將會重複執行兩次的動作或回覆兩次回應至主控端。主控端將會受到兩組相同回覆的影響,使得系統運作失常。 In addition, there is no relevant mechanism for the master to know whether the ring network is back to normal. When the ring network is restored, the host will still send signals to the target device through the two connection ports. Therefore, the target device will receive two identical signals respectively, so that the target device will repeat the action twice or reply twice to the host. The host will be affected by two sets of identical replies, causing the system to malfunction.

本發明提供一種RS485環狀網路的備援處理方法用於RS485環狀網路發生異常時的備援處理。 The invention provides a backup processing method for an RS485 ring network, which is used for backup processing when an abnormality occurs in the RS485 ring network.

本發明的RS485環狀網路的備援處理方法包括:主控端以環狀網路串接於多個RS485設備;主控端於初始階段時,由主控端的第一接口發出第一訊號,使第一訊號經由環狀網路後經由主控端的第二接口所接收;計時第一訊號於環狀網路中的第一時間;主控端每間隔第二時間,主控端由第一接口發出測試訊號至第二接口,用於判別環狀網路是否中斷;若環狀網路未發生中斷,主控端透過第一接口發送第一控制命令至第一目標設備;第一目標設備完成第一控制命令後,目標設備發送第一回應訊息與第二回應訊息至主控端;若環狀網路發生中斷,主控端驅動第一接口發送第二控制命令至第二目標設備;主控端間隔第三時間驅動第二接口發送另一第二控制命令至第二目標設備;第二目標設備根據任一第二控制命令返回第三回應訊息至主控端。 The backup processing method of the RS485 ring network of the present invention includes: the main control terminal is connected to a plurality of RS485 devices in series by the ring network; when the main control terminal is in the initial stage, the first interface of the main control terminal sends out a first signal , so that the first signal is received by the second interface of the main control terminal after passing through the ring network; the first time of the first signal in the ring network is timed; An interface sends a test signal to the second interface to determine whether the ring network is interrupted; if the ring network is not interrupted, the master sends a first control command to the first target device through the first interface; the first target device After the device completes the first control command, the target device sends the first response message and the second response message to the main control terminal; if the ring network is interrupted, the main control terminal drives the first interface to send the second control command to the second target device The main control terminal drives the second interface to send another second control command to the second target device at a third time interval; the second target device returns a third response message to the main control terminal according to any second control command.

本發明另提供一種RS485環狀網路的備援處理系統包括環狀網路、RS485設備端與主控端。環狀網路串接多個RS485設備端與主控端。主控端具有處理單元、儲存單元、路徑控制程序、第一接口與第二接口,處理單元電性連接於儲存單元、第一接口與第二接口,處理單元運行記錄於儲存單元的路徑控制程序,第一接口與第二接口分別連接環狀網路的兩端,主控端透過第一接口發送第一訊號並計算第一訊號在環狀網路中傳輸的第一時間,當環狀網路連線時,主控端透過第一接口發送第一控制命令至環狀網路中的第一目標設備;其中,主控端每間隔第二時間,主控端由第一接口發出測試訊號至第二接口,用於判別環狀網路是否中斷,主控端監測環狀網路發生中斷,主控端驅動第一接口發送第二控制命令至環狀網路中的第二目標設備,主控端間隔第三時間驅動第二接口發送另一第二控制命令至第二目標設備。 The present invention further provides a backup processing system for an RS485 ring network, which includes a ring network, an RS485 device end and a main control end. The ring network connects multiple RS485 device terminals and the main control terminal in series. The main control terminal has a processing unit, a storage unit, a path control program, a first interface and a second interface, the processing unit is electrically connected to the storage unit, the first interface and the second interface, and the processing unit runs the path control program recorded in the storage unit , the first interface and the second interface are respectively connected to the two ends of the ring network, the main control terminal sends the first signal through the first interface and calculates the first time when the first signal is transmitted in the ring network, when the ring network When the circuit is connected, the main control terminal sends a first control command to the first target device in the ring network through the first interface; wherein, the main control terminal sends a test signal from the first interface every second time interval To the second interface, it is used to determine whether the ring network is interrupted. The main control terminal monitors that the ring network is interrupted, and the main control terminal drives the first interface to send the second control command to the second target device in the ring network. The main control terminal drives the second interface to send another second control command to the second target device at a third time interval.

本發明的RS485環狀網路的備援處理方法與系統可以提供主控端在環狀網路連線、中斷或連線恢復的各種情況下,實現主控端對目 標設備的存取控制。本發明的RS485環狀網路的備援處理方法與系統再不增加額外的硬體成本的情況下,實現主控端與環狀網路備援的相關措施。 The backup processing method and system of the RS485 ring network of the present invention can provide the main control terminal to realize the purpose of the main control terminal under various circumstances of the ring network connection, interruption or connection recovery. access control of the target device. The backup processing method and system of the RS485 ring network of the present invention can realize the relevant measures of the backup of the main control terminal and the ring network without increasing the extra hardware cost.

有關本發明的特徵與實作,茲配合圖式作最佳實施例詳細說明如下。 With regard to the features and implementation of the present invention, the preferred embodiments are described in detail as follows in conjunction with the drawings.

100:備援處理系統 100: Backup Processing System

110:主控端 110: main control terminal

111:處理單元 111: Processing unit

112:儲存單元 112: storage unit

113:路徑控制程序 113: Path Control Program

114:第一接口 114: The first interface

115:第二接口 115: Second interface

120:RS485設備端 120: RS485 device side

130:環狀網路 130: Ring network

140:目標設備 140: target device

510:第一目標設備 510: First target device

520:第二目標設備 520: Second target device

第1圖係為本發明的RS485環狀網路的備援處理系統架構示意圖。 FIG. 1 is a schematic diagram of the structure of the redundant processing system of the RS485 ring network of the present invention.

第2圖係為本發明的環狀網路架構示意圖。 FIG. 2 is a schematic diagram of the ring network architecture of the present invention.

第3圖係為本發明的運作流程示意圖。 FIG. 3 is a schematic diagram of the operation flow of the present invention.

第4圖係為本發明的各接口與目標設備的訊號傳輸時序圖。 FIG. 4 is a signal transmission timing diagram of each interface and the target device of the present invention.

第5A圖係為本發明的第一目標設備、第一回應訊息與第二回應訊息示意圖。 FIG. 5A is a schematic diagram of the first target device, the first response message and the second response message according to the present invention.

第5B圖係為本發明的各接口與目標設備的訊號傳輸時序圖。 FIG. 5B is a signal transmission timing diagram of each interface and the target device of the present invention.

第5C圖係為本發明的發生中斷時的訊號傳輸時序圖。 FIG. 5C is a timing diagram of signal transmission when an interruption occurs according to the present invention.

請配合參考第1圖與第2圖所示,其係分別為本發明的RS485環狀網路的備援處理系統架構示意圖。本發明的RS485環狀網路的備援處理系統100包括主控端110、RS485設備端120與環狀網路130。環狀網路130分別連接於主控端110與多個RS485設備端120。主控端110可以是但不限定為個人電腦或伺服器,也可以是獨立具有通訊與計算能力的電子設備。 Please refer to FIG. 1 and FIG. 2, which are schematic diagrams of the redundant processing system of the RS485 ring network of the present invention, respectively. The backup processing system 100 of the RS485 ring network of the present invention includes a main control terminal 110 , an RS485 device terminal 120 and a ring network 130 . The ring network 130 is respectively connected to the main control terminal 110 and the plurality of RS485 device terminals 120 . The main control terminal 110 may be, but is not limited to, a personal computer or a server, and may also be an electronic device with independent communication and computing capabilities.

主控端110具有處理單元111、儲存單元112、路徑控制程序113、第一接口114與第二接口115。處理單元111電性連接於儲存單元112、第一接口114與第二接口115。儲存單元112存儲路徑控制程序113。處理單元111除了執行路徑控制程序113外,處理單元111也驅動第一接口114與第二接口115並用於傳輸命令或訊息。在本發明中第一接口114與第二接口115均可以任意傳輸命令或訊息,並非僅侷限本發明中所述的傳輸方向。 The main control terminal 110 has a processing unit 111 , a storage unit 112 , a path control program 113 , a first interface 114 and a second interface 115 . The processing unit 111 is electrically connected to the storage unit 112 , the first interface 114 and the second interface 115 . The storage unit 112 stores the path control program 113 . In addition to executing the path control program 113, the processing unit 111 also drives the first interface 114 and the second interface 115 to transmit commands or messages. In the present invention, both the first interface 114 and the second interface 115 can transmit commands or messages arbitrarily, and are not limited to the transmission direction described in the present invention.

第一接口114與第二接口115分別連接於環狀網路130的兩端。在第1、2圖中環狀網路130係以粗黑線作為表示。環狀網路130的連接方式是以串接RS485設備端120的方式所形成。換言之,第一接口114連接電纜至第一台的RS485設備端120,在由第一台RS485設備端120電纜連接至第二台RS485設備端120,依序連接至次一RS485設備端120直至第二接口115為止。在本發明中為方便說明所指定的RS485設備端120,因此將所指定的RS485設備端120定義為目標設備140。第2圖中的目標設備僅為示意,並非僅侷限於此一位置上的RS485設備端120。並且主控端110根據不同的傳輸目的,主控端110可以發送控制命令與測試訊號至目標設備140,用以驅動目標設備140或確認環狀網路130的連線狀態。 The first interface 114 and the second interface 115 are respectively connected to two ends of the ring network 130 . In Figures 1 and 2, the ring network 130 is represented by a thick black line. The connection mode of the ring network 130 is formed by connecting the RS485 device terminals 120 in series. In other words, the first interface 114 connects the cable to the RS485 device end 120 of the first set, and then the first RS485 device end 120 is cabled to the second RS485 device end 120, and then connected to the next RS485 device end 120 in sequence until the first RS485 device end 120. up to the second interface 115 . In the present invention, for the convenience of describing the designated RS485 device end 120 , the designated RS485 device end 120 is defined as the target device 140 . The target device in Figure 2 is for illustration only, and is not limited to the RS485 device terminal 120 at this position. In addition, according to different transmission purposes, the main control terminal 110 can send control commands and test signals to the target device 140 to drive the target device 140 or confirm the connection status of the ring network 130 .

在本發明中為能方便說明不同的狀況下的目標設備,因此定義第一目標設備與第二目標設備。在環狀網路130正常連線時,主控端110欲控制的目標設備為第一目標設備510。若是環狀網路130發生異常,主控端110對於欲控制的設備則定義為第二目標設備520。所述異常情況泛指網路訊號傳輸中斷或網路延遲過長等情況。 In the present invention, in order to facilitate the description of target devices under different conditions, a first target device and a second target device are defined. When the ring network 130 is normally connected, the target device to be controlled by the main control terminal 110 is the first target device 510 . If the ring network 130 is abnormal, the main control terminal 110 defines the device to be controlled as the second target device 520 . The abnormal conditions generally refer to the interruption of network signal transmission or the excessively long network delay.

為進一步說明本發明的運作方式,請配合第3圖,其係為本發明的運作流程示意圖。本發明的RS485環狀網路的備援處理方法包括以下步驟: To further illustrate the operation of the present invention, please refer to FIG. 3 , which is a schematic diagram of the operation flow of the present invention. The backup processing method of the RS485 ring network of the present invention comprises the following steps:

步驟S310:主控端以環狀網路串接於多個RS485設備; Step S310: the main control terminal is connected in series with a plurality of RS485 devices through a ring network;

步驟S320:主控端於初始階段時,由主控端的第一接口發出第一訊號,使第一訊號經由環狀網路後經由主控端的第二接口所接收; Step S320: when the main control terminal is in the initial stage, the first interface of the main control terminal sends out a first signal, so that the first signal is received through the second interface of the main control terminal after passing through the ring network;

步驟S330:確認環狀網路的連通並計時第一訊號於環狀網路中經過的第一時間; Step S330: confirming the connection of the ring network and timing the first time elapsed by the first signal in the ring network;

步驟S340:主控端每間隔第二時間,主控端由第一接口發出測試訊號至第二接口,用於判別環狀網路是否中斷; Step S340: the main control end sends a test signal from the first interface to the second interface every second time interval to determine whether the ring network is interrupted;

步驟S350:若環狀網路未發生中斷,主控端透過第一接口發送第一控制命令至第一目標設備,且經過第一時間後第二接口接獲第一控制命令; Step S350: if the ring network is not interrupted, the main control terminal sends the first control command to the first target device through the first interface, and the second interface receives the first control command after the first time;

步驟S360:第一目標設備完成第一控制命令後,目標設備發送第一回應訊息與第二回應訊息至主控端; Step S360: After the first target device completes the first control command, the target device sends the first response message and the second response message to the host;

步驟S370:若環狀網路發生中斷,主控端驅動第一接口發送第二控制命令至第二目標設備; Step S370: if the ring network is interrupted, the main control terminal drives the first interface to send the second control command to the second target device;

步驟S380:判斷第二目標設備是否於第一時間內完成第二控制命令; Step S380: Determine whether the second target device completes the second control command within the first time;

步驟S381:若第二目標設備於第一時間內未完成第二控制命令,主控 端間隔第三時間驅動第二接口發送另一組第二控制命令至第二目標設備;以及 Step S381: If the second target device does not complete the second control command within the first time, the main control driving the second interface to send another group of second control commands to the second target device at a third time interval; and

步驟S382:若第二目標設備於第一時間內完成第二控制命令,第二目標設備根據任一第二控制命令返回第三回應訊息至主控端。 Step S382 : If the second target device completes the second control command within the first time, the second target device returns a third response message to the master according to any second control command.

本發明的主控端110以串列的方式連接多個RS485設備,藉以形成環狀網路130,如第2圖所示。在環狀網路130的初始階段時,主控端110會開始運行路徑控制程序113。路徑控制程序113會透過第一接口114發出第一訊號至環狀網路130,如第4圖所示,其係為本發明的各接口與目標設備140的訊號傳輸時序圖。 The main control terminal 110 of the present invention is connected to a plurality of RS485 devices in a serial manner, thereby forming a ring network 130, as shown in FIG. 2 . In the initial stage of the ring network 130 , the master terminal 110 starts to run the path control program 113 . The path control program 113 sends a first signal to the ring network 130 through the first interface 114, as shown in FIG.

第4圖分為上、下兩部分,分別表示網路連接的初始階段與運作階段。所述的初始階段是主控端110開機後連接至環狀網路130的階段。主控端110將會計時第一訊號將通過第一接口114、環狀網路130與第二接口115的時間,而此一時間則是第一時間。如果主機端110重啟後,主機端110在初始階段會載入前次的第一時間作為新一回合的判斷基準。舉例來說,主控端110會根據前次的第一時間T n-1並乘上倍數m,其中0<m≦5且m為任意數;n為主控端110的重啟回合數,若n為1時則m不列入計算。mT n-1用以判斷本次初始階段的環狀網路是否有中斷。 Figure 4 is divided into upper and lower parts, which respectively represent the initial stage and the operation stage of network connection. The initial stage is the stage in which the main control terminal 110 is connected to the ring network 130 after being powered on. The main control terminal 110 will time the time when the first signal will pass through the first interface 114 , the ring network 130 and the second interface 115 , and this time is the first time. If the host terminal 110 is restarted, the host terminal 110 will load the previous first time in the initial stage as a judgment criterion for a new round. For example, the main control terminal 110 will multiply the multiple m according to the previous first time T n -1 , where 0<m≦5 and m is an arbitrary number; n is the number of restart rounds of the main control terminal 110, if When n is 1, m is not included in the calculation. m * T n -1 is used to judge whether the ring network in this initial stage is interrupted.

換言之,第二接口115若是於mT n-1的時間內收到第一訊號,則第二接口115除了可以認為環狀網路是連通的且第一訊號的經過時間則為新的第一時間。反之,第二接口115在經過mT n-1的時間未收到第一訊號,則表示環狀網路130是中斷的。主控端110會發出警示訊號,藉以提示使用者環狀網路130發生異常。 In other words, if the second interface 115 receives the first signal within the time of m * Tn - 1 , the second interface 115 can consider that the ring network is connected and the elapsed time of the first signal is the new first signal. a time. On the contrary, if the second interface 115 does not receive the first signal within the time of m * Tn - 1 , it means that the ring network 130 is interrupted. The main control terminal 110 will issue a warning signal to remind the user that the ring network 130 is abnormal.

在確認環狀網路130正常主控端110會每間隔第二時間後,主控端110由第一接口114發出測試訊號至第二接口115。主控端110藉由第二接口115有無接收測試訊號作為環狀網路130的中斷依據。其中,第二時間的長度可以透過使用者自行設定。 After confirming that the ring network 130 is normal, the main control terminal 110 will send a test signal to the second interface 115 through the first interface 114 every second time interval. The main control terminal 110 uses whether the second interface 115 receives the test signal as the basis for the interruption of the ring network 130 . The length of the second time can be set by the user.

在運作階段中,主控端110判斷環狀網路130是否發生中斷。以下為能區別不同情況所發送的命令,因此在未中斷所發送的控制命令為第一控制命令,而中斷時所發送的控制命令為第二控制命令。 In the operation phase, the main control terminal 110 determines whether the ring network 130 is interrupted. The following commands are sent to distinguish different situations, so the control command sent when not interrupted is the first control command, and the control command sent when interrupted is the second control command.

若環狀網路130未發生中斷,主控端110透過第一接口114發送第一控制命令至第一目標設備510與第二接口115。由於環狀網路130未中斷,因此第一控制命令除了流經第一目標設備150外,也會傳向第二接口115。因此,第一控制命令從第一接口114發出後,應該在經過第一時間後第二接口115也會收到第一控制命令。路徑控制程序113可以通過第二接口115有無接獲第一控制命令,進而判斷環狀網路130是否發生中斷。 If the ring network 130 is not interrupted, the master terminal 110 sends the first control command to the first target device 510 and the second interface 115 through the first interface 114 . Since the ring network 130 is not interrupted, the first control command will not only flow through the first target device 150 but also be transmitted to the second interface 115 . Therefore, after the first control command is sent from the first interface 114, the second interface 115 should also receive the first control command after the first time has elapsed. The path control program 113 can determine whether the ring network 130 is interrupted through whether the second interface 115 has received the first control command.

由於第一目標設備510對第一接口114與第二接口115的連線距離是有所差異,也會造成封包傳輸時間是有落差。因此本發明為避免重複接收回應訊息的情況發生,所以在第一個接獲回應訊息時設定一組門檻區間。無論第一接口114先收到回應訊息或是第二接口115先收到回應訊息,主控端110都會開始計時門檻區間。若是門檻區間之中,主控端110又收到另一回應訊息,主控端110就會丟棄第二組的回應訊息。 Since the connection distance between the first target device 510 and the first interface 114 and the second interface 115 is different, there will also be a difference in the packet transmission time. Therefore, in the present invention, in order to avoid the situation of repeatedly receiving the response message, a set of threshold intervals is set when the response message is first received. Regardless of whether the first interface 114 receives the response message first or the second interface 115 receives the response message first, the main control terminal 110 will start timing the threshold interval. If the main control terminal 110 receives another response message within the threshold interval, the main control terminal 110 will discard the second group of response messages.

在此一階段中將欲進行操作的RS485設備端120定義為第一目標設備510。第一目標設備510除了執行第一控制指令外,第一目標設備510也會在完成後發送一組回應訊息。由於第一目標設備510會將回應訊息發送至第一接口114與第二接口115,因此將回應訊息分別定義為第一回應訊息與第二回應訊息。其中,第一回應訊息與第二回應訊息的內容均相同,而第一回應訊息與第二回應訊息的接收目的端不同,如第5A圖所示。 In this stage, the RS485 device 120 to be operated is defined as the first target device 510 . In addition to executing the first control command, the first target device 510 also sends a set of response messages after completion. Since the first target device 510 sends the response message to the first interface 114 and the second interface 115, the response message is respectively defined as the first response message and the second response message. The contents of the first response message and the second response message are the same, and the receiving ends of the first response message and the second response message are different, as shown in FIG. 5A .

主控端110將會透過第一接口114接獲第一回應訊息,而第二接口115接獲第二回應訊息。路徑控制程序113根據第一時間的間距 判斷第一回應訊息與第二回應訊息的時間差是否超過第一預設門檻,藉以判別環狀網路130的傳輸路徑有無異常。 The host 110 will receive the first response message through the first interface 114, and the second interface 115 will receive the second response message. The path control program 113 according to the first time interval It is determined whether the time difference between the first response message and the second response message exceeds a first preset threshold, so as to determine whether the transmission path of the ring network 130 is abnormal.

舉例來說,第一接口114接獲第一回應訊息的時間為T 1,第二接口115接獲第二回應訊息的時間為T 2,而第一預設門檻的時間長度為△T。第一預設門檻△T的時間長度與第一時間成正比。當|T 1-T 2|小於△T時,則路徑控制程序113將繼續記錄環狀網路為正常的連線狀態,如第5B圖所示。第一目標設備510是同時向第一接口114與第二接口115發送第一回應訊息與第二回應訊息,而在第5B圖中為能方便說明將第一目標設備510以間隔方式繪製,但實際上並非分時發送。 For example, the time when the first interface 114 receives the first response message is T 1 , the time when the second interface 115 receives the second response message is T 2 , and the time length of the first predetermined threshold is ΔT . The time length of the first preset threshold ΔT is proportional to the first time. When | T 1 - T 2 | is smaller than ΔT , the path control program 113 will continue to record that the ring network is in a normal connection state, as shown in FIG. 5B . The first target device 510 sends the first response message and the second response message to the first interface 114 and the second interface 115 at the same time. In FIG. 5B, the first target device 510 is drawn at intervals for convenience, but Not actually time-sharing.

主控端110可以根據前文的△T與測試訊號判別環狀網路130是否發生中斷。實際上環狀網路130發生斷點的位置可能在第一接口114至第二目標設備520之間,也有可能斷點位於第二目標設備520至第二接口115之間。若斷點為前者情況時,則第二目標設備520將不會收到任何訊息。因此在經過第一時間後,第二接口115不會接收第二控制命令。所以主控端110間隔第三時間後在驅動第二接口115發送第二控制命令至第二目標設備520,如第5C圖所示。換言之,主控端110會分別在不同時間點向第一接口114與第二接口115發出第二控制命令。在環狀網路130中斷的情況中,第二目標設備520根據第二控制命令返回第三回應訊息。 The main control terminal 110 can determine whether the ring network 130 is interrupted according to the aforementioned ΔT and the test signal. In fact, the location of the breakpoint in the ring network 130 may be between the first interface 114 and the second target device 520 , or the breakpoint may be between the second target device 520 and the second interface 115 . If the breakpoint is in the former case, the second target device 520 will not receive any message. Therefore, after the first time has elapsed, the second interface 115 will not receive the second control command. Therefore, the main control terminal 110 drives the second interface 115 to send the second control command to the second target device 520 after a third time interval, as shown in FIG. 5C . In other words, the main control terminal 110 sends the second control command to the first interface 114 and the second interface 115 at different time points respectively. When the ring network 130 is interrupted, the second target device 520 returns a third response message according to the second control command.

另一種情況是,第二目標設備520與第二接口115之間的環狀網路130發生中斷。一般而言,若是第二接口115在經過第一時間未收到第二控制命令,主控端110會視為環狀網路130發生中斷。但有一種例外情況,第二目標設備520可能在第一時間內發生完成第二控制命令的情況。由於第二控制命令的內容種類有所差異,又或者第二目標設備520與第一接口114相鄰使得命令處理時間過短。因此可能會發生在第一時間內第二目標設備520完成第二控制命令的情況。 Another situation is that the ring network 130 between the second target device 520 and the second interface 115 is interrupted. Generally speaking, if the second interface 115 does not receive the second control command within the first time, the host 110 will regard the ring network 130 as being interrupted. But there is an exception, the second target device 520 may complete the second control command within the first time. Because the content types of the second control commands are different, or the second target device 520 is adjacent to the first interface 114, the command processing time is too short. Therefore, it may happen that the second target device 520 completes the second control command within the first time.

若是主控端110在偵測到環狀網路130發生中斷,主控端110在第四時間內偵測第二目標設備520完成第二控制命令與回覆第三回應訊息至第一接口114,則主控端110將會停止第二接口115再次發出第二控制命令。其中,第四時間為第二目標設備520完成第二控制命令的處理 時間Ta、與兩倍的第一接口114至第二目標設備520的傳輸時間Tb*2之總和(意即為Ta+2*Tb)。若第四時間內主控端110收到第三回應訊息 If the main control terminal 110 detects that the ring network 130 is interrupted, the main control terminal 110 detects that the second target device 520 completes the second control command and returns a third response message to the first interface 114 within the fourth time. Then, the main control terminal 110 will stop the second interface 115 from issuing the second control command again. The fourth time is when the second target device 520 completes the processing of the second control command The sum of the time Ta and twice the transmission time Tb*2 from the first interface 114 to the second target device 520 (meaning Ta+2*Tb). If the main control terminal 110 receives the third response message within the fourth time

本發明的RS485環狀網路的備援處理方法與系統可以提供主控端在環狀網路連線、中斷或連線恢復的各種情況下,實現主控端對目標設備的存取控制。本發明的RS485環狀網路的備援處理方法與系統再不增加額外的硬體成本的情況下,實現主控端與環狀網路備援的相關措施。 The backup processing method and system of the RS485 ring network of the present invention can provide the main control terminal to realize the access control of the target device by the main control terminal under various conditions of connection, interruption or connection recovery of the ring network. The backup processing method and system of the RS485 ring network of the present invention can realize the relevant measures of the backup of the main control terminal and the ring network without increasing the extra hardware cost.

雖然本發明以前述之較佳實施例揭露如上,然其並非用以限定本發明,任何熟習相像技藝者,在不脫離本發明之精神和範圍內,當可作些許之更動與潤飾,因此本發明之專利保護範圍須視本說明書所附之申請專利範圍所界定者為準。 Although the present invention is disclosed by the above-mentioned preferred embodiments, it is not intended to limit the present invention. Anyone who is familiar with the similar arts can make some changes and modifications without departing from the spirit and scope of the present invention. Therefore, this The scope of patent protection of the invention shall be determined by the scope of the patent application attached to this specification.

100:備援處理系統 100: Backup Processing System

110:主控端 110: main control terminal

111:處理單元 111: Processing unit

112:儲存單元 112: storage unit

113:路徑控制程序 113: Path Control Program

114:第一接口 114: The first interface

115:第二接口 115: Second interface

120:RS485設備端 120: RS485 device side

130:環狀網路 130: Ring network

140:目標設備 140: target device

Claims (7)

一種RS485環狀網路的備援處理方法,其特徵在於RS485環狀網路發生異常時的備援處理,該RS485環狀網路的備援處理方法包括: A backup processing method for an RS485 ring network is characterized in that the backup processing when an abnormality occurs in the RS485 ring network, and the backup processing method for the RS485 ring network comprises: 一主控端以一環狀網路串接於多個RS485設備; A main control terminal is connected to multiple RS485 devices in series with a ring network; 該主控端於一初始階段時,由該主控端的一第一接口發出一第一訊號,使該第一訊號經由該環狀網路後經由該主控端的一第二接口所接收; In an initial stage, the main control terminal sends a first signal from a first interface of the main control terminal, so that the first signal is received through a second interface of the main control terminal after passing through the ring network; 計時該第一訊號於該環狀網路中的一第一時間; timing a first time of the first signal in the ring network; 該主控端每間隔一第二時間,該主控端由該第一接口發出一測試訊號至該第二接口,用於判別該環狀網路是否中斷; The main control end sends a test signal from the first interface to the second interface at every second time interval for judging whether the ring network is interrupted; 若該環狀網路未發生中斷,該主控端透過該第一接口發送一第一控制命令至一第一目標設備,且經過該第一時間後該第二接口接獲該第一控制命令; If the ring network is not interrupted, the host sends a first control command to a first target device through the first interface, and the second interface receives the first control command after the first time ; 該第一目標設備完成該第一控制命令後,該目標設備發送一第一回應訊息與一第二回應訊息至該主控端; After the first target device completes the first control command, the target device sends a first response message and a second response message to the host; 若該環狀網路發生中斷,該主控端驅動該第一接口發送一第二控制命令至一第二目標設備; If the ring network is interrupted, the main control terminal drives the first interface to send a second control command to a second target device; 該主控端間隔一第三時間驅動該第二接口發送另一該第二控制命令至該第二目標設備;以及 The host computer drives the second interface to send another second control command to the second target device at a third time interval; and 該第二目標設備根據任一該第二控制命令返回一第三回應訊息與一第四回應訊息至該主控端。 The second target device returns a third response message and a fourth response message to the host according to any of the second control commands. 如請求項1所述之RS485環狀網路的備援處理方法,其中該主控端連接該環狀網路包括:將該環狀網路係由該第一接口串接於該些RS485設備與該第二接口。 The backup processing method for an RS485 ring network according to claim 1, wherein connecting the main control terminal to the ring network comprises: connecting the ring network to the RS485 devices in series through the first interface with this second interface. 如請求項1所述之RS485環狀網路的備援處理方法,其中該主控端根據該第一時間與該些RS485設備的數量決定該第二時間。 The backup processing method for an RS485 ring network according to claim 1, wherein the main control terminal determines the second time according to the first time and the number of the RS485 devices. 一種RS485環狀網路的備援處理系統,其特徵在於RS485環狀網路發生異常時的備援處理,該RS485環狀網路的備援處理系統包括: A backup processing system for an RS485 ring network is characterized in that the backup processing when an abnormality occurs in the RS485 ring network, the backup processing system for the RS485 ring network comprises: 一環狀網路,串接多個RS485設備端;以及 A ring network, connecting multiple RS485 devices in series; and 一主控端,具有一處理單元、一儲存單元、一路徑控制程序、一第一接口與一第二接口,該處理單元電性連接於該儲存單元、該第一接口與該第二接口,該處理單元運行記錄於該儲存單元的該路徑控制程序,該第一接口與該第二接口分別連接該環狀網路的兩端,該主控端透過該第一接口發送一第一訊號並計算該第一訊號在該環狀網路中傳輸的一第一時間,當該環狀網路連線時,該主控端透過該第一接口發送一第一控制命令至該環狀網路中的一第一目標設備; A main control terminal has a processing unit, a storage unit, a path control program, a first interface and a second interface, the processing unit is electrically connected to the storage unit, the first interface and the second interface, The processing unit runs the path control program recorded in the storage unit, the first interface and the second interface are respectively connected to two ends of the ring network, the master sends a first signal through the first interface and Calculate a first time when the first signal is transmitted in the ring network, when the ring network is connected, the host sends a first control command to the ring network through the first interface a first target device in; 其中,該主控端每間隔一第二時間,該主控端由該第一接口發出一測試訊號至該第二接口,用於判別該環狀網路是否中斷,該主控端監測該環狀網路發生中斷,該主控端驅動該第一接口發送一第二控制命令至該環狀網路中的一第二目標設備,該主控端間隔一第三時間驅動該第二接口發送另一該第二控制命令至該第二目標設備。 Wherein, the main control end sends a test signal from the first interface to the second interface every second time interval to determine whether the ring network is interrupted, and the main control end monitors the ring When the ring network is interrupted, the main control terminal drives the first interface to send a second control command to a second target device in the ring network, and the main control terminal drives the second interface to send a third time interval. Another of the second control commands to the second target device. 如請求項4所述之RS485環狀網路的備援處理系統,其中該第一目標設備接獲該第一控制命令後分別向該第一接口與該第二接口發送一第回應訊號與一第二回應訊號。 The backup processing system for an RS485 ring network according to claim 4, wherein after receiving the first control command, the first target device sends a first response signal and a first response signal to the first interface and the second interface respectively. The second response signal. 如請求項4所述之RS485環狀網路的備援處理系統,其中該主控端根據該些RS485設備的數量決定該第二時間。 The backup processing system for an RS485 ring network according to claim 4, wherein the main control terminal determines the second time according to the number of the RS485 devices. 如請求項4所述之RS485環狀網路的備援處理系統,其中若該環狀網路發生中斷,該主控端間隔該第三時間驅動該第二接口發送另一該第二控制命令至該第二目標設備。 The backup processing system for an RS485 ring network as claimed in claim 4, wherein if the ring network is interrupted, the host computer drives the second interface to send another second control command at the third time interval to the second target device.
TW109128720A 2020-08-20 2020-08-20 The redundant method and system of the rs485 ring network therefor TW202209856A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW109128720A TW202209856A (en) 2020-08-20 2020-08-20 The redundant method and system of the rs485 ring network therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW109128720A TW202209856A (en) 2020-08-20 2020-08-20 The redundant method and system of the rs485 ring network therefor

Publications (1)

Publication Number Publication Date
TW202209856A true TW202209856A (en) 2022-03-01

Family

ID=81746762

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109128720A TW202209856A (en) 2020-08-20 2020-08-20 The redundant method and system of the rs485 ring network therefor

Country Status (1)

Country Link
TW (1) TW202209856A (en)

Similar Documents

Publication Publication Date Title
EP2075974B1 (en) Method and apparatus for aggregating ports
JP4166939B2 (en) Active fault detection
CN110780615B (en) System and method for transmitting data on high availability industrial control system
JPH10228426A (en) Bus system and operating method for bus system
CN107360239A (en) A kind of client connection status detection method and system
CN109245950B (en) Method for determining link failure position and related device
CN102026042A (en) Keep-alive and self-healing method and device for advanced telecom computing architecture control surface
US20090077275A1 (en) Multiple I/O interfacing system for a storage device and communicating method for the same
CN105426171A (en) Synchronization and switching method and system for multiple two-out-of-two systems
US10055322B2 (en) Interpreting signals received from redundant buses
JP2008544678A (en) Communication network system
TW202209856A (en) The redundant method and system of the rs485 ring network therefor
CN212343793U (en) Backup processing system of RS485 ring network
TWM608805U (en) Backup processing system of RS485 ring network
CN111901216A (en) Backup processing method and system for RS485 ring network
CN106330357B (en) A kind of transfer check method, node and the system of SERDES
CN208128266U (en) A kind of communication control unit
JP6762032B2 (en) Power receiving device and control method
US8111610B2 (en) Flagging of port conditions in high speed networks
CN104185204B (en) A kind of connection status inspection method and device
JP3604868B2 (en) System and error handling method
CN114143139B (en) Tape machine protection system and method based on hardware redundancy packet communication
CN114844807B (en) System detection method, device, equipment, storage medium, vehicle and cloud control platform
KR102131194B1 (en) Apparatus for detecting fault of ethernet
US7724642B2 (en) Method and apparatus for continuous operation of a point-of-sale system during a single point-of-failure