本章節將說明如何使用 UA Expert 工具,讀取與寫入伺服器端的 Macro 變數,以達成訊號交握的基本應用。透過此教學,使用者將能了解 OPC UA 通訊環境下,如何以 UA Expert 作為用戶端介面,進行變數監控與控制操作,並驗證資料互通的正確性與即時性。
二、事前準備
1. 安裝UA Expert。
[1] 下載網址:https://www.unified-automation.com/prod ... xpert.html。
[2] 安裝並啟動應用程式。
2. 於FsBP OPC UA Server APP 設定以下內容。
[1] 打開FsBP OPC UA Server APP。
[2] 切換至Basic settings頁面。
[3] 點選【Edit】。
[4] 設定以下內容。
*注意:此功能務必設定並使用此頁面的帳號密碼才能使用。
[5] 點選【Save】。
[6] 點選【確定】,重啟FsBP OPC UA Server APP。
三、建立連線
1. 開啟 UA Expert。
2. 新增連線 Add Server。
[1] 路徑:Project > Servers >右鍵>Add。
[2] 輸入 Endpoint URL(手動新增)。
- 找到 Custom Discovery。
- 雙擊「Double click to Add Server」。
- Enter URL輸入:opc.tcp://<FIELD system BOX IP>:4840/OPCUAServer。
- 按下【OK】。
3. 驗證設定 Authentication Settings。
[1] 展開opc.tcp://<FIELD system BOX IP>:4840/OPCUAServer。
[2] 點選「Aes256_Sha256_RsaPss – Sign & Encrypt」。
[3] 輸入 Username。
[4] 勾選 Store。
[5] 輸入Password。
[6] 點選【OK】。
若出現「Connect Error」視窗,請點選Ignore。
4. 信任伺服器憑證(若使用加密模式)
[1] 若 Server 使用安全憑證,會出現「Certificate Validation」視窗。
[2] 點選【Trust Server Certificate】。
[3] 點選【Continue】。
5. 連線伺服器
[1] 路徑:Project>Servers。
[2] 找到:OPC UA Server@<FIELD system BOX IP>
[3] 右鍵點選【Connect】。
若出現「Connect Error」視窗,請點選【Ignore】。
四、讀取Marco變數
1.打開API視窗
[1] 至Address Space區塊。
[2] 展開節點:CommonDatabase>欲操作機台>Methods。
[3] 右鍵點選「get_marco_variable」節點。
[4] 點選【Call】。
[5] 輸入相關內容。
[6] 點選Call。
2. 顯示結果
Output Arguments和Result的部分會顯示API呼叫結果。
五、寫入Marco變數
1.打開API視窗
[1] 至Address Space區塊。
[2] 展開節點:CommonDatabase>欲操作機台>Methods。
[3] 右鍵點選「set_marco_variable」節點。
[4] 點選Call。
[5] 輸入相關內容。
2. 顯示結果
Output Arguments和Result的部分會顯示API呼叫結果。