Skip to main content

digital-twin

Expert guidance on digital twin technology, simulation, and cyber-physical systems. Use this skill for: building digital twin systems, creating virtual replicas of physical assets, integrating real-time data streams, enabling predictive analytics, implementing physics-based simulations, edge-cloud integration, system integration, and digital twin architecture design for industrial, manufacturing, or IoT applications.

설치로 이동

소스 정보

저장소
NeuralBlitz/Mito
최근 소스 활동
2026년 3월 22일 13:29
감지된 SKILL.md 언어
영어
스타
0
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
digital-twin
description
Expert guidance on digital twin technology, simulation, and cyber-physical systems. Use this skill for: building digital twin systems, creating virtual replicas of physical assets, integrating real-time data streams, enabling predictive analytics, implementing physics-based simulations, edge-cloud integration, system integration, and digital twin architecture design for industrial, manufacturing, or IoT applications.
license
MIT
compatibility
opencode
metadata
{"audience":"engineers, researchers, developers","category":"engineering","tags":["digital-twin","simulation","iot","cyber-physical","predictive-maintenance"]}
# Digital Twin Technology — Implementation Guide Covers: **Architecture Design · Data Integration · Simulation · Predictive Analytics · Edge-Cloud Integration · Industry Applications** ----- ## Understanding Digital Twins ### What is a Digital Twin? A digital twin is a virtual representation of a physical object, system, or process that serves as a real-time digital counterpart. Unlike simple 3D models or simulations, digital twins are connected to their physical counterparts through IoT sensors and other data streams, enabling bidirectional information flow between the physical and digital worlds. The concept was pioneered by NASA for space applications and has since expanded across industries including manufacturing, healthcare, smart cities, and energy management. Modern digital twins combine multiple technologies: Internet of Things (IoT) connectivity, edge and cloud computing, artificial intelligence and machine learning, physics-based simulation, and augmented/virtual reality visualization. **Key Characteristics:** - **Bidirectional Data Flow** — Sensors on physical assets transmit data to the digital twin, while control signals can flow back to affect the physical system. - **Real-Time Synchronization** — The digital twin updates continuously as the physical asset changes state. - **Historical Data Integration** — Digital twins incorporate both real-time and historical data for comprehensive analysis. - **Predictive Capabilities** — AI and simulation enable forecasting of future states, maintenance needs, and performance outcomes. - **What-If Analysis** — Users can simulate scenarios on the digital twin without affecting the physical asset. ### Digital Twin Maturity Levels | Level | Description | Capabilities | |-------|-------------|--------------| | **1. Descriptive** | Static 3D model | Visualization, basic documentation | | **2. Diagnostic** | Connected to data sources | Monitoring, alerting, basic analytics | | **3. Predictive** | Uses ML/AI | Forecasting, anomaly detection, predictive maintenance | | **4. Prescriptive** | Automated decision-making | Autonomous optimization, self-healing | ----- ## Architecture Design ### High-Level Architecture Components A comprehensive digital twin architecture consists of multiple interconnected layers that work together to create, maintain, and utilize the virtual representation. **Physical Layer** — The actual assets, equipment, and systems being modeled. This includes sensors, actuators, programmable logic controllers (PLCs), SCADA systems, and other industrial IoT devices that capture and control physical processes. **Connectivity Layer** — The infrastructure that transports data between physical and digital domains. This includes industrial protocols (OPC-UA, MQTT, Modbus), network infrastructure, and edge computing devices that preprocess and filter data before transmission. **Data Layer** — The storage and management systems that handle the massive volumes of data generated by digital twins. This includes time-series databases, data lakes, data warehouses, and real-time streaming platforms. **Analytics Layer** — The computation engines that process data and generate insights. This includes statistical analysis, machine learning models, physics-based simulations, and optimization algorithms. **Application Layer** — The user-facing interfaces and applications that interact with the digital twin. This includes dashboards, visualization tools, mobile applications, and integration APIs. **Control Layer** — The systems that can affect the physical world based on digital twin insights. This includes automation systems, control algorithms, and human decision support tools. ### Reference Architecture Diagram ``` ┌─────────────────────────────────────────────────────────────────┐ │ APPLICATION LAYER │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │Dashboard │ │Mobile App│ │Analytics │ │Integration│ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ └────────────────────────────┬────────────────────────────────────┘ │ ┌────────────────────────────▼────────────────────────────────────┐ │ ANALYTICS LAYER │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │Real-time │ │Machine │ │Physics │ │Optimization│ │ │ │Analytics │ │Learning │ │Simulation│ │Engine │ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ └────────────────────────────┬────────────────────────────────────┘ │ ┌────────────────────────────▼────────────────────────────────────┐ │ DATA LAYER │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │Time-Series│ │Data Lake │ │Asset │ │Knowledge │ │ │ │Database │ │ │ │Registry │ │Graph │ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ └────────────────────────────┬────────────────────────────────────┘ │ ┌────────────────────────────▼────────────────────────────────────┐ │ CONNECTIVITY LAYER │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │MQTT │ │OPC-UA │ │Edge │ │Protocol │ │ │ │Broker │ │Server │ │Gateway │ │Translator│ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ └────────────────────────────┬────────────────────────────────────┘ │ ┌────────────────────────────▼────────────────────────────────────┐ │ PHYSICAL LAYER │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │Sensors │ │Actuators │ │PLCs │ │Equipment │ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ └─────────────────────────────────────────────────────────────────┘ ``` ----- ## Data Integration ### Time-Series Data Management Digital twins generate massive volumes of time-series data from sensors. Efficient storage and querying of this data is critical for performance. ```python from dataclasses import dataclass from datetime import datetime from typing import List, Optional, Dict, Any from enum import Enum import json class DataQuality(Enum): GOOD = "good" SUSPECT = "suspect" BAD = "bad" MISSING = "missing" @dataclass class SensorReading: asset_id: str sensor_id: str timestamp: datetime value: float unit: str quality: DataQuality metadata: Dict[str, Any] class TimeSeriesIngestService: def __init__(self, database_client): self.db = database_client self.buffer = [] self.batch_size = 1000 self.flush_interval_seconds = 5 async def ingest_reading(self, reading: SensorReading): """Ingest a single sensor reading""" # Validate reading if not self._validate_reading(reading): await self._handle_invalid_reading(reading) return # Add to buffer self.buffer.append(reading) # Flush if buffer is full if len(self.buffer) >= self.batch_size: await self._flush_buffer() async def _flush_buffer(self): """Write buffered readings to database""" if not self.buffer: return # Convert to database format records = [self._to_db_record(r) for r in self.buffer] # Batch insert await self.db.batch_insert("sensor_readings", records) # Clear buffer self.buffer = [] def _validate_reading(self, reading: SensorReading) -> bool: """Validate sensor reading""" if reading.value is None: return False # Check for reasonable range if reading.sensor_id.startswith("temp_"): return -50 <= reading.value <= 200 elif reading.sensor_id.startswith("pressure_"): return 0 <= reading.value <= 1000 return True def _to_db_record(self, reading: SensorReading) -> Dict: """Convert reading to database record""" return { "asset_id": reading.asset_id, "sensor_id": reading.sensor_id, "timestamp": reading.timestamp.isoformat(), "value": reading.value, "unit": reading.unit, "quality": reading.quality.value, "metadata": json.dumps(reading.metadata) } async def _handle_invalid_reading(self, reading: SensorReading): """Handle invalid readings""" # Log or send to dead letter queue pass ``` ### Asset Registry The asset registry maintains the master data for all assets in the digital twin system. ```python from dataclasses import dataclass, field from typing import List, Dict, Optional from datetime import datetime @dataclass class Asset: asset_id: str asset_type: str name: str description: str location: Optional[Dict[str, float]] # lat, lon parent_asset_id: Optional[str] sensors: List[str] = field(default_factory=list) metadata: Dict = field(default_factory=dict) created_at: datetime = field(default_factory=datetime.now) updated_at: datetime = field(default_factory=datetime.now) @dataclass class Sensor: sensor_id: str asset_id: str sensor_type: str name: str unit: str min_value: Optional[float] = None max_value: Optional[float] = None sampling_rate_seconds: int = 60 class AssetRegistry: def __init__(self, database): self.db = database self.cache = {} async def register_asset(self, asset: Asset) -> str: """Register a new asset""" await self.db.insert("assets", { "asset_id": asset.asset_id, "asset_type": asset.asset_type, "name": asset.name, "description": asset.description, "location": json.dumps(asset.location) if asset.location else None, "parent_asset_id": asset.parent_asset_id, "metadata": json.dumps(asset.metadata), "created_at": asset.created_at.isoformat(), "updated_at": asset.updated_at.isoformat() }) self.cache[asset.asset_id] = asset return asset.asset_id async def register_sensor(self, sensor: Sensor) -> str: """Register a sensor for an asset""" await self.db.insert("sensors", { "sensor_id": sensor.sensor_id, "asset_id": sensor.asset_id, "sensor_type": sensor.sensor_type, "name": sensor.name, "unit": sensor.unit, "min_value": sensor.min_value, "max_value": sensor.max_value, "sampling_rate_seconds": sensor.sampling_rate_seconds }) return sensor.sensor_id async def get_asset_hierarchy(self, root_asset_id: str) -> Dict: """Get full asset hierarchy starting from root""" # Query all assets with parent relationship all_assets = await self.db.query("assets", {}) # Build hierarchy assets_by_id = {a["asset_id"]: a for a in all_assets} def build_tree(asset_id: str) -> Dict: asset = assets_by_id.get(asset_id, {}) children = [ build_tree(a["asset_id"]) for a in all_assets if a.get("parent_asset_id") == asset_id ] return { **asset, "children": children } return build_tree(root_asset_id) ``` ----- ## Real-Time Synchronization ### Data Pipeline Architecture ```python import asyncio from typing import Callable, Dict, List import json class DigitalTwinSynchronizer: def __init__(self, mqtt_client, timeseries_db, cache): self.mqtt = mqtt_client self.tsdb = timeseries_db self.cache = cache self.subscriptions = {} self.handlers = {} async def start(self): """Start the synchronization service""" # Subscribe to sensor data topics await self.mqtt.subscribe("assets/+/sensors/+/data", self._handle_sensor_data) await self.mqtt.subscribe("assets/+/events/+", self._handle_asset_event) await self.mqtt.subscribe("assets/+/telemetry", self._handle_telemetry) async def _handle_sensor_data(self, topic: str, payload: bytes): """Handle incoming sensor data""" # Parse topic: assets/{asset_id}/sensors/{sensor_id}/data parts = topic.split("/") asset_id = parts[1] sensor_id = parts[3] # Parse payload data = json.loads(payload) # Create reading reading = SensorReading( asset_id=asset_id, sensor_id=sensor_id, timestamp=datetime.fromisoformat(data.get("timestamp", datetime.now().isoformat())), value=data["value"], unit=data.get("unit", ""), quality=DataQuality(data.get("quality", "good")), metadata=data.get("metadata", {}) ) # Ingest to time-series database await self.tsdb.ingest_reading(reading) # Update cache for real-time queries cache_key = f"{asset_id}:{sensor_id}:latest" await self.cache.set(cache_key, json.dumps({ "value": reading.value, "timestamp": reading.timestamp.isoformat() }), ttl=300) # Invoke registered handlers handler_key = f"{asset_id}:{sensor_id}" if handler_key in self.handlers: await self.handlers[handler_key](reading) async def _handle_asset_event(self, topic: str, payload: bytes): """Handle asset events (state changes, alerts, etc.)""" parts = topic.split("/") asset_id = parts[1] event_type = parts[3] event = json.loads(payload) event["asset_id"] = asset_id event["event_type"] = event_type event["timestamp"] = datetime.now().isoformat() # Store event await self.tsdb.ingest_event(event) # Check for alert conditions await self._check_alerts(asset_id, event) def register_handler(self, asset_id: str, sensor_id: str, handler: Callable): """Register a handler for specific asset/sensor""" key = f"{asset_id}:{sensor_id}" self.handlers[key] = handler ``` ### Edge-Cloud Integration ```python import asyncio from enum import Enum class ProcessingTier(Enum): EDGE = "edge" FOG = "fog" CLOUD = "cloud" class DataRouter: def __init__(self, edge_client, fog_nodes, cloud_endpoint): self.edge = edge_client self.fog_nodes = fog_nodes self.cloud = cloud_endpoint self.routing_rules = {} def add_routing_rule( self, data_type: str, tier: ProcessingTier, condition: Callable = None ): """Add a routing rule for data type""" self.routing_rules[data_type] = { "tier": tier, "condition": condition } async def route_data(self, data: Dict) -> Dict: """Route data to appropriate processing tier""" data_type = data.get("data_type", "unknown") rule = self.routing_rules.get(data_type) if rule is None: # Default to cloud return await self._send_to_cloud(data) # Check condition if rule["condition"] and not rule["condition"](data): return await self._send_to_cloud(data) tier = rule["tier"] if tier == ProcessingTier.EDGE: return await self._process_at_edge(data) elif tier == ProcessingTier.FOG: return await self._send_to_fog(data) else: return await self._send_to_cloud(data) async def _process_at_edge(self, data: Dict) -> Dict: """Process data at edge device""" # Apply edge processing logic result = await self.edge.process(data) # If results need cloud storage, send asynchronously if result.get("store_in_cloud"): asyncio.create_task(self._send_to_cloud(result)) return result async def _send_to_fog(self, data: Dict) -> Dict: """Send data to nearest fog node""" # Find nearest fog node fog_node = self._find_nearest_fog(data.get("location"))
GitHub에서 보기
이 SKILL.md는 매우 커서 SkillsMP가 여기에는 첫 섹션만 미리 보여줍니다. GitHub에서 보기