> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/workflows/ko/tutorials/integrate-with-ignition/live-data/read-the-roboflow-opc-ua-server.md).

# Roboflow OPC UA Server 읽기

Ignition을 Roboflow 엣지 디바이스의 OPC UA Server에 연결하고 Workflow가 기록하는 태그를 읽습니다.

Ignition 또는 PLC가 쓰기 요청을 받는 대신 장치의 태그를 폴링해야 하는 경우 이 경로를 사용하세요. OPC UA Server는 Roboflow 장치에서 실행되는 서비스입니다. Workflow가 여기에 태그를 쓰고, Ignition은 클라이언트로서 태그를 읽습니다.

{% hint style="info" %}
OPC UA Writer Sink, OPC UA Reader, OPC UA Server는 Enterprise 고객만 사용할 수 있습니다. [자세한 내용은 Roboflow 영업팀에](https://roboflow.com/sales) 문의하세요.
{% endhint %}

{% hint style="info" %}
이 절차와 스크린샷은 Ignition 8.1(Designer 8.1.55)을 기준으로 합니다. 8.3을 포함한 다른 버전에서는 메뉴 이름, 대화상자, 속성 이름이 다를 수 있습니다.
{% endhint %}

## 예시 태그

이 페이지에서는 세 개의 태그를 사용해 패턴을 설명합니다. 설명을 위한 예시이므로 생산 라인에 맞게 폴더, 이름, 데이터 유형을 직접 정의하고 Workflow에서도 동일한 이름을 사용하세요.

<table data-search="false"><thead><tr><th>태그</th><th>데이터 유형</th><th>의미</th></tr></thead><tbody><tr><td><code>Line1/DefectFound</code></td><td>Boolean</td><td><code>true</code> 마지막 케이스가 검사에 불합격했을 때</td></tr><tr><td><code>Line1/PassCount</code></td><td>Int32</td><td>이번 교대조에서 합격한 케이스 수</td></tr><tr><td><code>Line1/LastResult</code></td><td>String</td><td><code>pass</code> 또는 <code>fail</code> 마지막 케이스의 결과</td></tr></tbody></table>

## 장치에 OPC UA Server 추가

1. Deployment Manager에서 장치를 열고 "Services" 탭으로 이동한 다음 "Add Service"를 클릭합니다. "OPC UA Server"를 선택합니다.
2. "Configure OPC UA Server"에서 "Server Settings" 기본값을 유지하거나 변경합니다. Workflow에서 사용해야 하므로 "Namespace URI"(기본값 `http://opcua.roboflow.run`)를 확인해 둡니다.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-898a7744caff2ff953cc53f33178b90e5b9619dd%2Fignition-dm-opcua-server-settings.png?alt=media" alt="The Configure OPC UA Server modal in Deployment Manager with Server Name Roboflow OPC UA Server, Namespace URI http://opcua.roboflow.run, Max Sessions 200, and Require Authentication off" width="500"><figcaption><p>서버 설정입니다.</p></figcaption></figure>
3. "Folders" 아래에서 "+ Add Folder"를 클릭하고 다음을 추가합니다. `Line1`.
4. "Tags" 아래에서 태그마다 "+ Add Tag"를 클릭합니다. "Display Name", "Browse Name", "Data Type", "Folder"를 설정하고 Workflow에서 쓸 수 있도록 "Access Level"은 "ReadWrite"로 유지합니다. 클라이언트는 태그의 "Browse Name"을 사용해 태그를 찾습니다.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-9afd0521b6166357fe38494be7b685e258c2cd31%2Fignition-dm-opcua-server-add-tag.png?alt=media" alt="The Add Tag dialog with Display Name Defect Found, Browse Name DefectFound, Data Type Boolean, Access Level ReadWrite, Folder Line1, and Initial Value false" width="500"><figcaption><p>예시 <code>DefectFound</code> 태그입니다.</p></figcaption></figure>
5. 폴더와 태그를 확인한 다음 "Add Service"를 클릭합니다. 태그 목록이 비어 있으면 서버가 시작되지 않으므로 태그를 하나 이상 추가하세요.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-32b4c65491f93811c09e604ac025f88c1ebdbea4%2Fignition-dm-opcua-server-tags.png?alt=media" alt="The Configure OPC UA Server modal with a Line1 folder and three tags: Defect Found Boolean, Pass Count Int32, and Last Result String, all ReadWrite in Line1" width="500"><figcaption><p>추가할 준비가 된 예시 폴더와 태그입니다.</p></figcaption></figure>

서버는 다음 주소에서 태그를 게시합니다. `opc.tcp://<device-ip>:4840/opcua/server`.

## Workflow에서 서버에 쓰기

다음 문서의 설명에 따라 Workflow를 구성합니다. [Ignition에 결과 쓰기](https://docs.roboflow.com/workflows/ko/tutorials/integrate-with-ignition/live-data/write-results-to-ignition.md#build-the-workflow). 태그마다 OPC UA Writer Sink를 하나씩 추가하되, 각 Writer Sink가 장치의 서버를 가리키도록 설정합니다.

<table data-search="false"><thead><tr><th>필드</th><th>값</th></tr></thead><tbody><tr><td>"Url"</td><td><code>opc.tcp://&#x3C;device-ip>:4840/opcua/server</code></td></tr><tr><td>"Namespace"</td><td>서버의 "Namespace URI"(예: <code>http://opcua.roboflow.run</code>)</td></tr><tr><td>"개체 이름"</td><td>폴더(예: <code>Line1</code>)</td></tr><tr><td>"변수 이름"</td><td>태그의 "찾아보기 이름"(예: <code>DefectFound</code>)</td></tr><tr><td>"값 유형"</td><td>태그의 "데이터 유형"(예: "Boolean")</td></tr><tr><td>"노드 조회 모드"</td><td>기본값은 "hierarchical"입니다. "direct"는 이러한 태그를 찾지 못합니다.</td></tr></tbody></table>

"인증 필요"를 켜지 않았다면 "사용자 이름"과 "비밀번호"를 비워 두세요.

## Ignition을 서버에 연결

Ignition은 클라이언트로 장치에 연결되므로 Ignition 자체의 OPC UA 서버 설정은 변경할 필요가 없습니다.

1. Ignition Gateway에서 "구성" > "OPC 클라이언트" > "OPC 연결"로 이동한 다음, "새 OPC 연결 만들기..."를 클릭하고 "OPC UA"를 선택한 후 "다음"을 클릭합니다. 다음을 입력합니다. `opc.tcp://<device-ip>:4840/opcua/server` "엔드포인트 URL"로 지정하고 서버 및 엔드포인트 단계를 진행하며 "보안 정책: 없음"인 엔드포인트를 선택합니다.

   서버는 호스트 이름으로 주소를 알립니다. Ignition에서 해당 이름을 확인할 수 없으면 마법사에서 대체 주소를 묻습니다. 입력한 IP 주소를 사용하도록 "검색된 URL 대체"와 "검색된 호스트 이름 대체"를 그대로 둡니다.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-636f94b18f0eac9e413f29368723d5c436990b5a%2Fignition-opc-connection-substitute-url.png?alt=media" alt="The Ignition 8.1 connection wizard step Specify an Alternate Discovery URL, with Substitute URL From Discovery set to the device IP address"><figcaption><p>Ignition은 장치 호스트 이름 대신 IP 주소를 사용합니다.</p></figcaption></figure>

   "인증서 관리"에서 "인증서를 신뢰하시겠습니까?"를 "예"로 설정합니다.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-638c8bc5d62881189a4a69810f308e735b0eb33e%2Fignition-opc-connection-trust-certificate.png?alt=media" alt="The Manage Certificate step showing the Roboflow OPC UA Server certificate with Trust certificate set to Yes"><figcaption><p>장치 서버 인증서를 신뢰합니다.</p></figcaption></figure>

   "완료"를 클릭하고 연결 이름을 입력한 다음(예: `Roboflow Line 1`), "새 OPC 연결 만들기"를 클릭합니다. 인증을 켜지 않았다면 "사용자 이름"과 "비밀번호"를 비워 둡니다. 연결의 "상태"에 "연결됨"이 표시됩니다.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-dc08d1e78c904a2f674e876773d553809b17e187%2Fignition-opc-connections-list.png?alt=media" alt="The Ignition OPC Connections list with a Roboflow Line 1 connection to the Roboflow device OPC UA Server showing Connected"><figcaption><p>장치에 새로 연결된 연결입니다.</p></figcaption></figure>
2. 태그를 확인하려면 "구성" > "OPC 클라이언트" > "OPC 빠른 클라이언트"로 이동해 연결을 펼친 다음, 태그에서 "\[s]"를 클릭하여 값 구독을 시작합니다.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-d21deda2f9e3922c47169008d4e4383d3ca02334%2Fignition-opc-quick-client.png?alt=media" alt="The Ignition OPC Quick Client with the Roboflow Line 1 connection expanded to Line1 and subscriptions showing DefectFound true, LastResult fail, and PassCount 128 with Good quality"><figcaption><p>Workflow가 쓴 값을 Ignition에서 읽은 결과입니다.</p></figcaption></figure>
3. Designer에서 "보기" > "패널" > "OPC 브라우저"를 열고 연결을 펼친 다음, 태그를 Tag Browser의 태그 공급자로 끌어다 놓습니다.

   <figure><img src="https://3843302164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-ef40928983f9cfdf27667f072bcd9f99e5784aed%2Fignition-designer-opc-browser.png?alt=media" alt="The Ignition Designer OPC Browser panel with Roboflow Line 1 expanded to the Line1 folder and its DefectFound, LastResult, and PassCount tags" width="300"><figcaption><p>Designer의 장치 태그입니다.</p></figcaption></figure>

기본적으로 서버는 익명 연결을 허용합니다. "OPC UA 서버 구성"에서 "인증 필요"를 켠 다음, Writer Sink와 Ignition 연결 모두에 해당 사용자 이름과 비밀번호를 사용합니다. 각 클라이언트는 태그를 쓰는 각 스트림을 포함해 세션 하나를 사용하므로, 여러 스트림과 SCADA 클라이언트가 한 서버를 공유한다면 "최대 세션 수"를 늘리세요. 자세한 내용은 [OPC UA 서버](https://docs.roboflow.com/deployment/self-hosted/enterprise/deployment-manager/services/opc-ua-server).

## 문제 해결

<table data-search="false"><thead><tr><th>증상</th><th>원인</th><th>해결 방법</th></tr></thead><tbody><tr><td>장치 로그 <code>BadNodeIdUnknown</code> Roboflow OPC UA Server에 쓸 때</td><td>"노드 조회 모드"가 "direct"로 설정되어 있음</td><td>"노드 조회 모드"를 "hierarchical"로 설정합니다.</td></tr><tr><td>Roboflow OPC UA Server가 계속 다시 시작됨</td><td>구성에 태그가 없으며 로그에 다음이 표시됨 <code>OPCUA_CONFIG 'tags' array cannot be empty</code></td><td>"OPC UA 서버 구성"에서 태그를 하나 이상 추가합니다.</td></tr><tr><td>Ignition에서 Roboflow OPC UA Server에 연결할 수 없음</td><td>서버가 "최대 세션 수"에 도달했으며 다음 오류와 함께 새 클라이언트 연결을 거부함 <code>BadTooManySessions</code></td><td>"최대 세션 수"를 늘리고 "OPC UA 클라이언트 연결 거부" 장치 알림을 추가합니다.</td></tr></tbody></table>
