oltc-selector 2.3.1 → 2.3.2

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.
Files changed (3) hide show
  1. package/README.md +31 -2
  2. package/bin/oltc.js +32 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,7 +6,7 @@ The type is a starting point. Get engineering confirmation before an order.
6
6
 
7
7
  ## CLI
8
8
 
9
- You do not need to clone this repository.
9
+ You do not need to clone this repository. Node.js 20 or later is needed.
10
10
 
11
11
  ```bash
12
12
  npm i -g oltc-selector
@@ -15,8 +15,14 @@ oltc --iu 350 --um 40.5 --conn D --reg W --pm 8
15
15
  # CV2III-350D/40.5-10193W
16
16
 
17
17
  oltc --octc --iu 800 --um 72.5 --conn D --series II --contact 6x5
18
+ # WSLII-800D/72.5-6x5A
19
+
18
20
  oltc --iu 600 --um 72.5 --conn Y --reg W --pm 8 --structure combined
21
+ # CM2III-600Y/72.5B-10193W
22
+
19
23
  oltc --mva 25 --kv 110 --tap neutral --reg W --pm 8
24
+ # CV2III-350Y/72.5-10193W
25
+
20
26
  oltc --mva 16 --kv 22 --tap line --winding star
21
27
  # CV2III-600D/40.5-10193W
22
28
 
@@ -29,6 +35,13 @@ oltc --line "220/110/35kV-125MVA 225±8x1,25%/115/35kV YNa0d11"
29
35
  # 3xCM2I-500/252D-10193W, plus the type at Um 126 / 170 / 252
30
36
  ```
31
37
 
38
+ Output is in Chinese by default; `--lang en` gives English. Every run asks npm for a newer version and prints a notice when there is one. Nothing is installed for you.
39
+
40
+ <details>
41
+ <summary><b>All flags</b></summary>
42
+
43
+ <br>
44
+
32
45
  | Flag | Meaning | Default |
33
46
  |------|---------|---------|
34
47
  | `--line "text"` | Tender line: MVA, kV ratio with ±N×x%, vector group. Flags given beside it win. | |
@@ -38,7 +51,7 @@ oltc --line "220/110/35kV-125MVA 225±8x1,25%/115/35kV YNa0d11"
38
51
  | `--step-pct` | Step as a percent (1.25 means 1.25 %), capacity path only | 1.25 |
39
52
  | `--os-imax` | Capacity path: the Imax the OS or maker states at the lowest tap (`--imax` beside `--mva` means this) | |
40
53
  | `--kind two\|auto` | Transformer kind (`--auto` = `--kind auto`) | two-winding |
41
- | `--tap` | Where the OLTC sits: `neutral` / `line` (two-winding), `junction` / `mv-line` (autotransformer). Sets current, Ust and Um. | neutral |
54
+ | `--tap` | Where the OLTC sits: `neutral` / `line` (two-winding), `junction` / `mv-line` (autotransformer). Sets current, Ust and Um. | neutral; junction with `--kind auto` |
42
55
  | `--winding star\|delta` | Tapped winding connection (two-winding) | star |
43
56
  | `--hv` `--mv` | Autotransformer HV / MV rated kV | |
44
57
  | `--earth-um` | OLTC insulation to earth from the OS; overrides the rule | |
@@ -72,6 +85,13 @@ Every flag with a value also takes `--flag=value`. A flag that cannot take effec
72
85
 
73
86
  **Exit code:** `0` a type was found (or help / version); `1` no type, or bad input.
74
87
 
88
+ </details>
89
+
90
+ <details>
91
+ <summary><b><code>--json</code> keys</b></summary>
92
+
93
+ <br>
94
+
75
95
  **`--json`** prints one object. For bad input (a flag that cannot be read) the object holds only `ok`, `version`, `model` and `errors`.
76
96
 
77
97
  | Key | Holds |
@@ -87,8 +107,15 @@ Every flag with a value also takes `--flag=value`. A flag that cannot take effec
87
107
  | `assumptions` | Every default that was applied, as text |
88
108
  | `errors` | Why there is no type |
89
109
 
110
+ </details>
111
+
90
112
  ## Selection rules
91
113
 
114
+ <details>
115
+ <summary><b>The eleven rules the engine follows</b></summary>
116
+
117
+ <br>
118
+
92
119
  1. **Minimum-adequate, not SHZV-by-default.** Rank **CV2 → CM2 → SHZV → SDZV → SHZVG**. SDZV (dual-break, Ust 6000 V) only when SHZV step voltage or step capacity is short. Prefer one three-phase unit over `3×` singles when a brochure III type exists.
93
120
  2. **OLTC existence comes from brochure / catalogue axes** (`lib/catalog.ts`), **not price-list Y/D twins**. A 2025 list row that prices `CM2III-…D` the same as Y does **not** make `CM2III-…D` a type.
94
121
  3. **No CV2-500.** CV2 III currents are 350 and 600 only.
@@ -100,3 +127,5 @@ Every flag with a value also takes `--flag=value`. A flag that cannot take effec
100
127
  9. **Um is set where the tap changer sits** (`lib/transformer.ts`). Line end: the winding system's class (132 kV → 145, 220 kV → 252). Neutral: the full class up to 72.5; above that 72.5 is assumed and flagged. Autotransformer: the HV system's class, combined types only (no CV / CV2 / SV).
101
128
  10. **Tapped windings on 220 kV class and above take combined types only.** 2025–2026 OS: 67 of 67 were CM / CM2 / SHZV.
102
129
  11. **An open Um is shown as a choice.** Star points above 72.5 and autotransformers list the type at each Um class; the tender's insulation picks one (`--earth-um`, or a row on the card).
130
+
131
+ </details>
package/bin/oltc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // lib/appVersion.ts
4
- var APP_VERSION = "2.3.1";
4
+ var APP_VERSION = "2.3.2";
5
5
 
6
6
  // lib/decimal.ts
7
7
  var GROUPED = /^\d{1,3}([,,]\d{3})+$/;
@@ -2869,21 +2869,21 @@ function deriveDuty(spec) {
2869
2869
  );
2870
2870
  }
2871
2871
  if (umRule === "neutral_full" && umAssumed) {
2872
- cautionsZh.push("35 kV \u7EA7\u4E2D\u6027\u70B9\u5148\u6309 Um 40.5 kV \u9009\uFF1B\u4E0D\u5C11\u9879\u76EE\u8981\u6C42 72.5\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u4E3A\u51C6\u3002CM/CM2/SHZV \u6700\u4F4E\u5C31\u662F 72.5\u3002");
2872
+ cautionsZh.push("35 kV \u7EA7\u4E2D\u6027\u70B9\u5148\u6309 Um 40.5 kV \u9009\uFF1B\u4E0D\u5C11\u9879\u76EE\u8981\u6C42 72.5\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\u4E3A\u51C6\u3002CM/CM2/SHZV \u6700\u4F4E\u5C31\u662F 72.5\u3002");
2873
2873
  cautionsEn.push("35 kV-class neutral sized at Um 40.5 kV; many projects specify 72.5; the order specification (OS) decides. CM/CM2/SHZV start at 72.5.");
2874
2874
  }
2875
2875
  if (umRule === "neutral_assumed") {
2876
2876
  if (neutralMarket === "IT") {
2877
- cautionsZh.push(`\u610F\u5927\u5229\u4E2D\u6027\u70B9\u5148\u6309\u7EBF\u7AEF\u7B49\u7EA7 Um ${umKv} kV \u9009\uFF08\u90E8\u5206\u9879\u76EE\u7528 72.5\uFF09\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u4E3A\u51C6\u3002`);
2877
+ cautionsZh.push(`\u610F\u5927\u5229\u4E2D\u6027\u70B9\u5148\u6309\u7EBF\u7AEF\u7B49\u7EA7 Um ${umKv} kV \u9009\uFF08\u90E8\u5206\u9879\u76EE\u7528 72.5\uFF09\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\u4E3A\u51C6\u3002`);
2878
2878
  cautionsEn.push(`Italy: neutral sized at the line class, Um ${umKv} kV (some projects use 72.5); the order specification (OS) decides.`);
2879
2879
  } else if (neutralMarket === "TR") {
2880
- cautionsZh.push(`\u571F\u8033\u5176 220 kV \u7EA7\u53CA\u4EE5\u4E0A\u4E2D\u6027\u70B9\u5148\u6309 Um ${umKv} kV \u9009\uFF08\u901A\u5E38 126 \u6216 170\uFF0C\u4E0D\u7528 72.5\uFF09\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u4E3A\u51C6\u3002`);
2880
+ cautionsZh.push(`\u571F\u8033\u5176 220 kV \u7EA7\u53CA\u4EE5\u4E0A\u4E2D\u6027\u70B9\u5148\u6309 Um ${umKv} kV \u9009\uFF08\u901A\u5E38 126 \u6216 170\uFF0C\u4E0D\u7528 72.5\uFF09\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\u4E3A\u51C6\u3002`);
2881
2881
  cautionsEn.push(`Turkey: 220 kV-class and above neutral sized at Um ${umKv} kV (126 or 170 is usual, not 72.5); the order specification (OS) decides.`);
2882
2882
  } else if (umKv === NEUTRAL_400KV_UM) {
2883
- cautionsZh.push(`400 kV \u7EA7\u7ED5\u7EC4\u4E2D\u6027\u70B9\u5148\u6309 Um ${umKv} kV \u9009\uFF08\u571F\u8033\u5176\u3001\u8461\u8404\u7259\u5E38\u7528 126\uFF1B\u5DF4\u897F 440/500 kV \u5E38\u7528 72.5\uFF09\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u4E3A\u51C6\u3002`);
2883
+ cautionsZh.push(`400 kV \u7EA7\u7ED5\u7EC4\u4E2D\u6027\u70B9\u5148\u6309 Um ${umKv} kV \u9009\uFF08\u571F\u8033\u5176\u3001\u8461\u8404\u7259\u5E38\u7528 126\uFF1B\u5DF4\u897F 440/500 kV \u5E38\u7528 72.5\uFF09\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\u4E3A\u51C6\u3002`);
2884
2884
  cautionsEn.push(`Neutral of a 400 kV-class winding sized at Um ${umKv} kV (126 is usual in Turkey and Portugal; 72.5 in Brazil at 440/500 kV); the order specification (OS) decides.`);
2885
2885
  } else {
2886
- cautionsZh.push(`\u4E2D\u6027\u70B9\u7EDD\u7F18\u672A\u7ED9\uFF0C\u5148\u6309 Um ${umKv} kV \u9009\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u4E3A\u51C6\u3002`);
2886
+ cautionsZh.push(`\u4E2D\u6027\u70B9\u7EDD\u7F18\u672A\u7ED9\uFF0C\u5148\u6309 Um ${umKv} kV \u9009\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\u4E3A\u51C6\u3002`);
2887
2887
  cautionsEn.push(`Neutral insulation not given: sized at Um ${umKv} kV; the order specification (OS) decides.`);
2888
2888
  }
2889
2889
  }
@@ -2898,11 +2898,11 @@ function deriveDuty(spec) {
2898
2898
  cautionsZh.push("230/121 kV \u81EA\u8026\u53D8\u4E2D\u538B\u51FA\u7EBF\u901A\u5E38\u7528 Um 170 kV\uFF0C\u8BF7\u6309\u5382\u5BB6\u6570\u636E\u6838\u5BF9\u3002");
2899
2899
  cautionsEn.push("230/121 kV autotransformer MV line lead: Um 170 kV is usual; check the maker's data.");
2900
2900
  } else {
2901
- cautionsZh.push(`\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\u6682\u6309 ${umKv} kV \u9009\uFF0C\u8BA2\u8D27\u524D\u8BF7\u6309\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u786E\u8BA4\u3002`);
2901
+ cautionsZh.push(`\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\u6682\u6309 ${umKv} kV \u9009\uFF0C\u8BA2\u8D27\u524D\u8BF7\u6309\u8BA2\u8D27\u89C4\u8303\u786E\u8BA4\u3002`);
2902
2902
  cautionsEn.push(`MV line lead sized at the MV class, Um ${umKv} kV; the order specification (OS) decides.`);
2903
2903
  }
2904
2904
  } else if (spec.tapPoint === "auto_junction" && umRule === "auto_hv") {
2905
- cautionsZh.push(`\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\u6682\u6309 ${umKv} kV \u9009\uFF0C\u8BA2\u8D27\u524D\u8BF7\u6309\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u786E\u8BA4\u3002`);
2905
+ cautionsZh.push(`\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\u6682\u6309 ${umKv} kV \u9009\uFF0C\u8BA2\u8D27\u524D\u8BF7\u6309\u8BA2\u8D27\u89C4\u8303\u786E\u8BA4\u3002`);
2906
2906
  cautionsEn.push(`Autotransformer junction sized at the HV class, Um ${umKv} kV; the order specification (OS) decides.`);
2907
2907
  }
2908
2908
  cautionsZh.push("\u81EA\u8026\u53D8\u53EA\u80FD\u7528\u7EC4\u5408\u5F0F\u5F00\u5173\u3002");
@@ -4116,17 +4116,20 @@ function parseCliArgs(rawArgv) {
4116
4116
  continue;
4117
4117
  }
4118
4118
  if (a === "--octc") {
4119
+ if (out.given.has("octc") && !out.octc) throw new CliError("--octc conflicts with --duty oltc. Drop one.");
4119
4120
  out.given.add("octc");
4120
4121
  out.octc = true;
4121
4122
  continue;
4122
4123
  }
4123
4124
  if (a === "--oil") {
4125
+ if (out.given.has("medium") && out.vacuum) throw new CliError("Give --oil or --vacuum, not both");
4124
4126
  out.given.add("medium");
4125
4127
  out.oil = true;
4126
4128
  out.vacuum = false;
4127
4129
  continue;
4128
4130
  }
4129
4131
  if (a === "--vacuum") {
4132
+ if (out.given.has("medium") && out.oil) throw new CliError("Give --oil or --vacuum, not both");
4130
4133
  out.given.add("medium");
4131
4134
  out.vacuum = true;
4132
4135
  out.oil = false;
@@ -4404,9 +4407,11 @@ function parseCliArgs(rawArgv) {
4404
4407
  out.given.add("octc");
4405
4408
  const [v, n] = take(i, a);
4406
4409
  const d = v.toLowerCase();
4410
+ const had = out.octc;
4407
4411
  if (d === "octc" || d === "off" || d === "detc") out.octc = true;
4408
4412
  else if (d === "oltc" || d === "on") out.octc = false;
4409
4413
  else throw new CliError(`--duty must be oltc or octc`);
4414
+ if (had && !out.octc) throw new CliError("--octc conflicts with --duty oltc. Drop one.");
4410
4415
  i = n;
4411
4416
  continue;
4412
4417
  }
@@ -4538,7 +4543,8 @@ Flags:
4538
4543
  --kind two|auto Transformer kind (--auto = --kind auto). Default two-winding.
4539
4544
  --tap P Where the OLTC sits: neutral|line (two-winding),
4540
4545
  junction|mv-line (autotransformer, series/common junction
4541
- or MV line lead). Capacity path; replaces --conn there.
4546
+ or MV line lead). Default neutral; junction with
4547
+ --kind auto. With --mva it replaces --conn.
4542
4548
  --winding star|delta Tapped winding connection (two-winding). Sets the current
4543
4549
  formula: star I = S/(\u221A3U), delta I = S/(3U).
4544
4550
  --hv kV --mv kV Autotransformer HV / MV rated voltage (with --kind auto).
@@ -4710,6 +4716,22 @@ function checkConflicts(args) {
4710
4716
  if (args.typed?.has("--conn") && args.typed.has("--tap") && args.conn === "D" && args.tap === "neutral") {
4711
4717
  throw new CliError("--conn D conflicts with --tap neutral: a neutral tap point is star (Y). Drop one.");
4712
4718
  }
4719
+ const typed = (...flags) => flags.some((f) => args.typed?.has(f));
4720
+ if (typed("--conn", "--connection") && typed("--tap") && args.conn === "Y" && args.tap === "line_end") {
4721
+ throw new CliError("--conn Y conflicts with --tap line: a line-end tap point is delta (D). Drop one.");
4722
+ }
4723
+ if (args.kind !== "auto" && (typed("--hv") || typed("--mv"))) {
4724
+ throw new CliError("--hv and --mv are autotransformer voltages: add --kind auto (a two-winding transformer takes --kv)");
4725
+ }
4726
+ if (typed("--minus") && args.mva == null) {
4727
+ throw new CliError("--minus sets the lowest-tap current on the --mva path; with --iu give the current itself");
4728
+ }
4729
+ if (typed("--um") && typed("--earth-um") && args.um != null && args.earthUm != null && args.um !== args.earthUm) {
4730
+ throw new CliError(`Give --um or --earth-um, not both: ${args.um} and ${args.earthUm} disagree.`);
4731
+ }
4732
+ if (args.stepPct != null && args.stepPct < 0.1) {
4733
+ throw new CliError(`--step-pct is a percent: 1.25 means 1.25 %. ${args.stepPct} is too small.`);
4734
+ }
4713
4735
  if (g("pm") && g("positions") && args.pm != null && args.positions != null) {
4714
4736
  const wg = () => plusMinusFromPositions(args.positions, args.reg) === args.pm || [1, 3].some(
4715
4737
  (mid) => resolveTapFields({ regulation: args.reg, plusMinusSteps: args.pm, midPositions: mid }).positions === args.positions
@@ -5020,7 +5042,7 @@ function cliNotes(args, input, primaryUmKv, en, engineNotes = []) {
5020
5042
  const already = duty.cautionsEn.some((c) => c.startsWith("Stated Um"));
5021
5043
  if (!already) {
5022
5044
  notes.push(
5023
- en ? `Stated insulation to earth, Um ${duty.umKv} kV, is below the ${duty.ruleUmKv} kV the winding voltage gives. Check the order specification (OS).` : `\u6307\u5B9A\u5BF9\u5730\u7EDD\u7F18 Um ${duty.umKv} kV \u4F4E\u4E8E\u6309\u7ED5\u7EC4\u7535\u538B\u5F97\u51FA\u7684 ${duty.ruleUmKv} kV\uFF0C\u8BF7\u6838\u5BF9\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u3002`
5045
+ en ? `Stated insulation to earth, Um ${duty.umKv} kV, is below the ${duty.ruleUmKv} kV the winding voltage gives. Check the order specification (OS).` : `\u6307\u5B9A\u5BF9\u5730\u7EDD\u7F18 Um ${duty.umKv} kV \u4F4E\u4E8E\u6309\u7ED5\u7EC4\u7535\u538B\u5F97\u51FA\u7684 ${duty.ruleUmKv} kV\uFF0C\u8BF7\u6838\u5BF9\u8BA2\u8D27\u89C4\u8303\u3002`
5024
5046
  );
5025
5047
  }
5026
5048
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oltc-selector",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "OLTC/OCTC type selection CLI. No prices. Same engine as the web app.",
5
5
  "bin": {
6
6
  "oltc": "bin/oltc.js"