oltc-selector 1.2.0 → 1.2.5

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 (2) hide show
  1. package/bin/oltc.js +26 -8
  2. package/package.json +1 -1
package/bin/oltc.js CHANGED
@@ -1543,11 +1543,12 @@ function selectOltc(input) {
1543
1543
  const reasonsZh = [];
1544
1544
  const warningsEn = [];
1545
1545
  const warningsZh = [];
1546
+ const dutyA = input.throughCurrentA >= 100 ? String(Math.round(input.throughCurrentA)) : String(Math.round(input.throughCurrentA * 10) / 10);
1546
1547
  reasonsEn.push(
1547
- `Minimum-adequate path: ${s.nameEn}, Ium ${current} A \u2265 ${input.throughCurrentA} A, Um ${att.um} kV.`
1548
+ `Minimum-adequate path: ${s.nameEn}, Ium ${current} A \u2265 ${dutyA} A, Um ${att.um} kV.`
1548
1549
  );
1549
1550
  reasonsZh.push(
1550
- `\u6700\u4F4E\u6EE1\u8DB3\u8DEF\u5F84\uFF1A${s.nameZh}\uFF0CIum ${current} A \u2265 \u9700\u6C42 ${input.throughCurrentA} A\uFF0CUm ${att.um} kV\u3002`
1551
+ `\u6700\u4F4E\u6EE1\u8DB3\u8DEF\u5F84\uFF1A${s.nameZh}\uFF0CIum ${current} A \u2265 \u9700\u6C42 ${dutyA} A\uFF0CUm ${att.um} kV\u3002`
1551
1552
  );
1552
1553
  if (s.structure === "compound" && !octc) {
1553
1554
  reasonsEn.push(
@@ -1971,7 +1972,7 @@ Flags:
1971
1972
  --um kV Equipment Um (OLTC). With --mva/--kv, derived if omitted.
1972
1973
  --ust V Step voltage. With --mva/--kv/--step-pct, derived if omitted.
1973
1974
  --step-pct % Step as percent (1.25 means 1.25%). Capacity path only.
1974
- --k n Safety factor on capacity path only (default 1.2).
1975
+ --k n Safety factor on capacity path only (default 1.0, same as the web app).
1975
1976
  --conn Y|D Switch connection (star / delta). Default Y.
1976
1977
  --reg W|G|0 Reversing / coarse-fine / linear. Default W.
1977
1978
  --pm N \xB1 steps. Default 8.
@@ -2007,7 +2008,7 @@ function cliToSelectInput(args) {
2007
2008
  const pct = args.stepPct != null && args.stepPct > 0 ? args.stepPct / 100 : 0.0125;
2008
2009
  const minus = args.pm != null && args.pm > 0 ? args.pm : 8;
2009
2010
  const iMax = maxThroughCurrent(rated, minus, pct);
2010
- const k = args.k != null && args.k > 0 ? args.k : 1.2;
2011
+ const k = args.k != null && args.k > 0 ? args.k : 1;
2011
2012
  iu = iMax * k;
2012
2013
  if (um == null || !(um > 0)) {
2013
2014
  um = oltcUmFromRatedKv(args.kv, args.conn);
@@ -2042,7 +2043,7 @@ function cliToSelectInput(args) {
2042
2043
  input.octcSeries = args.series ?? "auto";
2043
2044
  if (args.contact) input.octcContact = args.contact;
2044
2045
  if (args.positions != null) input.positions = args.positions;
2045
- else if (args.pm != null && args.pm > 0) {
2046
+ else if (args.given.has("pm") && args.pm != null && args.pm > 0) {
2046
2047
  input.positions = Math.round(2 * args.pm + 1);
2047
2048
  }
2048
2049
  } else if (args.reg === "linear") {
@@ -2059,21 +2060,37 @@ function cliToSelectInput(args) {
2059
2060
  var MOUNT_ZH = {
2060
2061
  in_tank: "\u7BB1\u5185",
2061
2062
  on_tank: "\u7BB1\u9876",
2062
- dry_type: "\u5E72\u5F0F"
2063
+ dry_type: "\u5E72\u5F0F",
2064
+ // CLI 不会接收这两种,列上只为 Record 完整性
2065
+ external_compartment: "\u5916\u7F6E\u9694\u5BA4",
2066
+ reactor: "\u7535\u6297\u5668"
2063
2067
  };
2064
2068
  function assumptionsFromArgs(args) {
2065
2069
  const mark = (key) => args.given.has(key) ? "" : "\uFF08\u9ED8\u8BA4\uFF09";
2066
2070
  const items = [
2067
2071
  `conn=${args.conn} ${args.conn === "Y" ? "\u661F\u70B9" : "\u7EBF\u7AEF"}${mark("conn")}`
2068
2072
  ];
2073
+ if (args.mva != null) {
2074
+ items.push(args.given.has("k") ? `k=${args.k}` : "k=1.0\uFF08\u9ED8\u8BA4\uFF09");
2075
+ items.push(
2076
+ args.given.has("stepPct") ? `step=${args.stepPct}%` : "step=1.25%\uFF08\u9ED8\u8BA4\uFF09"
2077
+ );
2078
+ }
2079
+ const phases = `\u76F8\u6570=${args.phases}${mark("phases")}`;
2069
2080
  if (args.octc) {
2070
- const pos = args.positions ?? (args.pm != null && args.pm > 0 ? Math.round(2 * args.pm + 1) : null);
2071
- items.push(pos != null ? `${pos} \u6863${mark("positions")}` : "\u6863\u6570\u672A\u6307\u5B9A");
2081
+ if (args.positions != null) {
2082
+ items.push(`${args.positions} \u6863`);
2083
+ } else if (args.given.has("pm") && args.pm != null && args.pm > 0) {
2084
+ items.push(`${Math.round(2 * args.pm + 1)} \u6863\uFF08\u7531 \xB1${args.pm} \u63A8\uFF09`);
2085
+ } else if (!args.given.has("contact")) {
2086
+ items.push("\u6863\u6570\u672A\u6307\u5B9A");
2087
+ }
2072
2088
  const s = args.series ?? "auto";
2073
2089
  items.push(
2074
2090
  s === "auto" ? `\u63A5\u7EBF=\u81EA\u52A8\uFF08${args.conn === "Y" ? "IV" : "II"}\uFF09${mark("series")}` : `\u63A5\u7EBF=${s}${mark("series")}`
2075
2091
  );
2076
2092
  items.push(`${MOUNT_ZH[args.mount]}${mark("mount")}`);
2093
+ items.push(phases);
2077
2094
  return items;
2078
2095
  }
2079
2096
  items.push(
@@ -2088,6 +2105,7 @@ function assumptionsFromArgs(args) {
2088
2105
  }
2089
2106
  items.push(`${args.oil || !args.vacuum ? "\u6CB9\u6D78" : "\u771F\u7A7A"}${mark("medium")}`);
2090
2107
  items.push(`${MOUNT_ZH[args.mount]}${mark("mount")}`);
2108
+ items.push(phases);
2091
2109
  return items;
2092
2110
  }
2093
2111
  function assumptionsLine(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oltc-selector",
3
- "version": "1.2.0",
3
+ "version": "1.2.5",
4
4
  "description": "Huaming OLTC/OCTC type selection CLI. No prices. Same engine as the web app.",
5
5
  "bin": {
6
6
  "oltc": "bin/oltc.js"