oltc-selector 2.4.0 → 2.5.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.
Files changed (3) hide show
  1. package/README.md +84 -73
  2. package/bin/oltc.js +168 -48
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,92 +6,124 @@ 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. Node.js 20 or later is needed.
10
-
11
9
  ```bash
12
10
  npm i -g oltc-selector
11
+ ```
13
12
 
14
- oltc --iu 350 --um 40.5 --conn D --reg W --pm 8
15
- # CV2III-350D/40.5-10193W
13
+ Then `oltc --help`. You can also skip the install and run `npx -y oltc-selector@latest` with the same flags.
16
14
 
17
- oltc --octc --iu 800 --um 72.5 --conn D --series II --contact 6x5
18
- # WSLII-800D/72.5-6x5A
15
+ ### Recipes
19
16
 
20
- oltc --iu 600 --um 72.5 --conn Y --reg W --pm 8 --structure combined
21
- # CM2III-600Y/72.5B-10193W
17
+ Find the row that matches what you have.
22
18
 
23
- oltc --mva 25 --kv 110 --tap neutral --reg W --pm 8
24
- # CV2III-350Y/72.5-10193W
19
+ | You have | Run | You get |
20
+ |----------|-----|---------|
21
+ | Max current and Um | `oltc --iu 350 --um 40.5 --conn D` | `CV2III-350D/40.5-10193W` |
22
+ | Capacity and voltage, tapped at the star point | `oltc --mva 25 --kv 110 --tap neutral` | `CV2III-350Y/72.5-10193W` |
23
+ | The same, tapped at the line end | `oltc --mva 16 --kv 22 --tap line --winding star` | `CV2III-600D/40.5-10193W` |
24
+ | An autotransformer | `oltc --mva 125 --kind auto --hv 225 --mv 115` | `3xCM2I-500/252D-10193W` |
25
+ | A line from the tender | `oltc --line "125MVA 225±8x1,25%/115/35kV YNa0d11"` | `3xCM2I-500/252D-10193W` |
26
+ | An uneven range | `oltc --mva 40 --kv 110 --range +4/-12x1.25%` | `CV2III-350Y/72.5-10193W` |
27
+ | Insulation to earth from the OS | `oltc --mva 25 --kv 110 --tap neutral --earth-um 126` | `CV2III-350Y/126-10193W` |
28
+ | An off-circuit duty | `oltc --octc --iu 800 --um 72.5 --conn D --series II --contact 6x5` | `WSLII-800D/72.5-6x5A` |
29
+ | A dry-type transformer | `oltc --mva 1.6 --kv 33 --tap line --mount dry --reg 0 --pm 4` | `3xCZI-500/40.5-9` |
30
+ | A combined type wanted | `oltc --iu 600 --um 72.5 --structure combined` | `CM2III-600Y/72.5B-10193W` |
31
+ | A script to feed | `oltc --json --iu 350 --um 40.5 --conn D` | One JSON object |
25
32
 
26
- oltc --mva 16 --kv 22 --tap line --winding star
27
- # CV2III-600D/40.5-10193W
33
+ Output is Chinese by default. `--lang en` (or `OLTC_LANG=en`) prints English. On a Chinese run an error prints in Chinese, then English.
28
34
 
29
- # Autotransformer tapped at the series/common junction (sized on the HV side)
30
- oltc --mva 125 --kind auto --hv 225 --mv 115 --tap junction
31
- # 3xCM2I-500/252D-10193W
35
+ Each run asks npm for a newer version and prints a notice on stderr when there is one. It never installs anything. `--no-update-check`, `OLTC_NO_UPDATE_CHECK=1` or `CI=1` turn the check off.
32
36
 
33
- # Or paste the tender line: YNa0 makes it an autotransformer
34
- oltc --line "220/110/35kV-125MVA 225±8x1,25%/115/35kV YNa0d11"
35
- # 3xCM2I-500/252D-10193W, plus the type at Um 126 / 170 / 252
36
- ```
37
+ ### Flags
38
+
39
+ Grouped like the cards of the web page.
40
+
41
+ <details>
42
+ <summary><b>Transformer</b></summary>
43
+
44
+ <br>
45
+
46
+ | Flag | Meaning | Default |
47
+ |------|---------|---------|
48
+ | `--line "text"` | Tender line: MVA, kV ratio with ±N×x%, vector group. Reads autotransformer from `YNa0` / auto, delta line end from `D`, star neutral from `Y`. Flags given beside it win. `--nameplate` is the same | |
49
+ | `--kind two\|auto` | Transformer kind. `--auto` is `--kind auto` | two-winding |
50
+ | `--tap` | Where the tap changer sits: `neutral` / `line` (two-winding), `junction` / `mv-line` (autotransformer). Sets current, Ust and Um | neutral; junction with `--kind auto` |
51
+ | `--winding star\|delta` | Tapped winding connection (two-winding). Star I = S/(√3U), delta I = S/(3U) | star |
52
+ | `--kv` | Rated voltage of the tapped winding (kV). With `--iu`, it sets the winding voltage for the 220 / 330 kV rules | |
53
+ | `--hv` `--mv` | Autotransformer HV / MV rated voltage (kV) | |
54
+ | `--earth-um` | Insulation to earth from the OS or maker (kV). Overrides the rule | rule |
37
55
 
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.
56
+ </details>
39
57
 
40
58
  <details>
41
- <summary><b>All flags</b></summary>
59
+ <summary><b>Duty</b></summary>
42
60
 
43
61
  <br>
44
62
 
45
63
  | Flag | Meaning | Default |
46
64
  |------|---------|---------|
47
- | `--line "text"` | Tender line: MVA, kV ratio with ±N×x%, vector group. Flags given beside it win. | |
48
- | `--iu` / `--imax` | Max through-current Imax (A). **No** safety factor. | required unless `--mva` |
49
- | `--mva` `--kv` | Transformer MVA + tap-side kV → Imax (min tap + `--k`). With `--iu`, `--kv` alone sets the winding voltage for the 220/330 kV rules | |
65
+ | `--mva` | Transformer capacity. With `--kv`: Imax from rated current at the lowest tap | |
66
+ | `--iu` / `--imax` | Max through-current Imax (A). **No** safety factor | required unless `--mva` |
67
+ | `--os-imax` | Capacity path: the Imax the OS or maker states at the lowest tap. `--imax` beside `--mva` means this | |
50
68
  | `--k` | Safety factor ≥ 1, **capacity path only** | 1.0 |
51
- | `--step-pct` | Step as a percent (1.25 means 1.25 %), capacity path only | 1.25 |
52
- | `--os-imax` | Capacity path: the Imax the OS or maker states at the lowest tap (`--imax` beside `--mva` means this) | |
53
- | `--kind two\|auto` | Transformer kind (`--auto` = `--kind auto`) | two-winding |
54
- | `--tap` | Where the OLTC sits: `neutral` / `line` (two-winding), `junction` / `mv-line` (autotransformer). Sets current, Ust and Um. | neutral; junction with `--kind auto` |
55
- | `--winding star\|delta` | Tapped winding connection (two-winding) | star |
56
- | `--hv` `--mv` | Autotransformer HV / MV rated kV | |
57
- | `--earth-um` | OLTC insulation to earth from the OS; overrides the rule | |
58
- | `--across-li` `--across-ac` | Stated LI / AC withstand across the tap winding (kV): sets the selector grade B/C/D/DE | |
59
- | `--um` | Equipment Um (kV) | derived from `--kv` if omitted |
60
- | `--ust` | Step voltage (V) | 0, or derived on MVA path |
61
- | `--conn Y\|D` | Switch star / delta on the `--iu` path (with `--mva`, use `--tap`) | Y |
62
69
  | `--reg W\|G\|0` | Reversing / coarse-fine / linear | W |
63
70
  | `--pm` | ± steps, a whole number | 8 |
64
71
  | `--pos` / `--positions` | Operating positions (linear and off-circuit; on W/G the Fig. 3-3 row with that count) | |
65
- | `--phases` | `I` / `II` / `III` | III |
66
72
  | `--range +a/-b[xs%]` | Uneven range. W/G takes the Fig. 3-3 row the maker sells (+4/-12 → 10193W); the lowest tap uses −b | |
67
73
  | `--minus` | Minus steps for the lowest-tap current, beside `--pm` / `--pos` | ± steps |
74
+ | `--step-pct` | Step as a percent (1.25 means 1.25 %). Capacity path only | 1.25 |
68
75
  | `--mid 1\|3` | Mid positions of the W/G diagram, when Fig. 3-3 has the pair | brochure |
69
- | `--octc` | Off-circuit 无载 (WSL cage; WDG/WLG/WSG drum). `--duty octc` is the same | on-load |
70
- | `--structure` | `auto` / `combined` 组合式 / `compound` 复合式 / `cage` 笼式 / `drum` 鼓式 | `auto` |
71
- | `--series` | OCTC wiring II IV V VI VII VIII | auto is linear IV for Y and D |
76
+ | `--ust` | Step voltage (V). Given, it is the OS figure and a floor | derived on the capacity path |
77
+ | `--um` | Equipment Um (kV) | derived from `--kv` |
78
+ | `--conn Y\|D` | Switch at the star point / line end. `--iu` path only; with `--mva` or `--line` use `--tap` | Y |
79
+ | `--phases` | `I` / `II` / `III` | III |
80
+
81
+ </details>
82
+
83
+ <details>
84
+ <summary><b>Tap changer</b></summary>
85
+
86
+ <br>
87
+
88
+ | Flag | Meaning | Default |
89
+ |------|---------|---------|
90
+ | `--octc` | Off-circuit (WSL cage; WDG / WLG / WSG drum). `--duty octc` is the same | on-load |
91
+ | `--structure` | `auto` / `combined` / `compound` / `cage` / `drum` | auto |
92
+ | `--series` | Off-circuit wiring `II` `IV` `V` `VI` `VII` `VIII` | auto: linear IV for Y and D |
72
93
  | `--mount` | `in-tank` / `on-tank` / `dry` / `reactor` (oil HWDK) | in-tank |
73
- | `--oil` / `--vacuum` | Switching medium | vacuum (on-load) |
74
- | `--contact` | OCTC contact e.g. `6x5` | |
75
- | `--json` | Machine output (see below) | |
76
- | `--lang en\|zh` | Output language. `OLTC_LANG=en` also works | zh |
77
- | `--version` / `-v` | Print the version | |
78
- | `--help` / `-h` | The flag list. Also shown when no flag is given | |
79
- | `--no-update-check` | Skip the npm check made on every run. A newer version only prints a notice on stderr; nothing is installed. `OLTC_NO_UPDATE_CHECK=1` or `CI=1` also skip it. | check on |
94
+ | `--vacuum` / `--oil` | Switching medium | vacuum (on-load) |
95
+ | `--contact` | Off-circuit contact, e.g. `6x5` | |
96
+ | `--across-li` `--across-ac` | Stated LI / AC withstand across the tap winding (kV). Sets the selector grade B / C / D / DE | |
80
97
 
81
- `--structure auto` and omitting `--octc` match the web first paint: on-load, in-tank vacuum, minimum-adequate ranking.
98
+ </details>
82
99
 
83
- Every flag with a value also takes `--flag=value`. A flag that cannot take effect is an error, not a silent default: `--series` or `--contact` without `--octc`, `--conn D` with `--tap neutral`, `--pm` and `--pos` that disagree, `--vacuum` with `--octc`, a flag given twice.
100
+ <details>
101
+ <summary><b>Output</b></summary>
102
+
103
+ <br>
84
104
 
85
- **Exit code:** `0` a type was found (or help / version); `1` no type, or bad input.
105
+ | Flag | Meaning |
106
+ |------|---------|
107
+ | `--json` | One JSON object on stdout, nothing on stderr. Keys below |
108
+ | `--lang en\|zh` | Output language. `OLTC_LANG=en` also works. Default zh |
109
+ | `--version` / `-v` | Print the version |
110
+ | `--help` / `-h` | The flag list. Also shown when no flag is given |
111
+ | `--no-update-check` | Skip the npm version check |
86
112
 
87
113
  </details>
88
114
 
115
+ Every flag with a value also takes `--flag=value`. A flag that cannot take effect is an error, not a silent default: `--series` or `--contact` without `--octc`, `--conn D` with `--tap neutral`, `--pm` and `--pos` that disagree, `--vacuum` with `--octc`, a flag given twice.
116
+
117
+ With no `--octc` and `--structure auto` the CLI matches the web page's first paint: on-load, in-tank vacuum, minimum-adequate ranking.
118
+
119
+ **Exit code:** `0` a type was found (or help / version). `1` no type, or bad input.
120
+
89
121
  <details>
90
122
  <summary><b><code>--json</code> keys</b></summary>
91
123
 
92
124
  <br>
93
125
 
94
- **`--json`** prints one object. For bad input (a flag that cannot be read) the object holds only `ok`, `version`, `model` and `errors`.
126
+ For bad input the object holds only `ok`, `version`, `model` and `errors`.
95
127
 
96
128
  | Key | Holds |
97
129
  |-----|-------|
@@ -103,28 +135,7 @@ Every flag with a value also takes `--flag=value`. A flag that cannot take effec
103
135
  | `line` | The `--line` read-back: `kind`, `mva`, `voltagesKv`, `vectorGroup`, `warnings` (or `null`) |
104
136
  | `basis` | Where current, Ust and Um came from on the capacity path (or `null`) |
105
137
  | `umChoices` | The type at each Um class when the insulation to earth is open |
106
- | `assumptions` | Every default that was applied, as text |
107
- | `errors` | Why there is no type |
108
-
109
- </details>
110
-
111
- ## Selection rules
112
-
113
- <details>
114
- <summary><b>The eleven rules the engine follows</b></summary>
115
-
116
- <br>
117
-
118
- 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.
119
- 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.
120
- 3. **No CV2-500.** CV2 III currents are 350 and 600 only.
121
- 4. **No combined III-D.** CM / CM2 / CMD / SHZV / SDZV / SHZVG three-phase strings are star-point Y. Cover delta with `3x…I-` when that I type exists. Compound **CV / CV2 / SV** and on-tank **HWV** III-D **do** exist. No SDZV II, I-1200/1500, or III-1300.
122
- 5. **Compound has no selector grade letter.** No `CV2III-350Y/40.5B-…`. Combined in-tank may have B/C/D/DE after Um.
123
- 6. **WSL / WDL existence is 2025-list row keys without prices** (`lib/listIndex.data.json`). Missing rows (no `WSLIV-2000D/126`, no `7x6E` @ 72.5) are not emitted.
124
- 7. **Drum OCTC is the sold WDG / WLG** (single-phase, `3x` per three-phase set, no Y/D in the string). Existence is the distinct sold OS rows (`DRUM_SOLD_ROWS` in `lib/listIndex.ts`). WDG IV is 5x5 up to 5 positions, V is 6x5 up to 6; no WDG on D. **WSG** is catalogue axes only (II/IV/V, 4x5/6x5, up to 6 positions) and stays for the D quote `WSGII-800D/40.5-4x5A`.
125
- 8. **Typing Imax (`--iu`) does not apply a safety factor.** `--k` only applies on the transformer-capacity (`--mva`) path.
126
- 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).
127
- 10. **Tapped windings on 220 kV class and above take combined types only.** 2025–2026 OS: 67 of 67 were CM / CM2 / SHZV.
128
- 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).
138
+ | `assumptions` | Every default that was applied, as text. The text output names only those that could change the type |
139
+ | `errors` | Why there is no type. Chinese then English; English alone with `--lang en` |
129
140
 
130
141
  </details>
package/bin/oltc.js CHANGED
@@ -1,7 +1,106 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // lib/appVersion.ts
4
- var APP_VERSION = "2.4.0";
4
+ var APP_VERSION = "2.5.0";
5
+
6
+ // lib/cliErrorsZh.ts
7
+ var WHAT_ZH = {
8
+ "MVA and kV": "\u5BB9\u91CF\u548C\u7535\u538B",
9
+ "the MVA rating": "\u5BB9\u91CF",
10
+ "the kV ratio": "\u7535\u538B\u6BD4",
11
+ "the kV ratio and range": "\u7535\u538B\u6BD4\u548C\u8C03\u538B\u8303\u56F4"
12
+ };
13
+ var ROWS = [
14
+ [/^(\S+) must be greater than 0 \(got (.+)\)$/, "$1 \u5FC5\u987B\u5927\u4E8E 0\uFF08\u6536\u5230 $2\uFF09"],
15
+ [/^(\S+) must not be negative \(got (.+)\)$/, "$1 \u4E0D\u80FD\u4E3A\u8D1F\uFF08\u6536\u5230 $2\uFF09"],
16
+ [/^Ambiguous number for (\S+): (.+)\. Write 1200 or 1\.2 \(no thousands separator\)\.$/, "$1 \u7684\u6570\u5B57\u6709\u6B67\u4E49\uFF1A$2\u3002\u8BF7\u5199 1200 \u6216 1.2\uFF0C\u4E0D\u8981\u7528\u5343\u5206\u4F4D\u3002"],
17
+ [/^Invalid number for (\S+): (.*)$/, "$1 \u7684\u6570\u5B57\u65E0\u6548\uFF1A$2"],
18
+ [
19
+ /^Unknown flag: (\S+?)\.(?: Did you mean (\S+)\?)?.* Run oltc --help for the list\.$/,
20
+ (m) => `\u672A\u77E5\u53C2\u6570\uFF1A${m[1]}\u3002${m[2] ? `\u662F\u4E0D\u662F\u60F3\u5199 ${m[2]}\uFF1F` : ""}\u8FD0\u884C oltc --help \u67E5\u770B\u5168\u90E8\u53C2\u6570\u3002`
21
+ ],
22
+ [/^(\S+) takes no value$/, "$1 \u4E0D\u5E26\u503C"],
23
+ [/^Missing value for (\S+)$/, "$1 \u7F3A\u5C11\u503C"],
24
+ [/^(\S+) is given twice$/, "$1 \u7ED9\u4E86\u4E24\u6B21"],
25
+ [/^--lang must be en or zh$/, "--lang \u53EA\u80FD\u662F en \u6216 zh"],
26
+ [/^--octc conflicts with --duty oltc\. Drop one\.$/, "--octc \u548C --duty oltc \u77DB\u76FE\uFF0C\u8BF7\u53BB\u6389\u4E00\u4E2A\u3002"],
27
+ [/^Give --oil or --vacuum, not both$/, "--oil \u548C --vacuum \u53EA\u80FD\u7ED9\u4E00\u4E2A"],
28
+ [/^Give --iu or --imax, not both$/, "--iu \u548C --imax \u53EA\u80FD\u7ED9\u4E00\u4E2A"],
29
+ [/^--market is removed\./, "--market \u5DF2\u5220\u9664\u3002\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\u8BF7\u7528 --earth-um\uFF0C\u8DE8\u8C03\u538B\u7ED5\u7EC4\u7684\u8010\u538B\u8BF7\u7528 --across-li / --across-ac\u3002"],
30
+ [/^--conn must be Y or D$/, "--conn \u53EA\u80FD\u662F Y \u6216 D"],
31
+ [/^--kind must be two or auto$/, "--kind \u53EA\u80FD\u662F two \u6216 auto"],
32
+ [/^--tap must be neutral\|line\|junction\|mv-line$/, "--tap \u53EA\u80FD\u662F neutral\u3001line\u3001junction \u6216 mv-line"],
33
+ [/^--winding must be star or delta$/, "--winding \u53EA\u80FD\u662F star \u6216 delta"],
34
+ [/^--reg must be W, G, or 0$/, "--reg \u53EA\u80FD\u662F W\u3001G \u6216 0"],
35
+ [/^--pm must be a whole number of at least 1$/, "--pm \u5FC5\u987B\u662F\u4E0D\u5C0F\u4E8E 1 \u7684\u6574\u6570"],
36
+ [/^(\S+) must be a whole number of at least 2$/, "$1 \u5FC5\u987B\u662F\u4E0D\u5C0F\u4E8E 2 \u7684\u6574\u6570"],
37
+ [/^--structure must be auto\|combined\|compound\|cage\|drum$/, "--structure \u53EA\u80FD\u662F auto\u3001combined\u3001compound\u3001cage \u6216 drum"],
38
+ [/^--series must be II\|IV\|V\|VI\|VII\|VIII$/, "--series \u53EA\u80FD\u662F II\u3001IV\u3001V\u3001VI\u3001VII \u6216 VIII"],
39
+ [/^--mount must be in-tank\|on-tank\|dry\|reactor$/, "--mount \u53EA\u80FD\u662F in-tank\u3001on-tank\u3001dry \u6216 reactor"],
40
+ [/^--contact must look like 6x5 or 12x11D$/, "--contact \u7684\u5199\u6CD5\u5982 6x5 \u6216 12x11D"],
41
+ [/^--phases must be I, II, or III$/, "--phases \u53EA\u80FD\u662F I\u3001II \u6216 III"],
42
+ [/^--minus must be a whole number of steps$/, "--minus \u5FC5\u987B\u662F\u6574\u6570\u7EA7\u6570"],
43
+ [/^--mid must be 1 or 3$/, "--mid \u53EA\u80FD\u662F 1 \u6216 3"],
44
+ [/^--duty must be oltc or octc$/, "--duty \u53EA\u80FD\u662F oltc \u6216 octc"],
45
+ [/^--range must look like \+4\/-12 or \+4\/-12x1\.25%$/, "--range \u7684\u5199\u6CD5\u5982 +4/-12 \u6216 +4/-12x1.25%"],
46
+ [/^--mid (\S+) does not fit (\S+): the Fig\. 3-3 row has mid (\S+)\.$/, "--mid $1 \u548C $2 \u4E0D\u5339\u914D\uFF1A\u6837\u672C\u56FE 3-3 \u5BF9\u5E94\u7684\u4E2D\u95F4\u4F4D\u662F $3\u3002"],
47
+ [
48
+ /^--line reads an autotransformer without both HV and MV kV: (.*)\. Give --hv and --mv\.$/s,
49
+ "--line \u8BFB\u51FA\u662F\u81EA\u8026\u53D8\uFF0C\u4F46\u7F3A\u9AD8\u538B\u6216\u4E2D\u538B\u7535\u538B\uFF1A$1\u3002\u8BF7\u7ED9 --hv \u548C --mv\u3002"
50
+ ],
51
+ [
52
+ /^Could not read (MVA and kV|the MVA rating|the kV ratio|the kV ratio and range) from --line: (.*)\. Write it like "25MVA 110±8x1\.25%\/10\.5kV YNd11", or give --mva\/--kv \(or --hv\/--mv\) instead\.$/s,
53
+ (m) => `--line \u8BFB\u4E0D\u51FA${WHAT_ZH[m[1]]}\uFF1A${m[2]}\u3002\u8BF7\u5199\u6210 "25MVA 110\xB18x1.25%/10.5kV YNd11" \u8FD9\u6837\uFF0C\u6216\u6539\u7528 --mva/--kv\uFF08\u81EA\u8026\u53D8\u7528 --hv/--mv\uFF09\u3002`
54
+ ],
55
+ [/^--kind auto with --mva needs --hv and --mv$/, "--kind auto \u914D --mva \u65F6\u9700\u8981 --hv \u548C --mv"],
56
+ [/^--mva requires --kv \(tap-side rated voltage\)$/, "--mva \u9700\u8981 --kv\uFF08\u8C03\u538B\u4FA7\u989D\u5B9A\u7535\u538B\uFF09"],
57
+ [/^--series is off-circuit wiring: add --octc$/, "--series \u662F\u65E0\u8F7D\u63A5\u7EBF\u65B9\u5F0F\uFF1A\u8BF7\u52A0 --octc"],
58
+ [/^--contact is an off-circuit contact: add --octc$/, "--contact \u662F\u65E0\u8F7D\u89E6\u5934\u89C4\u683C\uFF1A\u8BF7\u52A0 --octc"],
59
+ [/^--structure (\S+) is off-circuit: add --octc \(on-load takes combined or compound\)$/, "--structure $1 \u662F\u65E0\u8F7D\u7ED3\u6784\uFF1A\u8BF7\u52A0 --octc\uFF08\u6709\u8F7D\u7528 combined \u6216 compound\uFF09"],
60
+ [/^--structure (\S+) is on-load only: with --octc use cage or drum$/, "--structure $1 \u53EA\u7528\u4E8E\u6709\u8F7D\uFF1A--octc \u65F6\u7528 cage \u6216 drum"],
61
+ [/^--vacuum does not apply with --octc /, "--vacuum \u4E0D\u9002\u7528\u4E8E --octc\uFF08\u65E0\u8F7D\u5F00\u5173\u4E0D\u5207\u65AD\u7535\u6D41\uFF09"],
62
+ [/^--oil does not apply with --mount dry$/, "--oil \u4E0D\u9002\u7528\u4E8E --mount dry"],
63
+ [/^--vacuum does not apply with --mount reactor /, "--vacuum \u4E0D\u9002\u7528\u4E8E --mount reactor\uFF08\u7535\u6297\u5668\u5F00\u5173\u662F\u6CB9\u6D78\u7684\uFF09"],
64
+ [/^--conn D conflicts with --tap neutral: /, "--conn D \u548C --tap neutral \u77DB\u76FE\uFF1A\u4E2D\u6027\u70B9\u662F\u661F\u5F62\uFF08Y\uFF09\u3002\u8BF7\u53BB\u6389\u4E00\u4E2A\u3002"],
65
+ [/^--conn Y conflicts with --tap line: /, "--conn Y \u548C --tap line \u77DB\u76FE\uFF1A\u7EBF\u7AEF\u662F\u89D2\u5F62\uFF08D\uFF09\u3002\u8BF7\u53BB\u6389\u4E00\u4E2A\u3002"],
66
+ [/^--conn does not apply with --mva: /, "--conn \u4E0D\u7528\u4E8E --mva\uFF1AY \u6216 D \u7531\u5F00\u5173\u4F4D\u7F6E\u51B3\u5B9A\u3002\u7EBF\u7AEF\u7528 --tap line\uFF0C\u89D2\u5F62\u7ED5\u7EC4\u7528 --winding delta\u3002"],
67
+ [/^--hv and --mv are autotransformer voltages: /, "--hv \u548C --mv \u662F\u81EA\u8026\u53D8\u7684\u7535\u538B\uFF1A\u8BF7\u52A0 --kind auto\uFF08\u53CC\u7ED5\u7EC4\u7528 --kv\uFF09"],
68
+ [/^--minus sets the lowest-tap current on the --mva path; /, "--minus \u53EA\u5728 --mva \u8DEF\u5F84\u4E0A\u7528\u6765\u7B97\u6700\u4F4E\u6863\u7535\u6D41\uFF1B--iu \u8DEF\u5F84\u8BF7\u76F4\u63A5\u7ED9\u7535\u6D41"],
69
+ [/^Give --um or --earth-um, not both: (\S+) and (\S+) disagree\.$/, "--um \u548C --earth-um \u53EA\u80FD\u7ED9\u4E00\u4E2A\uFF1A$1 \u548C $2 \u4E0D\u4E00\u81F4\u3002"],
70
+ [/^--step-pct is a percent: 1\.25 means 1\.25 %\. (\S+) is too small\.$/, "--step-pct \u662F\u767E\u5206\u6570\uFF1A1.25 \u8868\u793A 1.25%\u3002$1 \u592A\u5C0F\u3002"],
71
+ [/^--pm (\S+) and --pos (\S+) disagree\. Give one of them\.$/, "--pm $1 \u548C --pos $2 \u4E0D\u4E00\u81F4\uFF0C\u8BF7\u53EA\u7ED9\u4E00\u4E2A\u3002"],
72
+ [/^Give --iu or --mva\/--kv, not both /, "--iu \u548C --mva/--kv \u53EA\u80FD\u7ED9\u4E00\u79CD\uFF08--mva \u65C1\u8FB9\u7684\u8BA2\u8D27\u89C4\u8303 Imax \u7528 --os-imax\uFF09"],
73
+ [/^--os-imax needs --mva\/--kv; /, "--os-imax \u9700\u8981 --mva/--kv\uFF1B--iu \u8DEF\u5F84\u4E0A\u7535\u6D41\u76F4\u63A5\u7528 --iu"],
74
+ [/^--k applies only on the --mva path /, "--k \u53EA\u7528\u4E8E --mva \u8DEF\u5F84\uFF08--iu \u4E0D\u4E58\u5B89\u5168\u7CFB\u6570\uFF09"],
75
+ [/^--k must be ≥ 1$/, "--k \u5FC5\u987B\u4E0D\u5C0F\u4E8E 1"],
76
+ [/^--step-pct needs --mva\/--kv; give --ust on the --iu path$/, "--step-pct \u9700\u8981 --mva/--kv\uFF1B--iu \u8DEF\u5F84\u8BF7\u7ED9 --ust"],
77
+ [/^Give --um or --earth-um, not both, when no winding voltage \(--kv\) is given$/, "\u6CA1\u7ED9\u7ED5\u7EC4\u7535\u538B\uFF08--kv\uFF09\u65F6\uFF0C--um \u548C --earth-um \u53EA\u80FD\u7ED9\u4E00\u4E2A"],
78
+ [/^Need --iu \(Imax\) or --mva plus --kv$/, "\u9700\u8981 --iu\uFF08\u6700\u5927\u7535\u6D41\uFF09\uFF0C\u6216 --mva \u52A0 --kv"],
79
+ [/^Need --um, or --mva\/--kv so Um can be derived$/, "\u9700\u8981 --um\uFF0C\u6216\u7ED9 --mva/--kv \u4EE5\u63A8\u51FA Um"],
80
+ [/^Engine emitted a non-catalogue type: (.*)$/, "\u5F15\u64CE\u7ED9\u51FA\u4E86\u6837\u672C\u518C\u91CC\u6CA1\u6709\u7684\u578B\u53F7\uFF1A$1"],
81
+ [/^Bad transformer data$/, "\u53D8\u538B\u5668\u53C2\u6570\u6709\u8BEF"],
82
+ [/^No type found\.$/, "\u6CA1\u6709\u627E\u5230\u578B\u53F7\u3002"]
83
+ ];
84
+ function cliErrorZh(en) {
85
+ for (const [re, to] of ROWS) {
86
+ const m = en.match(re);
87
+ if (!m) continue;
88
+ return typeof to === "function" ? to(m) : to.replace(/\$(\d)/g, (_, d) => m[Number(d)] ?? "");
89
+ }
90
+ return null;
91
+ }
92
+ var HAS_HAN = /[一-鿿]/;
93
+ function cliErrorLines(message, lang) {
94
+ const lines = message.split("\n").filter((l) => l !== "");
95
+ if (lang === "en") return lines;
96
+ if (lines.some((l) => HAS_HAN.test(l))) return lines;
97
+ const whole = cliErrorZh(message);
98
+ if (whole) return [whole, ...lines];
99
+ return lines.flatMap((l) => {
100
+ const zh = cliErrorZh(l);
101
+ return zh ? [zh, l] : [l];
102
+ });
103
+ }
5
104
 
6
105
  // lib/decimal.ts
7
106
  var GROUPED = /^\d{1,3}([,,]\d{3})+$/;
@@ -2209,7 +2308,7 @@ function selectOltc(input) {
2209
2308
  cautionsEn.push(`Needs the maker's technical review: ${review.join(", ")}.`);
2210
2309
  cautionsZh.push(`\u987B\u5382\u5BB6\u6280\u672F\u7279\u522B\u8BC4\u5BA1\uFF1A${reviewZh.join("\uFF0C")}\u3002`);
2211
2310
  }
2212
- if (tap.changeOver !== "0" && input.transformerKind !== "auto" && (input.tapWindingKv ?? 0) > 121) {
2311
+ if (tap.changeOver !== "0" && (input.transformerKind === "auto" ? (input.umKv ?? 0) > 126 : (input.tapWindingKv ?? 0) > 121)) {
2213
2312
  cautionsEn.push(
2214
2313
  "Change-over selector above 110 kV: check the recovery voltage and quote the tie-in resistor as an option (maker's Cw/Ce needed)."
2215
2314
  );
@@ -2859,13 +2958,13 @@ function deriveDuty(spec) {
2859
2958
  }
2860
2959
  return fail(
2861
2960
  `\u81EA\u8026\u53D8\u9AD8\u538B Um ${umKv} kV \u8D85\u51FA\u76EE\u5F55\uFF08\u6700\u9AD8 363 kV\uFF09\u3002\u8BF7\u6309 OS \u586B\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\uFF08CLI\uFF1A--earth-um\uFF09\uFF0C\u53EF\u9009 ${open.join("\u3001")} kV\u3002`,
2862
- `Autotransformer HV class Um ${umKv} kV is above the catalogue (top 363 kV). Give the switch's insulation to earth from the OS (CLI: --earth-um): ${open.join(", ")} kV.`
2961
+ `Autotransformer HV class Um ${umKv} kV is above the catalogue (top 363 kV). Give the tap changer's insulation to earth from the OS (CLI: --earth-um): ${open.join(", ")} kV.`
2863
2962
  );
2864
2963
  }
2865
2964
  if (!Number.isFinite(umKv) || umKv > 363) {
2866
2965
  return fail(
2867
2966
  "\u7535\u538B\u8D85\u51FA\u76EE\u5F55\uFF1A\u5F00\u5173\u6700\u9AD8 Um 363 kV\u3002",
2868
- "Voltage above the catalogue: the highest switch class is Um 363 kV."
2967
+ "Voltage above the catalogue: the highest tap changer class is Um 363 kV."
2869
2968
  );
2870
2969
  }
2871
2970
  if (umRule === "neutral_full" && umAssumed) {
@@ -2888,27 +2987,19 @@ function deriveDuty(spec) {
2888
2987
  }
2889
2988
  }
2890
2989
  const highWinding = !auto && catalogueUmFromRatedKv(spec.tapKv) >= 252;
2891
- if (highWinding) {
2892
- cautionsZh.push("220 kV \u7EA7\u53CA\u4EE5\u4E0A\u8C03\u538B\u7ED5\u7EC4\u53EA\u7528\u7EC4\u5408\u5F0F\u3002");
2893
- cautionsEn.push("220 kV-class tapped winding: combined types only.");
2894
- }
2895
2990
  if (auto) {
2896
2991
  if (spec.tapPoint === "auto_mv_line" && umRule === "auto_hv") {
2897
2992
  if (umKv === 170) {
2898
2993
  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
- cautionsEn.push("230/121 kV autotransformer MV line lead: Um 170 kV is usual; check the maker's data.");
2994
+ cautionsEn.push("230/121 kV autotransformer MV line: Um 170 kV is usual; check the maker's data.");
2900
2995
  } else {
2901
2996
  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
- cautionsEn.push(`MV line lead sized at the MV class, Um ${umKv} kV; the order specification (OS) decides.`);
2997
+ cautionsEn.push(`MV line sized at the MV class, Um ${umKv} kV; the order specification (OS) decides.`);
2903
2998
  }
2904
2999
  } else if (spec.tapPoint === "auto_junction" && umRule === "auto_hv") {
2905
3000
  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
- cautionsEn.push(`Autotransformer junction sized at the HV class, Um ${umKv} kV; the order specification (OS) decides.`);
3001
+ cautionsEn.push(`Series winding MV end sized at the HV class, Um ${umKv} kV; the order specification (OS) decides.`);
2907
3002
  }
2908
- cautionsZh.push("\u81EA\u8026\u53D8\u53EA\u80FD\u7528\u7EC4\u5408\u5F0F\u5F00\u5173\u3002");
2909
- cautionsEn.push("Autotransformer: combined types only (compound types stop at 200 kV across the tap winding).");
2910
- cautionsZh.push("\u8C03\u538B\u7ED5\u7EC4\u4E24\u7AEF\u7684\u51B2\u51FB\u7535\u538B\u3001\u8981\u4E0D\u8981\u52A0\u7535\u4F4D\u7535\u963B\uFF0C\u8FD9\u91CC\u6CA1\u6709\u7B97\uFF0C\u8BF7\u5411\u53D8\u538B\u5668\u5382\u786E\u8BA4\u3002");
2911
- cautionsEn.push("Not checked: impulse across the tap winding (a), tie-in resistor.");
2912
3003
  if (!(statedStepV > 0 && statedStepV >= (derivedStepV ?? 0) - 0.5)) {
2913
3004
  cautionsZh.push("\u5404\u6863\u7684\u7EA7\u7535\u538B\u548C\u7535\u6D41\u4E0D\u4E00\u6837\uFF0C\u8FD9\u91CC\u53EA\u6309\u989D\u5B9A\u6863\u7B97\u3002\u8BF7\u5411\u53D8\u538B\u5668\u5382\u8981\u5206\u63A5\u8868\u518D\u6838\u5BF9\u3002");
2914
3005
  cautionsEn.push("Variable flux: Ust and current differ per tap; Ust at the extreme tap is not checked. Get the maker's per-tap table.");
@@ -2964,7 +3055,7 @@ var NOTE_EN = {
2964
3055
  auto_tertiary: "range is on the tertiary of an autotransformer",
2965
3056
  zigzag: "zigzag tapped winding: confirm the tap point",
2966
3057
  tiny_mva: "power reads {mva} MVA: check the figure",
2967
- single_phase: "single-phase: {mva} MVA read as one unit, sized as 3 \xD7 {mva} MVA on a single-phase switch",
3058
+ single_phase: "single-phase: {mva} MVA read as one unit, sized as 3 \xD7 {mva} MVA on a single-phase tap changer",
2968
3059
  tap_ladder: "{chain} kV read as tap voltages; rated {kv} kV",
2969
3060
  auto_vg: "text says autotransformer but vector group {vg} has HV and MV in different connections",
2970
3061
  delta_text: "text mentions delta: confirm which winding is tapped",
@@ -3045,6 +3136,9 @@ function normalizeTenderText(raw) {
3045
3136
  }
3046
3137
  function parseVectorGroup(raw) {
3047
3138
  const text = raw.replace(
3139
+ /(?<![A-Za-z0-9])(yn|zn|y|d|z)((?:(?:yn|zn|y|d|z|a)\d{1,2}){1,3})(?![A-Za-z0-9])/g,
3140
+ (_m, head, rest) => head.toUpperCase() + rest
3141
+ ).replace(
3048
3142
  /\b(?:YN|Yn|Y|D|ZN|Z)(?:(?:yn|y|d|zn|z|a)[0-9Oo]{0,2}){1,3}(?![A-Za-z0-9])/g,
3049
3143
  (g) => g.replace(/(?<=(?:yn|y|d|zn|z|a)\d?)[Oo]/g, "0")
3050
3144
  ).replace(/(?<![A-Za-z])Y[oO0](?![A-Za-z0-9])/g, "YN").replace(/[Δ△]/g, "D").replace(/\b(YN|Yn|Y|D|ZN|Z)\s*-\s*(?=(?:yn|y|d|zn|z|YN|Yn|Y|D)\s*\d)/g, "$1").replace(
@@ -3285,9 +3379,12 @@ var DRY_TYPE = /\bdry[\s-]?type\b|\bcast[\s-]?resin\b|\bresin[\s-]?(?:cast|encap
3285
3379
  var OFF_CIRCUIT_TAP = new RegExp(
3286
3380
  [
3287
3381
  String.raw`\b(?:DETC|OCTC|NLTC)\b`,
3382
+ // 2026-11-14: "Dyn11 off-circuit ±2x2.5%" names no tap word. "Off-circuit"
3383
+ // and "de-energized" are never loss words; "no-load" is, so it still needs one.
3384
+ String.raw`\b(?:off[\s-]?circuit|de-?energi[sz]ed)\b`,
3288
3385
  String.raw`\b(?:off[\s-]?(?:circuit|load)|no[\s-]?load|de-?energi[sz]ed)\s+tap`,
3289
3386
  String.raw`\btap[\s-]?chang\w*\s*[(:,-]?\s*(?:off[\s-]?(?:circuit|load)|no[\s-]?load|de-?energi[sz]ed)`,
3290
- String.raw`(?:conmutador|cambiador)[^,;.]{0,30}(?:sin\s+carga|desenergizad)`,
3387
+ String.raw`(?:conmutador|cambiador)[^,;.]{0,30}(?:sin\s+carga|sin\s+tensi[oó]n|desenergizad)`,
3291
3388
  String.raw`(?:chuyển|đổi)\s+nấc[^,;.]{0,20}không\s+tải`,
3292
3389
  String.raw`(?:pengubah|perubah)\s+tap[^,;.]{0,20}tanpa\s+beban`,
3293
3390
  String.raw`yüksüz\s+kademe`,
@@ -4539,8 +4636,8 @@ Flags:
4539
4636
  combined-only, 330 kV grade) and Um if omitted.
4540
4637
  --kind two|auto Transformer kind (--auto = --kind auto). Default two-winding.
4541
4638
  --tap P Where the OLTC sits: neutral|line (two-winding),
4542
- junction|mv-line (autotransformer, series/common junction
4543
- or MV line lead). Default neutral; junction with
4639
+ junction|mv-line (autotransformer: series winding, MV
4640
+ end, or MV line after the junction). Default neutral; junction with
4544
4641
  --kind auto. With --mva it replaces --conn.
4545
4642
  --winding star|delta Tapped winding connection (two-winding). Sets the current
4546
4643
  formula: star I = S/(\u221A3U), delta I = S/(3U).
@@ -4557,7 +4654,7 @@ Flags:
4557
4654
  --step-pct % Step as percent (1.25 means 1.25%). Capacity path only.
4558
4655
  --k n Safety factor on capacity path only (default 1.0, same as the web app).
4559
4656
  --conn Y|D Switch connection (star point / line end). Default Y.
4560
- On the capacity path, legacy: Y = star neutral, D = delta line end.
4657
+ --iu path only. With --mva or --line it is an error: use --tap.
4561
4658
  --reg W|G|0 Reversing / coarse-fine / linear. Default W.
4562
4659
  --pm N \xB1 steps. Default 8.
4563
4660
  --range +a/-b[xs%] Uneven range, e.g. +4/-12x1.25%. W/G takes the Fig. 3-3
@@ -4710,6 +4807,11 @@ function checkConflicts(args) {
4710
4807
  throw new CliError("--conn D conflicts with --tap neutral: a neutral tap point is star (Y). Drop one.");
4711
4808
  }
4712
4809
  const typed = (...flags) => flags.some((f) => args.typed?.has(f));
4810
+ if (typed("--conn", "--connection") && args.mva != null) {
4811
+ throw new CliError(
4812
+ "--conn does not apply with --mva: the tap point sets Y or D. Use --tap line for a line end, --winding delta for a delta winding."
4813
+ );
4814
+ }
4713
4815
  if (typed("--conn", "--connection") && typed("--tap") && args.conn === "Y" && args.tap === "line_end") {
4714
4816
  throw new CliError("--conn Y conflicts with --tap line: a line-end tap point is delta (D). Drop one.");
4715
4817
  }
@@ -4841,7 +4943,7 @@ function assumptionsFromArgs(args, family) {
4841
4943
  const tapZh = {
4842
4944
  neutral: "\u4E2D\u6027\u70B9",
4843
4945
  line_end: "\u7EBF\u7AEF",
4844
- auto_junction: "\u4E32\u8054/\u516C\u5171\u7ED5\u7EC4\u8FDE\u63A5\u70B9",
4946
+ auto_junction: "\u4E32\u8054\u7ED5\u7EC4\u4E2D\u538B\u7AEF",
4845
4947
  auto_mv_line: "\u4E2D\u538B\u51FA\u7EBF"
4846
4948
  };
4847
4949
  const tapGiven = args.given.has("tap") || args.given.has("conn") || args.winding === "delta" && (args.line == null || args.given.has("winding"));
@@ -4864,7 +4966,7 @@ function assumptionsFromArgs(args, family) {
4864
4966
  const conn = cliConnection(args);
4865
4967
  const derived = tapSetsConnection(args);
4866
4968
  items.push(
4867
- `conn=${conn} ${conn === "Y" ? "\u661F\u70B9" : "\u7EBF\u7AEF"}${derived ? "" : mark("conn")}`
4969
+ `${conn} ${conn === "Y" ? "\u661F\u70B9" : "\u7EBF\u7AEF"}${derived ? "" : mark("conn")}`
4868
4970
  );
4869
4971
  if (args.kind === "auto") items.push("\u81EA\u8026\u53D8");
4870
4972
  if (derived) {
@@ -4876,10 +4978,10 @@ function assumptionsFromArgs(args, family) {
4876
4978
  if (args.mva != null) {
4877
4979
  items.push(args.given.has("k") ? `k=${args.k}` : "k=1.0\uFF08\u9ED8\u8BA4\uFF09");
4878
4980
  items.push(
4879
- args.given.has("stepPct") ? `step=${args.stepPct}%` : "step=1.25%\uFF08\u9ED8\u8BA4\uFF09"
4981
+ args.given.has("stepPct") ? `\u6BCF\u7EA7 ${args.stepPct}%` : "\u6BCF\u7EA7 1.25%\uFF08\u9ED8\u8BA4\uFF09"
4880
4982
  );
4881
4983
  if (!args.given.has("minus") && !args.given.has("range")) {
4882
- items.push(`\u6700\u4F4E\u6863\u6309 \u2212${cliMinusSteps(args)} \u7B97\uFF08\u2212\u6863\u672A\u6307\u5B9A\uFF0C+a/\u2212b \u7528 --range \u6216 --minus\uFF09`);
4984
+ items.push(`\u6700\u4F4E\u6863\u6309 \u2212${cliMinusSteps(args)}\uFF08\u672A\u6307\u5B9A\uFF09`);
4883
4985
  }
4884
4986
  if (args.lineRangeAssumed && args.range) {
4885
4987
  const { plus, minus } = args.range;
@@ -4914,7 +5016,7 @@ function assumptionsFromArgs(args, family) {
4914
5016
  return items;
4915
5017
  }
4916
5018
  items.push(
4917
- `reg=${args.reg === "reversing" ? "W \u6B63\u53CD\u8C03" : args.reg === "coarse_fine" ? "G \u7C97\u7EC6\u8C03" : "0 \u7EBF\u6027\u8C03"}${mark("reg")}`
5019
+ `${args.reg === "reversing" ? "W \u6B63\u53CD\u8C03" : args.reg === "coarse_fine" ? "G \u7C97\u7EC6\u8C03" : "0 \u7EBF\u6027\u8C03"}${mark("reg")}`
4918
5020
  );
4919
5021
  const uneven = args.range && args.range.plus !== args.range.minus ? `+${args.range.plus}/\u2212${args.range.minus}` : null;
4920
5022
  if (args.reg === "linear") {
@@ -4942,32 +5044,43 @@ function assumptionsFromArgs(args, family) {
4942
5044
  items.push(phases);
4943
5045
  return items;
4944
5046
  }
4945
- function assumptionsLine(args, family) {
4946
- const items = assumptionsFromArgs(args, family);
4947
- if (items.every((i) => !i.includes("\uFF08\u9ED8\u8BA4\uFF09") && !i.includes("\u672A\u6307\u5B9A"))) {
4948
- return null;
4949
- }
4950
- return `\u5047\u5B9A\uFF1A${items.join(" \xB7 ")}`;
5047
+ var QUIET_ASSUMPTIONS = [
5048
+ /^(双绕组|自耦变)(默认)$/,
5049
+ /^(星形|角形)绕组(默认)$/,
5050
+ /^k=1\.0(默认)$/,
5051
+ /^(真空|油浸)(默认)$/,
5052
+ /^相数=.+(默认)$/,
5053
+ // The note and the per-class line under the type already say it.
5054
+ /^对地 Um [\d.]+(未指定)$/,
5055
+ // The engine's own note says the step voltage was not given.
5056
+ /^Ust 未指定/,
5057
+ new RegExp(`^(${Object.values(MOUNT_ZH).map((m) => m.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")).join("|")})\uFF08\u9ED8\u8BA4\uFF09$`)
5058
+ ];
5059
+ function assumptionsShown(args, family) {
5060
+ const assumed = (i) => i.includes("\uFF08\u9ED8\u8BA4") || i.includes("\u672A\u6307\u5B9A") || i.includes("\u62DB\u6807\u884C");
5061
+ const workedOut = (i) => /(由 |(±|→/.test(i) || i.startsWith("\u5F00\u5173\u5728") && !args.given.has("tap") || /^[YD] (星点|线端)$/.test(i) && args.mva == null && !args.given.has("conn");
5062
+ return assumptionsFromArgs(args, family).filter((i) => assumed(i) || workedOut(i)).filter((i) => !QUIET_ASSUMPTIONS.some((re) => re.test(i))).map((i) => i.replace(/(默认)$/, ""));
4951
5063
  }
4952
5064
  var round1 = (n) => Math.round(n * 10) / 10;
4953
5065
  var ASSUMPTION_EN = [
5066
+ [/^最低档按 −(\d+)(未指定)$/, "lowest tap at \u2212$1 (not stated)"],
4954
5067
  ["\uFF08\u9ED8\u8BA4\uFF0C\u62DB\u6807\u884C\u672A\u5199\u5168\uFF09", " (default; the line does not give it all)"],
4955
5068
  ["\uFF08\u9ED8\u8BA4\uFF09", " (default)"],
4956
5069
  ["\uFF08\u672A\u6307\u5B9A\uFF09", " (not stated)"],
4957
5070
  ["\uFF08\u5F85 OS \u6838\u5BF9\uFF09", " (check the OS)"],
4958
5071
  [/(只给一项:等级不低于 Um 默认)/, " (one value only: grade not below the Um default)"],
4959
- [/^最低档按 −(\d+) 算(−档未指定,\+a\/−b 用 --range 或 --minus)$/, "lowest tap at \u2212$1 (minus not stated; give +a/\u2212b with --range or --minus)"],
4960
5072
  [/^无载开关取 ([\d.]+) kV 绕组的范围((默认,)?招标行有两个调压范围)$/, "off-circuit range from the $1 kV winding (two ranges on the line)"],
4961
5073
  [/^对地 Um ([\d.]+)(招标行中性点 BIL ([\d.]+) kV)$/, "Um to earth $1 (line neutral BIL $2 kV)"],
4962
5074
  ["Ust \u672A\u6307\u5B9A\uFF08\u7EA7\u7535\u538B\u3001\u7EA7\u5BB9\u91CF\u672A\u6821\u9A8C\uFF09", "Ust not stated (step voltage and capacity not checked)"],
4963
- ["\u4E32\u8054/\u516C\u5171\u7ED5\u7EC4\u8FDE\u63A5\u70B9", "series/common junction"],
4964
- ["\u4E2D\u538B\u51FA\u7EBF", "MV line lead"],
5075
+ ["\u4E32\u8054\u7ED5\u7EC4\u4E2D\u538B\u7AEF", "series winding, MV end"],
5076
+ ["\u4E2D\u538B\u51FA\u7EBF", "MV line"],
4965
5077
  ["\u5F00\u5173\u5728\u4E2D\u6027\u70B9", "tap at neutral"],
4966
5078
  ["\u5F00\u5173\u5728\u7EBF\u7AEF", "tap at line end"],
4967
5079
  ["\u5F00\u5173\u5728", "tap at "],
4968
5080
  ["\u81EA\u8026\u53D8", "autotransformer"],
4969
5081
  ["\u53CC\u7ED5\u7EC4", "two-winding"],
4970
5082
  [/^容量 /, "power "],
5083
+ [/^每级 /, "step "],
4971
5084
  ["\u661F\u5F62\u7ED5\u7EC4", "star winding"],
4972
5085
  ["\u89D2\u5F62\u7ED5\u7EC4", "delta winding"],
4973
5086
  [/^调压绕组间 /, "across tap winding "],
@@ -5007,7 +5120,7 @@ function assumptionEn(item) {
5007
5120
  }
5008
5121
  function basisLineEn(d) {
5009
5122
  const div = d.currentDivisor === "three" ? "3" : "\u221A3";
5010
- const um = d.umRule === "explicit" ? `Um to earth ${d.umKv} (stated)` : d.umRule === "neutral_assumed" || d.umRule === "neutral_full" ? `neutral Um ${d.umKv}${d.umAssumed ? " (check the OS)" : ""}` : `${d.umSystemKv} kV system Um ${d.actualUmKv} \u2192 class ${d.umKv}`;
5123
+ const um = d.umRule === "explicit" ? `Um to earth ${d.umKv} (stated)` : d.umRule === "neutral_assumed" || d.umRule === "neutral_full" ? `neutral Um ${d.umKv}` : `${d.umSystemKv} kV system Um ${d.actualUmKv} \u2192 class ${d.umKv}`;
5011
5124
  const ust = d.stepV == null ? "" : ` \xB7 Ust ${round1(d.stepV)} V`;
5012
5125
  const max = d.maxRule === "stated" ? "OS Imax" : "lowest tap";
5013
5126
  if (!(d.ratedA > 0)) return `Imax as given \xB7 ${um}`;
@@ -5015,7 +5128,7 @@ function basisLineEn(d) {
5015
5128
  }
5016
5129
  function basisLineZh(d) {
5017
5130
  const div = d.currentDivisor === "three" ? "3" : "\u221A3";
5018
- const um = d.umRule === "explicit" ? `\u5BF9\u5730 Um ${d.umKv}\uFF08\u6307\u5B9A\uFF09` : d.umRule === "neutral_assumed" || d.umRule === "neutral_full" ? `\u4E2D\u6027\u70B9 Um ${d.umKv}${d.umAssumed ? "\uFF08\u5F85 OS \u6838\u5BF9\uFF09" : ""}` : `${d.umSystemKv} kV \u7CFB\u7EDF Um ${d.actualUmKv} \u2192 ${d.umKv} \u7EA7`;
5131
+ const um = d.umRule === "explicit" ? `\u5BF9\u5730 Um ${d.umKv}\uFF08\u6307\u5B9A\uFF09` : d.umRule === "neutral_assumed" || d.umRule === "neutral_full" ? `\u4E2D\u6027\u70B9 Um ${d.umKv}` : `${d.umSystemKv} kV \u7CFB\u7EDF Um ${d.actualUmKv} \u2192 ${d.umKv} \u7EA7`;
5019
5132
  const ust = d.stepV == null ? "" : ` \xB7 Ust ${round1(d.stepV)} V`;
5020
5133
  const max = d.maxRule === "stated" ? "OS Imax" : "\u6700\u4F4E\u6863";
5021
5134
  if (!(d.ratedA > 0)) return `Imax \u6309\u7ED9\u5B9A\u503C \xB7 ${um}`;
@@ -5091,7 +5204,7 @@ function formatCliText(input, args) {
5091
5204
  if (choices.length > 1) {
5092
5205
  const list = choices.map((c) => `Um ${c.um} \u2192 ${c.model ?? (en ? "none" : "\u65E0")}`).join(" \xB7 ");
5093
5206
  lines.push(
5094
- en ? `Insulation to earth open: ${list} (take it from the tender's neutral / tap-winding insulation; use --earth-um)` : `\u5BF9\u5730\u7EDD\u7F18\u672A\u5B9A\uFF1A${list}\uFF08\u6309\u62DB\u6807\u7684\u4E2D\u6027\u70B9/\u8C03\u538B\u7ED5\u7EC4\u7EDD\u7F18\u53D6\uFF0C\u7528 --earth-um\uFF09`
5207
+ en ? `By insulation class: ${list} (set it with --earth-um)` : `\u5404\u7EDD\u7F18\u7B49\u7EA7\u5BF9\u5E94\u578B\u53F7\uFF1A${list}\uFF08\u7528 --earth-um \u6307\u5B9A\uFF09`
5095
5208
  );
5096
5209
  }
5097
5210
  if (args?.line) {
@@ -5103,14 +5216,14 @@ function formatCliText(input, args) {
5103
5216
  }
5104
5217
  if (alts.length) {
5105
5218
  lines.push("");
5106
- lines.push(en ? "Other" : "\u5176\u4ED6");
5219
+ lines.push(en ? "Other types that cover the duty" : "\u5176\u4ED6\u53EF\u9009");
5107
5220
  for (const a of alts) lines.push(a.model);
5108
5221
  }
5109
5222
  if (args) {
5110
- const assumed = assumptionsLine(args, primary.seriesCode);
5111
- if (assumed) {
5223
+ const shown = assumptionsShown(args, primary.seriesCode);
5224
+ if (shown.length) {
5112
5225
  lines.push("");
5113
- lines.push(en ? `Assumed: ${assumptionsFromArgs(args, primary.seriesCode).map(assumptionEn).join(" \xB7 ")}` : assumed);
5226
+ lines.push(en ? `Assumed: ${shown.map(assumptionEn).join(" \xB7 ")}` : `\u5047\u5B9A\uFF1A${shown.join(" \xB7 ")}`);
5114
5227
  }
5115
5228
  }
5116
5229
  return lines.join("\n") + "\n";
@@ -5179,7 +5292,8 @@ function formatCliJson(input, args) {
5179
5292
  })(),
5180
5293
  umChoices: args ? umChoicesFor(args, input) : [],
5181
5294
  assumptions: args ? assumptionsFromArgs(args, primary?.seriesCode).map((a) => en ? assumptionEn(a) : a) : [],
5182
- errors: [...en ? out.errorsEn : out.errorsZh.length ? out.errorsZh : out.errorsEn, ...hint ? [hint] : []]
5295
+ // Same lines as the text output: Chinese then English, or English alone.
5296
+ errors: [...en ? out.errorsEn : [...out.errorsZh, ...out.errorsEn], ...hint ? [hint] : []]
5183
5297
  };
5184
5298
  return JSON.stringify(payload, null, 2) + "\n";
5185
5299
  }
@@ -5217,11 +5331,17 @@ function runCli(argv2, io = {
5217
5331
  return 0;
5218
5332
  }
5219
5333
  const wantsJson = argv2.includes("--json");
5334
+ const langAt = argv2.findIndex((a) => a === "--lang" || a.startsWith("--lang="));
5335
+ const langArg = langAt < 0 ? void 0 : argv2[langAt].includes("=") ? argv2[langAt].split("=")[1] : argv2[langAt + 1];
5336
+ const envLang = typeof process !== "undefined" ? process.env?.OLTC_LANG : void 0;
5337
+ const lang = (langArg ?? envLang ?? "zh").toLowerCase() === "en" ? "en" : "zh";
5220
5338
  try {
5221
5339
  const args = parseCliArgs(argv2);
5222
5340
  if (args.version) {
5223
- io.stdout(`oltc-selector ${APP_VERSION}
5224
- `);
5341
+ io.stdout(
5342
+ wantsJson ? JSON.stringify({ ok: true, version: APP_VERSION }, null, 2) + "\n" : `oltc-selector ${APP_VERSION}
5343
+ `
5344
+ );
5225
5345
  return 0;
5226
5346
  }
5227
5347
  const input = cliToSelectInput(args);
@@ -5234,12 +5354,12 @@ function runCli(argv2, io = {
5234
5354
  return 0;
5235
5355
  } catch (err) {
5236
5356
  const msg = err instanceof Error ? err.message : String(err);
5357
+ const lines = cliErrorLines(msg, lang);
5237
5358
  if (wantsJson) {
5238
- io.stdout(
5239
- JSON.stringify({ ok: false, version: APP_VERSION, model: null, errors: msg.split("\n") }, null, 2) + "\n"
5240
- );
5359
+ io.stdout(JSON.stringify({ ok: false, version: APP_VERSION, model: null, errors: lines }, null, 2) + "\n");
5360
+ return 1;
5241
5361
  }
5242
- io.stderr(msg.endsWith("\n") ? msg : msg + "\n");
5362
+ io.stderr(lines.join("\n") + "\n");
5243
5363
  return 1;
5244
5364
  }
5245
5365
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oltc-selector",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
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"