向韻麟
關(guān)鍵詞: 數(shù)據(jù)處理; 系統(tǒng)設(shè)計(jì); 虛擬儀器; 數(shù)據(jù)采集; 跨平臺(tái); 運(yùn)行效率
中圖分類號(hào): TN919?34; TP274 ? ? ? ? ? ? ? ? ?文獻(xiàn)標(biāo)識(shí)碼: A ? ? ? ? ? ? ? ? ? 文章編號(hào): 1004?373X(2019)02?0005?04
Design and implementation of data processing system based on virtual instrument
XIANG Yunlin
(Wuhan University, Wuhan 430072, China)
Abstract: The traditional data processing system mainly takes the data of SCADA as the core, and uses the cross?platform as the data architecture to design the processing system. As a result, the data processing of the system without shared memory is inaccurate and inefficient. Therefore, a data processing system based on the virtual instrument is proposed and designed. The system is mainly divided into two parts of hardware and software. The hardware is mainly composed of the virtual instrument, digital I/O card, circular data acquisition card and data dispatching module. In the software part, the software implementation process of the data processing system is given. The experimental analysis was carried out. The experimental results show that in comparison with the traditional system, the improved design system for data processing has superior operation efficiency and higher accuracy of data processing results, which has a certain advantages.
Keywords: data processing; system design; virtual instrument; data acquisition; cross?platform; operation efficiency
20世紀(jì)80年代,世界上第一臺(tái)虛擬儀器問世,美國(guó)國(guó)家儀器公司NI第一次給出虛擬儀器的定義:虛擬儀器是一種可以實(shí)現(xiàn)用戶與計(jì)算機(jī)互動(dòng)的計(jì)算機(jī)儀器系統(tǒng)。其原理是以計(jì)算機(jī)作為系統(tǒng)控制器,通過軟件達(dá)到人機(jī)互動(dòng)目的,并且通過軟件還能實(shí)現(xiàn)儀器大部分的功能。虛擬儀器可以讓用戶按照自己的想法在虛擬面板上進(jìn)行設(shè)計(jì),通過測(cè)試軟件達(dá)到用戶所設(shè)計(jì)產(chǎn)物所具有的功能。虛擬儀器的功能包含了信號(hào)源、示波器、總線分析儀和諧波分析器等傳統(tǒng)測(cè)量?jī)x器所具有的功能[1]。隨著電子技術(shù)和計(jì)算機(jī)技術(shù)的高速發(fā)展,誕生出一批打破了傳統(tǒng)儀器概念的新數(shù)據(jù)處理方法、理論和儀器,新的儀器技術(shù)從本質(zhì)上就與傳統(tǒng)的儀器不同。為了滿足不同用戶所具有的獨(dú)特需求,研究人員借助計(jì)算機(jī)來(lái)構(gòu)建數(shù)據(jù)處理系統(tǒng),由此產(chǎn)生了虛擬儀器[2]。
傳統(tǒng)的數(shù)據(jù)處理至少需要兩種儀器:一種是磁帶記錄儀,用來(lái)記錄電路信號(hào);另一種是頻譜分析儀,用來(lái)對(duì)電路信號(hào)進(jìn)行分析。傳統(tǒng)的數(shù)據(jù)處理系統(tǒng)不僅存儲(chǔ)不方便,更改不方便,分析也不方便。因而,設(shè)計(jì)具有高準(zhǔn)確度、操作便利,能夠轉(zhuǎn)移、強(qiáng)大分析和處理功能的數(shù)據(jù)處理系統(tǒng)是至關(guān)重要的。
在對(duì)數(shù)據(jù)處理系統(tǒng)設(shè)計(jì)過程中,其主要由數(shù)據(jù)采集卡、數(shù)字I/O卡、傳感器、信號(hào)發(fā)生器、繼電器、計(jì)算機(jī)等組成,數(shù)據(jù)采集系統(tǒng)工作原理圖如圖1所示。
由圖1可以看出,用戶將其自定義的信息通過計(jì)算機(jī)及外部設(shè)備輸入到系統(tǒng)內(nèi),由于輸入的信號(hào)并不能被采集卡直接使用,因此需要信號(hào)調(diào)理部分將輸入的電路信號(hào)轉(zhuǎn)化為采集卡能夠使用的信號(hào)。信號(hào)調(diào)理部分包含多個(gè)模塊,具體有電壓和電流的傳感器和電路放大器[3]。數(shù)據(jù)處理系統(tǒng)能夠自動(dòng)檢測(cè)被測(cè)設(shè)備的各種指標(biāo),其原理是采用數(shù)字I/O卡模塊,它能夠控制繼電器的陣列,對(duì)輸入不同的電力信號(hào)進(jìn)行自動(dòng)的切換,以此來(lái)實(shí)現(xiàn)數(shù)據(jù)處理系統(tǒng)的自動(dòng)測(cè)試功能。信號(hào)發(fā)生器作為信號(hào)源,經(jīng)功率放大后提供給接收設(shè)備[4]。
2.1 ?虛擬儀器的系統(tǒng)構(gòu)成
市面上的虛擬儀器有的是由一種系統(tǒng)構(gòu)成,還有的是由多種系統(tǒng)組合構(gòu)成。目前市面上常用的虛擬儀器有數(shù)據(jù)采集系統(tǒng)[5]、GPIB儀器系統(tǒng)、VXI儀器系統(tǒng)以及將這三種系統(tǒng)組合的虛擬儀器。虛擬儀器的具體結(jié)構(gòu)見圖2。
2.2 ?數(shù)字I/O卡
數(shù)據(jù)處理系統(tǒng)的數(shù)字I/O卡模塊采用NI PCI?6503型號(hào)的設(shè)備。選用NI PCI?6503型號(hào)的主要原因是它的外圍接口達(dá)到24位,且每個(gè)外圍接口都可以實(shí)現(xiàn)程序編輯,也就是說該型號(hào)的設(shè)備擁有24路數(shù)字I/O通道可以使用。除此之外,NI PCI?6503型號(hào)設(shè)備還具有即插即用的優(yōu)點(diǎn),不需要獨(dú)立的板卡管理器就可以工作。如圖3所示,PCI?6503型號(hào)設(shè)備是由輸入通道接口電路、輸入端子、82C55數(shù)字接口芯片、輸出端子、輸出通道接口電路組成[6]。
2.3 ?循環(huán)數(shù)據(jù)采集卡
傳統(tǒng)數(shù)據(jù)處理系統(tǒng)采用單面采集卡進(jìn)行數(shù)據(jù)采集,然而,有些數(shù)據(jù)的流量過大,并且對(duì)其采集所需要的時(shí)間較長(zhǎng),單面采集卡進(jìn)行數(shù)據(jù)采集時(shí)運(yùn)行所需要的RAM過大,幾乎不能實(shí)現(xiàn)[7?8]。因此本文設(shè)計(jì)的數(shù)據(jù)處理系統(tǒng),在考慮了計(jì)算機(jī)帶寬約束條件后,采用雙RAM進(jìn)行數(shù)據(jù)采集,其具有價(jià)格低廉和速度快的優(yōu)點(diǎn)。數(shù)據(jù)采集卡的具體結(jié)構(gòu)見圖4。
通過計(jì)算機(jī)對(duì)控制邏輯復(fù)位,此時(shí)RAM1處于只寫的狀態(tài),而RAM2處于可讀、可寫、可查找三狀態(tài),地址計(jì)數(shù)器還原為0,此時(shí)將觸動(dòng)A/D轉(zhuǎn)換。將轉(zhuǎn)換完成的數(shù)據(jù)存入RAM1中,然后觸動(dòng)下一次A/D轉(zhuǎn)換,直到將RAM1存滿。RAM1存滿后,由控制邏輯將RAM1的只寫狀態(tài)更改為只讀狀態(tài),RAM2更換為只寫狀態(tài),將A/D轉(zhuǎn)換完成的數(shù)據(jù)存入RAM2[9]。在RAM1從只寫狀態(tài)轉(zhuǎn)換到只讀狀態(tài)的同時(shí),地址計(jì)數(shù)器還原為0,發(fā)出的脈沖將觸動(dòng)計(jì)算機(jī)進(jìn)行取數(shù),由于ISA總線在發(fā)出讀周期時(shí)RAM1會(huì)向總線發(fā)送數(shù)據(jù)[10],因此對(duì)計(jì)算機(jī)讀一個(gè)數(shù)據(jù)并將其存儲(chǔ)僅硬盤的速度有很高的要求,該速度必須高于A/D轉(zhuǎn)換一次所用的時(shí)間,這樣才不會(huì)發(fā)生掉數(shù)的現(xiàn)象。
2.4 ?數(shù)據(jù)調(diào)度模塊
由計(jì)算框架自帶的調(diào)度器對(duì)分配到的空閑資源進(jìn)行更加細(xì)粒度的分配和調(diào)度。整個(gè)資源調(diào)度器的架構(gòu)設(shè)計(jì)如圖5所示。
規(guī)則庫(kù)是資源調(diào)度器的調(diào)度依據(jù),包括元數(shù)據(jù)庫(kù)、靜態(tài)特征庫(kù)和動(dòng)態(tài)特征庫(kù)[11]。元數(shù)據(jù)庫(kù)常駐內(nèi)存,記錄了整個(gè)處理系統(tǒng)的數(shù)據(jù)名稱、數(shù)據(jù)類型、數(shù)據(jù)范圍等基本數(shù)據(jù)結(jié)構(gòu)信息;靜態(tài)特征庫(kù)記錄了數(shù)據(jù)的實(shí)時(shí)度、關(guān)聯(lián)度等信息;動(dòng)態(tài)特征庫(kù)記錄了動(dòng)態(tài)數(shù)據(jù)信息。
在軟件結(jié)構(gòu)設(shè)計(jì)過程中,主要對(duì)數(shù)據(jù)采集模塊、數(shù)據(jù)分析處理模塊和數(shù)據(jù)顯示存儲(chǔ)模塊進(jìn)行分析并研究。其中,數(shù)據(jù)采集模塊的主要目的是為數(shù)據(jù)分析處理模塊提供數(shù)據(jù)源,其原理是通過數(shù)據(jù)采集卡采集被測(cè)信號(hào),實(shí)現(xiàn)數(shù)據(jù)源的提供[12];數(shù)據(jù)分析處理模塊的主要功能是對(duì)數(shù)據(jù)采集模塊傳輸過來(lái)的信號(hào)進(jìn)行濾波和FFT變換等,同時(shí)依照檢測(cè)到的信號(hào)特點(diǎn)對(duì)檢測(cè)的數(shù)據(jù)進(jìn)行有時(shí)效性的分析;數(shù)據(jù)顯示存儲(chǔ)模塊是依據(jù)數(shù)據(jù)處理系統(tǒng)的規(guī)則將信號(hào)的時(shí)域、頻域波形和其他參數(shù)等數(shù)據(jù)信息顯示在虛擬面板上。軟件設(shè)計(jì)流程如圖6所示。
4.1 ?實(shí)驗(yàn)參數(shù)設(shè)置
實(shí)驗(yàn)中其軟硬件參數(shù)設(shè)置如表1所示。
4.2 ?實(shí)驗(yàn)結(jié)果分析
為了驗(yàn)證改進(jìn)系統(tǒng)在數(shù)據(jù)處理方面的有效性及可行性,以系統(tǒng)對(duì)數(shù)據(jù)處理精確度為指標(biāo),采用改進(jìn)系統(tǒng)與傳統(tǒng)跨平臺(tái)系統(tǒng)為對(duì)比,進(jìn)行實(shí)驗(yàn)對(duì)比分析,結(jié)果如圖7、圖8所示。圖中長(zhǎng)方形部分表示數(shù)據(jù)處理部分,實(shí)心部分表示數(shù)據(jù)處理不全面。由圖7和圖8可知,采用傳統(tǒng)跨平臺(tái)系統(tǒng)進(jìn)行數(shù)據(jù)處理時(shí),其數(shù)據(jù)處理過程中多次出現(xiàn)數(shù)據(jù)處理不全面且處理不完成的現(xiàn)象,約為14次,90.5 GB;采用改進(jìn)處理系統(tǒng)進(jìn)行數(shù)據(jù)處理時(shí),其數(shù)據(jù)處理結(jié)果出現(xiàn)3次處理不全面的問題,處理量達(dá)到了132.6 GB,相比傳統(tǒng)跨平臺(tái)系統(tǒng)數(shù)據(jù)處理過程中出現(xiàn)處理不全的次數(shù)降低了11次,且數(shù)據(jù)處理量增加,具有一定的優(yōu)勢(shì)。
針對(duì)傳統(tǒng)系統(tǒng)在處理數(shù)據(jù)過程中一直存在處理不全面且效率低的問題,提出并設(shè)計(jì)了基于虛擬儀器的數(shù)據(jù)處理系統(tǒng),并進(jìn)行實(shí)驗(yàn)分析。實(shí)驗(yàn)結(jié)果表明,采用改進(jìn)設(shè)計(jì)系統(tǒng)對(duì)數(shù)據(jù)進(jìn)行處理,其系統(tǒng)的運(yùn)行效率要優(yōu)于傳統(tǒng)系統(tǒng),且數(shù)據(jù)處理結(jié)果準(zhǔn)確度較高,具有一定的優(yōu)勢(shì)。
參考文獻(xiàn)
[1] 肖子陽(yáng),關(guān)靚.基于虛擬儀器的電機(jī)測(cè)試方法研究[J].電測(cè)與儀表,2016,53(z1):10?14.
XIAO Ziyang, GUAN Liang. Motor test method research based on virtual instrument [J]. Electrical measurement & instrumentation, 2016, 53(S1): 10?14.
[2] 史志輝,林君,周逢道.基于虛擬儀器的高準(zhǔn)確度同步采集系統(tǒng)[J].中國(guó)測(cè)試,2016,42(2):67?70.
SHI Zhihui, LIN Jun, ZHOU Fengdao. Precision synchronous acquisition system based on virtual instrument [J]. China measurement & test, 2016, 42(2): 67?70.
[3] 曹建樹,羅振興,姬保平,等.基于LabVIEW的激光超聲數(shù)據(jù)采集與處理系統(tǒng)設(shè)計(jì)[J].機(jī)床與液壓,2016,44(13):113?115.
CAO Jianshu, LUO Zhenxing, JI Baoping, et al. Design of laser ultrasonic data acquisition and processing system based on LabVIEW [J]. Machine tool & hydraulics, 2016, 44(13): 113?115.
[4] 向小佳,趙曉芳,劉洋,等.一種正交分解大數(shù)據(jù)處理系統(tǒng)設(shè)計(jì)方法及實(shí)現(xiàn)[J].計(jì)算機(jī)研究與發(fā)展,2017,54(5):1097?1108.
XIANG Xiaojia, ZHAO Xiaofang, LIU Yang, et al. An orthogonal decomposition based design method and implementation for big data processing system [J]. Journal of computer research and development, 2017, 54(5): 1097?1108.
[5] 張召文.基于Android系統(tǒng)的譜數(shù)據(jù)分析軟件設(shè)計(jì)與實(shí)現(xiàn)[J].中國(guó)礦業(yè),2017,26(z1):431?433.
ZHANG Zhaowen. The design and implementation of energy spectral data analysis software based on Android system [J]. China mining magazine, 2017, 26(S1): 431?433.
[6] 賈曉寒,郭利強(qiáng),郭濤.基于LabVIEW的水壓傳感器數(shù)據(jù)采集系統(tǒng)設(shè)計(jì)[J].儀表技術(shù)與傳感器,2016(12):83?86.
JIA Xiaohan, GUO Liqiang, GUO Tao. Design of pressure sensor data acquisition system based on LabVIEW [J]. Instrument technique and sensor, 2016(12): 83?86.
[7] 謝志遠(yuǎn),韓思思,胡正偉,等.基于虛擬儀器的多通道DC傳感器校驗(yàn)平臺(tái)設(shè)計(jì)[J].現(xiàn)代電子技術(shù),2017,40(14):144?148.
XIE Zhiyuan, HAN Sisi, HU Zhengwei, et al. Design of calibration platform for multi?channel DC sensor based on virtual instrument [J]. Modern electronics technique, 2017, 40(14): 144?148.
[8] 王海斌,丁發(fā)軍,錢偉.通航數(shù)據(jù)處理計(jì)算機(jī)測(cè)試平臺(tái)的設(shè)計(jì)與實(shí)現(xiàn)[J].電子器件,2016,39(6):1435?1439.
WANG Haibin, DING Fajun, QIAN Wei. Design and implementation of the test platform for aviation data processing computer [J]. Chinese journal of electron devices, 2016, 39(6): 1435?1439.
[9] 孫沖沖,王增才.基于LabVIEW的AMT數(shù)據(jù)采集處理系統(tǒng)設(shè)計(jì)[J].儀表技術(shù)與傳感器,2016(11):62?66.
SUN Chongchong, WANG Zengcai. Design of AMT data acquisition and processing system based on LabVIEW [J]. Instrument technique and sensor, 2016(11): 62?66.
[10] 張法全,黃三,葉金才,等.基于LabVIEW的多通道槽波地震數(shù)據(jù)采集系統(tǒng)[J].儀表技術(shù)與傳感器,2017(6):59?63.
ZHANG Faquan, HUANG San, YE Jincai, et al. Multichannel in?seam seismic data acquisition system based on LabVIEW [J]. Instrument technique and sensor, 2017(6): 59?63.
[11] 井后華,王芳,劉志遠(yuǎn),等.基于虛擬儀器的電動(dòng)汽車控制器自動(dòng)測(cè)試系統(tǒng)[J].汽車技術(shù),2016,24(11):25?29.
JING Houhua, WANG Fang, LIU Zhiyuan, et al. Automatic test system for electronic control units of electric vehicle based on virtual instrument [J]. Automobile technology, 2016, 24(11): 25?29.
[12] 徐一鳳,豐大軍,張瀚文,等.基于跨平臺(tái)的實(shí)時(shí)數(shù)據(jù)處理系統(tǒng)的設(shè)計(jì)[J].電子技術(shù)應(yīng)用,2017,43(9):98?100.
XU Yifeng, FENG Dajun, ZHANG Hanwen, et al. The design of the real?time data processing system based on multi?platform [J]. Application of electronic technique, 2017, 43(9): 98?100.