【教程】Matrikon OPC使用教程連載(六)

上一篇文章已經完成MatrikonOPC Data Manager的配置,本篇文章將與大家分享如何測試OPC連接。

測試OPC連接

修改MatrikonOPC Data Manager中的值

此測試的目的是爲了瞭解在MatrikonOPC Data Manager中爲創建的共享數據點發出OPC寫入時OPC體系結構的行爲。在雙向共享點上在OPC Data Manager中發出OPC寫入的預期行爲是,該值將寫入OPC Server for DDEOPC Server for Simulation and Testing

在MatrikonOPC Data Manager中測試OPC寫入:

1.在“Configuration(配置)”屏幕右下方的窗格中,鼠標右鍵單擊共享點(已在本教程的“添加OPC數據點”部分中添加)。

2.從顯示的菜單中選擇“Write(寫入)”。

3.出現“Write Value(寫入值)”窗口(圖1)。

MatrikonOPC 圖1-Write Value窗口

圖1-Write Value窗口

4.在“Value(值)”字段中,輸入1550

5.單擊“Apply(應用)”按鈕以提交更改並關閉“Write Value”窗口。

6.查看Book1.xls文件以確認FIC101值已更改(圖2)。

MatrikonOPC 圖2-在Microsoft Excel中驗證值更改

圖2-在Microsoft Excel中驗證值更改

7.要確保將值寫入OPC Server for Simulation,需使用OPC Explorer建立與OPC服務器的另一個連接。

8.瀏覽並添加OPC Data Manager引用的Bucket Brigade項(即Int1Int2Int4)。

9.確認FIC101數據點的值已從1600更改爲1550(圖3)。

MatrikonOPC 圖3-在MatrikonOPC Server for Simulation and Testing中驗證值更改

圖3-在MatrikonOPC Server for Simulation and Testing中驗證值更改


修改Microsoft Excel中的值

此測試的目的是在Microsoft Excel中更改值時驗證OPC體系結構的行爲。在Excel中更改值的預期行爲是,將使用Excel中的當前值更新OPC Server for DDE。OPC服務器中的此值更改將導致發生OPC讀取,將新值發送到OPC Data ManagerOPC Data Manager中將發生OPC寫入,將新值發送到OPC Server for Simulation中的關聯數據點。

測試Microsoft Excel中的值更改:

1.在Microsoft Excel Book1.xls文件中,將FIC101的值更改爲2000(圖4)

MatrikonOPC 圖4-更改Excel值

圖4-更改Excel值

2.查看OPC Data Manager Configuration窗口並確認FIC101共享數據點值已更改爲2000(圖5)。

MatrikonOPC 圖5-MatrikonOPC Data Manager中值改變

圖5-MatrikonOPC Data Manager中值改變

3.要確保將值寫入OPC Server for Simulation,需使用OPC Explorer建立與OPC服務器的另一個連接。瀏覽並添加OPC Data Manager引用的Bucket Brigade項目(例如,Int1Int2Int4)。

4.確認FIC101數據點的值已更改爲2000(圖6)。

MatrikonOPC 圖6-在MatrikonOPC Server for Simulation and Testing驗證值更改

圖6-在MatrikonOPC Server for Simulation and Testing驗證值更改


修改MatrikonOPC Server for Simulation and Testing中的值

此測試的目的是在OPC Server for Simulation and Testing中更改值時驗證OPC體系結構的行爲。在OPC Server for Simulation中更改值的預期行爲是將OPC讀取發送到OPC Data Manager。隨後的OPC寫操作將在OPC Data Manager中發生,將新值發送到OPC Server for DDE中的關聯數據點,最終發送到Microsoft Excel

測試MatrikonOPC Server for Simulation and Testing中值變化:

1.在OPC Explorer中,在頂部標籤(Bucket Brigade.Int1)上單擊鼠標右鍵,然後從顯示的菜單中選擇“Write Values”。

2.出現Write Values窗口(圖7)。

MatrikonOPC 圖7-寫入值窗口

圖7-Write Values窗口

3.在“New Value”字段中選擇當前標記值。

4.將標記值更改爲2513,然後單擊“OK”按鈕。(圖8)

注意:此操作從OPC ExplorerOPC Server for Simulation發出寫入。 通過在寫入後查看OPC Explorer並驗證該項目的值更改爲2513,這確認了OPC服務器中的值已成功更改。

MatrikonOPC 圖8-在MatrikonOPC Server for Simulation and Testing中更改值

圖8-在MatrikonOPC Server for Simulation and Testing中更改值

5.查看OPC Data Manager Configuration屏幕並檢查FIC101 / Bucket Brigade.Int1共享數據點值。 共享點的值顯示爲2513

6.在Microsoft Excel中,驗證FIC101的值更改爲2513(圖9)。

MatrikonOPC 圖9-在Excel驗證值更改

圖9-在Excel驗證值更改

OPC連接測試就到此結束,以上操作順利完成說明OPC之間的連接已經配置完成並且測試通過,接下來就可以在兩個OPC服務器之間交換數據了。

下一篇文章將與大家分享使用Matrikon OPC服務器時常見的問題和解決方法,敬請期待噢~


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章