@tscircuit/schematic-trace-solver 0.0.172 → 0.0.174

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 (23) hide show
  1. package/dist/index.js +32 -0
  2. package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +12 -1
  3. package/lib/solvers/SameNetJunctionAlignmentSolver/placeGroundRailLabelsAtOuterEnd.ts +49 -0
  4. package/package.json +1 -1
  5. package/site/bug-reports/bug-report-20260831T133233Z.page.tsx +4 -0
  6. package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +18 -18
  7. package/tests/bug-reports/bug-report-20260831T133233Z/__snapshots__/bug-report-20260831T133233Z.snap.svg +85 -0
  8. package/tests/bug-reports/bug-report-20260831T133233Z/bug-report-20260831T133233Z.json +172 -0
  9. package/tests/bug-reports/bug-report-20260831T133233Z/bug-report-20260831T133233Z.test.ts +25 -0
  10. package/tests/repros/__snapshots__/repro-bq40z60-current-sense.snap.svg +94 -0
  11. package/tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc.snap.svg +10 -10
  12. package/tests/repros/__snapshots__/repro-ti-power-output-section.snap.svg +87 -87
  13. package/tests/repros/__snapshots__/repro-tida-01389-hbridge.snap.svg +47 -153
  14. package/tests/repros/__snapshots__/repro-tida010076-j4-ground-bus.snap.svg +1 -8
  15. package/tests/repros/__snapshots__/repro-tida010076-page02.snap.svg +1625 -1681
  16. package/tests/repros/__snapshots__/repro-tmp1075-ground-label-overlap.snap.svg +3 -3
  17. package/tests/repros/assets/repro-bq40z60-current-sense.input.json +158 -0
  18. package/tests/repros/assets/repro-tida-01389-hbridge.input.json +67 -657
  19. package/tests/repros/assets/repro-tida010076-page02.input.json +2 -0
  20. package/tests/repros/repro-bq40z60-current-sense.test.ts +18 -0
  21. package/tests/repros/repro-tida-01389-hbridge.test.ts +27 -6
  22. package/tests/repros/repro-tida010076-j4-ground-bus.test.ts +1 -0
  23. package/tests/repros/repro-tmp1075-ground-label-overlap.test.ts +12 -0
@@ -1567,6 +1567,7 @@
1567
1567
  },
1568
1568
  {
1569
1569
  "netId": "NET_GND",
1570
+ "isGround": true,
1570
1571
  "netLabelWidth": 0.96,
1571
1572
  "pinIds": [
1572
1573
  "schematic_port_119",
@@ -1611,6 +1612,7 @@
1611
1612
  },
1612
1613
  {
1613
1614
  "netId": "NET_AGND",
1615
+ "isGround": true,
1614
1616
  "netLabelWidth": 0.42,
1615
1617
  "netLabelHeight": 1.08,
1616
1618
  "pinIds": [
@@ -0,0 +1,18 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import type { InputProblem } from "lib/types/InputProblem"
4
+ import "tests/fixtures/matcher"
5
+ import inputProblem from "./assets/repro-bq40z60-current-sense.input.json"
6
+
7
+ // Minimal input derived from @tsci/tscircuit.ti's
8
+ // BatteryManagement_2to4Cell_BQ40Z60 subcircuit. It isolates the bottom-left
9
+ // R38/R43/R44 and C26/C36 current-sense section.
10
+ test("repro BQ40Z60 current-sense schematic traces", () => {
11
+ const solver = new SchematicTracePipelineSolver(
12
+ inputProblem as unknown as InputProblem,
13
+ { hideRatsNet: true },
14
+ )
15
+ solver.solve()
16
+
17
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
18
+ })
@@ -4,12 +4,12 @@ import type { InputProblem } from "lib/types/InputProblem"
4
4
  import "tests/fixtures/matcher"
5
5
  import inputProblem from "./assets/repro-tida-01389-hbridge.input.json"
6
6
 
7
- // Captured from the TIDA-01389 H-bridge in tscircuit/ti#116. Only display
8
- // metadata was normalized; component positions and connectivity are unchanged.
9
- test("repro: TIDA-01389 H-bridge traces float above MOSFET ports", () => {
10
- expect(inputProblem.chips).toHaveLength(18)
11
- expect(inputProblem.directConnections).toHaveLength(21)
12
- expect(inputProblem.netConnections).toHaveLength(11)
7
+ // Reduced from the TIDA-01389 H-bridge in tscircuit/ti#116. It retains only
8
+ // the four components on the enclosing loop and the two nested capacitors.
9
+ test("repro: enclosing rectangle collapses into two smaller loops", () => {
10
+ expect(inputProblem.chips).toHaveLength(6)
11
+ expect(inputProblem.directConnections).toHaveLength(8)
12
+ expect(inputProblem.netConnections).toHaveLength(0)
13
13
 
14
14
  const solver = new SchematicTracePipelineSolver(
15
15
  inputProblem as unknown as InputProblem,
@@ -18,6 +18,27 @@ test("repro: TIDA-01389 H-bridge traces float above MOSFET ports", () => {
18
18
 
19
19
  solver.solve()
20
20
 
21
+ const pairKeys = new Set(
22
+ solver.mspConnectionPairSolver!.mspConnectionPairs.map((pair) =>
23
+ pair.pins
24
+ .map((pin) => pin.pinId)
25
+ .sort()
26
+ .join("::"),
27
+ ),
28
+ )
29
+ expect(
30
+ pairKeys.has("schematic_port_q1a_drain::schematic_port_q1b_source"),
31
+ ).toBe(false)
32
+ expect(
33
+ pairKeys.has("schematic_port_q2a_source::schematic_port_q2b_drain"),
34
+ ).toBe(false)
35
+ expect(pairKeys.has("schematic_port_c18_1::schematic_port_q1a_drain")).toBe(
36
+ true,
37
+ )
38
+ expect(pairKeys.has("schematic_port_c18_2::schematic_port_q2b_drain")).toBe(
39
+ true,
40
+ )
41
+
21
42
  expect(solver.solved).toBe(true)
22
43
  expect(solver).toMatchSolverSnapshot(import.meta.path)
23
44
  })
@@ -28,6 +28,7 @@ const inputProblem: InputProblem = {
28
28
  netConnections: [
29
29
  {
30
30
  netId: "NET_AGND",
31
+ isGround: true,
31
32
  pinIds: ["J4.3", "J4.4", "J4.5", "J4.6"],
32
33
  netLabelWidth: 0.42,
33
34
  netLabelHeight: 1.08,
@@ -14,5 +14,17 @@ test("repro TMP1075 ground label overlap", () => {
14
14
 
15
15
  solver.solve()
16
16
 
17
+ const finalOutput = solver.netLabelToTraceSolver!.getOutput()
18
+ const groundRailLabel = finalOutput.netLabelPlacements.find((label) =>
19
+ label.pinIds.includes("schematic_port_18"),
20
+ )
21
+ const lowerGroundRailTrace = finalOutput.traces.find(
22
+ (trace) =>
23
+ trace.pinIds.includes("schematic_port_7") &&
24
+ trace.pinIds.includes("schematic_port_8"),
25
+ )
26
+
27
+ expect(groundRailLabel?.anchorPoint.y).toBeCloseTo(-1.075)
28
+ expect(lowerGroundRailTrace?.tracePath[1]?.x).toBeCloseTo(4.25)
17
29
  expect(solver).toMatchSolverSnapshot(import.meta.path)
18
30
  })