外文文獻(xiàn)翻譯-計(jì)算機(jī)網(wǎng)絡(luò)冗余GPS時(shí)間同步電路板的設(shè)計(jì)與實(shí)現(xiàn)【中文5000字】【中英文WORD】
外文文獻(xiàn)翻譯-計(jì)算機(jī)網(wǎng)絡(luò)冗余GPS時(shí)間同步電路板的設(shè)計(jì)與實(shí)現(xiàn)【中文5000字】【中英文WORD】,中文5000字,中英文WORD,外文,文獻(xiàn),翻譯,計(jì)算機(jī)網(wǎng)絡(luò),冗余,GPS,時(shí)間,同步,電路板,設(shè)計(jì),實(shí)現(xiàn),中文,5000,中英文,WORD
計(jì)算機(jī)網(wǎng)絡(luò)冗余GPS時(shí)間同步電路板的設(shè)計(jì)與實(shí)現(xiàn)
摘要:如今,在計(jì)算機(jī)網(wǎng)絡(luò)系統(tǒng)中準(zhǔn)確和可靠的時(shí)間是一個(gè)基本要求。為實(shí)現(xiàn)這一必要性,時(shí)間同步想法產(chǎn)生了。同時(shí)在某些情況下,可靠的時(shí)間是如此的重要,以致于一個(gè)冗余的結(jié)構(gòu)得以應(yīng)用。在本文中,時(shí)間同步系統(tǒng)的主要研究是設(shè)計(jì)和實(shí)施一個(gè)時(shí)間同步電路,該電路能夠通過(guò)NTP協(xié)議與計(jì)算機(jī)網(wǎng)絡(luò)同步時(shí)間。在本設(shè)計(jì)中還嵌入了冗余方案以便提供更高的可靠性。
關(guān)鍵字:計(jì)算機(jī)網(wǎng)絡(luò) GPS時(shí)間 NTP 冗余 時(shí)間同步 時(shí)間同步協(xié)議 時(shí)間服務(wù)器
1. 引言
我們通常會(huì)把電腦的時(shí)間和手表的誤差設(shè)置在一兩分鐘內(nèi),但另一方面,準(zhǔn)確和可靠的時(shí)間對(duì)于財(cái)務(wù)和法律事務(wù)、運(yùn)輸、分銷系統(tǒng),和許多其他涉及資源分布廣泛的應(yīng)用程序是必要的。舉一個(gè)例子說(shuō)明,在一個(gè)分布式的機(jī)票預(yù)訂系統(tǒng),如果分布式計(jì)算機(jī)時(shí)間不同,座椅可以賣出兩倍價(jià)格甚至更多,或者在網(wǎng)上股票交易完成之前會(huì)產(chǎn)生法律后果。在這方面,世界協(xié)調(diào)時(shí)和時(shí)鐘同步已開(kāi)發(fā)出來(lái)?;A(chǔ)的時(shí)間尺度已隨著歷史得到改進(jìn),以地球自轉(zhuǎn)為基礎(chǔ)的地球時(shí)和原子時(shí)也產(chǎn)生了。一些重要的時(shí)間尺度還包括國(guó)際原子時(shí)(TAI)、通用協(xié)調(diào)時(shí)間尺度(UTC)、和標(biāo)準(zhǔn)時(shí)間或民用時(shí)間。
時(shí)鐘同步協(xié)議的想法是,即使最初設(shè)置準(zhǔn)確,但電腦的內(nèi)部時(shí)鐘也可能與世界時(shí)鐘不同。之后,由于時(shí)鐘漂移,會(huì)有相當(dāng)大的誤差,所以總是有必要將這些漂移的時(shí)鐘同步到參考時(shí)鐘源。
時(shí)間同步源包括地球上的無(wú)線電同步技術(shù)(WWV, WWVH, WWVB, DCF77 and LORAN-C)、衛(wèi)星時(shí)間同步技術(shù)(GOES, GPS, GLONASS, and Galileo)、互聯(lián)網(wǎng)時(shí)間同步技術(shù)以及電話撥號(hào)時(shí)間同步技術(shù)。在這些時(shí)鐘源中,全球定位系統(tǒng)(GPS)提供了一些特殊的優(yōu)點(diǎn),如時(shí)間精度、抗噪聲干擾、在世界各地都可用、并不斷引用國(guó)際標(biāo)準(zhǔn)。如今,相比其他時(shí)鐘資源,全球定位系統(tǒng)時(shí)鐘的使用更為廣泛。
圖1顯示了一個(gè)典型的時(shí)間同步結(jié)構(gòu),其中時(shí)間服務(wù)器從GPS接收的數(shù)據(jù)作為時(shí)間同步源。接下來(lái),時(shí)間服務(wù)器為需要時(shí)間的設(shè)備發(fā)送滿足同步協(xié)議的準(zhǔn)確時(shí)間消息。這些設(shè)備通過(guò)收到的消息同步它們的內(nèi)部時(shí)鐘。
當(dāng)今各種各樣的同步協(xié)議為時(shí)間同步提供了不同的手段,但他們都遵循兩種常用的一般模式。無(wú)論是客戶端向服務(wù)器發(fā)出請(qǐng)求,并且服務(wù)器以當(dāng)前時(shí)間響應(yīng)客戶端,或者是服務(wù)器向組內(nèi)或所有的客戶發(fā)送消息。一些重要的標(biāo)準(zhǔn)計(jì)算機(jī)網(wǎng)絡(luò)時(shí)間同步協(xié)議如下:
時(shí)間協(xié)議:時(shí)間協(xié)議規(guī)定在RFC868,返回一個(gè)32位并行的二進(jìn)制數(shù)表示時(shí)間,參考自1900年1月1日協(xié)調(diào)世界時(shí)秒。服務(wù)器監(jiān)聽(tīng)端口37上的時(shí)間請(qǐng)求,并響應(yīng)TCP/IP 和UDP/IP 格式的請(qǐng)求。
白天協(xié)議:白天協(xié)議規(guī)定在RFC867,發(fā)送時(shí)間使用ASCII字符。服務(wù)器監(jiān)聽(tīng)端口13,并且響應(yīng)TCP/IP和UDP/IP格式的請(qǐng)求。
網(wǎng)絡(luò)時(shí)間協(xié)議(NTP):協(xié)議規(guī)定在RFC-5905,對(duì)于通過(guò)網(wǎng)絡(luò)同步電腦始終來(lái)說(shuō),是最古老的(并且仍在使用)和最先進(jìn)的時(shí)間同步協(xié)議。這個(gè)NTP服務(wù)器監(jiān)聽(tīng)123端口,并通過(guò)發(fā)送一個(gè)滿足NTP協(xié)議格式的UDP數(shù)據(jù)包來(lái)響應(yīng)請(qǐng)求。
簡(jiǎn)單網(wǎng)絡(luò)時(shí)間協(xié)議(SNTP):SNTP是NTP協(xié)議的一個(gè)不太復(fù)雜的實(shí)現(xiàn)版本。當(dāng)完整的NTP最終表現(xiàn)不需要的時(shí)候可以使用SNTP。
精密時(shí)間協(xié)議(PTP):PTP正式出現(xiàn)在IEEE 1588-2008,是一個(gè)旨在提高相對(duì)于傳統(tǒng)的基于以太網(wǎng)協(xié)議比如NTP的時(shí)間精確度,但是在實(shí)際應(yīng)用當(dāng)中更昂貴。
對(duì)于開(kāi)源,對(duì)于典型的應(yīng)用來(lái)說(shuō)NTP具有足夠的精度,并且有能力工作在大型網(wǎng)絡(luò)中,NTP是公共互聯(lián)網(wǎng)中使用最廣泛的,并且已經(jīng)為許多私人網(wǎng)絡(luò)服務(wù)了超過(guò)三十年。
可靠性要求對(duì)于時(shí)間同步來(lái)說(shuō)可能太嚴(yán)格了,以致于一個(gè)單一的時(shí)間服務(wù)器都可能不可信。因此,在一個(gè)冗余結(jié)構(gòu)中需要使用多個(gè)時(shí)間服務(wù)器。
在本文中,我們將探討時(shí)間同步系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn),通過(guò)從一個(gè)低成本的GPS接收器獲取時(shí)間的數(shù)據(jù),然后使用NTP協(xié)議同步計(jì)算機(jī)網(wǎng)絡(luò)。在本設(shè)計(jì)中,以使用兩個(gè)時(shí)間同步板以提供更高的可靠性的方式嵌入了冗余管理。
這份文件的組織如下:第二部分給出了關(guān)于NTP協(xié)議的一個(gè)簡(jiǎn)短解釋,并且使用它同步時(shí)間。第三部分給出關(guān)于冗余的更多解釋。第四部分給出了建立一個(gè)網(wǎng)絡(luò)時(shí)間同步器的結(jié)構(gòu),包括硬件設(shè)計(jì)和軟件算法。第五部分給出最后的測(cè)試和結(jié)果。
2. 什么是NTP?
NTP主要包含三個(gè)部分:NTP軟件程序,在UNIX系統(tǒng)中稱為守護(hù)進(jìn)程,在WINDOWS系統(tǒng)中成為服務(wù);用于在服務(wù)器和客戶機(jī)之間交換時(shí)間值的協(xié)議;和一套處理時(shí)間值提前或延緩系統(tǒng)時(shí)鐘的算法。因?yàn)镹TP軟件往往是和操作系統(tǒng)捆綁在一起的(如大多數(shù)的WINDOWS和UNIX系統(tǒng)),是計(jì)算機(jī)網(wǎng)絡(luò)時(shí)間同步中最常用的協(xié)議。例如,我們不打算涵蓋所有三部分,但我們打算描述設(shè)計(jì)一個(gè)網(wǎng)絡(luò)時(shí)間服務(wù)器中所涉及的協(xié)議。更詳細(xì)的細(xì)節(jié)可在正式規(guī)范中瀏覽。
NTP協(xié)議是基于互聯(lián)網(wǎng)協(xié)議(IP)和用戶數(shù)據(jù)報(bào)協(xié)議(UDP)建立的,在IEEE 802.3以太網(wǎng)幀中。該NTP協(xié)議報(bào)頭,在可選的擴(kuò)展域和一個(gè)可選的消息認(rèn)證碼(MAC)后有12個(gè)字。
NTP工作模式,包括C/S模式和廣播模式。在客戶機(jī)/服務(wù)器模式中,客戶端向服務(wù)器發(fā)出請(qǐng)求,服務(wù)器以當(dāng)前時(shí)間響應(yīng)請(qǐng)求。然而在廣播模式,時(shí)間服務(wù)器周期性地向客戶端發(fā)送NTP數(shù)據(jù)包,客戶端使用接收到的數(shù)據(jù)包調(diào)整自己的時(shí)間。
在NTP數(shù)據(jù)包中最重要的領(lǐng)域是時(shí)間戳字段。一個(gè)NTP的時(shí)間戳是一個(gè)64位無(wú)符號(hào)定點(diǎn)數(shù)的整數(shù)部分,在前32位顯示以1900年1月為參考的時(shí)間和小數(shù)部分在最后32位。這種表示的精度是約2 - 32秒(233皮秒)。
時(shí)間同步的精度取決于網(wǎng)絡(luò)環(huán)境。今天,在互聯(lián)網(wǎng)的大多數(shù)地方,提供準(zhǔn)確的時(shí)間為10 - 100毫秒,而如果在一個(gè)良好的條件,沒(méi)有太多的路由器的局域網(wǎng)上,正常同步在幾毫秒。
3. 什么是冗余?
冗余是一種通常用于提高系統(tǒng)可靠性的技術(shù)。它有多種形式和類型。冗余最一般的形式冗余是Mout-of-N(MooN)冗余,其中MooN至少必須是有效的系統(tǒng)函數(shù)。這方面的例子如圖2所示。M-out-of-N冗余廣泛應(yīng)用于不同的領(lǐng)域,例如,在安全系統(tǒng)、編程等。
同時(shí),尊重切換時(shí)間,冗余可分為并行和備用冗余。在并行模式下,冗余的部分是連續(xù)運(yùn)行,在待機(jī)模式下,當(dāng)一個(gè)正常運(yùn)行的操作組件失敗時(shí),他們才切換至一個(gè)操作模式。兩者之間的本質(zhì)區(qū)別如圖3所示。
只要時(shí)間同步系統(tǒng)需要更多的可靠性,冗余技術(shù)就可以用。圖4顯示了一個(gè)在時(shí)間同步系統(tǒng)中的1oo3冗余結(jié)構(gòu)。根據(jù)這個(gè)數(shù)據(jù),三個(gè)時(shí)間服務(wù)器正在從是時(shí)間同步源(GPS)那里獲取時(shí)間,然后作為時(shí)間服務(wù)器,反饋給和一個(gè)共同網(wǎng)絡(luò)連接的群體的客戶端以準(zhǔn)確和可靠的時(shí)間。
值得一提的是,不同的冗余度也可以增加時(shí)間同步的可靠性。這是通過(guò)讓時(shí)間從一種以上的時(shí)間參考實(shí)現(xiàn)的。例如一個(gè)時(shí)間服務(wù)器從GPS獲取時(shí)間,而另一個(gè)時(shí)間服務(wù)器從DC F77廣播時(shí)間源獲取時(shí)間。
4. 時(shí)間同步電路設(shè)計(jì)
A. 硬件設(shè)計(jì)
在這里,我們提出一個(gè)方案,一個(gè)時(shí)間服務(wù)器從GPS獲取時(shí)間數(shù)據(jù),并且通過(guò)NTP協(xié)議為客戶端提供準(zhǔn)確的時(shí)間。圖5給出了時(shí)間服務(wù)器主板的內(nèi)部結(jié)構(gòu)。它主要由五個(gè)部分組成:低成本的GPS接收器、單片機(jī)、以太網(wǎng)接口、用戶接口和電源。
在提出了時(shí)間服務(wù)器中,單片機(jī)中起著重要的作用。它應(yīng)該被適當(dāng)?shù)鼐幊虂?lái)和其他部分交流,讓他們作為一個(gè)時(shí)間服務(wù)器一起工作。GPS接收器通過(guò)串行接口連接到單片機(jī)。它為單片機(jī)提供NMEA協(xié)議格式的時(shí)間數(shù)據(jù)和與UTC同步的1PPS信號(hào)(秒脈沖)。以太網(wǎng)控制器接口計(jì)算機(jī)網(wǎng)絡(luò)建立一個(gè)連接并通過(guò)它傳輸以及接收數(shù)據(jù)。用戶接口包括一個(gè)液晶顯示器和觸摸屏。它從用戶得到所需的配置數(shù)據(jù)從而顯示時(shí)間同步的結(jié)果。
B. 軟件設(shè)計(jì)
關(guān)于時(shí)間服務(wù)器中單片機(jī)的算法設(shè)計(jì)包括三個(gè)子算法,如圖7所示:主回路、GPS 1PPS中斷服務(wù)程序(ISR),和GPS串行接口(ISR)。
主回路首先初始化以太網(wǎng)控制器、GPS接收器、和用戶接口,然后進(jìn)入一個(gè)死循環(huán),等待GPS時(shí)間脈沖和串行接口的中斷。
這1PPS ISR被設(shè)置為上升沿觸發(fā)。本ISR具有最高優(yōu)先級(jí),并且能夠讓單片機(jī)在數(shù)萬(wàn)納秒精度的情況下獲得世界協(xié)調(diào)時(shí)。在這個(gè)程序中計(jì)數(shù)器設(shè)置為每10秒發(fā)送一次NTP數(shù)據(jù)包。NTP的工作模式是廣播模式,讓所有連接到網(wǎng)絡(luò)的客戶端可以接收數(shù)據(jù)包。
GPS的串行接口ISR每次運(yùn)行都會(huì)接收來(lái)自GPS接收機(jī)的一個(gè)串行數(shù)據(jù)。如果收到的數(shù)據(jù)是一個(gè)時(shí)間數(shù)據(jù),就會(huì)進(jìn)行解碼并且存儲(chǔ)在“Time”變量中。同時(shí)NTP數(shù)據(jù)包會(huì)在下一個(gè)1PPS被發(fā)送出去,其時(shí)間戳提前1秒。
冗余也嵌入算法當(dāng)中。如圖6所示,為此板“優(yōu)先級(jí)”和“優(yōu)先權(quán)”的參數(shù)。主機(jī)發(fā)送時(shí)間信息到以太網(wǎng)。此外,主機(jī)發(fā)送一個(gè)“活消息”給另一個(gè)板的地址。監(jiān)測(cè)器接收 “活消息”,如果超過(guò)3秒還沒(méi)有收到,從站承擔(dān)主機(jī)的責(zé)任向以太網(wǎng)發(fā)送時(shí)間消息和“活消息”。
5. 結(jié)果
A. 硬件實(shí)現(xiàn)
在測(cè)試中實(shí)現(xiàn)網(wǎng)絡(luò)時(shí)間顯示,選擇NEO-5Q GPS接收器,atmeaga128單片機(jī),ENC28j60以太網(wǎng)控制器,45以太網(wǎng)插座,128 *64液晶顯示器和觸摸屏,和一個(gè)電源(周圍建立的電壓調(diào)節(jié)器)。圖8顯示了根據(jù)結(jié)構(gòu)圖5建立的一個(gè)原型板。
B. 軟件實(shí)現(xiàn)
為實(shí)現(xiàn)時(shí)間服務(wù)器的軟件使用了“CodeVisionAVR”。根據(jù)上述算法編寫(xiě)了C++程序,本程序編譯并下載到單片機(jī)中。圖9顯示了設(shè)計(jì)的由菜單顯示的同步結(jié)果和由用戶配置的數(shù)據(jù)。
C. 同步結(jié)果
為了測(cè)試系統(tǒng)板,通過(guò)一個(gè)HUB與安裝了“Sun Virtual Box”虛擬機(jī)軟件的計(jì)算機(jī)相連接。其中一個(gè)是作為主機(jī),另一個(gè)作為從機(jī)。下一步,建立兩個(gè)虛擬機(jī),并且都裝有Windows XP,所有三個(gè)互聯(lián)。通過(guò)操縱注冊(cè)表鍵的綜合時(shí)間同步服務(wù)(W32服務(wù))讓他們NTP時(shí)間同步。所有計(jì)算機(jī)都成功同步到了時(shí)間服務(wù)器。
圖10顯示W(wǎng)ireshark軟件的截屏(免費(fèi)的網(wǎng)絡(luò)協(xié)議分析儀),捕捉NTP數(shù)據(jù)包在這些電腦之間的傳送,服務(wù)器的客戶端請(qǐng)求和服務(wù)器答復(fù)溯源。
測(cè)試冗余功能,主機(jī)與網(wǎng)絡(luò)斷開(kāi),從機(jī)在3秒內(nèi)成功地承擔(dān)了主機(jī)的責(zé)任。因?yàn)榭蛻舳嗣?0秒接收NTP數(shù)據(jù)包,他們不覺(jué)得時(shí)間服務(wù)器更改了。
6. 結(jié)論
如今,準(zhǔn)確的時(shí)間對(duì)于以計(jì)算機(jī)為基礎(chǔ)的系統(tǒng)來(lái)說(shuō)必不可少,在這方面,通常用一個(gè)時(shí)間同步系統(tǒng)從一個(gè)時(shí)間參考來(lái)獲取的時(shí)間,同時(shí)通過(guò)時(shí)間同步協(xié)議為需要時(shí)間的系統(tǒng)提供精確的時(shí)間。
考慮到GPS作為一個(gè)參考時(shí)間源的巨大優(yōu)勢(shì),也因?yàn)槠渚哂懈叨鹊臏?zhǔn)確性和對(duì)NTP協(xié)議廣泛的適用性,它常用在時(shí)間同步系統(tǒng)中。
在本文中探討了一個(gè)典型的時(shí)間同步系統(tǒng)的設(shè)計(jì)和實(shí)現(xiàn)方法,時(shí)間服務(wù)器從一個(gè)低成本的GPS接收器上獲取時(shí)間數(shù)據(jù)然后使用NTP協(xié)議給計(jì)算機(jī)網(wǎng)絡(luò)同步時(shí)間。同時(shí)提供更可靠的時(shí)間同步服務(wù),建造了兩個(gè)時(shí)間服務(wù)器主板,設(shè)計(jì)了一個(gè)冗余方案,并且在一個(gè)1oo2冗余結(jié)構(gòu)中實(shí)現(xiàn)了方案。
參考文獻(xiàn)
[1] Liskov, B.,”時(shí)鐘同步在分布式系統(tǒng)中的實(shí)際應(yīng)用”。分布式計(jì)算,6卷,pp.211- 219,1991年4月。
[2] K. Behrendt 和 K. Fodero?!蓖昝赖臅r(shí)間:時(shí)間同步技術(shù)測(cè)試”。第三十三屆年度西部保護(hù)會(huì)議,斯波坎,華盛頓,2006年10月。
[3] Postel,J .時(shí)間協(xié)議。美國(guó)網(wǎng)絡(luò)工作組的報(bào)告RFC-868,南加州大學(xué)信息科學(xué)研究所,1983。
[4] Postel,J .白天協(xié)議。美國(guó)網(wǎng)絡(luò)工作組的報(bào)告RFC-867,南加州大學(xué)信息科學(xué)研究所, 1983年5月。
[5] Mills, D.L網(wǎng)絡(luò)時(shí)間協(xié)議(4版)-協(xié)議和算法規(guī)范。美國(guó)網(wǎng)絡(luò)工作組的報(bào)告RFC-5905,德拉瓦大學(xué), 2010年6月。
[6] Mills, D.L簡(jiǎn)單網(wǎng)絡(luò)時(shí)間協(xié)議(種)4版本為IP v6和IP v4,開(kāi)放系統(tǒng)互連,RFC 4430。德拉瓦大學(xué),2006 年1月。
[7] 關(guān)于網(wǎng)絡(luò)測(cè)量和控制系統(tǒng)的標(biāo)準(zhǔn)時(shí)鐘同步協(xié)議的國(guó)際標(biāo)準(zhǔn),標(biāo)準(zhǔn)1588-2008, 2008年7月。
[8] D . L .Mills,計(jì)算機(jī)網(wǎng)絡(luò)時(shí)間協(xié)議:在地球和空間運(yùn)用的NTP。第二版,出版社,2011。
[9] R . billinton和R. N. Allan,工程系統(tǒng)可靠性評(píng)估。紐約:全會(huì),1992。
[10] 美國(guó)0183標(biāo)準(zhǔn)接口海洋電子設(shè)備,是美國(guó)國(guó)家海洋電子協(xié)會(huì),1983。
[11] virtualbox.org,操作,可用:http://www.virtualbox.org/,9月16日訪問(wèn)。
[12] 微軟支持的注冊(cè)表項(xiàng),W32服務(wù),提供:http://support.microsoft.com/kb/223184,2011年10月6日訪問(wèn)。
[13] 世界上最重要的網(wǎng)絡(luò)協(xié)議分析器,wireshark-go deep,可用:http://www.wireshark.org/,2011年10月6日訪問(wèn)。
1. GPS得到廣泛應(yīng)用,但仍存在不足。GPS已成為全球性的高新技術(shù)產(chǎn)業(yè),成為一種信息基礎(chǔ)設(shè)施,正逐步進(jìn)入人們的日常生活。存在的不足是十分明顯的,它是個(gè)軍方控制的系統(tǒng),不可能在任何時(shí)候任何地點(diǎn)保證民用;在鬧市、密林,或有遮擋和環(huán)境惡劣的情況下,其可用性受到限制;單系統(tǒng)本身就存在著局限性,不可能確保任何應(yīng)用。
2. GLONASS備受關(guān)注,卻令人失望。GLONASS一度給人們以很樂(lè)觀的情景,現(xiàn)實(shí)又如此無(wú)情,經(jīng)濟(jì)和技術(shù)的雙重原因,使它只能殘缺不全地工作,今僅有不足十顆星工作,且很不穩(wěn)定。
3. Galileo先聲奪人,與GPS組合應(yīng)用為總體思路。Galileo計(jì)劃高舉的純民用旗幟,給人一個(gè)放心和安全感。而且它公開(kāi)宣布與GPS兼容互動(dòng),更增強(qiáng)了其吸引力和競(jìng)爭(zhēng)力,以及服務(wù)保證承諾。豐富多彩的服務(wù)可滿足不同檔次和應(yīng)用領(lǐng)域的需求。
4. 多系統(tǒng)組合并非多多益善,應(yīng)用設(shè)備做到適可而止。多年后,可能有多個(gè)衛(wèi)星導(dǎo)航系統(tǒng)在天空運(yùn)行,是不是多多益善,一是沒(méi)有必要,二是應(yīng)用接收機(jī)不能做得太復(fù)雜,不然會(huì)大幅增加成本,無(wú)法大批量推廣,三是接收到的衛(wèi)星數(shù)達(dá)到一定數(shù)目后,衛(wèi)星信號(hào)再多也不會(huì)帶來(lái)明顯好處。一般有雙系統(tǒng)足矣。
5. 增強(qiáng)系統(tǒng)層出不窮,最終出路是多系統(tǒng)的組合。現(xiàn)在各種各樣的衛(wèi)星導(dǎo)航增強(qiáng)系統(tǒng)層出不窮,僅以廣域增強(qiáng)系統(tǒng)而言,就有美國(guó)的WAAS,歐洲的EGNOS,中國(guó)的CWAAS,日本的QZSS(還有一種為MSAS)。一旦有兩個(gè)完整的全球?qū)Ш较到y(tǒng)(GNSS)工作,在軌衛(wèi)星達(dá)50-60個(gè),就沒(méi)有必要去建設(shè)那些廣域增強(qiáng)系統(tǒng)了。更多地是要走既省錢(qián),又辦事的國(guó)際合作之路。
Redundant GPS Time Synchronization Boards
for Computer Networks
Abstract --Nowadays, accurate and reliable time is an essential requirement in computer network based systems. To fulfill this necessity, time synchronization idea has been developed. Meanwhile in some cases, reliable time is so vital, therefore a redundant structure can be used. In this paper, a time synchronization system is investigated by designing and implementing a time synchronization board capable of synchronizing time of computer networks using NTP(Network Time Protocol). A redundant scheme is also embedded in this work to provide more reliability.
Keywords--Computer Network, GPS Time, NTP, Redundancy, Time Synchronization, Time Synchronization Protocols, Time Server.
I. INTRODUCTION
We may usually set our computer’s time by our wristwatch to within a minute or two, but on the other side, accurate and reliable time is necessary for financial and legal transactions, transportation, distribution systems, and many other applications involving widely distributed resources. To make sense, as an example, in a distributed airline reservation system, a seat can be sold twice or not at all if the distributed computers vary in time or there may be legal consequences when an online stock trade is completed, before it is bid [1]. In this regard, coordination to an international time scale and clock synchronization have been developed. The basis for the time scales has been refined throughout the history and sidereal time, earth rotation based time, and atomic time have been developed. Some important time scales include International Atomic Time scale (TAI), Coordinated Universal Time scale (UTC), and Standard Time or civil time.
Clock synchronization deals with the idea that internal clocks of computers may differ even if initially set accurately. After a while due to clock drift, there will be considerable clock errors, so there is always need for keeping these drifty clock synchrone to a time synchronization source as a reference clock.
Time synchronization sources include earth-based radio transmission (WWV, WWVH, WWVB, DCF77 and LORAN-C), satellite-based signal transmission (GOES, GPS, GLONASS, and Galileo), and time-setting messages via communications networks and telephone modem services [2]. Among these sources, Global Positioning System (GPS) offers some special advantages such as great time accuracy, noise immunity, worldwide availability for free, and continuously referenced to an international standard. Nowadays GPS based clocks are used very often as the time synchronization sources over the other clock recourses.
Fig. 1 shows a typical time synchronization structure, where a time server receives time data form GPS as a time synchronization sources. The time server then provides the time needing devices with accurate time by sending them a massage in form of a synchronization protocol. The devices synchronize their internal clocks using the received massage.
The various synchronization protocols in use today provide different means to time synchronization, but they all follow two general models. Whether the client sends a request to the server and the server responds with its current time, or the server sends messages to a group or all of the clients. Some important standard computer network time synchronization protocols are as follows:
Time Protocol: Time protocol specified in RFC868 [3], returns a 32-bit unformatted binary number that represents the time in UTC seconds since January 1st, 1900. The server listens to time requests on port 37, and responds in either TCP/IP or UDP/IP formats.
Daytime Protocol: Daytime Protocol specified in RFC867 [4], sends time using ASCII characters. The server listens on port 13, and responds to requests in either TCP/IP or UDP/IP formats.
Network Time Protocol (NTP): NTP specified in RFC-5905 [5], is the oldest (and still in use) and most sophisticated time protocols for synchronizing computer clocks across a network. The NTP servers listen for a NTP request on port 123, and respond by sending a UDP/IP data packet in the NTP format.
Simple Network Time Protocol (SNTP): SNTP is a less complex implementation version of NTP protocol [6]. SNTP can be used when the ultimate performance of the full NTP implementation is not needed.
Precision Time Protocol (PTP): PTP formalized by IEEE 1588-2008 [7], is a protocol designed to increase timing accuracy over traditional Ethernet based protocols like NTP but it is more expensive in implementation.
For being open source, having sufficient accuracy for typical applications and the ability to work on large networks, NTP is the one widely in use on the public Internet and numerous private networks for over almost three decades.
The reliability requirements for time synchronization may be so strict that a single time server cannot always be trusted. Therefore, more time servers can be used in a redundant structure.
In this paper, we will investigate time synchronization system by design and implementation of a time synchronization board which gets time data from a low-cost GPS receiver and then synchronize time of computer networks using NTP protocol. In this design, redundancy is also embedded in a way that two time synchronization boards can be used together to provide more reliability.
The remainder of this document is organized as follows. Section II presents a brief explanation of NTP protocol and time synchronization using it. Redundancy gets more interpreted in section III. A structural scheme for building a network time synchronizer board, hardware design and software algorithms are proposed in section IV. Finally the implemented board and the results are presented in sections V.
II. WHAT IS NTP?
NTP has three major parts: the NTP software program, called a Daemon in UNIX and a Service in Windows; a protocol that exchanges time values between servers and clients; and a suite of algorithms that processes the time values to advance or retard the system clock [8]. Because NTP software is often bundled with the operating systems (such as most flavors of Windows and UNIX) it is the most common used protocol for computer network time synchronizations. For instant, we are not going to cover all the three parts but we are intending to describe the Protocol which is in need for designing a NTP time server. Further details can be found in the formal specification in [5].
The NTP is built on the Internet Protocol (IP) and User Datagram Protocol (UDP) in an IEEE 802.3 Ethernet frame demonstrated in Table 1. The NTP packet header, shown in Table 2, has 12 words followed by optional extension fields and an optional Message Authentication Code (MAC).
NTP working modes include client/server and broadcast mode. In client/server mode, the client sends a request to the server and the server responds with its current time. In broadcast mode however, time server periodically sends NTP packets to the clients and they use the packet to adjust their time.
The most important field in the NTP packet is the timestamp field. An NTP timestamp is a 64-bit unsigned fixed-point number, with the integer part in the first 32 bits showing the past seconds from 0h 1 January 1900 and the fraction part in the last 32 bits. The precision of this representation is about 2-32 second (233 picoseconds).
Accuracy of NTP synchronization depends on the network environment. Today in most places of the Internet, NTP provides time accurate to the order of 10-100 mSec while under good conditions on a LAN without too many routers synchronization to within a few milliseconds is normal [8].
III. WHAT IS REDUNDANCY?
Redundancy is a technique usually used in order to increase the reliability of a system. It comes in many forms and types. The most general form of redundancy is the Mout-of-N (MooN) redundancy, where at least M of N components must be functional in order the system functions. Some examples of this mode are shown in Fig. 2. Applications of M-out-of-N redundancy can be found in various applied areas, for example, in safety systems, N-version programming, etc [9].
Meanwhile, respecting the switch over time, redundancy can be classified as Parallel and Standby redundancy [10]. In parallel mode, redundant components are continuously operating and in standby mode they are only switched into an operating mode when a normally operating operation component fails. The essential difference between these two modes is illustrated in Fig. 3.
Whenever time synchronization in a system needs to be done with more reliability, redundancy technique can be used. Fig. 4 shows a 1oo3 redundancy structure in a time synchronization system. According to this figure, three time servers are getting time from time synchronization source (GPS) themselves and then act as time servers to feed a much larger group of clients connected with a common network with an accurate and reliable time.
It worth mentioning that diverse redundancy can also increase time synchronization reliability. This is done by getting time from more than one type of time references. For example a time server gets time from GPS satellites and the other one gets it from DCF77 radio time source.
IV. TIME SYNCHRONIZATION BOARD DESIGN
A. Hardware design
Here we present a scheme of a time server board which gets timing data from GPS and provides accurate time for the clients via NTP protocol. Fig. 5 presents the internal structure of the proposed time server board. It consists of five main parts; low-cost GPS receiver, Ethernet interface, Microcontroller, user interface and power supply.
In this structure the Microcontroller plays an important role in the proposed time server. It should be programmed properly to communicate with the other parts and make them work together as a time server. GPS receiver connects to the microcontroller via a serial interface. It provides microcontroller with timing data in form of NMEA protocol [11] and a 1PPS (one Pulse Per Second) signal which is synchronized to UTC. The Ethernet controller interface establishes a connection to the computer network and transmit/receive packets to/from it. The user interface consists of a LCD display and a touchscreen. It gets the needed configuration data from user and displays time synchronization results.
B. Software design
The designed algorithm for microcontroller in the time server consists of three sub algorithms, shown in Fig. 7; main loop, GPS 1PPS Interrupt Service Routine (ISR), and GPS serial interface ISR.
The main loop first initializes Ethernet controller, GPS receiver, and the user interface, then it enters an endless loop, waiting for interrupts from GPS time pulse and serial interface.
The 1PPS ISR is set to be called at the rising edge of time pulse. This ISR has the highest priority and lets the microcontroller knows the happening of UTC seconds with tens of nanosecond accuracy. In this routine a counter is set to send NTP packets every 10 seconds. The NTP working mode is Broadcast mode, so all of the clients connected to the network can receive the packets.
The GPS serial interface ISR runs every time a serial data is received from GPS reviver. If received data be a time data, it is decoded and stored in “Time” variable. As the NTP packet will be sent at the next 1PPS, its timestamps should point to 1 second in advance.
Redundancy is also embedded in the algorithm. As Fig. 6 illustrates, for this purpose one board is parameterized as “Priority Master” and the other as “Priority Slave”. The Master transmits the time message to the Ethernet. In addition, the Master transmits an “Alive message” to the address of the other board. The Slave monitors the reception of the “Alive message” and if it is not received for more than 3 seconds, the Slave assumes the duty of the Master and transmits both the time message and the “Alive message” to the Ethernet.
V. RESULTS
A. Hardware Implementation
For implementing the Network Time Display in practice, NEO-5Q GPS receiver, ATmeaga128 Microcontroller, ENC28j60 Ethernet Controller, RJ-45 Ethernet Socket, 128*64 graphical LCD with touch-screen, and a power supply (build around Voltage Regulators) were selected. Fig. 8 shows a prototype board built according to the structure in Fig. 5.
B. Software Implementation
In order to implement the software for time server, “CodeVisionAVR” was used. Some C++ codes were written according to the mentioned algorithm in Fig. 7 to build the whole program. This program is then compiled and transferred to the Microcontroller. Fig . 9 shows some of the designed menus for showing the synchronization results and configuring the board by user.
C. Synchronization Results
In order to test the boards, they were connected via a HUB to a computer with “Sun Virtual Box” [12] virtual machine software installed in it. Then one of them was set as priority master and the other as priority slave. Next, two virtual machines were made in Sun Virtual Box, Windows XP was installed in each and all three were networked together. By manipulating registry keys [13] of the integrated windows time synchronization service (w32time service) they we made to be synchronized from the NTP time. All computers successfully synchronized to the time server.
Fig. 10 shows screenshot of Wireshark software (a free network protocol analyzer [14]) capturing the NTP packets transmitted between three computers and the time server in which client requests and time server replies are traceable.
To test the redundancy feature, Priority Master Board was disconnected from the network, Priority Slave board successfully assumed the duty of the Master board within 3 seconds. Because the clients receive NTP packets every 10 seconds, they did not felt the time server change.
VI. CONCLUSION
Now
收藏