@operato/ops-contract 0.9.48 → 0.9.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ IEC 61850 · ISO 50001 전기 계통과 성과지표
13
13
 
14
14
  ## 패키지의 책임
15
15
 
16
- 여기 있는 것은 **타입 · 판별 함수 · 정합 검증 · 어휘 상수**입니다. **인자만 보고 답합니다** — 상태도 시계도 갖지 않습니다.
16
+ 이 패키지는 **타입, 판별 함수, 정합성 검사, 공통 상수**를 제공합니다. 함수는 전달받은 인자만 사용하며, 내부 상태나 현재 시각에 의존하지 않습니다.
17
17
 
18
18
  여기 없는 것은 **정책과 엔진**입니다. 그 사실로 무엇을 할지는 `@operato/twin-kernel` 이 정합니다.
19
19
 
@@ -94,10 +94,17 @@ assertOperationalAttentionV1(attention)
94
94
  `locationStatusOf` · `dockDoorStatusOf`(도어의 동시 수용 한도 `dockDoorCapacityOf` — 정수, 최소 1, 1.5 는 1). 이 기준을 넘는 판정 — 예약 규칙 · 우선순위 ·
95
95
  아래 생산자의 전이 판정 — 은 계약에 올리지 않습니다.
96
96
 
97
- **전기 요금표 읽기**(`tariff.ts`, 2026-11-27) — 요금제와 시간대 구간은 ops-master 가 저장하고, 이 계약은 「이 순간의 단가」(`bandAt`)와
98
- 「구간이 하루를 빈틈없이 덮나」(`tariffCoverageIssues`)를 정합니다. 문제는 문장이 아니라 `{ field, code, params }` 로 냅니다(화면이 번역).
99
- 원천 사실의 단가(`EnergyUsagePeriodData.unitPrice`)가 마스터의 구간 단가를 이깁니다. 새 나라는 행으로 옵니다 — 구간 코드는 요금제의 것이고
100
- 견주기용 등급(`TARIFF_LOAD_CLASSES`)만 닫혀 있으며, 일요일과 공휴일은 따로(공휴일이 요일보다 앞섬), 공휴일 달력은 요금제가 이름으로 가리킵니다.
97
+ **구내 반송**(2026-12-03, operato-application ADR-0266) — 새 온톨로지가 아니라 기존 축에 선택 칸을 더했습니다.
98
+ 경로망은 자리 사이의 연결(`route-network.ts` — 길이 · 방향 · 속도 제한 · 동시 점유 수 · 지나갈 수 있는 장비 분류, 고정 경로, 발행 판)이고
99
+ 좌표는 담지 않습니다. 구조 검사(`validateRouteNetwork`)만 여기서 하고, 도달 가능성 같은 그래프 탐색은 판단하는 쪽(앱의 규칙, 커널의 실행 정책)이 합니다.
100
+ 관제를 받는 장비는 능력 `guided` 와 운행 상태(`travel.ts` — 마지막으로 지난 자리 · 진행 방향 · 예약 구간 · 통신 상태 · 측정 위치)를 갖고,
101
+ 배터리는 `energyStoring` 의 `soc` 를 씁니다. 반송 어휘는 `intralogistics-profile.ts`, 정책의 선언(규칙 이름 · 파라미터)은 `transport-policy.ts`,
102
+ 용기가 실을 수 있는 품목은 `asset-acceptance.ts`(받는다 · 안 받는다 · 판단할 수 없다)입니다. 운행 사건 넷을 상태로 접는 일은 커널의 다음 단계입니다.
103
+
104
+ **전기 요금표 읽기**(`tariff.ts`, 2026-11-27) — 요금제와 시간대 구간은 ops-master가 저장합니다. 이 계약은 지정한 시각의 단가(`bandAt`)와
105
+ 하루 24시간에 요금 구간이 빠짐없이 지정됐는지(`tariffCoverageIssues`)를 판정합니다. 검사 결과는 `{ field, code, params }` 형식으로 반환하고 화면에서 번역합니다.
106
+ 원천 사실의 단가(`EnergyUsagePeriodData.unitPrice`)를 마스터에 설정한 구간 단가보다 우선 적용합니다. 새 국가의 요금은 데이터 행으로 추가합니다. 구간 코드는 요금제별로 정의하고,
107
+ 요금 비교에 쓰는 등급(`TARIFF_LOAD_CLASSES`)만 고정합니다. 일요일과 공휴일은 구분하며, 공휴일 규칙을 요일 규칙보다 우선 적용합니다. 요금제는 공휴일 달력을 이름으로 참조합니다.
101
108
 
102
109
  > **기준의 예외 하나 — 예정된 두 번째 소비처.** 지금 이 규칙을 부르는 곳은 ops-master 하나입니다. ems 커넥터가 붙으면
103
110
  > (operato-application `design/charters/operato-energy.md` §4) 원천 사실에 단가가 없는 구간마다 `bandAt` 으로 단가를 구해 사용량 요금을 더하고,
@@ -0,0 +1,27 @@
1
+ import type { ResourceProperty } from './contract.ts';
2
+ export interface AssetAcceptance {
3
+ materialDefinitionIds?: string[];
4
+ materialClassIds?: string[];
5
+ /** At most this much in one carrier. */
6
+ maxQuantity?: {
7
+ value: number;
8
+ uom: string;
9
+ };
10
+ /** Conditions such as dividers or temperature keeping. Carried, not judged here. */
11
+ properties?: ResourceProperty[];
12
+ }
13
+ export interface AcceptanceQuery {
14
+ materialDefinitionId?: string;
15
+ /** The material's classes, base classes included if the caller wants them counted. */
16
+ materialClassIds?: readonly string[];
17
+ quantity?: {
18
+ value: number;
19
+ uom: string;
20
+ };
21
+ }
22
+ /**
23
+ * Whether an asset class with `accepts` may carry this material (and this quantity).
24
+ *
25
+ * `undefined` when it cannot tell: nothing declared, no material named, or a quantity in a unit other than the declared maximum's.
26
+ */
27
+ export declare function acceptsMaterial(accepts: AssetAcceptance | undefined, query: AcceptanceQuery): boolean | undefined;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Whether an asset class with `accepts` may carry this material (and this quantity).
3
+ *
4
+ * `undefined` when it cannot tell: nothing declared, no material named, or a quantity in a unit other than the declared maximum's.
5
+ */
6
+ export function acceptsMaterial(accepts, query) {
7
+ if (!accepts)
8
+ return undefined;
9
+ const defs = accepts.materialDefinitionIds ?? [];
10
+ const classes = accepts.materialClassIds ?? [];
11
+ const named = query.materialDefinitionId !== undefined || (query.materialClassIds?.length ?? 0) > 0;
12
+ if (!named)
13
+ return undefined;
14
+ let material;
15
+ if (defs.length === 0 && classes.length === 0)
16
+ material = undefined;
17
+ else {
18
+ const byDef = query.materialDefinitionId !== undefined && defs.includes(query.materialDefinitionId);
19
+ const byClass = (query.materialClassIds ?? []).some(id => classes.includes(id));
20
+ material = byDef || byClass;
21
+ }
22
+ if (material === false)
23
+ return false;
24
+ let quantity = true;
25
+ if (query.quantity && accepts.maxQuantity) {
26
+ quantity = query.quantity.uom === accepts.maxQuantity.uom ? query.quantity.value <= accepts.maxQuantity.value : undefined;
27
+ }
28
+ if (quantity === false)
29
+ return false;
30
+ if (material === undefined || quantity === undefined)
31
+ return undefined;
32
+ return true;
33
+ }
@@ -1,5 +1,5 @@
1
1
  import type { EquipmentStatus } from './contract.ts';
2
- export type CapabilityKey = 'operable' | 'storable' | 'mobile' | 'processable' | 'trackable' | 'switching' | 'metered' | 'curtailable' | 'energyGenerating' | 'energyStoring';
2
+ export type CapabilityKey = 'operable' | 'storable' | 'mobile' | 'processable' | 'trackable' | 'switching' | 'metered' | 'curtailable' | 'energyGenerating' | 'energyStoring' | 'guided';
3
3
  /** 이동 관측 — Mobile 이 노출. */
4
4
  export interface Motion {
5
5
  fromNode: string;
@@ -88,9 +88,24 @@ export const CAPABILITIES = {
88
88
  key: 'energyStoring', label: 'twin.capability.energyStoring', semantics: '전력을 저장하고 공급합니다. 손실과 수명을 평가할 수 있도록 충전과 방전을 구분합니다.',
89
89
  commands: [],
90
90
  stateFields: ['soc', 'chargeKW', 'dischargeKW'], models: ['StoringState'], invariants: ['0 <= soc <= 100'], results: ['stored', 'discharged']
91
+ },
92
+ /*
93
+ * ── Guided — travels the route network under transport control (2026-12-03, operato-application ADR-0266) ──────────────
94
+ *
95
+ * `mobile` says a resource moves between locations; a forklift a person drives has it. Last location passed, reserved
96
+ * connections and link state mean something only for equipment under transport control, so they are a capability of their
97
+ * own, declared together with `mobile`. Battery is not repeated here: guided equipment declares `energyStoring` as well.
98
+ *
99
+ * No commands. The twin does not drive robots: dispatch, pause and resume are the transport control product's instructions
100
+ * to its equipment (VDA 5050 instant actions), not stimuli inside the kernel, so they do not belong in `CMD`.
101
+ */
102
+ guided: {
103
+ key: 'guided', label: 'twin.capability.guided', semantics: '경로망 위를 관제에 따라 다니는 장비 — 마지막으로 지난 자리 · 진행 방향 · 예약 구간 · 통신 상태 · 측정 위치. mobile 과 함께 선언한다.',
104
+ commands: [],
105
+ stateFields: ['travel'], models: ['TravelState'], invariants: ['guided => mobile', '0 <= heading < 360'], results: ['passed', 'reserved', 'linkChanged', 'poseReported']
91
106
  }
92
107
  };
93
- export const CAPABILITY_KEYS = ['operable', 'storable', 'mobile', 'processable', 'trackable', 'switching', 'metered', 'curtailable', 'energyGenerating', 'energyStoring'];
108
+ export const CAPABILITY_KEYS = ['operable', 'storable', 'mobile', 'processable', 'trackable', 'switching', 'metered', 'curtailable', 'energyGenerating', 'energyStoring', 'guided'];
94
109
  /** 능력 집합이 관측 노출하는 상태 필드 합집합(직교이므로 단순 병합). */
95
110
  export function stateFieldsOf(caps) {
96
111
  const out = new Set();
@@ -1,6 +1,10 @@
1
1
  import { type RatedUsage, type UsedUsage } from './rated-usage.ts';
2
2
  import type { FoldedOrders, OrderFoldPolicy } from './order-fold.ts';
3
3
  import type { ReferencedLocation } from './referenced-location.ts';
4
+ import type { FixedRoute, LocationConnection, RouteNetworkEdition } from './route-network.ts';
5
+ import type { TravelState } from './travel.ts';
6
+ import type { TransportPolicySet } from './transport-policy.ts';
7
+ import type { AssetAcceptance } from './asset-acceptance.ts';
4
8
  export type ISOTime = string;
5
9
  export interface CanonicalEnvelope<T = unknown> {
6
10
  eventId: string;
@@ -860,6 +864,8 @@ export interface ResourceClassDef extends EffectivePeriod {
860
864
  properties?: ResourceProperty[];
861
865
  /** 이 등급의 적격을 정하는 시험 명세들 — 표준 `TestSpecificationID`. */
862
866
  testSpecificationIds?: TestSpecificationRefs;
867
+ /** What a carrier of this asset class may hold (ADR-0266 decision 8 ③, `asset-acceptance.ts`). Meaningful on asset classes only. */
868
+ accepts?: AssetAcceptance;
863
869
  }
864
870
  export declare function classClosure(directIds: readonly string[] | undefined, defs: readonly ResourceClassDef[] | undefined, at?: ISOTime): Set<string>;
865
871
  /**
@@ -1680,6 +1686,8 @@ export interface EquipmentState extends EffectivePeriod {
1680
1686
  status: string;
1681
1687
  taskId?: string;
1682
1688
  motion?: EquipmentMotion;
1689
+ /** Where guided equipment is on the route network (`guided` capability, `travel.ts`). Absent for equipment that is not guided. */
1690
+ travel?: TravelState;
1683
1691
  oee?: OeeMetrics;
1684
1692
  held?: boolean;
1685
1693
  /**
@@ -2958,6 +2966,10 @@ export declare const OP_EVENT: {
2958
2966
  * 두 채널을 합치지 않는 이유는 에너지 쪽이 **구간에 누적되는 표본**이라 처리가 다르기 때문이다.
2959
2967
  */
2960
2968
  readonly observation: "location.measured";
2969
+ readonly travelPassed: "equipment.passed";
2970
+ readonly travelReservation: "equipment.reservation";
2971
+ readonly travelLink: "equipment.link";
2972
+ readonly travelPose: "equipment.pose";
2961
2973
  };
2962
2974
  /**
2963
2975
  * 에너지 트윈의 사건 — **물(物)의 계보가 아니라 스칼라의 시계열.**
@@ -3909,6 +3921,20 @@ export interface TwinModelDef {
3909
3921
  * 물품은 이 트윈의 재고에서 빠진다. 없으면 참조하는 자리가 없다.
3910
3922
  */
3911
3923
  referencedLocations?: ReferencedLocation[];
3924
+ /**
3925
+ * **Route network** - the paths guided equipment travels (operato-application ADR-0266 decision 8 ①, `route-network.ts`).
3926
+ * The places are locations; these are the edges between them and the ordered edge lists some equipment must follow.
3927
+ * No coordinates: geometry is the board's. `routeNetwork` names the published edition both simulation and live control read.
3928
+ */
3929
+ connections?: LocationConnection[];
3930
+ fixedRoutes?: FixedRoute[];
3931
+ routeNetwork?: RouteNetworkEdition;
3932
+ /**
3933
+ * **Transport policy** - the dispatch, routing, traffic, charging and alternate-destination rules transport control and its
3934
+ * simulation decide by (ADR-0266 decision 8 ⑤, `transport-policy.ts`). Versioned; a declaration of the twin, like
3935
+ * `allocationPolicy`, not an axis.
3936
+ */
3937
+ transportPolicy?: TransportPolicySet;
3912
3938
  /**
3913
3939
  * 설비 — ISA-95 `Equipment`. mtbfMs/mttrMs 지정 시 확률적 고장 모델 참여(OEE Availability 손실).
3914
3940
  * 미지정=고장 없음. `window` 지정 시 그 시간대에만 일한다(교대·가동시간) — 미지정이면 24시간 가용.
package/dist/contract.js CHANGED
@@ -1271,7 +1271,21 @@ export const OP_EVENT = {
1271
1271
  * 이름을 `energy.measured` 와 같은 결로 둔다 — 그쪽이 에너지 계량의 도착이고 이쪽이 그 일반형이다.
1272
1272
  * 두 채널을 합치지 않는 이유는 에너지 쪽이 **구간에 누적되는 표본**이라 처리가 다르기 때문이다.
1273
1273
  */
1274
- observation: 'location.measured'
1274
+ observation: 'location.measured',
1275
+ /*
1276
+ * ── Travel of guided equipment (2026-12-03, operato-application ADR-0266 decision 8 ②, `travel.ts`) ────────────────────
1277
+ *
1278
+ * The four facts that carry `EquipmentState.travel` into the journal (state ⊆ events). Sent on change, never per tick.
1279
+ * Payloads: `TravelPassedFact` · `TravelReservationFact` · `TravelLinkFact` · `TravelPoseFact`.
1280
+ *
1281
+ * The transport control product sends them as canonical envelopes, so they need no connector mapping in
1282
+ * `operational-ingest`. Folding them into state is the kernel's next stage (ADR-0266 §5 stage 6); until then the mirror
1283
+ * does not show travel.
1284
+ */
1285
+ travelPassed: 'equipment.passed',
1286
+ travelReservation: 'equipment.reservation',
1287
+ travelLink: 'equipment.link',
1288
+ travelPose: 'equipment.pose'
1275
1289
  };
1276
1290
  // ── 에너지(EMS) 사건 — 네 번째 종류의 어휘 ────────────────────────────────
1277
1291
  /**
@@ -20,7 +20,7 @@ import type { EquipmentLevel } from './contract.ts';
20
20
  * ⚠ **복수형이 정본이다.** 이 이름이 `TwinModelDef` 의 키 그대로여야 하고(그 키가 복수다), 어긋나면
21
21
  * 저장된 이름과 화면이 부르는 이름이 달라진다 — 그 어긋남은 오류를 내지 않고 **빈 목록**을 돌려준다.
22
22
  */
23
- export type TwinAxis = 'locations' | 'equipment' | 'persons' | 'assets' | 'materials' | 'materialDefinitions' | 'items' | 'operations' | 'orders' | 'tasks' | 'recipes' | 'routes' | 'productionSpec' | 'testSpecifications' | 'demandWindows' | 'equipmentClasses' | 'personnelClasses' | 'materialClasses' | 'assetClasses';
23
+ export type TwinAxis = 'locations' | 'equipment' | 'persons' | 'assets' | 'materials' | 'materialDefinitions' | 'items' | 'operations' | 'orders' | 'tasks' | 'recipes' | 'routes' | 'productionSpec' | 'testSpecifications' | 'demandWindows' | 'equipmentClasses' | 'personnelClasses' | 'materialClasses' | 'assetClasses' | 'connections' | 'fixedRoutes';
24
24
  /**
25
25
  * 트윈의 종류 — 한 현실을 비추는 렌즈의 갈래.
26
26
  *
@@ -231,7 +231,18 @@ export const TWIN_AXES = [
231
231
  * 선언이 답하게 한다 — 축이 사는 자리(`path`)를 선언하는 것과 같은 이유다.
232
232
  */
233
233
  { axis: 'demandWindows', path: 'energy.closed', idField: 'startMs', label: 'twin.axis.demandWindows', kind: 'instance',
234
- source: 'state', historical: true, standardClass: {}, systems: ['ems'] }
234
+ source: 'state', historical: true, standardClass: {}, systems: ['ems'] },
235
+ /*
236
+ * ── Route network (2026-12-03, operato-application ADR-0266 decision 8 ①) ──────────────────────────
237
+ *
238
+ * The edges guided equipment travels between locations, and the ordered edge lists some equipment must follow.
239
+ * No standard names them: ISA-95 and EPCIS have no route network, and VDA 5050 is a protocol, not an ontology this
240
+ * catalogue projects to. So `standardClass` stays empty rather than borrowing a near name.
241
+ *
242
+ * An energy twin has no travelling equipment, so both axes are logistics-only (`LOGISTICS`).
243
+ */
244
+ { axis: 'connections', path: 'connections', label: 'twin.axis.connections', kind: 'instance', standardClass: {}, systems: LOGISTICS },
245
+ { axis: 'fixedRoutes', path: 'fixedRoutes', label: 'twin.axis.fixedRoutes', kind: 'spec', standardClass: {}, systems: LOGISTICS }
235
246
  ];
236
247
  /**
237
248
  * 화면이 이 관계를 **담아 두어도 되나** — `standing` 만 그렇다.
@@ -349,7 +360,20 @@ export const TWIN_RELATIONS = [
349
360
  { from: 'materialClasses', field: 'testSpecificationIds[]', target: { kind: 'axis', axis: 'testSpecifications' }, via: 'ops.rel.test', optional: true, tense: 'standing' },
350
361
  /* 공정이 도는 자리·자원 — 항목이 아니라 **타입**을 가리킨다 */
351
362
  { from: 'operations', field: 'locationType', target: { kind: 'type', role: 'location' }, via: 'ops.rel.at', optional: true, tense: 'standing' },
352
- { from: 'operations', field: 'resourceType', target: { kind: 'type', role: 'equipment' }, via: 'ops.rel.by', optional: true, tense: 'standing' }
363
+ { from: 'operations', field: 'resourceType', target: { kind: 'type', role: 'equipment' }, via: 'ops.rel.by', optional: true, tense: 'standing' },
364
+ /*
365
+ * Route network (ADR-0266). A connection's ends are locations of this lens or referenced ones of another lens
366
+ * (`referencedLocations`), so the target is the either-kind, like `locations.parentId`. Structure inside a published
367
+ * edition has no time of its own - it holds for as long as the edition does - so these are `standing`, like a location's parent.
368
+ */
369
+ { from: 'connections', field: 'from', target: { kind: 'axis-or-external', axis: 'locations', entity: 'lens.referencedLocation' }, via: 'ops.rel.from', tense: 'standing' },
370
+ { from: 'connections', field: 'to', target: { kind: 'axis-or-external', axis: 'locations', entity: 'lens.referencedLocation' }, via: 'ops.rel.to', tense: 'standing' },
371
+ { from: 'connections', field: 'equipmentClassIds[]', target: { kind: 'axis', axis: 'equipmentClasses' }, via: 'ops.rel.allows', optional: true, tense: 'standing' },
372
+ { from: 'fixedRoutes', field: 'connectionIds[]', target: { kind: 'axis', axis: 'connections' }, via: 'ops.rel.along', tense: 'standing' },
373
+ { from: 'fixedRoutes', field: 'equipmentClassIds[]', target: { kind: 'axis', axis: 'equipmentClasses' }, via: 'ops.rel.allows', optional: true, tense: 'standing' },
374
+ /* What a carrier accepts (ADR-0266 decision 8 ③) - a property of the asset class, so standing like the class itself. */
375
+ { from: 'assetClasses', field: 'accepts.materialDefinitionIds[]', target: { kind: 'axis', axis: 'materialDefinitions' }, via: 'ops.rel.accepts', optional: true, tense: 'standing' },
376
+ { from: 'assetClasses', field: 'accepts.materialClassIds[]', target: { kind: 'axis', axis: 'materialClasses' }, via: 'ops.rel.accepts', optional: true, tense: 'standing' }
353
377
  ];
354
378
  /**
355
379
  * 오늘 **실제로 짝이 서는 것**만 선언한다. 그럴듯한 속성을 미리 적어 두면 화면이 빈칸을 줄줄이
package/dist/index.d.ts CHANGED
@@ -10,6 +10,11 @@ export * from './epcis.ts';
10
10
  export * from './gs1.ts';
11
11
  export * from './order-fold.ts';
12
12
  export * from './referenced-location.ts';
13
+ export * from './route-network.ts';
14
+ export * from './travel.ts';
15
+ export * from './intralogistics-profile.ts';
16
+ export * from './transport-policy.ts';
17
+ export * from './asset-acceptance.ts';
13
18
  export * from './face2-adapter.ts';
14
19
  export * from './iso-duration.ts';
15
20
  export * from './master-data.ts';
package/dist/index.js CHANGED
@@ -31,6 +31,11 @@ export * from "./epcis.js";
31
31
  export * from "./gs1.js";
32
32
  export * from "./order-fold.js";
33
33
  export * from "./referenced-location.js";
34
+ export * from "./route-network.js";
35
+ export * from "./travel.js";
36
+ export * from "./intralogistics-profile.js";
37
+ export * from "./transport-policy.js";
38
+ export * from "./asset-acceptance.js";
34
39
  export * from "./face2-adapter.js";
35
40
  export * from "./iso-duration.js";
36
41
  export * from "./master-data.js";
@@ -0,0 +1,80 @@
1
+ import type { TwinTypeInfo } from './domain-catalog.ts';
2
+ /**
3
+ * CBV steps for a carrier moving between ports. All three are CBV's own (ref.gs1.org/cbv) - checked by the CBV bizStep test.
4
+ *
5
+ * The transport control product speaks only of the carrier (GRAI). Stock moving in or out is the warehouse's and the plant's to say
6
+ * (ADR-0266 decision 9) - items in the carrier follow through `carriedBy`.
7
+ */
8
+ export declare const ILG_BIZSTEP: {
9
+ /** The carrier left a port. */
10
+ readonly departing: "urn:epcglobal:cbv:bizstep:departing";
11
+ /** The carrier reached a port. */
12
+ readonly arriving: "urn:epcglobal:cbv:bizstep:arriving";
13
+ /** The carrier is on its way. */
14
+ readonly transporting: "urn:epcglobal:cbv:bizstep:transporting";
15
+ };
16
+ /** Location types of the route network. */
17
+ export declare const ILG_LOCATION_TYPES: readonly ["waypoint", "port", "charger", "parking"];
18
+ export type IlgLocationType = (typeof ILG_LOCATION_TYPES)[number];
19
+ export declare const ILG_TYPES: TwinTypeInfo[];
20
+ /** This list's entry for a type key, or `undefined`. */
21
+ export declare function intralogisticsTypeOf(key: string): TwinTypeInfo | undefined;
22
+ /** A transport command (MCS) - `OrderState.kind`. */
23
+ export declare const ILG_ORDER_KIND: {
24
+ readonly transport: "transport";
25
+ };
26
+ export type IlgOrderKind = (typeof ILG_ORDER_KIND)[keyof typeof ILG_ORDER_KIND];
27
+ /**
28
+ * Transport jobs (MCS) - `TaskState.kind`.
29
+ *
30
+ * · `transport-leg` - one leg, port to port. A command can split into several legs (a stop on the way, an alternate destination).
31
+ * · `charge` - occupies a charger. Charging takes a place, so it is a task.
32
+ * · `park` - to a parking spot.
33
+ */
34
+ export declare const ILG_TASK_KIND: {
35
+ readonly leg: "transport-leg";
36
+ readonly charge: "charge";
37
+ readonly park: "park";
38
+ };
39
+ export type IlgTaskKind = (typeof ILG_TASK_KIND)[keyof typeof ILG_TASK_KIND];
40
+ /**
41
+ * Why a transport command failed. Closed: a reason the receiver does not know cannot be shown or counted. Values are refusal codes
42
+ * (kebab-case); wording is the presentation layer's.
43
+ */
44
+ export declare const TRANSPORT_FAILURE_REASON: readonly ["no-route", "destination-unavailable", "carrier-not-found", "carrier-mismatch", "cancelled-by-source", "equipment-fault"];
45
+ export type TransportFailureReason = (typeof TRANSPORT_FAILURE_REASON)[number];
46
+ export declare function isTransportFailureReason(v: unknown): v is TransportFailureReason;
47
+ /**
48
+ * Operational attention kinds the transport control product raises - `<product>.<code>` (`operational-attention.ts`).
49
+ * Keys and values only; no sentences (the kernel's rule for attentions).
50
+ */
51
+ export declare const ILG_ATTENTION_KIND: {
52
+ readonly deadlock: "intralogic.traffic-deadlock";
53
+ readonly blocked: "intralogic.traffic-blocked";
54
+ readonly lowCharge: "intralogic.low-charge";
55
+ readonly linkLost: "intralogic.link-lost";
56
+ readonly noRoute: "intralogic.no-route";
57
+ readonly rerouted: "intralogic.rerouted";
58
+ readonly carrierUnidentified: "intralogic.carrier-unidentified";
59
+ readonly carrierDuplicate: "intralogic.carrier-duplicate";
60
+ };
61
+ export type IlgAttentionKind = (typeof ILG_ATTENTION_KIND)[keyof typeof ILG_ATTENTION_KIND];
62
+ /**
63
+ * What a transport command carries beyond the common order fields.
64
+ *
65
+ * `sourceRef` is the upper system's own reference - a warehouse task id, a material move's `moveId`, a production order id. It is
66
+ * another product's id, so it is not declared as a relation into an axis.
67
+ */
68
+ export interface TransportCommandAttributes {
69
+ /** `assets.id` of the carrier to move. */
70
+ carrierId: string;
71
+ from: string;
72
+ to: string;
73
+ /** Larger first. Absent = the policy's default. */
74
+ priority?: number;
75
+ dueAt?: string;
76
+ sourceRef?: {
77
+ system: string;
78
+ id: string;
79
+ };
80
+ }
@@ -0,0 +1,113 @@
1
+ /*
2
+ * **Intralogistics vocabulary** - transport control inside a plant or warehouse (operato-application ADR-0266 decision 8 ④).
3
+ *
4
+ * Not a new twin area (ADR-0266 decision 5): transport crosses wms, mes and yms (warehouse to line, dock to warehouse), and a fact
5
+ * goes to the area its location declares (ADR-0081). This file names the words those facts use, the way the wms and yms profiles
6
+ * do, so the transport control product and the twin spell them once.
7
+ *
8
+ * Semiconductor MCS words map onto existing axes: a carrier is an asset (GS1 GRAI), a port is a location whose parent is its
9
+ * machine's location, a transport command is an order and a transport job is a task.
10
+ *
11
+ * The types here are not entries of `DOMAIN_CATALOG`. That catalogue gives every equipment type one owning area and every logistics
12
+ * location type `storable`; guided equipment works in several areas, and a waypoint holds nothing. How a host resolves these types
13
+ * next to an area's own is the kernel stage's decision (ADR-0266 §5 stage 6) - `intralogisticsTypeOf` answers for this list.
14
+ */
15
+ /**
16
+ * CBV steps for a carrier moving between ports. All three are CBV's own (ref.gs1.org/cbv) - checked by the CBV bizStep test.
17
+ *
18
+ * The transport control product speaks only of the carrier (GRAI). Stock moving in or out is the warehouse's and the plant's to say
19
+ * (ADR-0266 decision 9) - items in the carrier follow through `carriedBy`.
20
+ */
21
+ export const ILG_BIZSTEP = {
22
+ /** The carrier left a port. */
23
+ departing: 'urn:epcglobal:cbv:bizstep:departing',
24
+ /** The carrier reached a port. */
25
+ arriving: 'urn:epcglobal:cbv:bizstep:arriving',
26
+ /** The carrier is on its way. */
27
+ transporting: 'urn:epcglobal:cbv:bizstep:transporting'
28
+ };
29
+ /** Location types of the route network. */
30
+ export const ILG_LOCATION_TYPES = ['waypoint', 'port', 'charger', 'parking'];
31
+ /**
32
+ * ISA-95 level of each location type.
33
+ *
34
+ * · `port` - one carrier stays there for a while: `StorageUnit`.
35
+ * · `waypoint` - neither storage nor work, a point passed through. The standard's escape is `Other`; writing `StorageUnit` would
36
+ * make a roll-up count waypoints as storage and the occupancy rate false (the same judgement as the yard's `gate`).
37
+ * · `charger` · `parking` - equipment stands there, not goods: `Other`.
38
+ */
39
+ const ILG_LOCATION_LEVEL = {
40
+ waypoint: 'Other',
41
+ port: 'StorageUnit',
42
+ charger: 'Other',
43
+ parking: 'Other'
44
+ };
45
+ /**
46
+ * Only the port holds goods (`storable`). A waypoint, a charger and a parking spot declare no capability of their own: a charger's
47
+ * metering belongs to the energy twin's segment that shares its location id.
48
+ */
49
+ const ILG_LOCATION_CAPABILITIES = {
50
+ waypoint: [],
51
+ port: ['storable'],
52
+ charger: [],
53
+ parking: []
54
+ };
55
+ export const ILG_TYPES = [
56
+ ...ILG_LOCATION_TYPES.map((k) => ({
57
+ key: k, role: 'location', label: `twin.type.${k}`, standardClass: { epcis: 'bizLocation' }, identity: { scheme: 'gs1:SGLN' },
58
+ level: ILG_LOCATION_LEVEL[k], capabilities: ILG_LOCATION_CAPABILITIES[k]
59
+ })),
60
+ /* A forklift under transport control keeps the wms `forklift` type and adds `guided` in the site's own declaration. */
61
+ { key: 'amr', role: 'equipment', label: 'twin.type.amr', standardClass: { epcis: 'object', iso55000: 'Asset' }, identity: { scheme: 'gs1:GIAI' }, capabilities: ['mobile', 'guided', 'operable', 'energyStoring'] },
62
+ { key: 'agv', role: 'equipment', label: 'twin.type.agv', standardClass: { epcis: 'object', iso55000: 'Asset' }, identity: { scheme: 'gs1:GIAI' }, capabilities: ['mobile', 'guided', 'operable', 'energyStoring'] }
63
+ ];
64
+ /** This list's entry for a type key, or `undefined`. */
65
+ export function intralogisticsTypeOf(key) {
66
+ return ILG_TYPES.find(t => t.key === key);
67
+ }
68
+ /** A transport command (MCS) - `OrderState.kind`. */
69
+ export const ILG_ORDER_KIND = {
70
+ transport: 'transport'
71
+ };
72
+ /**
73
+ * Transport jobs (MCS) - `TaskState.kind`.
74
+ *
75
+ * · `transport-leg` - one leg, port to port. A command can split into several legs (a stop on the way, an alternate destination).
76
+ * · `charge` - occupies a charger. Charging takes a place, so it is a task.
77
+ * · `park` - to a parking spot.
78
+ */
79
+ export const ILG_TASK_KIND = {
80
+ leg: 'transport-leg',
81
+ charge: 'charge',
82
+ park: 'park'
83
+ };
84
+ /**
85
+ * Why a transport command failed. Closed: a reason the receiver does not know cannot be shown or counted. Values are refusal codes
86
+ * (kebab-case); wording is the presentation layer's.
87
+ */
88
+ export const TRANSPORT_FAILURE_REASON = [
89
+ 'no-route',
90
+ 'destination-unavailable',
91
+ 'carrier-not-found',
92
+ /** The carrier identified at pick-up is not the one the command named. */
93
+ 'carrier-mismatch',
94
+ 'cancelled-by-source',
95
+ 'equipment-fault'
96
+ ];
97
+ export function isTransportFailureReason(v) {
98
+ return typeof v === 'string' && TRANSPORT_FAILURE_REASON.includes(v);
99
+ }
100
+ /**
101
+ * Operational attention kinds the transport control product raises - `<product>.<code>` (`operational-attention.ts`).
102
+ * Keys and values only; no sentences (the kernel's rule for attentions).
103
+ */
104
+ export const ILG_ATTENTION_KIND = {
105
+ deadlock: 'intralogic.traffic-deadlock',
106
+ blocked: 'intralogic.traffic-blocked',
107
+ lowCharge: 'intralogic.low-charge',
108
+ linkLost: 'intralogic.link-lost',
109
+ noRoute: 'intralogic.no-route',
110
+ rerouted: 'intralogic.rerouted',
111
+ carrierUnidentified: 'intralogic.carrier-unidentified',
112
+ carrierDuplicate: 'intralogic.carrier-duplicate'
113
+ };
@@ -0,0 +1,84 @@
1
+ import type { EffectivePeriod, ISOTime, RefusalParams, ResourceClassDef, ResourceProperty } from './contract.ts';
2
+ /** A path from one location to another. VDA 5050 `edge`. */
3
+ export interface LocationConnection extends EffectivePeriod {
4
+ id: string;
5
+ /** `locations.id` (or a referenced location of another lens). */
6
+ from: string;
7
+ to: string;
8
+ /** `one-way` = from -> to only. */
9
+ direction: ConnectionDirection;
10
+ /** Metres, > 0. The basis of travel time. Never computed from coordinates here. */
11
+ lengthM: number;
12
+ /** Metres per second, > 0. Absent = the equipment's own speed. */
13
+ maxSpeedMps?: number;
14
+ /** How many machines may be on this connection at once. Absent = 1 (exclusive). */
15
+ capacity?: number;
16
+ /** Equipment classes allowed to pass. Absent = no restriction. */
17
+ equipmentClassIds?: string[];
18
+ properties?: ResourceProperty[];
19
+ }
20
+ export declare const CONNECTION_DIRECTION: readonly ["one-way", "two-way"];
21
+ export type ConnectionDirection = (typeof CONNECTION_DIRECTION)[number];
22
+ /** An ordered list of connections - "this equipment goes this way". */
23
+ export interface FixedRoute extends EffectivePeriod {
24
+ id: string;
25
+ /** In travel order; each must start where the previous one ended. */
26
+ connectionIds: string[];
27
+ /** Equipment bound to this route. Absent = advisory for all. */
28
+ equipmentClassIds?: string[];
29
+ binding: FixedRouteBinding;
30
+ }
31
+ export declare const FIXED_ROUTE_BINDING: readonly ["mandatory", "preferred"];
32
+ export type FixedRouteBinding = (typeof FIXED_ROUTE_BINDING)[number];
33
+ /** One published edition of the network. A published edition is never edited; a change is a new version. */
34
+ export interface RouteNetworkEdition {
35
+ id: string;
36
+ version: string;
37
+ publishedAt: ISOTime;
38
+ publishedBy?: string;
39
+ }
40
+ /** Default capacity of a connection when none is declared. */
41
+ export declare const DEFAULT_CONNECTION_CAPACITY = 1;
42
+ export declare const ROUTE_NETWORK_ISSUE: {
43
+ readonly connectionDangling: "route-connection-dangling";
44
+ readonly connectionSelf: "route-connection-self";
45
+ readonly connectionLength: "route-connection-length";
46
+ readonly connectionSpeed: "route-connection-speed";
47
+ readonly connectionCapacity: "route-connection-capacity";
48
+ readonly connectionDirection: "route-connection-direction";
49
+ readonly connectionDuplicate: "route-connection-duplicate";
50
+ readonly connectionUnknownClass: "route-connection-unknown-class";
51
+ readonly fixedEmpty: "route-fixed-empty";
52
+ readonly fixedUnknownConnection: "route-fixed-unknown-connection";
53
+ readonly fixedBroken: "route-fixed-broken";
54
+ readonly fixedClass: "route-fixed-class";
55
+ readonly fixedBinding: "route-fixed-binding";
56
+ readonly duplicateId: "route-duplicate-id";
57
+ };
58
+ export type RouteNetworkIssueCode = (typeof ROUTE_NETWORK_ISSUE)[keyof typeof ROUTE_NETWORK_ISSUE];
59
+ export interface RouteNetworkIssue {
60
+ code: RouteNetworkIssueCode;
61
+ /** The connection or fixed route the issue is about. */
62
+ subject: string;
63
+ params: RefusalParams;
64
+ }
65
+ export interface RouteNetworkInput {
66
+ locations?: readonly {
67
+ id: string;
68
+ }[];
69
+ referencedLocations?: readonly {
70
+ id: string;
71
+ }[];
72
+ connections?: readonly LocationConnection[];
73
+ fixedRoutes?: readonly FixedRoute[];
74
+ equipmentClasses?: readonly ResourceClassDef[];
75
+ }
76
+ /**
77
+ * Checks the structure of a route network. Returns every issue found (empty = structurally sound).
78
+ *
79
+ * Not checked here: whether a port can be reached, dead ends, deadlock risk. Those need graph search and belong to the deciders
80
+ * (the app's rules, the kernel's execution policy).
81
+ */
82
+ export declare function validateRouteNetwork(def: RouteNetworkInput): RouteNetworkIssue[];
83
+ /** Whether equipment of these classes may pass this connection (class closure included). */
84
+ export declare function connectionAdmits(c: LocationConnection, equipmentClassIds: readonly string[], classes?: readonly ResourceClassDef[]): boolean;