oltc-selector 2.0.0 → 2.1.0
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 +2 -2
- package/bin/oltc.js +71 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
填工况,给出 2025 目录里**最低满足**的型号。网页和 `oltc` CLI 共用同一份 `selectOltc` 引擎。
|
|
4
4
|
|
|
5
|
-
**CLI:** `npx -y oltc-selector@2.
|
|
5
|
+
**CLI:** `npx -y oltc-selector@2.1.0`,命令是 `oltc`。Agent 技能包另放,不在这个仓库里。
|
|
6
6
|
**网页:** [oltc-selector.vercel.app](https://oltc-selector.vercel.app/) · [GitHub Pages](https://erict16.github.io/oltc-selector/)
|
|
7
7
|
|
|
8
8
|
私人辅助,不是厂家官网。型号是起点,出 OS 前要工程确认。
|
|
@@ -69,7 +69,7 @@ oltc --mva 125 --kind auto --hv 225 --mv 115 --tap junction
|
|
|
69
69
|
|
|
70
70
|
## Web app
|
|
71
71
|
|
|
72
|
-
预选 66 / 110 / 220 kV 带常用工况。默认真变压器容量,星/角推出 Imax(最低分接和安全系数)。调压侧电压推出 Um
|
|
72
|
+
预选 66 / 110 / 220 kV 带常用工况。默认真变压器容量,星/角推出 Imax(最低分接和安全系数)。调压侧电压推出 Um。型号随参数实时更新,结果卡把工况和型号额定并排列出(电流、级电压、级容量、开关绝缘)。开关一组默认折叠,折叠时一行显示当前取值。手机上型号固定在底栏,点箭头跳到完整结果。
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
75
|
npm install
|
package/bin/oltc.js
CHANGED
|
@@ -202,7 +202,7 @@ function resolveTapFields(input) {
|
|
|
202
202
|
return row != null && row.pitch === pitch2;
|
|
203
203
|
};
|
|
204
204
|
if (reg === "linear") {
|
|
205
|
-
const positions2 = input.positions ?? 9;
|
|
205
|
+
const positions2 = input.positions ?? (input.plusMinusSteps != null && input.plusMinusSteps > 0 ? 2 * input.plusMinusSteps + 1 : 9);
|
|
206
206
|
const pitch2 = input.pitch ?? defaultPitch(positions2, reg);
|
|
207
207
|
const mid2 = 0;
|
|
208
208
|
return {
|
|
@@ -2092,17 +2092,17 @@ function deriveDuty(spec) {
|
|
|
2092
2092
|
umKv = catalogueUmFromRatedKv(spec.tapKv);
|
|
2093
2093
|
umRule = "line";
|
|
2094
2094
|
}
|
|
2095
|
+
if (spec.earthUmKv != null && spec.earthUmKv > 0) {
|
|
2096
|
+
umKv = spec.earthUmKv;
|
|
2097
|
+
umRule = "explicit";
|
|
2098
|
+
umAssumed = false;
|
|
2099
|
+
}
|
|
2095
2100
|
if (!Number.isFinite(umKv) || umKv > 363) {
|
|
2096
2101
|
return fail(
|
|
2097
2102
|
"\u7535\u538B\u8D85\u51FA\u76EE\u5F55\uFF1A\u5F00\u5173\u6700\u9AD8 Um 363 kV\u3002",
|
|
2098
2103
|
"Voltage above the catalogue: the highest switch class is Um 363 kV."
|
|
2099
2104
|
);
|
|
2100
2105
|
}
|
|
2101
|
-
if (spec.earthUmKv != null && spec.earthUmKv > 0) {
|
|
2102
|
-
umKv = spec.earthUmKv;
|
|
2103
|
-
umRule = "explicit";
|
|
2104
|
-
umAssumed = false;
|
|
2105
|
-
}
|
|
2106
2106
|
if (umRule === "neutral_full" && umAssumed) {
|
|
2107
2107
|
cautionsZh.push("35 kV \u7EA7\u4E2D\u6027\u70B9\u5148\u6309 Um 40.5 \u9009\uFF1B\u4E0D\u5C11\u8BA2\u5355\uFF08\u4FC4\u7F57\u65AF\u3001\u571F\u8033\u5176\uFF09\u6309 72.5 \u4E70\uFF0C\u4EE5 OS \u4E3A\u51C6\u3002");
|
|
2108
2108
|
cautionsEn.push("35 kV-class neutral sized at Um 40.5; many orders (Russia, Turkey) bought 72.5. The OS decides.");
|
|
@@ -2467,6 +2467,46 @@ Flags:
|
|
|
2467
2467
|
Defaults match the web first paint: on-load, in-tank vacuum, structure auto,
|
|
2468
2468
|
\xB18 mid-3 reversing. Omitting --octc and --structure auto is minimum-adequate.
|
|
2469
2469
|
`;
|
|
2470
|
+
function cliTapPoint(args) {
|
|
2471
|
+
if (args.tap) return args.tap;
|
|
2472
|
+
if (args.kind === "auto") return "auto_junction";
|
|
2473
|
+
return args.conn === "D" || args.winding === "delta" ? "line_end" : "neutral";
|
|
2474
|
+
}
|
|
2475
|
+
function tapSetsConnection(args) {
|
|
2476
|
+
return args.mva != null || args.tap != null || args.kind === "auto" || args.winding === "delta";
|
|
2477
|
+
}
|
|
2478
|
+
function cliConnection(args) {
|
|
2479
|
+
if (!tapSetsConnection(args)) return args.conn;
|
|
2480
|
+
return cliTapPoint(args) === "neutral" ? "Y" : "D";
|
|
2481
|
+
}
|
|
2482
|
+
var pmGiven = (args) => args.given.has("pm") && args.pm != null && args.pm > 0;
|
|
2483
|
+
function cliPlusMinus(args) {
|
|
2484
|
+
if (pmGiven(args)) return { n: args.pm, mid: 3 };
|
|
2485
|
+
if (args.positions != null) {
|
|
2486
|
+
const n = plusMinusFromPositions(args.positions, args.reg);
|
|
2487
|
+
if (n == null) return null;
|
|
2488
|
+
const mid = lookupByPositions(args.positions, 3, args.reg) ? 3 : 1;
|
|
2489
|
+
return { n, mid };
|
|
2490
|
+
}
|
|
2491
|
+
if (args.given.has("pm")) return null;
|
|
2492
|
+
return args.pm != null && args.pm > 0 ? { n: args.pm, mid: 3 } : null;
|
|
2493
|
+
}
|
|
2494
|
+
function cliMinusSteps(args) {
|
|
2495
|
+
const fromPositions = args.positions != null && args.positions > 1 ? Math.ceil((args.positions - 1) / 2) : null;
|
|
2496
|
+
if (args.octc || args.reg === "linear") {
|
|
2497
|
+
if (fromPositions != null) return fromPositions;
|
|
2498
|
+
if (pmGiven(args)) return args.pm;
|
|
2499
|
+
return 8;
|
|
2500
|
+
}
|
|
2501
|
+
const pm = cliPlusMinus(args);
|
|
2502
|
+
if (pm) return pm.n;
|
|
2503
|
+
return fromPositions ?? 8;
|
|
2504
|
+
}
|
|
2505
|
+
function cliLinearPositions(args) {
|
|
2506
|
+
if (args.positions != null) return args.positions;
|
|
2507
|
+
if (pmGiven(args)) return Math.round(2 * args.pm + 1);
|
|
2508
|
+
return void 0;
|
|
2509
|
+
}
|
|
2470
2510
|
function cliDuty(args) {
|
|
2471
2511
|
if (args.mva == null) return null;
|
|
2472
2512
|
const auto = args.kind === "auto";
|
|
@@ -2477,7 +2517,7 @@ function cliDuty(args) {
|
|
|
2477
2517
|
} else if (!(args.kv != null && args.kv > 0)) {
|
|
2478
2518
|
throw new CliError("--mva requires --kv (tap-side rated voltage)");
|
|
2479
2519
|
}
|
|
2480
|
-
const tap =
|
|
2520
|
+
const tap = cliTapPoint(args);
|
|
2481
2521
|
const winding = args.winding ?? (tap === "neutral" || args.conn === "Y" ? "star" : "delta");
|
|
2482
2522
|
const pct = args.stepPct != null && args.stepPct > 0 ? args.stepPct / 100 : 0.0125;
|
|
2483
2523
|
const earth = args.earthUm != null && args.earthUm > 0 ? args.earthUm : args.um != null && args.um > 0 ? args.um : void 0;
|
|
@@ -2489,7 +2529,7 @@ function cliDuty(args) {
|
|
|
2489
2529
|
tapKv: args.kv ?? 0,
|
|
2490
2530
|
hvKv: args.hv ?? 0,
|
|
2491
2531
|
mvKv: args.mv ?? 0,
|
|
2492
|
-
minusSteps: args
|
|
2532
|
+
minusSteps: cliMinusSteps(args),
|
|
2493
2533
|
stepFraction: pct,
|
|
2494
2534
|
// 与网页版首屏一致:容量路径默认不额外加安全系数
|
|
2495
2535
|
safetyK: args.k != null && args.k > 0 ? args.k : 1,
|
|
@@ -2523,8 +2563,8 @@ function cliToSelectInput(args) {
|
|
|
2523
2563
|
if (um == null || !(um > 0)) um = duty.umKv;
|
|
2524
2564
|
if (!(ust > 0) && duty.stepV != null) ust = duty.stepV;
|
|
2525
2565
|
conn = duty.connection;
|
|
2526
|
-
} else
|
|
2527
|
-
conn = args
|
|
2566
|
+
} else {
|
|
2567
|
+
conn = cliConnection(args);
|
|
2528
2568
|
}
|
|
2529
2569
|
if (iu == null || !(iu > 0)) {
|
|
2530
2570
|
throw new CliError("Need --iu (Imax) or --mva plus --kv");
|
|
@@ -2556,11 +2596,13 @@ function cliToSelectInput(args) {
|
|
|
2556
2596
|
input.positions = Math.round(2 * args.pm + 1);
|
|
2557
2597
|
}
|
|
2558
2598
|
} else if (args.reg === "linear") {
|
|
2559
|
-
|
|
2599
|
+
const pos = cliLinearPositions(args);
|
|
2600
|
+
if (pos != null) input.positions = pos;
|
|
2560
2601
|
} else {
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
input.
|
|
2602
|
+
const pm = cliPlusMinus(args);
|
|
2603
|
+
if (pm) {
|
|
2604
|
+
input.plusMinusSteps = pm.n;
|
|
2605
|
+
input.midPositions = pm.mid;
|
|
2564
2606
|
}
|
|
2565
2607
|
if (args.positions != null) input.positions = args.positions;
|
|
2566
2608
|
}
|
|
@@ -2583,21 +2625,29 @@ function assumptionsFromArgs(args, family) {
|
|
|
2583
2625
|
auto_junction: "\u4E32\u8054/\u516C\u5171\u7ED5\u7EC4\u8FDE\u63A5\u70B9",
|
|
2584
2626
|
auto_mv_line: "\u4E2D\u538B\u51FA\u7EBF"
|
|
2585
2627
|
};
|
|
2628
|
+
const tapGiven = args.given.has("tap") || args.given.has("conn") || args.winding === "delta";
|
|
2586
2629
|
if (args.mva != null) {
|
|
2587
2630
|
const duty = cliDuty(args);
|
|
2588
|
-
const tap =
|
|
2631
|
+
const tap = cliTapPoint(args);
|
|
2589
2632
|
items.push(`${args.kind === "auto" ? "\u81EA\u8026\u53D8" : "\u53CC\u7ED5\u7EC4"}${mark("kind")}`);
|
|
2590
|
-
items.push(`\u5F00\u5173\u5728${tapZh[tap]}${
|
|
2633
|
+
items.push(`\u5F00\u5173\u5728${tapZh[tap]}${tapGiven ? "" : "\uFF08\u9ED8\u8BA4\uFF09"}`);
|
|
2591
2634
|
if (args.kind !== "auto") {
|
|
2592
2635
|
const w = args.winding ?? (tap === "neutral" || args.conn === "Y" ? "star" : "delta");
|
|
2593
2636
|
items.push(`${w === "star" ? "\u661F\u5F62" : "\u89D2\u5F62"}\u7ED5\u7EC4${args.given.has("winding") ? "" : "\uFF08\u9ED8\u8BA4\uFF09"}`);
|
|
2594
2637
|
}
|
|
2595
2638
|
if (duty?.umAssumed) items.push(`\u5BF9\u5730 Um ${duty.umKv}\uFF08\u672A\u6307\u5B9A\uFF09`);
|
|
2596
2639
|
} else {
|
|
2640
|
+
const conn = cliConnection(args);
|
|
2641
|
+
const derived = tapSetsConnection(args);
|
|
2597
2642
|
items.push(
|
|
2598
|
-
`conn=${
|
|
2643
|
+
`conn=${conn} ${conn === "Y" ? "\u661F\u70B9" : "\u7EBF\u7AEF"}${derived ? "" : mark("conn")}`
|
|
2599
2644
|
);
|
|
2600
2645
|
if (args.kind === "auto") items.push("\u81EA\u8026\u53D8");
|
|
2646
|
+
if (derived) {
|
|
2647
|
+
items.push(
|
|
2648
|
+
`\u5F00\u5173\u5728${tapZh[cliTapPoint(args)]}${tapGiven ? "" : "\uFF08\u9ED8\u8BA4\uFF09"}`
|
|
2649
|
+
);
|
|
2650
|
+
}
|
|
2601
2651
|
}
|
|
2602
2652
|
if (args.mva != null) {
|
|
2603
2653
|
items.push(args.given.has("k") ? `k=${args.k}` : "k=1.0\uFF08\u9ED8\u8BA4\uFF09");
|
|
@@ -2627,8 +2677,11 @@ function assumptionsFromArgs(args, family) {
|
|
|
2627
2677
|
);
|
|
2628
2678
|
if (args.reg === "linear") {
|
|
2629
2679
|
items.push(
|
|
2630
|
-
args.positions != null ? `${args.positions} \u6863${mark("positions")}` : "\u6863\u6570\u672A\u6307\u5B9A"
|
|
2680
|
+
args.positions != null ? `${args.positions} \u6863${mark("positions")}` : pmGiven(args) ? `${cliLinearPositions(args)} \u6863\uFF08\u7531 \xB1${args.pm} \u63A8\uFF09` : "\u6863\u6570\u672A\u6307\u5B9A"
|
|
2631
2681
|
);
|
|
2682
|
+
} else if (args.positions != null && !args.given.has("pm")) {
|
|
2683
|
+
const pm = cliPlusMinus(args);
|
|
2684
|
+
items.push(pm ? `${args.positions} \u6863\uFF08\xB1${pm.n}\uFF09` : `${args.positions} \u6863`);
|
|
2632
2685
|
} else {
|
|
2633
2686
|
items.push(`\xB1${args.pm ?? 8} \u6863${mark("pm")}`);
|
|
2634
2687
|
}
|