> For the complete documentation index, see [llms.txt](https://kopens.gitbook.io/plantpulse-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kopens.gitbook.io/plantpulse-platform/admin/modules/plugin.md).

# plugin (OPC-UA · AAS)

## 역할

산업 표준 프로토콜 연동 플러그인. 외부 시스템 / 디바이스가 PlantPulse 의 데이터에 산업 표준 인터페이스로 접근할 수 있도록 합니다.

| 항목        | 값                                                    |
| --------- | ---------------------------------------------------- |
| 모듈명       | `plantpulse-plugin`                                  |
| 설치 경로     | `/opt/kopens/plantpulse-platform/plantpulse-plugin/` |
| OPC-UA 포트 | **11004** (TCP), 11005 (TLS)                         |
| AAS V2 포트 | 8007                                                 |
| AAS V3 포트 | 8090                                                 |

## 구성

```mermaid
graph LR
  EXTERNAL_OPC[외부 OPC-UA 클라이언트<br/>SCADA / DCS / MES] --> OPCUA[OPC-UA Server<br/>:11004]
  EXTERNAL_AAS[외부 AAS Registry / 클라이언트] --> AAS[AAS Server<br/>:8007 / :8090]

  subgraph PLUG["plantpulse-plugin"]
    OPCUA
    AAS
  end

  OPCUA --> CASS[(Cassandra)]
  OPCUA --> PG[(PostgreSQL)]
  AAS --> PG
```

## 디렉토리 구조

```
plantpulse-plugin/
├── opc-ua/                          # OPC-UA 서버
│   ├── bin/start.sh stop.sh log-viewer.sh
│   ├── config/
│   │   ├── server.properties
│   │   └── address-space.xml
│   ├── lib/
│   └── logs/system.log
└── aasx-server/                     # AAS (Asset Administration Shell)
    ├── bin/
    ├── config/
    │   ├── BaSyx-V2.cfg
    │   └── BaSyx-V3.cfg
    ├── lib/
    └── logs/
```

## OPC-UA Server (port 11004)

PlantPulse 의 태그 / 자산 데이터를 OPC-UA 표준으로 외부에 노출합니다.

### 핵심 설정

```properties
# opc-ua/config/server.properties
opcua.server.port=${PP_OPCUA_TCP_PORT}
opcua.server.tls.port=${PP_OPCUA_TLS_PORT}
opcua.server.app.uri=${PP_TLS_OPCUA_APP_URI}
opcua.server.product.name=PlantPulse OPC-UA Server

opcua.security.policy=Basic256Sha256,None
opcua.security.user.token=Username,Anonymous

opcua.user=opcua
opcua.password=opcua123!

opcua.cassandra.host=${PP_CASSANDRA_HOST}
opcua.cassandra.keyspace=${PP_KEYSPACE}
```

### 클라이언트 접속

OPC-UA Endpoint URL:

* `opc.tcp://[HOST]:11004` (None)
* `opc.tcp://[HOST]:11005` (Basic256Sha256, TLS)

검증된 OPC-UA 클라이언트:

* UaExpert (Unified Automation)
* Prosys OPC UA Browser
* Node-RED `node-red-contrib-opcua`

## AAS Server (Asset Administration Shell)

ISO 23252 / IEC 63278 표준의 **디지털 트윈** 인터페이스. Industrie 4.0 에서 자산 데이터를 표준화된 셸로 노출합니다.

| 버전         | 포트   | 표준                         |
| ---------- | ---- | -------------------------- |
| V2 (BaSyx) | 8007 | Plattform Industrie 4.0 V2 |
| V3 (BaSyx) | 8090 | IEC 63278 V3               |

### API 엔드포인트

```bash
# V2
curl http://[HOST]:8007/registry/api/v1/registry

# V3
curl http://[HOST]:8090/api/v3.0/shells
```

## 운영 명령

```bash
cd /opt/kopens/plantpulse-platform/plantpulse-startup

./restart-plugin.sh            # 플러그인 전체 재시작
./restart-opcua-server.sh      # OPC-UA 만 재시작
./restart-aasx-server.sh       # AAS 만 재시작
./status.sh                    # 11004 / 8007 / 8090 RUNNING 확인
```

## 자주 발생하는 문제

| 증상                       | 원인                  | 조치                                              |
| ------------------------ | ------------------- | ----------------------------------------------- |
| OPC-UA 클라이언트 접속 실패       | 방화벽 / 인증서           | 11004 포트 + `prepare-ssl.sh` 의 OPC-UA app URI 확인 |
| OPC-UA "Bad Certificate" | self-signed 인증서 미신뢰 | 클라이언트에서 `rejected/` → `trusted/` 로 이동           |
| AAS 데이터 미반영              | 메타데이터 캐시            | 재시작 또는 AAS Registry 갱신                          |

## 관련 문서

* [모듈 인덱스](/plantpulse-platform/admin/modules.md)
* [표준 및 외부 도구 (사용자)](/plantpulse-platform/user/tools.md)
* [연결 관리 (사용자)](/plantpulse-platform/user/connection.md)
