@operato/twin-kernel 0.11.32 → 0.11.33
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/dist/capacity.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/observed-reducer.js +13 -3
- package/dist/work-calendar-time.d.ts +36 -0
- package/dist/work-calendar-time.js +78 -0
- package/dist-cjs/index.cjs +61 -46
- package/package.json +2 -2
package/dist/capacity.js
CHANGED
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
* 부족은 조달 문제이지 용량 문제가 아니다(자재 부족은 `work-backlog` 가 흐름에서 잡는다).
|
|
26
26
|
* 인원·자산에는 신뢰도 모델이 없다 — 가동률 1로 본다(설비만 mtbf/mttr 를 갖는다).
|
|
27
27
|
*/
|
|
28
|
-
import {
|
|
28
|
+
import { workingTimeOfWeek } from "./work-calendar-time.js";
|
|
29
|
+
import { isoDurationHours } from '@operato/ops-contract';
|
|
29
30
|
function paramOf(op, id) {
|
|
30
31
|
return op.parameters?.find(p => p.id === id)?.value;
|
|
31
32
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './state-projector.ts';
|
|
|
10
10
|
export * from './task-fold.ts';
|
|
11
11
|
export * from './order-fold.ts';
|
|
12
12
|
export * from './capacity.ts';
|
|
13
|
+
export * from './work-calendar-time.ts';
|
|
13
14
|
export * from './operations-capability.ts';
|
|
14
15
|
export * from './job-response.ts';
|
|
15
16
|
export * from './runtime.ts';
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export * from "./state-projector.js";
|
|
|
24
24
|
export * from "./task-fold.js";
|
|
25
25
|
export * from "./order-fold.js";
|
|
26
26
|
export * from "./capacity.js";
|
|
27
|
+
export * from "./work-calendar-time.js";
|
|
27
28
|
export * from "./operations-capability.js";
|
|
28
29
|
export * from "./job-response.js";
|
|
29
30
|
export * from "./runtime.js";
|
package/dist/observed-reducer.js
CHANGED
|
@@ -868,6 +868,16 @@ export class ObservedReducer {
|
|
|
868
868
|
return;
|
|
869
869
|
}
|
|
870
870
|
if (ev.type === 'AggregationEvent') {
|
|
871
|
+
/*
|
|
872
|
+
* ── 부모를 말하지 않은 관측 (2026-11-27, EPCIS 2.0 §7.4.3) ─────────────────
|
|
873
|
+
* 표준은 OBSERVE 에서 parentID 를 선택으로 둔다(부모가 보이지 않았을 수 있다). 아래는 모두 부모를 열쇠로 담김을
|
|
874
|
+
* 적으므로, 부모 없는 관측을 그대로 지나면 열쇠가 undefined 인 담김이 생긴다. 세어서 드러내고 건너뛴다.
|
|
875
|
+
*/
|
|
876
|
+
if (!ev.parentID) {
|
|
877
|
+
if (envelope)
|
|
878
|
+
this.noteUnhandled(envelope, 'aggregation-no-parent');
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
871
881
|
/*
|
|
872
882
|
* ── 바코드 없이 **수량만** 실린 담김 (2026-08-19) ────────────────────────
|
|
873
883
|
* 실제 창고는 박스마다 바코드를 붙이지 않는다. 팔레트 하나에 「이 품번 40개」로 입고하는 것이
|
|
@@ -965,7 +975,7 @@ export class ObservedReducer {
|
|
|
965
975
|
}
|
|
966
976
|
// ObjectEvent
|
|
967
977
|
if (ev.action === 'DELETE') {
|
|
968
|
-
for (const epc of ev.epcList)
|
|
978
|
+
for (const epc of ev.epcList ?? [])
|
|
969
979
|
this.remove(epc);
|
|
970
980
|
/*
|
|
971
981
|
* ── ★ **수량으로 온 물품도 없어질 수 있어야 한다** (2026-08-25 실측) ────────
|
|
@@ -1021,14 +1031,14 @@ export class ObservedReducer {
|
|
|
1021
1031
|
* 원본의 「없어졌다」가 줄인다). 순서 판정은 그대로 지난다 — 늦게 온 옛 불출이 그 뒤에 돌아온 물품을 지우지 않게.
|
|
1022
1032
|
*/
|
|
1023
1033
|
if (loc && this.referenced.has(loc)) {
|
|
1024
|
-
for (const epc of ev.epcList) {
|
|
1034
|
+
for (const epc of ev.epcList ?? []) {
|
|
1025
1035
|
if (envelope && this.stale(`item:${epc}`, envelope))
|
|
1026
1036
|
continue;
|
|
1027
1037
|
this.remove(epc);
|
|
1028
1038
|
}
|
|
1029
1039
|
return;
|
|
1030
1040
|
}
|
|
1031
|
-
for (const epc of ev.epcList) {
|
|
1041
|
+
for (const epc of ev.epcList ?? []) {
|
|
1032
1042
|
/* 물품별 순서 판정 — 늦게 온 옛 관측이 최신 위치를 덮지 않게. */
|
|
1033
1043
|
if (envelope && this.stale(`item:${epc}`, envelope))
|
|
1034
1044
|
continue;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type WorkCalendarEntry } from '@operato/ops-contract';
|
|
2
|
+
/**
|
|
3
|
+
* 근무 캘린더에서 **가용 시간과 조업일**을 읽는다 — 1분 간격 샘플링.
|
|
4
|
+
*
|
|
5
|
+
* 교대·휴게·비근무 규칙을 여기 다시 적지 않는다. 규칙은 `inWorkCalendarAt` 한 곳에만 있고, 이 함수는
|
|
6
|
+
* 그것에 묻기만 한다. 두 벌이 되면 달력을 고칠 때 한쪽만 고쳐져 어긋난다.
|
|
7
|
+
*
|
|
8
|
+
* 캘린더가 없으면 **종일 가동**으로 본다(7일 × 24h) — 제약이 없는 것이 아니라 **선언되지 않은** 것이고,
|
|
9
|
+
* 선언이 없으면 커널은 멈출 이유를 모른다.
|
|
10
|
+
*/
|
|
11
|
+
export declare function workingTimeOfWeek(calendar: readonly WorkCalendarEntry[] | undefined, weekStartMs: number, utcOffsetMinutes?: number): {
|
|
12
|
+
hoursPerWeek: number;
|
|
13
|
+
daysPerWeek: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 이 창에서 **조업이 계획되지 않은 시간**(ms) — 없으면 `undefined`.
|
|
17
|
+
*
|
|
18
|
+
* ── 무엇에 쓰나 ─────────────────────────────────────────────────────────────
|
|
19
|
+
* ISO 22400 의 계획 조업 시간(PBT)에서 뺄 값이다(`OeeCounters.holdMs`). 커널의 PBT 가 「재기 시작한
|
|
20
|
+
* 뒤 흐른 시간 전부」였고, 그래서 주말·야간·휴일이 계획 조업으로 세어졌다.
|
|
21
|
+
*
|
|
22
|
+
* ── 선언이 없으면 `undefined` 다 ────────────────────────────────────────────
|
|
23
|
+
* **0 을 내지 않는다.** 0 은 「비근무 시간이 없다」는 주장이고, 그것은 24시간 365일 도는 현장에
|
|
24
|
+
* 대해서만 참이다. 선언이 없는 것은 **모르는 것**이고, 부르는 쪽이 그 둘을 갈라야 한다 — 0 을 받으면
|
|
25
|
+
* 「달력을 확인했고 쉬는 시간이 없었다」로 읽는다.
|
|
26
|
+
*
|
|
27
|
+
* `workingTimeOfWeek` 이 캘린더가 없을 때 종일 가동으로 보는 것과 방향이 반대로 보이지만, 그쪽은
|
|
28
|
+
* **능력**을 묻는 자리라 「최대 얼마나 돌 수 있나」에 답해야 하고, 이쪽은 **실적 지표**의 분모라
|
|
29
|
+
* 모르는 것을 채우면 그 수가 조용히 틀린다.
|
|
30
|
+
*
|
|
31
|
+
* ── 분 단위로 센다 ──────────────────────────────────────────────────────────
|
|
32
|
+
* `workingTimeOfWeek` 과 같은 방식이다(`inWorkCalendarAt` 을 분마다 묻는다). 구간 대수로 풀면
|
|
33
|
+
* 되풀이·요일·절대 구간이 겹칠 때의 규칙을 여기서 다시 적게 되고, 그 규칙은 이미 그 함수 안에 있다 —
|
|
34
|
+
* 두 곳이 다른 답을 내는 것이 이 저장소에서 여러 번 났다.
|
|
35
|
+
*/
|
|
36
|
+
export declare function nonWorkingMsIn(calendar: readonly WorkCalendarEntry[] | undefined, fromMs: number, toMs: number, utcOffsetMinutes?: number): number | undefined;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* **근무 캘린더 집계** — 한 주의 가용 시간 · 한 창의 비근무 시간.
|
|
3
|
+
*
|
|
4
|
+
* 계약(`@operato/ops-contract` capacity.ts)에서 옮겨 왔다(2026-11-27). 「이 분이 근무인가」는 계약의 `inWorkCalendarAt`
|
|
5
|
+
* 한 곳이 정하고, 여기서는 그것을 분마다 물어 더한다. 소비처는 커널의 용량 분석(`workingTimeOfWeek`)과 호스트의 OEE
|
|
6
|
+
* 누산(`nonWorkingMsIn`, headless-twin) — 각자 하나뿐이라 계약의 「파생의 기준」(두 구현이 같은 답)에 들지 않는다.
|
|
7
|
+
*/
|
|
8
|
+
import { inWorkCalendarAt } from '@operato/ops-contract';
|
|
9
|
+
/**
|
|
10
|
+
* 근무 캘린더에서 **가용 시간과 조업일**을 읽는다 — 1분 간격 샘플링.
|
|
11
|
+
*
|
|
12
|
+
* 교대·휴게·비근무 규칙을 여기 다시 적지 않는다. 규칙은 `inWorkCalendarAt` 한 곳에만 있고, 이 함수는
|
|
13
|
+
* 그것에 묻기만 한다. 두 벌이 되면 달력을 고칠 때 한쪽만 고쳐져 어긋난다.
|
|
14
|
+
*
|
|
15
|
+
* 캘린더가 없으면 **종일 가동**으로 본다(7일 × 24h) — 제약이 없는 것이 아니라 **선언되지 않은** 것이고,
|
|
16
|
+
* 선언이 없으면 커널은 멈출 이유를 모른다.
|
|
17
|
+
*/
|
|
18
|
+
export function workingTimeOfWeek(calendar, weekStartMs, utcOffsetMinutes) {
|
|
19
|
+
if (!calendar?.length)
|
|
20
|
+
return { hoursPerWeek: 7 * 24, daysPerWeek: 7 };
|
|
21
|
+
let minutes = 0;
|
|
22
|
+
const touched = new Set();
|
|
23
|
+
for (let m = 0; m < 7 * 24 * 60; m++) {
|
|
24
|
+
if (!inWorkCalendarAt(calendar, weekStartMs + m * 60_000, utcOffsetMinutes))
|
|
25
|
+
continue;
|
|
26
|
+
minutes++;
|
|
27
|
+
touched.add(Math.floor((m + (utcOffsetMinutes ?? 0)) / (24 * 60)));
|
|
28
|
+
}
|
|
29
|
+
/*
|
|
30
|
+
* 조업일은 **선언이 말하는 것**이지 타임라인이 번진 자국이 아니다.
|
|
31
|
+
*
|
|
32
|
+
* 야간 교대는 자정을 넘는다 — 금요일 밤에 시작한 교대는 토요일 새벽에 끝난다. 샘플링한 분을
|
|
33
|
+
* 날짜로 세면 월~금 3교대가 **6일**로 나오고, 그러면 주간 수요가 20% 부풀어 필요 없는 설비를
|
|
34
|
+
* 사라고 답한다. 교대는 "월~금에 **시작한다**" 고 선언돼 있고(`daysOfWeek`), 그것이 조업일이다.
|
|
35
|
+
*
|
|
36
|
+
* 요일 선언이 아예 없는 달력(절대 구간만 쓰는 경우)에서는 셀 근거가 없으므로 번진 자국을 쓴다.
|
|
37
|
+
*/
|
|
38
|
+
const declared = new Set();
|
|
39
|
+
for (const e of calendar)
|
|
40
|
+
if (e.entryType !== 'non-working')
|
|
41
|
+
for (const d of e.daysOfWeek ?? [])
|
|
42
|
+
declared.add(d);
|
|
43
|
+
return { hoursPerWeek: minutes / 60, daysPerWeek: declared.size || touched.size };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 이 창에서 **조업이 계획되지 않은 시간**(ms) — 없으면 `undefined`.
|
|
47
|
+
*
|
|
48
|
+
* ── 무엇에 쓰나 ─────────────────────────────────────────────────────────────
|
|
49
|
+
* ISO 22400 의 계획 조업 시간(PBT)에서 뺄 값이다(`OeeCounters.holdMs`). 커널의 PBT 가 「재기 시작한
|
|
50
|
+
* 뒤 흐른 시간 전부」였고, 그래서 주말·야간·휴일이 계획 조업으로 세어졌다.
|
|
51
|
+
*
|
|
52
|
+
* ── 선언이 없으면 `undefined` 다 ────────────────────────────────────────────
|
|
53
|
+
* **0 을 내지 않는다.** 0 은 「비근무 시간이 없다」는 주장이고, 그것은 24시간 365일 도는 현장에
|
|
54
|
+
* 대해서만 참이다. 선언이 없는 것은 **모르는 것**이고, 부르는 쪽이 그 둘을 갈라야 한다 — 0 을 받으면
|
|
55
|
+
* 「달력을 확인했고 쉬는 시간이 없었다」로 읽는다.
|
|
56
|
+
*
|
|
57
|
+
* `workingTimeOfWeek` 이 캘린더가 없을 때 종일 가동으로 보는 것과 방향이 반대로 보이지만, 그쪽은
|
|
58
|
+
* **능력**을 묻는 자리라 「최대 얼마나 돌 수 있나」에 답해야 하고, 이쪽은 **실적 지표**의 분모라
|
|
59
|
+
* 모르는 것을 채우면 그 수가 조용히 틀린다.
|
|
60
|
+
*
|
|
61
|
+
* ── 분 단위로 센다 ──────────────────────────────────────────────────────────
|
|
62
|
+
* `workingTimeOfWeek` 과 같은 방식이다(`inWorkCalendarAt` 을 분마다 묻는다). 구간 대수로 풀면
|
|
63
|
+
* 되풀이·요일·절대 구간이 겹칠 때의 규칙을 여기서 다시 적게 되고, 그 규칙은 이미 그 함수 안에 있다 —
|
|
64
|
+
* 두 곳이 다른 답을 내는 것이 이 저장소에서 여러 번 났다.
|
|
65
|
+
*/
|
|
66
|
+
export function nonWorkingMsIn(calendar, fromMs, toMs, utcOffsetMinutes) {
|
|
67
|
+
if (!calendar?.length)
|
|
68
|
+
return undefined;
|
|
69
|
+
if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || toMs <= fromMs)
|
|
70
|
+
return undefined;
|
|
71
|
+
const minutes = Math.floor((toMs - fromMs) / 60_000);
|
|
72
|
+
let closed = 0;
|
|
73
|
+
for (let m = 0; m < minutes; m++) {
|
|
74
|
+
if (!inWorkCalendarAt(calendar, fromMs + m * 60_000, utcOffsetMinutes))
|
|
75
|
+
closed++;
|
|
76
|
+
}
|
|
77
|
+
return closed * 60_000;
|
|
78
|
+
}
|
package/dist-cjs/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ __export(index_exports, {
|
|
|
62
62
|
journalProjector: () => journalProjector,
|
|
63
63
|
monteCarloForecast: () => monteCarloForecast,
|
|
64
64
|
monteCarloForecastAsync: () => monteCarloForecastAsync,
|
|
65
|
+
nonWorkingMsIn: () => nonWorkingMsIn,
|
|
65
66
|
operationsCapabilityOf: () => operationsCapabilityOf,
|
|
66
67
|
partialFitPolicy: () => partialFitPolicy,
|
|
67
68
|
planMakeToOrder: () => planMakeToOrder,
|
|
@@ -72,7 +73,8 @@ __export(index_exports, {
|
|
|
72
73
|
replayFrom: () => replayFrom,
|
|
73
74
|
replaySegments: () => replaySegments,
|
|
74
75
|
replayWithCheckpoint: () => replayWithCheckpoint,
|
|
75
|
-
standsNewOrderRow: () => standsNewOrderRow
|
|
76
|
+
standsNewOrderRow: () => standsNewOrderRow,
|
|
77
|
+
workingTimeOfWeek: () => workingTimeOfWeek
|
|
76
78
|
});
|
|
77
79
|
module.exports = __toCommonJS(index_exports);
|
|
78
80
|
|
|
@@ -81,7 +83,7 @@ var CAPABILITIES = {
|
|
|
81
83
|
operable: {
|
|
82
84
|
key: "operable",
|
|
83
85
|
label: "twin.capability.operable",
|
|
84
|
-
semantics: "\uB2A5\uB3D9 \uC790\uC6D0\uC758 \uC6B4\uC601 \uC0C1\uD0DC(\uC720\uD734/\uAC00\uB3D9/\uACE0\uC7A5).
|
|
86
|
+
semantics: "\uB2A5\uB3D9 \uC790\uC6D0\uC758 \uC6B4\uC601 \uC0C1\uD0DC(\uC720\uD734/\uAC00\uB3D9/\uACE0\uC7A5). \uACF5\uD1B5 \uC6B4\uC601 \uC0C1\uD0DC\uB97C \uAD00\uB9AC\uD569\uB2C8\uB2E4.",
|
|
85
87
|
commands: ["resource.hold", "resource.resume", "resource.down", "resource.repair", "resource.reset-metrics"],
|
|
86
88
|
stateFields: ["status"],
|
|
87
89
|
results: ["statusChanged"]
|
|
@@ -98,7 +100,7 @@ var CAPABILITIES = {
|
|
|
98
100
|
mobile: {
|
|
99
101
|
key: "mobile",
|
|
100
102
|
label: "twin.capability.mobile",
|
|
101
|
-
semantics: "\uC790\uC6D0 \
|
|
103
|
+
semantics: "\uC790\uC6D0\uC774 \uD55C \uC704\uCE58\uC5D0\uC11C \uB2E4\uB978 \uC704\uCE58\uB85C \uC774\uB3D9\uD558\uB294 \uAE30\uB2A5\uC785\uB2C8\uB2E4. Transferable\uC740 \uC544\uC774\uD15C\uC758 \uC774\uB3D9\uC744 \uB098\uD0C0\uB0C5\uB2C8\uB2E4. (\uC52C \uAE30\uC81C: CarrierLine)",
|
|
102
104
|
commands: [],
|
|
103
105
|
stateFields: ["location", "motion"],
|
|
104
106
|
models: ["Motion"],
|
|
@@ -107,7 +109,7 @@ var CAPABILITIES = {
|
|
|
107
109
|
processable: {
|
|
108
110
|
key: "processable",
|
|
109
111
|
label: "twin.capability.processable",
|
|
110
|
-
semantics: "\uBCC0\uD658/\uAC00\uACF5 \uC218\uD589 \u2014 \uC0B0\uCD9C(\uC591\uD488/\uBD88\uB7C9). \uC6B4\uC601 status \uB294 Operable \uC870\uD569.
|
|
112
|
+
semantics: "\uBCC0\uD658/\uAC00\uACF5 \uC218\uD589 \u2014 \uC0B0\uCD9C(\uC591\uD488/\uBD88\uB7C9). \uC6B4\uC601 status \uB294 Operable \uC870\uD569. \uC9C4\uD589\uB960 \uC774\uBCA4\uD2B8\uB294 \uD6C4\uC18D \uAD6C\uD604 \uB300\uC0C1\uC785\uB2C8\uB2E4.",
|
|
111
113
|
commands: [],
|
|
112
114
|
stateFields: ["output"],
|
|
113
115
|
results: ["completed"]
|
|
@@ -136,7 +138,7 @@ var CAPABILITIES = {
|
|
|
136
138
|
trackable: {
|
|
137
139
|
key: "trackable",
|
|
138
140
|
label: "twin.capability.trackable",
|
|
139
|
-
semantics: "\uC624\uB354/\uC544\uC774\uD15C \uC0DD\uC560 \uCD94\uC801 \u2014 \
|
|
141
|
+
semantics: "\uC624\uB354/\uC544\uC774\uD15C \uC0DD\uC560 \uCD94\uC801 \u2014 \uC218\uBA85\uC8FC\uAE30 \uB2E8\uACC4(\uB3C4\uBA54\uC778 \uACF5\uD1B5 \uB77C\uBCA8)\xB7\uC9C4\uD589\xB7\uBCF4\uB958.",
|
|
140
142
|
commands: ["order.hold", "order.resume", "order.release"],
|
|
141
143
|
stateFields: ["lifecycle", "progress", "held"],
|
|
142
144
|
results: ["lifecycleChanged"]
|
|
@@ -150,7 +152,7 @@ var CAPABILITIES = {
|
|
|
150
152
|
metered: {
|
|
151
153
|
key: "metered",
|
|
152
154
|
label: "twin.capability.metered",
|
|
153
|
-
semantics: "\uC790\
|
|
155
|
+
semantics: "\uC790\uC6D0\uC758 \uC720\uD6A8\uC804\uB825\xB7\uB204\uC801 \uC5D0\uB108\uC9C0 \uC18C\uBE44\uB7C9\xB7\uC5ED\uB960\uC744 \uACC4\uCE21\uD569\uB2C8\uB2E4. \uCE21\uC815\uAC12\uC774 \uC5C6\uC73C\uBA74 \uBBF8\uD655\uC778 \uC0C1\uD0DC\uB85C \uCC98\uB9AC\uD558\uBA70 0\uC73C\uB85C \uAC04\uC8FC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
154
156
|
commands: [],
|
|
155
157
|
stateFields: ["kW", "kWh", "powerFactor"],
|
|
156
158
|
models: ["MeteredState"],
|
|
@@ -159,7 +161,7 @@ var CAPABILITIES = {
|
|
|
159
161
|
curtailable: {
|
|
160
162
|
key: "curtailable",
|
|
161
163
|
label: "twin.capability.curtailable",
|
|
162
|
-
semantics: "\
|
|
164
|
+
semantics: "\uCD5C\uC18C \uC720\uC9C0 \uBD80\uD558\uB97C \uC900\uC218\uD558\uB294 \uBC94\uC704\uC5D0\uC11C \uAC10\uCD95 \uAC00\uB2A5 \uC5EC\uBD80\uB97C \uD310\uC815\uD569\uB2C8\uB2E4. \uC2E4\uC81C \uC2E4\uD589\uC740 \uB2F4\uB2F9\uC790\uC640 \uC5F0\uACC4 \uC2DC\uC2A4\uD15C\uC5D0\uC11C \uCC98\uB9AC\uD569\uB2C8\uB2E4.",
|
|
163
165
|
commands: [],
|
|
164
166
|
stateFields: ["curtailable", "minKW"],
|
|
165
167
|
models: ["CurtailableState"],
|
|
@@ -169,7 +171,7 @@ var CAPABILITIES = {
|
|
|
169
171
|
energyGenerating: {
|
|
170
172
|
key: "energyGenerating",
|
|
171
173
|
label: "twin.capability.energyGenerating",
|
|
172
|
-
semantics: "\uC804\
|
|
174
|
+
semantics: "\uC804\uB825 \uC0DD\uC0B0\uB7C9\uC744 \uAD00\uB9AC\uD569\uB2C8\uB2E4. \uC5ED\uC1A1\uB7C9\uC740 \uC18C\uBE44\uB7C9\uC758 \uC74C\uC218\uAC00 \uC544\uB2CC \uBCC4\uB3C4 \uD56D\uBAA9\uC73C\uB85C \uAE30\uB85D\uD569\uB2C8\uB2E4.",
|
|
173
175
|
commands: [],
|
|
174
176
|
/*
|
|
175
177
|
* ── 적산을 더한다 (2026-08-26) ─────────────────────────────────────────────
|
|
@@ -195,7 +197,7 @@ var CAPABILITIES = {
|
|
|
195
197
|
energyStoring: {
|
|
196
198
|
key: "energyStoring",
|
|
197
199
|
label: "twin.capability.energyStoring",
|
|
198
|
-
semantics: "\
|
|
200
|
+
semantics: "\uC804\uB825\uC744 \uC800\uC7A5\uD558\uACE0 \uACF5\uAE09\uD569\uB2C8\uB2E4. \uC190\uC2E4\uACFC \uC218\uBA85\uC744 \uD3C9\uAC00\uD560 \uC218 \uC788\uB3C4\uB85D \uCDA9\uC804\uACFC \uBC29\uC804\uC744 \uAD6C\uBD84\uD569\uB2C8\uB2E4.",
|
|
199
201
|
commands: [],
|
|
200
202
|
stateFields: ["soc", "chargeKW", "dischargeKW"],
|
|
201
203
|
models: ["StoringState"],
|
|
@@ -211,6 +213,16 @@ function stateFieldsOf(caps) {
|
|
|
211
213
|
return [...out];
|
|
212
214
|
}
|
|
213
215
|
|
|
216
|
+
// ../ops-contract/dist/capacity.js
|
|
217
|
+
function isoDurationHours(iso2) {
|
|
218
|
+
if (!iso2)
|
|
219
|
+
return 0;
|
|
220
|
+
const m = /^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:([\d.]+)S)?)?$/.exec(iso2);
|
|
221
|
+
if (!m)
|
|
222
|
+
throw new Error(`\uAE30\uAC04 \uD45C\uAE30\uB97C \uC77D\uC744 \uC218 \uC5C6\uB2E4: ${iso2}`);
|
|
223
|
+
return Number(m[1] ?? 0) * 24 + Number(m[2] ?? 0) + Number(m[3] ?? 0) / 60 + Number(m[4] ?? 0) / 3600;
|
|
224
|
+
}
|
|
225
|
+
|
|
214
226
|
// ../ops-contract/dist/rated-usage.js
|
|
215
227
|
var USE_UOM = "C62";
|
|
216
228
|
var num = (n) => typeof n === "number" && Number.isFinite(n);
|
|
@@ -945,34 +957,6 @@ function gs1Namespaces(prefix) {
|
|
|
945
957
|
return [`urn:epc:idpat:sgtin:${prefix}.`, `urn:epc:class:lgtin:${prefix}.`, `urn:epc:id:sgtin:${prefix}.`];
|
|
946
958
|
}
|
|
947
959
|
|
|
948
|
-
// ../ops-contract/dist/capacity.js
|
|
949
|
-
function isoDurationHours(iso2) {
|
|
950
|
-
if (!iso2)
|
|
951
|
-
return 0;
|
|
952
|
-
const m = /^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:([\d.]+)S)?)?$/.exec(iso2);
|
|
953
|
-
if (!m)
|
|
954
|
-
throw new Error(`\uAE30\uAC04 \uD45C\uAE30\uB97C \uC77D\uC744 \uC218 \uC5C6\uB2E4: ${iso2}`);
|
|
955
|
-
return Number(m[1] ?? 0) * 24 + Number(m[2] ?? 0) + Number(m[3] ?? 0) / 60 + Number(m[4] ?? 0) / 3600;
|
|
956
|
-
}
|
|
957
|
-
function workingTimeOfWeek(calendar, weekStartMs, utcOffsetMinutes) {
|
|
958
|
-
if (!calendar?.length)
|
|
959
|
-
return { hoursPerWeek: 7 * 24, daysPerWeek: 7 };
|
|
960
|
-
let minutes = 0;
|
|
961
|
-
const touched = /* @__PURE__ */ new Set();
|
|
962
|
-
for (let m = 0; m < 7 * 24 * 60; m++) {
|
|
963
|
-
if (!inWorkCalendarAt(calendar, weekStartMs + m * 6e4, utcOffsetMinutes))
|
|
964
|
-
continue;
|
|
965
|
-
minutes++;
|
|
966
|
-
touched.add(Math.floor((m + (utcOffsetMinutes ?? 0)) / (24 * 60)));
|
|
967
|
-
}
|
|
968
|
-
const declared = /* @__PURE__ */ new Set();
|
|
969
|
-
for (const e of calendar)
|
|
970
|
-
if (e.entryType !== "non-working")
|
|
971
|
-
for (const d of e.daysOfWeek ?? [])
|
|
972
|
-
declared.add(d);
|
|
973
|
-
return { hoursPerWeek: minutes / 60, daysPerWeek: declared.size || touched.size };
|
|
974
|
-
}
|
|
975
|
-
|
|
976
960
|
// ../ops-contract/dist/epcis.js
|
|
977
961
|
var EPCIS_CONTEXT = "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld";
|
|
978
962
|
var UTC_OFFSET = "+00:00";
|
|
@@ -1373,7 +1357,7 @@ function gs1KeyDigitViolation(uri) {
|
|
|
1373
1357
|
const got = prefix.length + ref.length;
|
|
1374
1358
|
if (got === want)
|
|
1375
1359
|
return void 0;
|
|
1376
|
-
return `${m[1]} \uC790\uB9AC \uC218 \uC624\uB958: ${uri} \u2014 \uD68C\uC0AC \uD504\uB9AC\uD53D\uC2A4(${prefix.length}) + \uCC38\uC870(${ref.length}) = ${got} \uC774\uC9C0\uB9CC ${want} \uC5EC\uC57C \uD55C\uB2E4(GS1 TDS). \uD504\uB9AC\uD53D\uC2A4\uB97C \uBC14\uAFB8\uBA74 \uCC38\uC870 \uC790\
|
|
1360
|
+
return `${m[1]} \uC790\uB9AC \uC218 \uC624\uB958: ${uri} \u2014 \uD68C\uC0AC \uD504\uB9AC\uD53D\uC2A4(${prefix.length}) + \uCC38\uC870(${ref.length}) = ${got} \uC774\uC9C0\uB9CC ${want} \uC5EC\uC57C \uD55C\uB2E4(GS1 TDS). \uD504\uB9AC\uD53D\uC2A4\uB97C \uBC14\uAFB8\uBA74 \uCC38\uC870 \uC790\uB9BF\uC218\uB97C \uD568\uAED8 \uB9DE\uCDB0\uC57C \uD55C\uB2E4.`;
|
|
1377
1361
|
}
|
|
1378
1362
|
|
|
1379
1363
|
// ../ops-contract/dist/wms-profile.js
|
|
@@ -1487,7 +1471,7 @@ var YMS_TYPES = [
|
|
|
1487
1471
|
var MES_BIZSTEP = {
|
|
1488
1472
|
receiving: "urn:epcglobal:cbv:bizstep:receiving",
|
|
1489
1473
|
// 원자재 수령
|
|
1490
|
-
producing:
|
|
1474
|
+
producing: CBV_BIZSTEP.commissioning,
|
|
1491
1475
|
// 생산(제품 최초 생성)
|
|
1492
1476
|
storing: "urn:epcglobal:cbv:bizstep:storing"
|
|
1493
1477
|
// 완제품 저장
|
|
@@ -1887,12 +1871,12 @@ function procedureViolations(route) {
|
|
|
1887
1871
|
if (n.step === void 0)
|
|
1888
1872
|
continue;
|
|
1889
1873
|
if (hasChild.has(n.key))
|
|
1890
|
-
errors.push(`${n.key}: \
|
|
1874
|
+
errors.push(`${n.key}: \uD558\uC704 \uC694\uC18C\uAC00 \uC788\uB294 \uB178\uB4DC\uC5D0 \uC2E4\uD589 \uB2E8\uACC4\uAC00 \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC2E4\uD589 \uB2E8\uACC4\uB294 \uB9D0\uB2E8 \uB178\uB4DC\uC5D0\uB9CC \uC9C0\uC815\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);
|
|
1891
1875
|
if (!stepSet.has(n.step))
|
|
1892
|
-
errors.push(`${n.key}: \
|
|
1876
|
+
errors.push(`${n.key}: \uB2E8\uACC4 \uBAA9\uB85D(steps)\uC5D0 \uC815\uC758\uB418\uC9C0 \uC54A\uC740 \uB2E8\uACC4\uC785\uB2C8\uB2E4: '${n.step}'`);
|
|
1893
1877
|
const already = seenStep.get(n.step);
|
|
1894
1878
|
if (already)
|
|
1895
|
-
errors.push(`\uB2E8\uACC4 '${n.step}' \uAC00 '${already}' \uC640 '${n.key}' \
|
|
1879
|
+
errors.push(`\uB2E8\uACC4 '${n.step}' \uAC00 '${already}' \uC640 '${n.key}' \uB450 \uACF3\uC5D0 \uC911\uBCF5 \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD55C \uC704\uCE58\uC5D0\uB9CC \uC9C0\uC815\uD558\uC138\uC694.`);
|
|
1896
1880
|
else
|
|
1897
1881
|
seenStep.set(n.step, n.key);
|
|
1898
1882
|
}
|
|
@@ -3455,6 +3439,10 @@ var ObservedReducer = class {
|
|
|
3455
3439
|
return;
|
|
3456
3440
|
}
|
|
3457
3441
|
if (ev.type === "AggregationEvent") {
|
|
3442
|
+
if (!ev.parentID) {
|
|
3443
|
+
if (envelope) this.noteUnhandled(envelope, "aggregation-no-parent");
|
|
3444
|
+
return;
|
|
3445
|
+
}
|
|
3458
3446
|
if (ev.action === "ADD" && ev.childQuantityList?.length) {
|
|
3459
3447
|
const classes = new Set(ev.childQuantityList.map((q2) => q2.epcClass));
|
|
3460
3448
|
if (classes.size > 1) {
|
|
@@ -3509,7 +3497,7 @@ var ObservedReducer = class {
|
|
|
3509
3497
|
return;
|
|
3510
3498
|
}
|
|
3511
3499
|
if (ev.action === "DELETE") {
|
|
3512
|
-
for (const epc of ev.epcList) this.remove(epc);
|
|
3500
|
+
for (const epc of ev.epcList ?? []) this.remove(epc);
|
|
3513
3501
|
const goneAt = ev.readPoint?.id;
|
|
3514
3502
|
for (const qe of ev.quantityList ?? []) {
|
|
3515
3503
|
if (!qe?.epcClass) continue;
|
|
@@ -3532,13 +3520,13 @@ var ObservedReducer = class {
|
|
|
3532
3520
|
const q = all[0];
|
|
3533
3521
|
this.touchLocation(loc);
|
|
3534
3522
|
if (loc && this.referenced.has(loc)) {
|
|
3535
|
-
for (const epc of ev.epcList) {
|
|
3523
|
+
for (const epc of ev.epcList ?? []) {
|
|
3536
3524
|
if (envelope && this.stale(`item:${epc}`, envelope)) continue;
|
|
3537
3525
|
this.remove(epc);
|
|
3538
3526
|
}
|
|
3539
3527
|
return;
|
|
3540
3528
|
}
|
|
3541
|
-
for (const epc of ev.epcList) {
|
|
3529
|
+
for (const epc of ev.epcList ?? []) {
|
|
3542
3530
|
if (envelope && this.stale(`item:${epc}`, envelope)) continue;
|
|
3543
3531
|
const seen = this.mergeItem(epc, { location: loc, disposition: ev.disposition, ilmd: ev.ilmd }, q, all);
|
|
3544
3532
|
const atSeen = Date.parse(String(envelope?.eventTime ?? ""));
|
|
@@ -4026,6 +4014,31 @@ function allocationPolicyOf(name) {
|
|
|
4026
4014
|
return found;
|
|
4027
4015
|
}
|
|
4028
4016
|
|
|
4017
|
+
// src/work-calendar-time.ts
|
|
4018
|
+
function workingTimeOfWeek(calendar, weekStartMs, utcOffsetMinutes) {
|
|
4019
|
+
if (!calendar?.length) return { hoursPerWeek: 7 * 24, daysPerWeek: 7 };
|
|
4020
|
+
let minutes = 0;
|
|
4021
|
+
const touched = /* @__PURE__ */ new Set();
|
|
4022
|
+
for (let m = 0; m < 7 * 24 * 60; m++) {
|
|
4023
|
+
if (!inWorkCalendarAt(calendar, weekStartMs + m * 6e4, utcOffsetMinutes)) continue;
|
|
4024
|
+
minutes++;
|
|
4025
|
+
touched.add(Math.floor((m + (utcOffsetMinutes ?? 0)) / (24 * 60)));
|
|
4026
|
+
}
|
|
4027
|
+
const declared = /* @__PURE__ */ new Set();
|
|
4028
|
+
for (const e of calendar) if (e.entryType !== "non-working") for (const d of e.daysOfWeek ?? []) declared.add(d);
|
|
4029
|
+
return { hoursPerWeek: minutes / 60, daysPerWeek: declared.size || touched.size };
|
|
4030
|
+
}
|
|
4031
|
+
function nonWorkingMsIn(calendar, fromMs, toMs, utcOffsetMinutes) {
|
|
4032
|
+
if (!calendar?.length) return void 0;
|
|
4033
|
+
if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || toMs <= fromMs) return void 0;
|
|
4034
|
+
const minutes = Math.floor((toMs - fromMs) / 6e4);
|
|
4035
|
+
let closed = 0;
|
|
4036
|
+
for (let m = 0; m < minutes; m++) {
|
|
4037
|
+
if (!inWorkCalendarAt(calendar, fromMs + m * 6e4, utcOffsetMinutes)) closed++;
|
|
4038
|
+
}
|
|
4039
|
+
return closed * 6e4;
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4029
4042
|
// src/capacity.ts
|
|
4030
4043
|
function paramOf(op, id) {
|
|
4031
4044
|
return op.parameters?.find((p) => p.id === id)?.value;
|
|
@@ -10717,6 +10730,7 @@ function electricityCost(input) {
|
|
|
10717
10730
|
journalProjector,
|
|
10718
10731
|
monteCarloForecast,
|
|
10719
10732
|
monteCarloForecastAsync,
|
|
10733
|
+
nonWorkingMsIn,
|
|
10720
10734
|
operationsCapabilityOf,
|
|
10721
10735
|
partialFitPolicy,
|
|
10722
10736
|
planMakeToOrder,
|
|
@@ -10727,5 +10741,6 @@ function electricityCost(input) {
|
|
|
10727
10741
|
replayFrom,
|
|
10728
10742
|
replaySegments,
|
|
10729
10743
|
replayWithCheckpoint,
|
|
10730
|
-
standsNewOrderRow
|
|
10744
|
+
standsNewOrderRow,
|
|
10745
|
+
workingTimeOfWeek
|
|
10731
10746
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/twin-kernel",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Twin Domain Kernel — framework-agnostic, zero-dep (domain + sim + 3-channel contract). WMS/YMS/MES, EPCIS 2.0 · ISA-95.",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"test": "node --test test/*.test.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@operato/ops-contract": "^0.9.
|
|
40
|
+
"@operato/ops-contract": "^0.9.48"
|
|
41
41
|
}
|
|
42
42
|
}
|