@tscircuit/schematic-trace-solver 0.0.30 → 0.0.32

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.
@@ -0,0 +1,177 @@
1
+ import { GenericSolverDebugger } from "site/components/GenericSolverDebugger"
2
+ import { useMemo } from "react"
3
+ import type { InputProblem } from "lib/types/InputProblem"
4
+ import { SchematicTracePipelineSolver } from "lib/index"
5
+
6
+ const inputProblem = {
7
+ chips: [
8
+ {
9
+ chipId: "schematic_component_0",
10
+ center: {
11
+ x: 0,
12
+ y: 0,
13
+ },
14
+ width: 0.4,
15
+ height: 0.8,
16
+ pins: [
17
+ {
18
+ pinId: "U1.6",
19
+ x: 0.6000000000000001,
20
+ y: -0.2,
21
+ },
22
+ {
23
+ pinId: "U1.8",
24
+ x: 0.6000000000000001,
25
+ y: 0,
26
+ },
27
+ {
28
+ pinId: "U1.1",
29
+ x: 0.6000000000000001,
30
+ y: 0.2,
31
+ },
32
+ ],
33
+ },
34
+ {
35
+ chipId: "schematic_component_1",
36
+ center: {
37
+ x: 1.4,
38
+ y: 0.55,
39
+ },
40
+ width: 0.5291665999999999,
41
+ height: 1.0583333000000001,
42
+ pins: [
43
+ {
44
+ pinId: "C2.1",
45
+ x: 1.4002733499999995,
46
+ y: -0.0012093000000001908,
47
+ },
48
+ {
49
+ pinId: "C2.2",
50
+ x: 1.3997266500000003,
51
+ y: 1.1012093000000003,
52
+ },
53
+ ],
54
+ },
55
+ {
56
+ chipId: "schematic_component_2",
57
+ center: {
58
+ x: 2.7,
59
+ y: 1.3,
60
+ },
61
+ width: 1.0583332999999997,
62
+ height: 0.388910699999999,
63
+ pins: [
64
+ {
65
+ pinId: "R1.1",
66
+ x: 2.1487093,
67
+ y: 1.3002732499999994,
68
+ },
69
+ {
70
+ pinId: "R1.2",
71
+ x: 3.2512907000000006,
72
+ y: 1.2997267500000007,
73
+ },
74
+ ],
75
+ },
76
+ {
77
+ chipId: "schematic_component_3",
78
+ center: {
79
+ x: 4.4,
80
+ y: 0,
81
+ },
82
+ width: 0.4,
83
+ height: 0.4,
84
+ pins: [
85
+ {
86
+ pinId: "JP5.1",
87
+ x: 3.8000000000000003,
88
+ y: 0,
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ chipId: "schematic_component_4",
94
+ center: {
95
+ x: 4.4,
96
+ y: -0.9,
97
+ },
98
+ width: 0.4,
99
+ height: 0.4,
100
+ pins: [
101
+ {
102
+ pinId: "JP9.1",
103
+ x: 3.8000000000000003,
104
+ y: -0.9,
105
+ },
106
+ ],
107
+ },
108
+ {
109
+ chipId: "schematic_component_5",
110
+ center: {
111
+ x: 2,
112
+ y: -1.1,
113
+ },
114
+ width: 0.8843008999999997,
115
+ height: 0.5299361999999987,
116
+ pins: [
117
+ {
118
+ pinId: "JP8.1",
119
+ x: 2.4458007999999998,
120
+ y: -1.2015872704999997,
121
+ },
122
+ {
123
+ pinId: "JP8.2",
124
+ x: 2.0034928,
125
+ y: -0.8474009705000005,
126
+ },
127
+ {
128
+ pinId: "JP8.3",
129
+ x: 1.5541992,
130
+ y: -1.2014628704999997,
131
+ },
132
+ ],
133
+ },
134
+ ],
135
+ directConnections: [
136
+ {
137
+ pinIds: ["C2.1", "U1.8"],
138
+ netId: "capacitor.C2 > port.pin1 to .U1 > .pin8",
139
+ },
140
+ {
141
+ pinIds: ["C2.2", "R1.1"],
142
+ netId: "capacitor.C2 > port.pin2 to .R1 > .pin1",
143
+ },
144
+ {
145
+ pinIds: ["R1.1", "U1.1"],
146
+ netId: "resistor.R1 > port.pin1 to .U1 > .pin1",
147
+ },
148
+ {
149
+ pinIds: ["JP5.1", "R1.2"],
150
+ netId: "pinheader.JP5 > port.pin1 to .R1 > .pin2",
151
+ },
152
+ {
153
+ pinIds: ["JP9.1", "R1.2"],
154
+ netId: "pinheader.JP9 > port.pin1 to .R1 > .pin2",
155
+ },
156
+ {
157
+ pinIds: ["JP8.2", "U1.6"],
158
+ netId: "solderjumper.JP8 > port.pin2 to .U1 > .pin6",
159
+ },
160
+ ],
161
+ netConnections: [
162
+ {
163
+ netId: "PAD",
164
+ pinIds: ["R1.2", "JP5.1", "JP9.1"],
165
+ },
166
+ ],
167
+ availableNetLabelOrientations: {},
168
+ maxMspPairDistance: 5,
169
+ } as InputProblem
170
+
171
+ export default () => {
172
+ const solver = useMemo(
173
+ () => new SchematicTracePipelineSolver(inputProblem),
174
+ [],
175
+ )
176
+ return <GenericSolverDebugger solver={solver} />
177
+ }
@@ -0,0 +1,486 @@
1
+ import { PipelineDebugger } from "site/components/PipelineDebugger"
2
+ import type { InputProblem } from "lib/types/InputProblem"
3
+
4
+ export const inputProblem: InputProblem = {
5
+ chips: [
6
+ {
7
+ chipId: "schematic_component_0",
8
+ center: {
9
+ x: 0,
10
+ y: 0,
11
+ },
12
+ width: 2.3,
13
+ height: 1.4,
14
+ pins: [
15
+ {
16
+ pinId: "J1.1",
17
+ x: 1.15,
18
+ y: 0.5,
19
+ },
20
+ {
21
+ pinId: "J1.2",
22
+ x: 1.15,
23
+ y: 0.30000000000000004,
24
+ },
25
+ {
26
+ pinId: "J1.3",
27
+ x: 1.15,
28
+ y: 0.10000000000000009,
29
+ },
30
+ {
31
+ pinId: "J1.4",
32
+ x: 1.15,
33
+ y: -0.09999999999999998,
34
+ },
35
+ {
36
+ pinId: "J1.5",
37
+ x: 1.15,
38
+ y: -0.3,
39
+ },
40
+ {
41
+ pinId: "J1.6",
42
+ x: 1.15,
43
+ y: -0.5,
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ chipId: "schematic_component_1",
49
+ center: {
50
+ x: 1.56,
51
+ y: 4.308333333333334,
52
+ },
53
+ width: 1,
54
+ height: 0.45,
55
+ pins: [
56
+ {
57
+ pinId: "SW1.1",
58
+ x: 1.06,
59
+ y: 4.258333333333334,
60
+ },
61
+ {
62
+ pinId: "SW1.2",
63
+ x: 2.06,
64
+ y: 4.258333333333334,
65
+ },
66
+ ],
67
+ },
68
+ {
69
+ chipId: "schematic_component_2",
70
+ center: {
71
+ x: 0.3599999999999999,
72
+ y: 4.308333333333334,
73
+ },
74
+ width: 1.04,
75
+ height: 0.54,
76
+ pins: [
77
+ {
78
+ pinId: "D1.1",
79
+ x: -0.16000000000000014,
80
+ y: 4.308333333333334,
81
+ },
82
+ {
83
+ pinId: "D1.2",
84
+ x: 0.8799999999999999,
85
+ y: 4.308333333333334,
86
+ },
87
+ ],
88
+ },
89
+ {
90
+ chipId: "schematic_component_3",
91
+ center: {
92
+ x: 5.06,
93
+ y: 0.3583333333333334,
94
+ },
95
+ width: 1,
96
+ height: 0.45,
97
+ pins: [
98
+ {
99
+ pinId: "SW2.1",
100
+ x: 4.56,
101
+ y: 0.30833333333333357,
102
+ },
103
+ {
104
+ pinId: "SW2.2",
105
+ x: 5.56,
106
+ y: 0.30833333333333357,
107
+ },
108
+ ],
109
+ },
110
+ {
111
+ chipId: "schematic_component_4",
112
+ center: {
113
+ x: 3.8599999999999994,
114
+ y: 0.3583333333333334,
115
+ },
116
+ width: 1.040000000000001,
117
+ height: 0.54,
118
+ pins: [
119
+ {
120
+ pinId: "D2.1",
121
+ x: 3.339999999999999,
122
+ y: 0.3583333333333334,
123
+ },
124
+ {
125
+ pinId: "D2.2",
126
+ x: 4.38,
127
+ y: 0.3583333333333334,
128
+ },
129
+ ],
130
+ },
131
+ {
132
+ chipId: "schematic_component_5",
133
+ center: {
134
+ x: 3.163333333333334,
135
+ y: 10.185,
136
+ },
137
+ width: 1,
138
+ height: 0.45,
139
+ pins: [
140
+ {
141
+ pinId: "SW3.1",
142
+ x: 2.663333333333334,
143
+ y: 10.135,
144
+ },
145
+ {
146
+ pinId: "SW3.2",
147
+ x: 3.663333333333334,
148
+ y: 10.135,
149
+ },
150
+ ],
151
+ },
152
+ {
153
+ chipId: "schematic_component_6",
154
+ center: {
155
+ x: 1.9633333333333338,
156
+ y: 10.185,
157
+ },
158
+ width: 1.040000000000001,
159
+ height: 0.54,
160
+ pins: [
161
+ {
162
+ pinId: "D3.1",
163
+ x: 1.4433333333333334,
164
+ y: 10.185,
165
+ },
166
+ {
167
+ pinId: "D3.2",
168
+ x: 2.4833333333333343,
169
+ y: 10.185,
170
+ },
171
+ ],
172
+ },
173
+ {
174
+ chipId: "schematic_component_7",
175
+ center: {
176
+ x: 3.8100000000000005,
177
+ y: 3.715,
178
+ },
179
+ width: 1,
180
+ height: 0.45,
181
+ pins: [
182
+ {
183
+ pinId: "SW4.1",
184
+ x: 3.3100000000000005,
185
+ y: 3.665,
186
+ },
187
+ {
188
+ pinId: "SW4.2",
189
+ x: 4.3100000000000005,
190
+ y: 3.665,
191
+ },
192
+ ],
193
+ },
194
+ {
195
+ chipId: "schematic_component_8",
196
+ center: {
197
+ x: 2.6100000000000003,
198
+ y: 3.715,
199
+ },
200
+ width: 1.04,
201
+ height: 0.54,
202
+ pins: [
203
+ {
204
+ pinId: "D4.1",
205
+ x: 2.0900000000000003,
206
+ y: 3.715,
207
+ },
208
+ {
209
+ pinId: "D4.2",
210
+ x: 3.1300000000000003,
211
+ y: 3.715,
212
+ },
213
+ ],
214
+ },
215
+ {
216
+ chipId: "schematic_component_9",
217
+ center: {
218
+ x: 3.34,
219
+ y: 5.783333333333333,
220
+ },
221
+ width: 1,
222
+ height: 0.45,
223
+ pins: [
224
+ {
225
+ pinId: "SW5.1",
226
+ x: 2.84,
227
+ y: 5.733333333333333,
228
+ },
229
+ {
230
+ pinId: "SW5.2",
231
+ x: 3.84,
232
+ y: 5.733333333333333,
233
+ },
234
+ ],
235
+ },
236
+ {
237
+ chipId: "schematic_component_10",
238
+ center: {
239
+ x: 2.1399999999999997,
240
+ y: 5.783333333333333,
241
+ },
242
+ width: 1.040000000000001,
243
+ height: 0.54,
244
+ pins: [
245
+ {
246
+ pinId: "D5.1",
247
+ x: 1.6199999999999992,
248
+ y: 5.783333333333333,
249
+ },
250
+ {
251
+ pinId: "D5.2",
252
+ x: 2.66,
253
+ y: 5.783333333333333,
254
+ },
255
+ ],
256
+ },
257
+ {
258
+ chipId: "schematic_component_11",
259
+ center: {
260
+ x: 1.4249999999999998,
261
+ y: 2.17,
262
+ },
263
+ width: 1,
264
+ height: 0.45,
265
+ pins: [
266
+ {
267
+ pinId: "SW6.1",
268
+ x: 0.9249999999999998,
269
+ y: 2.12,
270
+ },
271
+ {
272
+ pinId: "SW6.2",
273
+ x: 1.9249999999999998,
274
+ y: 2.12,
275
+ },
276
+ ],
277
+ },
278
+ {
279
+ chipId: "schematic_component_12",
280
+ center: {
281
+ x: 0.22499999999999964,
282
+ y: 2.17,
283
+ },
284
+ width: 1.040000000000001,
285
+ height: 0.54,
286
+ pins: [
287
+ {
288
+ pinId: "D6.1",
289
+ x: -0.2950000000000008,
290
+ y: 2.17,
291
+ },
292
+ {
293
+ pinId: "D6.2",
294
+ x: 0.7450000000000001,
295
+ y: 2.17,
296
+ },
297
+ ],
298
+ },
299
+ {
300
+ chipId: "schematic_component_13",
301
+ center: {
302
+ x: 4.9799999999999995,
303
+ y: -3.4499999999999997,
304
+ },
305
+ width: 1,
306
+ height: 0.45,
307
+ pins: [
308
+ {
309
+ pinId: "SW7.1",
310
+ x: 4.4799999999999995,
311
+ y: -3.4999999999999996,
312
+ },
313
+ {
314
+ pinId: "SW7.2",
315
+ x: 5.4799999999999995,
316
+ y: -3.4999999999999996,
317
+ },
318
+ ],
319
+ },
320
+ {
321
+ chipId: "schematic_component_14",
322
+ center: {
323
+ x: 3.7799999999999994,
324
+ y: -3.4499999999999997,
325
+ },
326
+ width: 1.04,
327
+ height: 0.54,
328
+ pins: [
329
+ {
330
+ pinId: "D7.1",
331
+ x: 3.2599999999999993,
332
+ y: -3.4499999999999997,
333
+ },
334
+ {
335
+ pinId: "D7.2",
336
+ x: 4.299999999999999,
337
+ y: -3.4499999999999997,
338
+ },
339
+ ],
340
+ },
341
+ {
342
+ chipId: "schematic_component_15",
343
+ center: {
344
+ x: 2.944999999999998,
345
+ y: -6.048333333333334,
346
+ },
347
+ width: 1,
348
+ height: 0.45,
349
+ pins: [
350
+ {
351
+ pinId: "SW8.1",
352
+ x: 2.444999999999998,
353
+ y: -6.098333333333334,
354
+ },
355
+ {
356
+ pinId: "SW8.2",
357
+ x: 3.444999999999998,
358
+ y: -6.098333333333334,
359
+ },
360
+ ],
361
+ },
362
+ {
363
+ chipId: "schematic_component_16",
364
+ center: {
365
+ x: 1.744999999999998,
366
+ y: -6.048333333333334,
367
+ },
368
+ width: 1.04,
369
+ height: 0.54,
370
+ pins: [
371
+ {
372
+ pinId: "D8.1",
373
+ x: 1.224999999999998,
374
+ y: -6.048333333333334,
375
+ },
376
+ {
377
+ pinId: "D8.2",
378
+ x: 2.264999999999998,
379
+ y: -6.048333333333334,
380
+ },
381
+ ],
382
+ },
383
+ {
384
+ chipId: "schematic_component_17",
385
+ center: {
386
+ x: 4.409999999999998,
387
+ y: -7.788333333333336,
388
+ },
389
+ width: 1,
390
+ height: 0.45,
391
+ pins: [
392
+ {
393
+ pinId: "SW9.1",
394
+ x: 3.9099999999999984,
395
+ y: -7.838333333333335,
396
+ },
397
+ {
398
+ pinId: "SW9.2",
399
+ x: 4.909999999999998,
400
+ y: -7.838333333333335,
401
+ },
402
+ ],
403
+ },
404
+ {
405
+ chipId: "schematic_component_18",
406
+ center: {
407
+ x: 3.209999999999998,
408
+ y: -7.788333333333336,
409
+ },
410
+ width: 1.040000000000001,
411
+ height: 0.54,
412
+ pins: [
413
+ {
414
+ pinId: "D9.1",
415
+ x: 2.6899999999999977,
416
+ y: -7.788333333333336,
417
+ },
418
+ {
419
+ pinId: "D9.2",
420
+ x: 3.7299999999999986,
421
+ y: -7.788333333333336,
422
+ },
423
+ ],
424
+ },
425
+ ],
426
+ directConnections: [
427
+ {
428
+ pinIds: ["D1.2", "SW1.1"],
429
+ netId: ".D1 > .cathode to .SW1 > .pin1",
430
+ },
431
+ {
432
+ pinIds: ["D2.2", "SW2.1"],
433
+ netId: ".D2 > .cathode to .SW2 > .pin1",
434
+ },
435
+ {
436
+ pinIds: ["D3.2", "SW3.1"],
437
+ netId: ".D3 > .cathode to .SW3 > .pin1",
438
+ },
439
+ {
440
+ pinIds: ["D4.2", "SW4.1"],
441
+ netId: ".D4 > .cathode to .SW4 > .pin1",
442
+ },
443
+ {
444
+ pinIds: ["D5.2", "SW5.1"],
445
+ netId: ".D5 > .cathode to .SW5 > .pin1",
446
+ },
447
+ {
448
+ pinIds: ["D6.2", "SW6.1"],
449
+ netId: ".D6 > .cathode to .SW6 > .pin1",
450
+ },
451
+ {
452
+ pinIds: ["D7.2", "SW7.1"],
453
+ netId: ".D7 > .cathode to .SW7 > .pin1",
454
+ },
455
+ {
456
+ pinIds: ["D8.2", "SW8.1"],
457
+ netId: ".D8 > .cathode to .SW8 > .pin1",
458
+ },
459
+ {
460
+ pinIds: ["D9.2", "SW9.1"],
461
+ netId: ".D9 > .cathode to .SW9 > .pin1",
462
+ },
463
+ ],
464
+ netConnections: [
465
+ {
466
+ netId: "ROW0",
467
+ pinIds: ["J1.1", "D1.1", "D2.1", "D3.1"],
468
+ },
469
+ {
470
+ netId: "ROW1",
471
+ pinIds: ["J1.2", "D4.1", "D5.1", "D6.1"],
472
+ },
473
+ {
474
+ netId: "ROW2",
475
+ pinIds: ["J1.3", "D7.1", "D8.1", "D9.1"],
476
+ },
477
+ ],
478
+ availableNetLabelOrientations: {
479
+ ROW0: ["x-", "x+"],
480
+ ROW1: ["x-", "x+"],
481
+ ROW2: ["x-", "x+"],
482
+ },
483
+ maxMspPairDistance: 5,
484
+ }
485
+
486
+ export default () => <PipelineDebugger inputProblem={inputProblem} />
@@ -70,7 +70,7 @@ x+" data-x="1.48" data-y="-0.665" cx="516.9811320754716" cy="426.7924528301886"
70
70
  <polyline data-points="0.5800000000000001,-0.665 0.1,-0.665 0.1,0.1 -1.6800000000000002,0.1 -1.6800000000000002,0.765 -1.58,0.765" data-type="line" data-label="" points="381.1320754716981,426.7924528301886 308.6792452830188,426.7924528301886 308.6792452830188,311.3207547169811 39.99999999999997,311.3207547169811 39.99999999999997,210.94339622641508 55.09433962264151,210.94339622641508" fill="none" stroke="purple" stroke-width="1" />
71
71
  </g>
72
72
  <g>
73
- <polyline data-points="1.48,-0.665 1.78,-0.665 1.78,0.03527232500000027 0,0.03527232500000027 0,0.765 -0.48,0.765" data-type="line" data-label="" points="516.9811320754716,426.7924528301886 562.2641509433961,426.7924528301886 562.2641509433961,321.0909698113207 293.58490566037733,321.0909698113207 293.58490566037733,210.94339622641508 221.1320754716981,210.94339622641508" fill="none" stroke="purple" stroke-width="1" />
73
+ <polyline data-points="1.48,-0.665 1.78,-0.665 1.78,0.03527232500000027 0,0.03527232500000027 0,0.865 -0.38,0.865 -0.38,0.765 -0.48,0.765" data-type="line" data-label="" points="516.9811320754716,426.7924528301886 562.2641509433961,426.7924528301886 562.2641509433961,321.0909698113207 293.58490566037733,321.0909698113207 293.58490566037733,195.84905660377356 236.2264150943396,195.84905660377356 236.2264150943396,210.94339622641508 221.1320754716981,210.94339622641508" fill="none" stroke="purple" stroke-width="1" />
74
74
  </g>
75
75
  <g>
76
76
  <rect data-type="rect" data-label="schematic_component_0" data-x="-1.03" data-y="0.765" x="55.09433962264151" y="181.59164528301895" width="166.0377358490566" height="58.70350188679228" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.006625000000000001" />