AgentSkillsCN

iiot-isa95-hierarchy

IIoT 资产建模的 ISA-95 设备层次结构。企业 → 站点 → 区域 → 线路 → 细胞 → 设备 → 传感器。

SKILL.md
--- frontmatter
name: iiot-isa95-hierarchy
description: ISA-95 equipment hierarchy for IIoT asset modeling. Enterprise → Site → Area → Line → Cell → Equipment → Sensor.
triggers:
  - "ISA-95"
  - "ISA-88"
  - "equipment hierarchy"
  - "asset hierarchy"
  - "plant model"
  - "production line"
  - "work center"
  - "control module"

IIoT ISA-95 Hierarchy

Overview

ISA-95 (IEC 62264) defines the standard equipment hierarchy for manufacturing. This skill provides guidance for modeling IIoT assets following these industry standards.

Hierarchy Levels

Equipment Hierarchy (Physical Assets)

code
Enterprise
└── Site
    └── Area
        └── Production Line (Work Center)
            └── Work Cell (Work Unit)
                └── Equipment Module
                    └── Control Module (Sensor/Actuator)

Automation Levels (Data Flow / ISA-95 Pyramid)

LevelNameSystemsData Flow
L4Business PlanningERP, BIStrategic planning, finance
L3Manufacturing OperationsMES, MOMProduction scheduling, quality
L2Supervisory ControlSCADA, HMIReal-time monitoring, alarms
L1Automation ControlPLC, DCSProcess control logic
L0Physical ProcessSensors, ActuatorsPhysical measurements

TMNL Schema Mapping

ISA-95 TermTMNL SchemaGraph LabelFile Location
Site/AreaPlant:plantdocker/iiot-db/init.sql:53
Production LineLine:linedocker/iiot-db/init.sql:62
Work CellMachine:machinedocker/iiot-db/init.sql:76
Control ModuleSensor:sensordocker/iiot-db/init.sql:92

Decision Tree: Asset Classification

code
Modeling a physical asset?
│
├─ Facility/Building scope?
│  ├─ Multiple facilities?
│  │  └─ Use: Enterprise (extend schema if needed)
│  └─ Single facility?
│     └─ Use: Plant (ISA-95 Site/Area)
│
├─ Production sequence scope?
│  ├─ Multiple sequential steps?
│  │  └─ Use: Line (ISA-95 Work Center)
│  └─ Single processing area?
│     └─ Use: Area (optional sub-plant zone)
│
├─ Single equipment/machine?
│  ├─ Multiple coordinated units?
│  │  └─ Use: Work Cell (group of machines)
│  └─ Individual machine?
│     └─ Use: Machine (ISA-95 Equipment Module)
│
└─ Measurement/control point?
   ├─ Sensor (reads values)?
   │  └─ Use: Sensor (ISA-95 Control Module)
   └─ Actuator (writes values)?
      └─ Use: Actuator (ISA-95 Control Module)

Graph Relationships (Apache AGE)

Standard Edge Types

RelationshipFromToMeaning
[:contains]PlantLineFacility contains production line
[:contains]LineMachineLine contains equipment
[:monitors]SensorMachineSensor monitors equipment
[:controls]ActuatorMachineActuator controls equipment
[:triggered_by]AlarmSensorAlarm triggered by sensor reading
[:caused]AlarmAlarmAlarm causality chain

Creating Hierarchy in Cypher

sql
-- Create plant (ISA-95 Site)
SELECT * FROM cypher('iiot', $$
    CREATE (:plant {
        id: 'PLANT-A',
        name: 'Chicago Assembly',
        location: 'Chicago, IL',
        timezone: 'America/Chicago'
    })
$$) AS (v agtype);

-- Create line (ISA-95 Work Center)
SELECT * FROM cypher('iiot', $$
    CREATE (:line {
        id: 'LINE-001',
        name: 'Body Assembly',
        plant_id: 'PLANT-A',
        capacity: 60  -- units per hour
    })
$$) AS (v agtype);

-- Create relationship
SELECT * FROM cypher('iiot', $$
    MATCH (p:plant {id: 'PLANT-A'}), (l:line {id: 'LINE-001'})
    CREATE (p)-[:contains]->(l)
$$) AS (e agtype);

-- Create machine (ISA-95 Equipment Module)
SELECT * FROM cypher('iiot', $$
    CREATE (:machine {
        id: 'MCH-001',
        name: 'Welding Robot Alpha',
        model: 'FANUC R-2000iC/210F',
        line_id: 'LINE-001',
        commissioned_date: '2023-01-15'
    })
$$) AS (v agtype);

-- Create sensor (ISA-95 Control Module)
SELECT * FROM cypher('iiot', $$
    CREATE (:sensor {
        device_id: 'TMP-001',
        type: 'temperature',
        unit: 'celsius',
        machine_id: 'MCH-001',
        sample_rate_ms: 1000,
        threshold_high: 30,
        threshold_critical: 35
    })
$$) AS (v agtype);

Querying Hierarchy

sql
-- Get full path from sensor to enterprise
SELECT * FROM cypher('iiot', $$
    MATCH path = (s:sensor {device_id: 'TMP-001'})-[:monitors]->
                 (m:machine)<-[:contains]-
                 (l:line)<-[:contains]-
                 (p:plant)
    RETURN s.device_id, m.name, l.name, p.name
$$) AS (sensor agtype, machine agtype, line agtype, plant agtype);

-- Find all sensors on a specific machine
SELECT * FROM cypher('iiot', $$
    MATCH (m:machine {id: 'MCH-001'})<-[:monitors]-(s:sensor)
    RETURN s.device_id, s.type, s.unit
$$) AS (device_id agtype, type agtype, unit agtype);

-- Get all equipment in a plant (recursive)
SELECT * FROM cypher('iiot', $$
    MATCH (p:plant {id: 'PLANT-A'})-[:contains*]->(asset)
    RETURN labels(asset)[0] AS asset_type, asset.id AS id, asset.name AS name
$$) AS (asset_type agtype, id agtype, name agtype);

Extended Hierarchy (Optional)

For enterprise-scale deployments, extend the schema with additional levels:

typescript
// src/lib/iiot/schemas/assets.ts

import { Schema } from 'effect'

// Branded identifiers
export const EnterpriseId = Schema.String.pipe(Schema.brand('EnterpriseId'))
export const SiteId = Schema.String.pipe(Schema.brand('SiteId'))
export const AreaId = Schema.String.pipe(Schema.brand('AreaId'))
export const PlantId = Schema.String.pipe(Schema.brand('PlantId'))
export const LineId = Schema.String.pipe(Schema.brand('LineId'))
export const MachineId = Schema.String.pipe(Schema.brand('MachineId'))
export const DeviceId = Schema.String.pipe(Schema.brand('DeviceId'))

// Enterprise (multi-site corporation)
export const Enterprise = Schema.TaggedStruct('Enterprise', {
  id: EnterpriseId,
  name: Schema.NonEmptyString,
  industry: Schema.optional(Schema.String),
})

// Site (physical location)
export const Site = Schema.TaggedStruct('Site', {
  id: SiteId,
  name: Schema.NonEmptyString,
  enterpriseId: EnterpriseId,
  location: Schema.optional(Schema.String),
  timezone: Schema.optional(Schema.String),
})

// Area (sub-plant zone)
export const Area = Schema.TaggedStruct('Area', {
  id: AreaId,
  name: Schema.NonEmptyString,
  siteId: SiteId,
  type: Schema.optional(Schema.Literal('production', 'warehouse', 'maintenance')),
})

// Plant (our current top-level)
export const Plant = Schema.TaggedStruct('Plant', {
  id: PlantId,
  name: Schema.NonEmptyString,
  areaId: Schema.optional(AreaId),  // Optional if using simplified hierarchy
  location: Schema.optional(Schema.String),
})

// Line (production line)
export const Line = Schema.TaggedStruct('Line', {
  id: LineId,
  name: Schema.NonEmptyString,
  plantId: PlantId,
  capacity: Schema.optional(Schema.Number),
})

// Machine (equipment)
export const Machine = Schema.TaggedStruct('Machine', {
  id: MachineId,
  name: Schema.NonEmptyString,
  model: Schema.optional(Schema.String),
  lineId: LineId,
  commissionedDate: Schema.optional(Schema.DateFromString),
})

// Sensor type enumeration
export const SensorType = Schema.Literal(
  'temperature',
  'vibration',
  'humidity',
  'pressure',
  'speed',
  'current',
  'voltage',
  'flow',
  'level'
)

// Sensor (control module)
export const Sensor = Schema.TaggedStruct('Sensor', {
  deviceId: DeviceId,
  type: SensorType,
  unit: Schema.NonEmptyString,
  machineId: MachineId,
  sampleRateMs: Schema.optional(Schema.Number),
  thresholdHigh: Schema.optional(Schema.Number),
  thresholdCritical: Schema.optional(Schema.Number),
})

ISA-88 Integration (Batch Manufacturing)

For batch processes, ISA-88 provides additional concepts:

ISA-88 TermDescriptionUse Case
Process CellLogical grouping for batchChemical reactors
UnitEquipment that performs batchMixing tank
Equipment ModuleFunctional group within unitAgitator, heater
Control ModuleSingle deviceTemperature sensor
RecipeProcedure definitionBatch instructions
PhaseRecipe stepHeat, Mix, Cool

These map to the same physical hierarchy but add procedural concepts for batch control.

Best Practices

Naming Conventions

Asset TypePatternExample
PlantPLANT-{CODE}PLANT-A, PLANT-CHI
LineLINE-{NNN}LINE-001, LINE-042
MachineMCH-{NNN}MCH-001, MCH-123
Sensor{TYPE}-{NNN}TMP-001, VIB-002
AlarmALM-{UUID}ALM-abc123...

Sensor Type Prefixes

PrefixTypeUnit
TMPTemperaturecelsius, fahrenheit
VIBVibrationmm/s, g
HUMHumiditypercent
PRSPressurebar, psi
SPDSpeedm/min, rpm
CURCurrentamps
VLTVoltagevolts
FLWFlowL/min, gal/hr
LVLLevelpercent, meters

Related Skills

  • /iiot-unified-namespace - Topic hierarchy and data flow
  • /nex-effect-services - Effect-TS service patterns
  • /effect-schema-mastery - Schema definition patterns

References