@tscircuit/schematic-trace-solver 0.0.68 → 0.0.70
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/dist/index.js +86 -29
- package/lib/solvers/TraceLabelOverlapAvoidanceSolver/rerouteCollidingTrace.ts +12 -3
- package/lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/SingleOverlapSolver/SingleOverlapSolver.ts +11 -0
- package/lib/solvers/TraceLabelOverlapAvoidanceSolver/tryFourPointDetour.ts +13 -8
- package/lib/solvers/TraceLabelOverlapAvoidanceSolver/violation.ts +54 -20
- package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapIssueSolver/TraceOverlapIssueSolver.ts +45 -10
- package/package.json +1 -1
- package/site/examples/example42.page.tsx +4 -0
- package/tests/assets/example42.json +139 -0
- package/tests/examples/__snapshots__/example03.snap.svg +66 -66
- package/tests/examples/__snapshots__/example16.snap.svg +5 -9
- package/tests/examples/__snapshots__/example20.snap.svg +4 -7
- package/tests/examples/__snapshots__/example22.snap.svg +5 -9
- package/tests/examples/__snapshots__/example32.snap.svg +108 -93
- package/tests/examples/__snapshots__/example42.snap.svg +195 -0
- package/tests/examples/example42.test.ts +12 -0
- package/tests/repros/__snapshots__/repro-bq24074-battery-charger.snap.svg +396 -0
- package/tests/repros/assets/repro-bq24074-battery-charger.input.json +219 -0
- package/tests/repros/repro-bq24074-battery-charger.test.ts +18 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chips": [
|
|
3
|
+
{
|
|
4
|
+
"chipId": "schematic_component_0",
|
|
5
|
+
"center": {
|
|
6
|
+
"x": -4.460000000000001,
|
|
7
|
+
"y": -0.2050000000000003
|
|
8
|
+
},
|
|
9
|
+
"width": 1.8000000000000003,
|
|
10
|
+
"height": 0.6000000000000001,
|
|
11
|
+
"pins": [
|
|
12
|
+
{
|
|
13
|
+
"pinId": "J1.1",
|
|
14
|
+
"x": -3.1600000000000006,
|
|
15
|
+
"y": -0.10500000000000029
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"pinId": "J1.2",
|
|
19
|
+
"x": -3.1600000000000006,
|
|
20
|
+
"y": -0.30500000000000027
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"chipId": "schematic_component_1",
|
|
26
|
+
"center": {
|
|
27
|
+
"x": 0,
|
|
28
|
+
"y": 0
|
|
29
|
+
},
|
|
30
|
+
"width": 3.1,
|
|
31
|
+
"height": 4.3,
|
|
32
|
+
"pins": [
|
|
33
|
+
{
|
|
34
|
+
"pinId": "U1.1",
|
|
35
|
+
"x": -1.9500000000000002,
|
|
36
|
+
"y": -0.7000000000000001
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"pinId": "U1.2",
|
|
40
|
+
"x": -1.9500000000000002,
|
|
41
|
+
"y": -0.9
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"pinId": "U1.4",
|
|
45
|
+
"x": 1.9500000000000002,
|
|
46
|
+
"y": -0.85
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"pinId": "U1.5",
|
|
50
|
+
"x": 1.9500000000000002,
|
|
51
|
+
"y": -0.2499999999999999
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"pinId": "U1.6",
|
|
55
|
+
"x": 1.9500000000000002,
|
|
56
|
+
"y": -0.44999999999999996
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"pinId": "U1.7",
|
|
60
|
+
"x": -0.44999999999999996,
|
|
61
|
+
"y": 2.55
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"pinId": "U1.8",
|
|
65
|
+
"x": -1.9500000000000002,
|
|
66
|
+
"y": 0.7
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"pinId": "U1.9",
|
|
70
|
+
"x": 0.44999999999999996,
|
|
71
|
+
"y": 2.55
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"pinId": "U1.10",
|
|
75
|
+
"x": 1.9500000000000002,
|
|
76
|
+
"y": 0.85
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"pinId": "U1.12",
|
|
80
|
+
"x": 0,
|
|
81
|
+
"y": -2.55
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"pinId": "U1.13",
|
|
85
|
+
"x": -1.9500000000000002,
|
|
86
|
+
"y": 0.9
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"pinId": "U1.14",
|
|
90
|
+
"x": 1.9500000000000002,
|
|
91
|
+
"y": -0.6499999999999999
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"pinId": "U1.15",
|
|
95
|
+
"x": -0.65,
|
|
96
|
+
"y": -2.55
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"pinId": "U1.16",
|
|
100
|
+
"x": 0.65,
|
|
101
|
+
"y": -2.55
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"chipId": "schematic_component_2",
|
|
107
|
+
"center": {
|
|
108
|
+
"x": -3.7100000000000013,
|
|
109
|
+
"y": 2.1149999999999998
|
|
110
|
+
},
|
|
111
|
+
"width": 1.1,
|
|
112
|
+
"height": 0.84,
|
|
113
|
+
"pins": [
|
|
114
|
+
{
|
|
115
|
+
"pinId": "C1.1",
|
|
116
|
+
"x": -4.260000000000002,
|
|
117
|
+
"y": 2.1149999999999998
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"pinId": "C1.2",
|
|
121
|
+
"x": -3.160000000000001,
|
|
122
|
+
"y": 2.1149999999999998
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"chipId": "schematic_component_3",
|
|
128
|
+
"center": {
|
|
129
|
+
"x": -4.205,
|
|
130
|
+
"y": -2.9050000000000002
|
|
131
|
+
},
|
|
132
|
+
"width": 2.1,
|
|
133
|
+
"height": 0.8,
|
|
134
|
+
"pins": [
|
|
135
|
+
{
|
|
136
|
+
"pinId": "BT1.1",
|
|
137
|
+
"x": -2.755,
|
|
138
|
+
"y": -2.705
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"pinId": "BT1.2",
|
|
142
|
+
"x": -2.755,
|
|
143
|
+
"y": -2.9050000000000002
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"pinId": "BT1.3",
|
|
147
|
+
"x": -2.755,
|
|
148
|
+
"y": -3.1050000000000004
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"directConnections": [],
|
|
154
|
+
"netConnections": [
|
|
155
|
+
{
|
|
156
|
+
"netId": "IN",
|
|
157
|
+
"pinIds": ["J1.1", "U1.13", "C1.1"],
|
|
158
|
+
"netLabelWidth": 0.36
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"netId": "GND",
|
|
162
|
+
"pinIds": ["J1.2", "U1.4", "U1.6", "U1.8", "U1.14", "C1.2", "BT1.3"],
|
|
163
|
+
"netLabelWidth": 0.48
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"netId": "TS",
|
|
167
|
+
"pinIds": ["U1.1", "BT1.1"],
|
|
168
|
+
"netLabelWidth": 0.36
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"netId": "BAT",
|
|
172
|
+
"pinIds": ["U1.2", "BT1.2"],
|
|
173
|
+
"netLabelWidth": 0.48
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"netId": "OUT",
|
|
177
|
+
"pinIds": ["U1.5", "U1.10"],
|
|
178
|
+
"netLabelWidth": 0.48
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"netId": "N_PGOOD_LED",
|
|
182
|
+
"pinIds": ["U1.7"],
|
|
183
|
+
"netLabelWidth": 1.44
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"netId": "N_CHG_LED",
|
|
187
|
+
"pinIds": ["U1.9"],
|
|
188
|
+
"netLabelWidth": 1.2
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"netId": "ILIM",
|
|
192
|
+
"pinIds": ["U1.12"],
|
|
193
|
+
"netLabelWidth": 0.6
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"netId": "ITERM",
|
|
197
|
+
"pinIds": ["U1.15"],
|
|
198
|
+
"netLabelWidth": 0.72
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"netId": "ISET",
|
|
202
|
+
"pinIds": ["U1.16"],
|
|
203
|
+
"netLabelWidth": 0.6
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"availableNetLabelOrientations": {
|
|
207
|
+
"IN": ["x-", "x+"],
|
|
208
|
+
"GND": ["y-"],
|
|
209
|
+
"TS": ["x-", "x+"],
|
|
210
|
+
"BAT": ["x-", "x+"],
|
|
211
|
+
"N_PGOOD_LED": ["x-", "x+"],
|
|
212
|
+
"N_CHG_LED": ["x-", "x+"],
|
|
213
|
+
"OUT": ["x-", "x+"],
|
|
214
|
+
"ITERM": ["x-", "x+"],
|
|
215
|
+
"ILIM": ["x-", "x+"],
|
|
216
|
+
"ISET": ["x-", "x+"]
|
|
217
|
+
},
|
|
218
|
+
"maxMspPairDistance": 2.4
|
|
219
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import inputProblem from "./assets/repro-bq24074-battery-charger.input.json"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
|
|
6
|
+
// InputProblem extracted from a tscircuit circuit: a BQ24074RGTR Li-ion battery
|
|
7
|
+
// charger (U1) wired to a DC adapter header (J1), a 1uF input capacitor (C1)
|
|
8
|
+
// and a 3-pin battery pack header (BT1). Power/ground/signal nets connect the
|
|
9
|
+
// parts, and several U1 pins (N_PGOOD, N_CHG, ILIM, ITERM, ISET) break out to
|
|
10
|
+
// net labels. Generated by rendering the circuit in @tscircuit/core with
|
|
11
|
+
// DEBUG=Group_doInitialSchematicTraceRender and copying the emitted
|
|
12
|
+
// "group-trace-render-input-problem" output.
|
|
13
|
+
test("repro bq24074 battery charger", () => {
|
|
14
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
15
|
+
solver.solve()
|
|
16
|
+
|
|
17
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
18
|
+
})
|