제5장
표준화된 데이터를 프로그래밍 방식으로 접근. RESTful API, WebSocket 스트리밍, SDK로 전 세계 핵융합 시설을 하나의 네트워크로 연결합니다.
표준 데이터 형식이 있다면, 다음 단계는 이 데이터에 접근하는 표준 방법입니다. 과거에는 각 핵융합 시설에 방문하거나, 특수 소프트웨어를 설치하거나, 개인 연락처를 통해 데이터를 요청해야 했습니다. 이는 비효율적이고 확장 불가능하며 협업을 저해했습니다.
WIA-FUSION API는 이 모든 것을 변화시킵니다. 이제 연구자는 어디서나, 어떤 프로그래밍 언어로든, 표준 HTTP 요청으로 KSTAR, JET, DIII-D, ITER의 데이터에 접근할 수 있습니다.
WIA-FUSION API는 3가지 접근 방식을 제공합니다:
/auth/token
API 키로 JWT 토큰을 발급받습니다.
// 요청
POST https://api.fusion.wia.live/v1/auth/token
Content-Type: application/json
{
"api_key": "wia_fusion_live_abc123...",
"facility": "KSTAR"
}
// 응답
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 3600,
"facility": "KSTAR",
"permissions": ["read", "stream"]
}
/plasma/shots
샷 목록을 조회합니다.
// 요청
GET /v1/plasma/shots?facility=KSTAR&date_from=2023-01-01&date_to=2023-12-31&limit=100
Authorization: Bearer <token>
// 응답
{
"total": 2450,
"page": 1,
"shots": [
{
"shot_id": "KSTAR-2023-12-15-24501",
"timestamp": "2023-12-15T09:23:45.250Z",
"duration_s": 102.3,
"peak_temperature_keV": 8.6,
"peak_density_1e20m3": 0.85,
"disruption": false
},
...
]
}
/plasma/shots/{shot_id}
특정 샷의 상세 데이터를 가져옵니다.
/plasma/query
복잡한 조건으로 데이터를 검색합니다.
// 요청
POST /v1/plasma/query
{
"facility": ["KSTAR", "JET"],
"temperature_keV": {"min": 5, "max": 15},
"beta_percent": {"min": 2},
"disruption": false,
"date_range": {
"from": "2022-01-01",
"to": "2023-12-31"
},
"limit": 1000
}
// 응답
{
"matches": 1247,
"shots": [...]
}
/ai/predict/disruption
현재 플라즈마 상태에서 붕괴 확률을 예측합니다.
// 요청
POST /v1/ai/predict/disruption
{
"plasma_state": {
"temperature_keV": 10.0,
"density_1e20m3": 1.2,
"plasma_current_ma": 15,
"beta_percent": 2.8,
"mhd_amplitude": 0.25
},
"model": "KAIST-DNN-v3.2"
}
// 응답
{
"prediction": {
"disruption_probability": 0.72,
"time_to_disruption_ms": 350,
"confidence": 0.94,
"recommended_actions": [
{
"action": "reduce_heating_power",
"target": "NBI",
"amount_percent": -30,
"urgency": "high"
},
{
"action": "activate_elm_mitigation",
"method": "RMP_coils",
"urgency": "medium"
}
],
"model_version": "KAIST-DNN-v3.2",
"training_data": "KSTAR+JET+DIII-D (2018-2023)"
}
}
실시간 플라즈마 모니터링과 제어를 위해 WIA-FUSION은 WebSocket 프로토콜을 지원합니다. KSTAR는 최대 10 kHz로 70개 이상의 진단 채널을 스트리밍합니다.
// JavaScript/TypeScript 예시
const ws = new WebSocket('wss://api.fusion.wia.live/v1/stream/plasma');
// 인증
ws.onopen = () => {
ws.send(JSON.stringify({
action: 'auth',
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
}));
// 채널 구독
ws.send(JSON.stringify({
action: 'subscribe',
facility: 'KSTAR',
shot_id: 'KSTAR-2024-01-15-24600',
channels: [
'plasma_state', // 플라즈마 상태 (10 Hz)
'thomson_scattering',// Thomson 산란 (100 Hz)
'ece', // 전자 사이클로트론 (1 kHz)
'magnetics', // 자기 신호 (10 kHz)
'ai_predictions' // AI 예측 (1 Hz)
],
sample_rate_hz: 100 // 최대 샘플링 레이트
}));
};
// 데이터 수신
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.channel === 'plasma_state') {
console.log(`온도: ${data.temperature_keV.ion} keV`);
console.log(`밀도: ${data.density_1e20m3} × 10²⁰/m³`);
console.log(`베타: ${data.beta_percent}%`);
updateDashboard(data);
}
if (data.channel === 'ai_predictions') {
if (data.disruption_probability > 0.7) {
console.warn('⚠️ 붕괴 위험 높음!', data);
triggerAlert(data);
}
}
};
// 오류 처리
ws.onerror = (error) => {
console.error('WebSocket 오류:', error);
};
// 재연결
ws.onclose = () => {
console.log('연결 종료, 5초 후 재연결...');
setTimeout(connectWebSocket, 5000);
};
국가핵융합연구소(KFE)는 2024년 KSTAR에 완전한 WIA-FUSION API를 구축했습니다. 이는 세계 최초의 PLATINUM 인증 API입니다.
| 구성 요소 | 기술 스택 | 성능 | 가용성 |
|---|---|---|---|
| API 게이트웨이 | Kong + Kubernetes | 10,000 req/s | 99.99% |
| REST 서버 | Node.js + Express | <5 ms 지연 | 99.95% |
| WebSocket 서버 | Go + gorilla/websocket | 10 kHz 스트리밍 | 99.9% |
| 데이터베이스 | PostgreSQL + TimescaleDB | 100 TB 저장 | 99.99% |
| 캐시 | Redis Cluster | <1 ms 응답 | 99.99% |
| AI 추론 | NVIDIA Triton + TensorRT | <10 ms 예측 | 99.9% |
import { FusionClient } from '@wia/fusion-sdk';
// 클라이언트 초기화
const client = new FusionClient({
apiKey: process.env.WIA_FUSION_API_KEY,
facility: 'KSTAR',
baseURL: 'https://api.fusion.wia.live/v1'
});
// 샷 조회
const shots = await client.plasma.getShots({
dateFrom: '2023-01-01',
dateTo: '2023-12-31',
temperatureMin: 5,
disruptionOnly: false
});
console.log(`${shots.total}개 샷 발견`);
// 특정 샷 상세 정보
const shot = await client.plasma.getShot('KSTAR-2023-12-15-24501');
console.log(`최고 온도: ${shot.peak_temperature_keV} keV`);
console.log(`지속 시간: ${shot.duration_s}초`);
// AI 붕괴 예측
const prediction = await client.ai.predictDisruption({
temperature_keV: 10.0,
density_1e20m3: 1.2,
beta_percent: 2.8
});
if (prediction.disruption_probability > 0.7) {
console.warn('⚠️ 붕괴 위험!');
console.log(`예상 시간: ${prediction.time_to_disruption_ms}ms`);
console.log('권장 조치:', prediction.recommended_actions);
}
// 실시간 스트리밍
const stream = client.stream.connect('KSTAR-2024-01-15-24600');
stream.subscribe(['plasma_state', 'ai_predictions'], (data) => {
console.log('실시간 데이터:', data);
});
stream.on('disruption_warning', (warning) => {
console.error('🚨 붕괴 경고!', warning);
});
from wia_fusion import FusionClient
import asyncio
# 클라이언트 초기화
client = FusionClient(
api_key=os.getenv("WIA_FUSION_API_KEY"),
facility="KSTAR"
)
# 샷 조회 (동기)
shots = client.plasma.get_shots(
date_from="2023-01-01",
date_to="2023-12-31",
temperature_min=5
)
print(f"{shots.total}개 샷 발견")
# AI 예측 (동기)
prediction = client.ai.predict_disruption(
temperature_keV=10.0,
density_1e20m3=1.2,
beta_percent=2.8
)
if prediction.disruption_probability > 0.7:
print("⚠️ 붕괴 위험!")
print(f"확률: {prediction.disruption_probability * 100}%")
# 실시간 스트리밍 (비동기)
async def stream_data():
async with client.stream.connect("KSTAR-2024-01-15-24600") as stream:
await stream.subscribe(["plasma_state", "ai_predictions"])
async for data in stream:
print(f"온도: {data.temperature_keV} keV")
if data.channel == "ai_predictions":
if data.disruption_probability > 0.7:
print("🚨 붕괴 경고!")
# 실행
asyncio.run(stream_data())
핵융합 시설은 민감한 국가 인프라입니다. WIA-FUSION API는 다층 보안을 제공합니다:
| 보안 계층 | 메커니즘 | 목적 |
|---|---|---|
| 인증 | API 키 + JWT 토큰 | 사용자 신원 확인 |
| 인가 | 역할 기반 접근 제어 (RBAC) | 권한 관리 (read/write/admin) |
| 전송 | TLS 1.3 암호화 | 데이터 전송 보호 |
| 속도 제한 | 토큰 버킷 알고리즘 | 남용 방지 (1,000 req/min) |
| 감사 | 모든 요청 로깅 | 추적성 및 컴플라이언스 |
| 레벨 | 권한 | 대상 | 승인 과정 |
|---|---|---|---|
| PUBLIC | 요약 데이터 읽기 | 모든 사용자 | 자동 (이메일 확인) |
| RESEARCHER | 전체 데이터 읽기 | 학술 연구자 | 소속 기관 확인 (1-3일) |
| OPERATOR | 읽기 + 제어 제안 | 시설 운영자 | KFE 직접 승인 (1주) |
| ADMIN | 전체 제어 | 시설 관리자 | KFE 이사회 승인 |
KSTAR API는 다음 기술로 고성능을 달성합니다:
접근성을 통한 인류의 이익
WIA-FUSION API는 弘益人間 정신을 실천합니다:
제6장: 3단계 - 프로토콜
데이터와 API로 기술적 상호운용성을 달성했으니, 이제 운영 표준으로 넘어갑니다. 제6장에서는 플라즈마 시작 시퀀스, 정상 상태 제어, 안전한 종료, 비상 대응 프로토콜을 배웁니다. KSTAR가 어떻게 AI로 1억 °C 플라즈마를 102초간 유지하는지, 그리고 이 운영 지식을 어떻게 표준화하여 ITER와 공유하는지 살펴봅니다.