@operato/twin-kernel 0.7.81 → 0.7.83
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/contract.d.ts +12 -0
- package/dist/ems-kernel.js +25 -4
- package/dist-cjs/index.cjs +9 -4
- package/package.json +1 -1
package/dist/contract.d.ts
CHANGED
|
@@ -2096,6 +2096,18 @@ export interface GenerationPeriodObservation {
|
|
|
2096
2096
|
/** 이 기간에서 마지막으로 본 적산과 그 시각 — 기간 누적은 이것이 곧 총량이다. */
|
|
2097
2097
|
lastKWh: number;
|
|
2098
2098
|
lastMs: number;
|
|
2099
|
+
/**
|
|
2100
|
+
* 그 적산이 **어떤 누적인가** — 마감할 때 총량을 얻는 방법이 이것으로 갈린다.
|
|
2101
|
+
*
|
|
2102
|
+
* ── 왜 여기 함께 두나 (2026-08-30) ────────────────────────────────────────
|
|
2103
|
+
* 설비 상태는 원천이 다시 보내 주므로 재기동에서 되살리지 않는다(관측 축은 원천에서). 그 규율은
|
|
2104
|
+
* 맞다. 그런데 **누적의 종류는 관측이 아니라 그 원본이 어떤 값을 주는지에 대한 사실**이다 —
|
|
2105
|
+
* 값은 다음 표본에 다시 오지만 종류도 그때까지 없다.
|
|
2106
|
+
*
|
|
2107
|
+
* 태양광은 밤에 표본을 보내지 않는다. 그래서 밤에 재기동하면 종류가 사라지고, 시계가 자정을
|
|
2108
|
+
* 지나도 **어느 기간의 값인지 몰라 마감하지 못한다.** 실제로 그렇게 됐다(2026-08-30 04:54).
|
|
2109
|
+
*/
|
|
2110
|
+
accumulation?: 'lifetime' | 'daily' | 'monthly' | 'billing' | 'unknown';
|
|
2099
2111
|
}
|
|
2100
2112
|
/**
|
|
2101
2113
|
* 조치방향 — code=안정 조치 키(언어 중립). command 있으면 원클릭 실행, 없으면 권고.
|
package/dist/ems-kernel.js
CHANGED
|
@@ -548,7 +548,26 @@ export class EmsKernel extends FlowEngine {
|
|
|
548
548
|
const eq = this.equipment.get(id);
|
|
549
549
|
if (!eq)
|
|
550
550
|
continue;
|
|
551
|
-
|
|
551
|
+
/*
|
|
552
|
+
* 종류는 **관측과 함께 이어받은 것**이 먼저다. 설비 상태는 재기동에서 되살아나지 않으므로
|
|
553
|
+
* (관측 축은 원천에서), 밤에 재기동하면 상태의 종류가 비어 있다 — 그러면 자정이 지나도
|
|
554
|
+
* 「어느 기간의 값인지 모른다」로 마감하지 못한다.
|
|
555
|
+
*/
|
|
556
|
+
const kind = obs.accumulation ?? eq.generatedKWhAccumulation;
|
|
557
|
+
/*
|
|
558
|
+
* ── 마감하지 못하면 **손대지 않는다** (2026-08-30, 고침) ─────────────────
|
|
559
|
+
*
|
|
560
|
+
* 종류를 모르면 마감할 수 없다. 그런데 그대로 아래로 내려보내면 관측이 **오늘 것으로 덮인다** —
|
|
561
|
+
* 표본이 왔을 때는 그 재설정이 맞지만(새 관측이니까), 시계로 부를 때는 새 표본이 없다.
|
|
562
|
+
* 덮으면 어제는 영영 마감되지 않는다.
|
|
563
|
+
*
|
|
564
|
+
* 실제로 그렇게 됐다: 밤에 재기동해 종류가 비었고, 시계가 자정을 지날 때마다 어제 관측이
|
|
565
|
+
* 오늘로 밀렸다. 아침 표본이 와도 마감할 어제가 남아 있지 않다.
|
|
566
|
+
*/
|
|
567
|
+
if (kind === undefined || kind === 'unknown') {
|
|
568
|
+
this.unclosedGenerationPeriods++;
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
552
571
|
/*
|
|
553
572
|
* 마감은 `applyGenerated` 와 **같은 함수**로 한다 — 규칙을 두 벌 만들면 표본으로 닫은 날과
|
|
554
573
|
* 시계로 닫은 날이 다른 값을 낸다.
|
|
@@ -591,7 +610,8 @@ export class EmsKernel extends FlowEngine {
|
|
|
591
610
|
*/
|
|
592
611
|
closeGenerationPeriod(id, eq, at) {
|
|
593
612
|
const obs = this.generationPeriodObs.get(id);
|
|
594
|
-
|
|
613
|
+
/* 종류를 함께 들고 간다 — 재기동에서 설비 상태는 사라지지만 이 관측은 이어진다. */
|
|
614
|
+
const fresh = { dayIndex: at.dayIndex, fromMs: at.atMs, lastKWh: at.kWh, lastMs: at.atMs, accumulation: at.kind };
|
|
595
615
|
/* 계기가 되돌아간 뒤의 관측은 쓸 수 없다 — 되돌아간 시점 앞뒤가 한 기간에 섞인다. */
|
|
596
616
|
if (at.faulted || !obs || at.kind === undefined || at.kind === 'unknown') {
|
|
597
617
|
this.generationPeriodObs.set(id, fresh);
|
|
@@ -622,7 +642,7 @@ export class EmsKernel extends FlowEngine {
|
|
|
622
642
|
if (at.dayIndex !== obs.dayIndex)
|
|
623
643
|
this.generationPeriodObs.set(id, fresh);
|
|
624
644
|
else
|
|
625
|
-
this.generationPeriodObs.set(id, { ...obs, lastKWh: at.kWh, lastMs: at.atMs });
|
|
645
|
+
this.generationPeriodObs.set(id, { ...obs, lastKWh: at.kWh, lastMs: at.atMs, accumulation: (at.kind ?? obs.accumulation) });
|
|
626
646
|
return;
|
|
627
647
|
}
|
|
628
648
|
/*
|
|
@@ -1614,7 +1634,8 @@ export class EmsKernel extends FlowEngine {
|
|
|
1614
1634
|
dayIndex: Number(o.dayIndex),
|
|
1615
1635
|
fromMs: Number(o.fromMs),
|
|
1616
1636
|
lastKWh: Number(o.lastKWh),
|
|
1617
|
-
lastMs: Number(o.lastMs)
|
|
1637
|
+
lastMs: Number(o.lastMs),
|
|
1638
|
+
...(o.accumulation ? { accumulation: o.accumulation } : {})
|
|
1618
1639
|
});
|
|
1619
1640
|
}
|
|
1620
1641
|
/* 못 마감한 수도 이어받는다 — 이어받지 않으면 재기동마다 0 으로 돌아가 문제가 사라진 것처럼 보인다. */
|
package/dist-cjs/index.cjs
CHANGED
|
@@ -8182,7 +8182,11 @@ var EmsKernel = class extends FlowEngine {
|
|
|
8182
8182
|
if (today <= obs.dayIndex) continue;
|
|
8183
8183
|
const eq = this.equipment.get(id);
|
|
8184
8184
|
if (!eq) continue;
|
|
8185
|
-
const kind = eq.generatedKWhAccumulation;
|
|
8185
|
+
const kind = obs.accumulation ?? eq.generatedKWhAccumulation;
|
|
8186
|
+
if (kind === void 0 || kind === "unknown") {
|
|
8187
|
+
this.unclosedGenerationPeriods++;
|
|
8188
|
+
continue;
|
|
8189
|
+
}
|
|
8186
8190
|
this.closeGenerationPeriod(id, eq, {
|
|
8187
8191
|
atMs: nowMs,
|
|
8188
8192
|
kWh: obs.lastKWh,
|
|
@@ -8219,7 +8223,7 @@ var EmsKernel = class extends FlowEngine {
|
|
|
8219
8223
|
*/
|
|
8220
8224
|
closeGenerationPeriod(id, eq, at) {
|
|
8221
8225
|
const obs = this.generationPeriodObs.get(id);
|
|
8222
|
-
const fresh = { dayIndex: at.dayIndex, fromMs: at.atMs, lastKWh: at.kWh, lastMs: at.atMs };
|
|
8226
|
+
const fresh = { dayIndex: at.dayIndex, fromMs: at.atMs, lastKWh: at.kWh, lastMs: at.atMs, accumulation: at.kind };
|
|
8223
8227
|
if (at.faulted || !obs || at.kind === void 0 || at.kind === "unknown") {
|
|
8224
8228
|
this.generationPeriodObs.set(id, fresh);
|
|
8225
8229
|
return;
|
|
@@ -8241,7 +8245,7 @@ var EmsKernel = class extends FlowEngine {
|
|
|
8241
8245
|
if (startMs === void 0 || endMs === void 0 || boundary === void 0 || !Number.isFinite(startMs) || !Number.isFinite(endMs)) {
|
|
8242
8246
|
if (at.dayIndex > obs.dayIndex) this.unclosedGenerationPeriods++;
|
|
8243
8247
|
if (at.dayIndex !== obs.dayIndex) this.generationPeriodObs.set(id, fresh);
|
|
8244
|
-
else this.generationPeriodObs.set(id, { ...obs, lastKWh: at.kWh, lastMs: at.atMs });
|
|
8248
|
+
else this.generationPeriodObs.set(id, { ...obs, lastKWh: at.kWh, lastMs: at.atMs, accumulation: at.kind ?? obs.accumulation });
|
|
8245
8249
|
return;
|
|
8246
8250
|
}
|
|
8247
8251
|
const total = obs.lastKWh;
|
|
@@ -8957,7 +8961,8 @@ var EmsKernel = class extends FlowEngine {
|
|
|
8957
8961
|
dayIndex: Number(o.dayIndex),
|
|
8958
8962
|
fromMs: Number(o.fromMs),
|
|
8959
8963
|
lastKWh: Number(o.lastKWh),
|
|
8960
|
-
lastMs: Number(o.lastMs)
|
|
8964
|
+
lastMs: Number(o.lastMs),
|
|
8965
|
+
...o.accumulation ? { accumulation: o.accumulation } : {}
|
|
8961
8966
|
});
|
|
8962
8967
|
}
|
|
8963
8968
|
if (Number.isFinite(e.unclosedGenerationPeriods)) this.unclosedGenerationPeriods = Number(e.unclosedGenerationPeriods);
|
package/package.json
CHANGED