@tscircuit/matchpack 0.0.15 → 0.0.16

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.d.ts CHANGED
@@ -62,6 +62,8 @@ type GroupPin = {
62
62
  };
63
63
  type Net = {
64
64
  netId: NetId;
65
+ isGround?: boolean;
66
+ isPositiveVoltageSource?: boolean;
65
67
  };
66
68
  type InputProblem = {
67
69
  chipMap: Record<ChipId, Chip>;
@@ -98,7 +100,7 @@ interface DecouplingCapGroup {
98
100
  /**
99
101
  * Identify decoupling capacitor groups based on specific criteria:
100
102
  * 1. Component has exactly 2 pins and restricted rotation (0/180 only or no rotation)
101
- * 2. One pin indirectly connected to net with "y+" restriction, one to "y-" restriction
103
+ * 2. One pin indirectly connected to net with isGround and one to isPositiveVoltageSource
102
104
  * 3. At least one pin directly connected to a chip (the main chip, typically a microcontroller)
103
105
  */
104
106
  declare class IdentifyDecouplingCapsSolver extends BaseSolver {
package/dist/index.js CHANGED
@@ -345,11 +345,13 @@ var ChipPartitionsSolver = class extends BaseSolver {
345
345
  for (const capId of group.decouplingCapChipIds) {
346
346
  if (inputProblem.chipMap[capId]) {
347
347
  capsOnly.push(capId);
348
- decapChipIdSet.add(capId);
349
348
  }
350
349
  }
351
- if (capsOnly.length > 0) {
350
+ if (capsOnly.length >= 2) {
352
351
  decapGroupPartitions.push(capsOnly);
352
+ for (const capId of capsOnly) {
353
+ decapChipIdSet.add(capId);
354
+ }
353
355
  }
354
356
  }
355
357
  }
@@ -631,6 +633,11 @@ var IdentifyDecouplingCapsSolver = class extends BaseSolver {
631
633
  if (!mainChipId) return;
632
634
  const netPair = this.getNormalizedNetPair(currentChip);
633
635
  if (!netPair) return;
636
+ const [n1, n2] = netPair;
637
+ const net1 = this.inputProblem.netMap[n1];
638
+ const net2 = this.inputProblem.netMap[n2];
639
+ const isDecouplingNetPair = net1?.isGround && net2?.isPositiveVoltageSource || net2?.isGround && net1?.isPositiveVoltageSource;
640
+ if (!isDecouplingNetPair) return;
634
641
  this.addToGroup(mainChipId, netPair, currentChip.chipId);
635
642
  }
636
643
  visualize() {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/matchpack",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.15",
5
+ "version": "0.0.16",
6
6
  "files": [
7
7
  "dist"
8
8
  ],