版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
中英文對(duì)照外文翻譯文獻(xiàn)(文檔含英文原文和中文翻譯)計(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,DCF77andLORAN-C)、衛(wèi)星時(shí)間同步技術(shù)(GOES,GPS,GLONASS,andGalileo)、互聯(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)在IEEE1588-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)建立的,在IEEE802.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ù)器從DCF77廣播時(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所示:主回路、GPS1PPS中斷服務(wù)程序(ISR),和GPS串行接口(ISR)。主回路首先初始化以太網(wǎng)控制器、GPS接收器、和用戶接口,然后進(jìn)入一個(gè)死循環(huán),等待GPS時(shí)間脈沖和串行接口的中斷。這1PPSISR被設(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-5QGPS接收器,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與安裝了“SunVirtualBox”虛擬機(jī)軟件的計(jì)算機(jī)相連接。其中一個(gè)是作為主機(jī),另一個(gè)作為從機(jī)。下一步,建立兩個(gè)虛擬機(jī),并且都裝有WindowsXP,所有三個(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版本為IPv6和IPv4,開(kāi)放系統(tǒng)互連,RFC4430。德拉瓦大學(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],操作,可用:/,9月16日訪問(wèn)。[12]微軟支持的注冊(cè)表項(xiàng),W32服務(wù),提供:/kb/223184,2011年10月6日訪問(wèn)。[13]世界上最重要的網(wǎng)絡(luò)協(xié)議分析器,wireshark-godeep,可用:/,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)的組合?,F(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ó)際合作之路。RedundantGPSTimeSynchronizationBoardsforComputerNetworksAbstract--Nowadays,accurateandreliabletimeisanessentialrequirementincomputernetworkbasedsystems.Tofulfillthisnecessity,timesynchronizationideahasbeendeveloped.Meanwhileinsomecases,reliabletimeissovital,thereforearedundantstructurecanbeused.Inthispaper,atimesynchronizationsystemisinvestigatedbydesigningandimplementingatimesynchronizationboardcapableofsynchronizingtimeofcomputernetworksusingNTP(NetworkTimeProtocol).Aredundantschemeisalsoembeddedinthisworktoprovidemorereliability.Keywords--ComputerNetwork,GPSTime,NTP,Redundancy,TimeSynchronization,TimeSynchronizationProtocols,TimeServer.I.INTRODUCTIONWemayusuallysetourcomputer’stimebyourwristwatchtowithinaminuteortwo,butontheotherside,accurateandreliabletimeisnecessaryforfinancialandlegaltransactions,transportation,distributionsystems,andmanyotherapplicationsinvolvingwidelydistributedresources.Tomakesense,asanexample,inadistributedairlinereservationsystem,aseatcanbesoldtwiceornotatallifthedistributedcomputersvaryintimeortheremaybelegalconsequenceswhenanonlinestocktradeiscompleted,beforeitisbid[1].Inthisregard,coordinationtoaninternationaltimescaleandclocksynchronizationhavebeendeveloped.Thebasisforthetimescaleshasbeenrefinedthroughoutthehistoryandsiderealtime,earthrotationbasedtime,andatomictimehavebeendeveloped.SomeimportanttimescalesincludeInternationalAtomicTimescale(TAI),CoordinatedUniversalTimescale(UTC),andStandardTimeorciviltime.Clocksynchronizationdealswiththeideathatinternalclocksofcomputersmaydifferevenifinitiallysetaccurately.Afterawhileduetoclockdrift,therewillbeconsiderableclockerrors,sothereisalwaysneedforkeepingthesedriftyclocksynchronetoatimesynchronizationsourceasareferenceclock.Timesynchronizationsourcesincludeearth-basedradiotransmission(WWV,WWVH,WWVB,DCF77andLORAN-C),satellite-basedsignaltransmission(GOES,GPS,GLONASS,andGalileo),andtime-settingmessagesviacommunicationsnetworksandtelephonemodemservices[2].Amongthesesources,GlobalPositioningSystem(GPS)offerssomespecialadvantagessuchasgreattimeaccuracy,noiseimmunity,worldwideavailabilityforfree,andcontinuouslyreferencedtoaninternationalstandard.NowadaysGPSbasedclocksareusedveryoftenasthetimesynchronizationsourcesovertheotherclockrecourses.Fig.1showsatypicaltimesynchronizationstructure,whereatimeserverreceivestimedataformGPSasatimesynchronizationsources.Thetimeserverthenprovidesthetimeneedingdeviceswithaccuratetimebysendingthemamassageinformofasynchronizationprotocol.Thedevicessynchronizetheirinternalclocksusingthereceivedmassage.Thevarioussynchronizationprotocolsinusetodayprovidedifferentmeanstotimesynchronization,buttheyallfollowtwogeneralmodels.Whethertheclientsendsarequesttotheserverandtheserverrespondswithitscurrenttime,ortheserversendsmessagestoagrouporalloftheclients.Someimportantstandardcomputernetworktimesynchronizationprotocolsareasfollows:TimeProtocol:TimeprotocolspecifiedinRFC868[3],returnsa32-bitunformattedbinarynumberthatrepresentsthetimeinUTCsecondssinceJanuary1st,1900.Theserverlistenstotimerequestsonport37,andrespondsineitherTCP/IPorUDP/IPformats.DaytimeProtocol:DaytimeProtocolspecifiedinRFC867[4],sendstimeusingASCIIcharacters.Theserverlistensonport13,andrespondstorequestsineitherTCP/IPorUDP/IPformats.NetworkTimeProtocol(NTP):NTPspecifiedinRFC-5905[5],istheoldest(andstillinuse)andmostsophisticatedtimeprotocolsforsynchronizingcomputerclocksacrossanetwork.TheNTPserverslistenforaNTPrequestonport123,andrespondbysendingaUDP/IPdatapacketintheNTPformat.SimpleNetworkTimeProtocol(SNTP):SNTPisalesscompleximplementationversionofNTPprotocol[6].SNTPcanbeusedwhentheultimateperformanceofthefullNTPimplementationisnotneeded.PrecisionTimeProtocol(PTP):PTPformalizedbyIEEE1588-2008[7],isaprotocoldesignedtoincreasetimingaccuracyovertraditionalEthernetbasedprotocolslikeNTPbutitismoreexpensiveinimplementation.Forbeingopensource,havingsufficientaccuracyfortypicalapplicationsandtheabilitytoworkonlargenetworks,NTPistheonewidelyinuseonthepublicInternetandnumerousprivatenetworksforoveralmostthreedecades.Thereliabilityrequirementsfortimesynchronizationmaybesostrictthatasingletimeservercannotalwaysbetrusted.Therefore,moretimeserverscanbeusedinaredundantstructure.Inthispaper,wewillinvestigatetimesynchronizationsystembydesignandimplementationofatimesynchronizationboardwhichgetstimedatafromalow-costGPSreceiverandthensynchronizetimeofcomputernetworksusingNTPprotocol.Inthisdesign,redundancyisalsoembeddedinawaythattwotimesynchronizationboardscanbeusedtogethertoprovidemorereliability.Theremainderofthisdocumentisorganizedasfollows.SectionIIpresentsabriefexplanationofNTPprotocolandtimesynchronizationusingit.RedundancygetsmoreinterpretedinsectionIII.Astructuralschemeforbuildinganetworktimesynchronizerboard,hardwaredesignandsoftwarealgorithmsareproposedinsectionIV.FinallytheimplementedboardandtheresultsarepresentedinsectionsV.II.WHATISNTP?NTPhasthreemajorparts:theNTPsoftwareprogram,calledaDaemoninUNIXandaServiceinWindows;aprotocolthatexchangestimevaluesbetweenserversandclients;andasuiteofalgorithmsthatprocessesthetimevaluestoadvanceorretardthesystemclock[8].BecauseNTPsoftwareisoftenbundledwiththeoperatingsystems(suchasmostflavorsofWindowsandUNIX)itisthemostcommonusedprotocolforcomputernetworktimesynchronizations.Forinstant,wearenotgoingtocoverallthethreepartsbutweareintendingtodescribetheProtocolwhichisinneedfordesigningaNTPtimeserver.Furtherdetailscanbefoundintheformalspecificationin[5].TheNTPisbuiltontheInternetProtocol(IP)andUserDatagramProtocol(UDP)inanIEEE802.3EthernetframedemonstratedinTable1.TheNTPpacketheader,showninTable2,has12wordsfollowedbyoptionalextensionfieldsandanoptionalMessageAuthenticationCode(MAC).NTPworkingmodesincludeclient/serverandbroadcastmode.Inclient/servermode,theclientsendsarequesttotheserverandtheserverrespondswithitscurrenttime.Inbroadcastmodehowever,timeserverperiodicallysendsNTPpacketstotheclientsandtheyusethepackettoadjusttheirtime.ThemostimportantfieldintheNTPpacketisthetimestampfield.AnNTPtimestampisa64-bitunsignedfixed-pointnumber,withtheintegerpartinthefirst32bitsshowingthepastsecondsfrom0h1January1900andthefractionpartinthelast32bits.Theprecisionofthisrepresentationisabout2-32second(233picoseconds).AccuracyofNTPsynchronizationdependsonthenetworkenvironment.TodayinmostplacesoftheInternet,NTPprovidestimeaccuratetotheorderof10-100mSecwhileundergoodconditionsonaLANwithouttoomanyrouterssynchronizationtowithinafewmillisecondsisnormal[8].III.WHATISREDUNDANCY?Redundancyisatechniqueusuallyusedinordertoincreasethereliabilityofasystem.Itcomesinmanyformsandtypes.ThemostgeneralformofredundancyistheMout-of-N(MooN)redundancy,whereatleastMofNcomponentsmustbefunctionalinorderthesystemfunctions.SomeexamplesofthismodeareshowninFig.2.ApplicationsofM-out-of-Nredundancycanbefoundinvariousappliedareas,forexample,insafetysystems,N-versionprogramming,etc[9].Meanwhile,respectingtheswitchovertime,redundancycanbeclassifiedasParallelandStandbyredundancy[10].Inparallelmode,redundantcomponentsarecontinuouslyoperatingandinstandbymodetheyareonlyswitchedintoanoperatingmodewhenanormallyoperatingoperationcomponentfails.TheessentialdifferencebetweenthesetwomodesisillustratedinFig.3.Whenevertimesynchronizationinasystemneedstobedonewithmorereliability,redundancytechniquecanbeused.Fig.4showsa1oo3redundancystructureinatimesynchronizationsystem.Accordingtothisfigure,threetimeserversaregettingtimefromtimesynchronizationsource(GPS)themselvesandthenactastimeserverstofeedamuchlargergroupofclientsconnectedwithacommonnetworkwithanaccurateandreliabletime.Itworthmentioningthatdiverseredundancycanalsoincreasetimesynchronizationreliability.Thisisdonebygettingtimefrommorethanonetypeoftimereferences.ForexampleatimeservergetstimefromGPSsatellitesandtheotheronegetsitfromDCF77radiotimesource.IV.TIMESYNCHRONIZATIONBOARDDESIGNA.HardwaredesignHerewepresentaschemeofatimeserverboardwhichgetstimingdatafromGPSandprovidesaccuratetimefortheclientsviaNTPprotocol.Fig.5presentstheinternalstructureoftheproposedtimeserverboard.Itconsistsoffivemainparts;low-costGPSreceiver,Ethernetinterface,Microcontroller,userinterfaceandpowersupply.InthisstructuretheMicrocontrollerplaysanimportantroleintheproposedtimeserver.Itshouldbeprogrammedproperlytocommunicatewiththeotherpartsandmakethemworktogetherasatimeserver.GPSreceiverconnectstothemicrocontrollerviaaserialinterface.ItprovidesmicrocontrollerwithtimingdatainformofNMEAprotocol[11]anda1PPS(onePulsePerSecond)signalwhichissynchronizedtoUTC.TheEthernetcontrollerinterfaceestablishesaconnectiontothecomputernetworkandtransmit/receivepacketsto/fromit.TheuserinterfaceconsistsofaLCDdisplayandatouchscreen.Itgetstheneededconfigurationdatafromuseranddisplaystimesynchronizationresults.B.SoftwaredesignThedesignedalgorithmformicrocontrollerinthetimeserverconsistsofthreesubalgorithms,showninFig.7;mainloop,GPS1PPSInterruptServiceRoutine(ISR),andGPSserialinterfaceISR.ThemainloopfirstinitializesEthernetcontroller,GPSreceiver,andtheuserinterface,thenitentersanendlessloop,waitingforinterruptsfromGPStimepulseandserialinterface.The1PPSISRissettobecalledattherisingedgeoftimepulse.ThisISRhasthehighestpriorityandletsthemicrocontrollerknowsthehappeningofUTCsecondswithtensofnanosecondaccuracy.InthisroutineacounterissettosendNTPpacketsevery10seconds.TheNTPworkingmodeisBroadcastmode,soalloftheclientsconnectedtothenetworkcanreceivethepackets.TheGPSserialinterfaceISRrunseverytimeaserialdataisreceivedfromGPSreviver.Ifreceiveddatabeatimedata,itisdecodedandstoredin“Time”variable.AstheNTPpacketwillbesentatthenext1PPS,itstimestampsshouldpointto1secondinadvance.Redundancyisalsoembeddedinthealgorithm.AsFig.6illustrates,forthispurposeoneboardisparameterizedas“PriorityMaster”andtheotheras“PrioritySlave”.TheMastertransmitsthetimemessagetotheEthernet.Inaddition,theMastertransmitsan“Alivemessage”totheaddressoftheotherboard.TheSlavemonitorsthereceptionofthe“Alivemessage”andifitisnotreceivedformorethan3seconds,theSlaveassumesthedutyoftheMasterandtransmitsboththetimemessageandthe“Alivemessage”totheEthernet.V.RESULTSA.HardwareImplementationForimplementingtheNetworkTimeDisplayinpractice,NEO-5QGPSreceiver,ATmeaga128Microcontroller,ENC28j60EthernetController,RJ-45EthernetSocket,128*64graphicalLCDwithtouch-screen,andapowersupply(buildaroundVoltageRegulators)wereselected.Fig.8showsaprototypeboardbuiltaccordingtothestructureinFig.5.B.SoftwareImplementationInordertoimplementthesoftwarefortimeserver,“CodeVisionAVR”wasused.SomeC++codeswerewrittenaccordingtothementionedalgorithminFig.7tobuildthewholeprogram.ThisprogramisthencompiledandtransferredtotheMicrocontroller.Fig.9showssomeofthedesignedmenusforshowingthesynchronizationresultsandconfiguringtheboardbyuser.C.SynchronizationResultsInordertotesttheboards,theywereconnectedviaaHUBtoacomputerwith“SunVirtualBox”[12]virtualmachinesoftwareinstalledinit.Thenoneofthemwassetasprioritymasterandtheotheraspriorityslave.Next,twovirtualmachinesweremadeinSunVirtualBox,WindowsXPwasinstalledineachandallthreewerenetworkedtogether.Bymanipulatingregistrykeys[13]oftheintegratedwindowstimesynchronizationservice(w32timeservice)theywemadetobesynchronizedfromtheNTPtime.Allcomputerssuccessfullysynchronizedtothetimeserver.Fig.10showsscreenshotofWiresharksoftware(afreenetworkprotocolanalyzer[14])capturingtheNTPpacketstransmittedbetweenthreecomputersandthetimeserverinwhichclientrequestsandtimeserverrepliesaretraceable.Totesttheredundancyfeature,PriorityMasterBoardwasdisconnectedfromthenetwork,PrioritySlaveboardsuccessfullyassumedthedutyoftheMasterboardwithin3seconds.BecausetheclientsreceiveNTPpacketsevery10seconds,theydidnotfeltthetimeserverchange.VI.CONCLUSIONNowadaysaccuratetimeisanessentialneedincomputerbasedsystems.Inthisregard,usuallyatimesynchronizationsystemisusedtogettimefromatimereferenceandthenprovidethetimeneedingsystemswithprecisetimeviaatimesynchronizationprotocol.RegardingthesignificantGPSadvantagesasareferencetimesourceandalsobecauseofgreataccuracyandworldwidepopularityofNTPprotocoltheyarecommonlyusedintimesynchronizationsystems.Inthispaperatypicaltimesynchronizationsystemwasinvestigatedbydesignandimplementationofatimeserverboardwhichgetstimedatafromalow-costGPSreceiverandthensynchronizestimeofcomputernetworksusingNTP.Meanwhiletoprovidemorereliabilityintimesynchronizationservice,twotimeserverboardswerebuiltandaredundantschemewasdevisedandimplementedtousethemina1oo2redundantstructure.REFERENCES[1]Liskov,B.,”P(pán)racticalusesofsynchronizedclocksindistributedsystems,”inproc.OfDistributedComputing,Vol.6,pp.211-219,Apr.1991.[2]K.BehrendtandK.Fodero.“Theperfecttime:Anexaminationoftimesynchronizationtechniques”.Proceedingsofthe33rdAnnualWesternProtectiveRelayConference,Spokane,WA,October2006.[3]Postel,J.Timeprotocol.DARPANetworkWorkingGroupReportRFC-868,USCInformationSciencesInstitute,May1983.[4]Postel,J.Daytimeprotocol.DARPANetworkWorkingGroupReportRFC-867,USCInformationSciencesInstitute,May.1983.[5]Mills,D.L.NetworkTimeProtocol(Version4)-ProtocolandAlgorithmsSpecification.DARPANetworkWorkingGroupReportRFC-5905,UniversityofDelaware,June2010.[6]Mills,D.L.SimpleNetworkTimeProtocol(SNTP)Version4forIPv4,IPv6andOSI,RFC4430.UniversityofDelaware,Jan.2006.[7]IEEEStandardforaPrecisionClockSynchronizationProtocolforNetworkedMeasurementandControlSystems,IEEEStandard1588-2008,July.2008.[8]D.L.Mills,ComputerNetworkTimeSynchronization:theNetworkTimeProtocolonEarthandinSpace.SecondEdition,CRCPress,2011.[9]R.BillintonandR.N.Allan,ReliabilityEvaluationofEngineeringSystems.NewYork:Plenum,1992.[10]NMEA0183standardforinterfacingmarineelectronicsdevices,NationalMarineElectronicsAssociation,1983.[11],VirtualBox,Available:/,accessedonSept.16.[12]MicrosoftSupport,RegistryentriesfortheW32Timeservice,Available:/kb/223184,accessedonOct.6,2011.[13]Theworld’sforemostnetworkprotocolanalyzer,Wireshark-Godeep,Available:/,accessedonOct.6,2011.1.GPSobtainsthewide-spreadapplication,butitstillha
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 房產(chǎn)融資合同范本
- 農(nóng)資購(gòu)買(mǎi)合同范本
- 陽(yáng)臺(tái)微改合同范本
- 合同補(bǔ)充運(yùn)費(fèi)協(xié)議
- 戶外營(yíng)銷合同范本
- 技術(shù)調(diào)試合同范本
- 收定金寫(xiě)協(xié)議合同
- 農(nóng)村除草合同范本
- 鉤機(jī)雇用合同范本
- 足球課安全協(xié)議書(shū)
- 2023年西安市政道橋建設(shè)集團(tuán)有限公司招聘筆試題庫(kù)及答案解析
- GB/T 28734-2012固體生物質(zhì)燃料中碳?xì)錅y(cè)定方法
- GB/T 23280-2009開(kāi)式壓力機(jī)精度
- 智慧樹(shù)創(chuàng)意學(xué)經(jīng)濟(jì)測(cè)試題答案
- 《我的心兒怦怦跳》優(yōu)秀課件
- 包裝印刷包裝設(shè)計(jì)及及規(guī)范
- 金壇區(qū)蘇教版六年級(jí)上冊(cè)數(shù)學(xué)第6單元《百分?jǐn)?shù)》教材分析(定稿)
- 畢業(yè)論文-基于單片機(jī)的太陽(yáng)能充電寶設(shè)計(jì)
- 申請(qǐng)簽證證件的證明(擔(dān)保)函件
- (研究生)高級(jí)管理會(huì)計(jì)理論與實(shí)務(wù)ppt教學(xué)課件(完整版)
- 《西游記》中女妖形象探析新譚素梅
評(píng)論
0/150
提交評(píng)論