@tscircuit/core 0.0.2120 → 0.0.2122
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/README.md +2 -0
- package/dist/index.d.ts +79 -5
- package/dist/index.js +249 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,5 +55,7 @@ circuit.getCircuitJson() // [{ type: "board", ...}, { type: "resistor", ...}, ..
|
|
|
55
55
|
|
|
56
56
|
## Development
|
|
57
57
|
|
|
58
|
+
- [Declare PCB return-current experiments in TSX](./docs/pcb-return-current-simulation.md)
|
|
59
|
+
|
|
58
60
|
- [How does core work?](./docs/DEVELOPMENT.md#overview-of-how-core-works)
|
|
59
61
|
- [How to do benchmarking or debug performance](./docs/DEVELOPMENT.md#debugging-performance)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as circuit_json from 'circuit-json';
|
|
2
|
-
import { PcbGroup, PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, PcbVia as PcbVia$1, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbTraceRoutePoint, AnySourceComponent, SourcePort, PcbComponent, SchematicPort, SchematicComponent, SimulationVoltageSource, SimulationCurrentSource, PcbSilkscreenGraphic, PcbSolderPastePolygon, SourceBus, RouteHintPoint, PcbBoard, SchematicSheet as SchematicSheet$1, SchematicGraphic as SchematicGraphic$1, SimulationExperiment, SimulationParameterSweep, PcbBend as PcbBend$1, PcbStiffener as PcbStiffener$1, PcbSoldermaskOpening as PcbSoldermaskOpening$1, CircuitJson } from 'circuit-json';
|
|
2
|
+
import { PcbGroup, PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, PcbVia as PcbVia$1, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbTraceRoutePoint, AnySourceComponent, SourcePort, PcbComponent, SchematicPort, SchematicComponent, SimulationVoltageSource, SimulationCurrentSource, PcbSilkscreenGraphic, PcbSolderPastePolygon, SourceBus, RouteHintPoint, PcbBoard, SchematicSheet as SchematicSheet$1, SchematicGraphic as SchematicGraphic$1, SimulationExperiment, SimulationParameterSweep, SimulationReturnCurrentExcitation, PcbBend as PcbBend$1, PcbStiffener as PcbStiffener$1, PcbSoldermaskOpening as PcbSoldermaskOpening$1, CircuitJson } from 'circuit-json';
|
|
3
3
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
4
|
-
import { FanoutTracePath, PlatformConfig, autoroutingPhaseProps, traceProps, netProps, AutoroutingPhaseProps, AutorouterProp, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, PinAttributeMap, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, platedHoleProps, BoardOutlinePoint, boardProps, subcircuitProps, subpanelProps, capacitorProps, antennaProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, drcCheckProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, busProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, assemblyDeviceProps, assemblyMotorProps, assemblyScreenProps, assemblySubassemblyProps, assemblyPartProps, assemblyReferenceSurfaceProps, enclosureCutoutApertureProps, enclosureFdmBoxProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSymbolProps, schematicSectionProps, schematicSheetProps, schematicGraphicProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, analogTransientSimulationProps, analogDcOperatingPointSimulationProps, analogDcSweepSimulationProps, analogAcSweepSimulationProps, analogSweepParameterProps, pcbReturnCurrentSimulationProps, voltageProbeProps, spicemodelProps, pcbBendProps, pcbStiffenerProps, pcbSoldermaskOpeningProps, assemblyPrintedPartProps, assemblyCableProps, AnalogTransientSimulationProps, AnalogDcSweepSimulationProps, AnalogAcSweepSimulationProps, AnalogSweepParameterProps, AssemblyCablePropsInput, AssemblySubassemblyPropsInput, AssemblyDevicePropsInput, AssemblyMotorPropsInput, AssemblyPartPropsInput, AssemblyPrintedPartPropsInput, AssemblyScreenPropsInput, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, PcbReturnCurrentSimulationProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
4
|
+
import { FanoutTracePath, PlatformConfig, autoroutingPhaseProps, traceProps, netProps, AutoroutingPhaseProps, AutorouterProp, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, PinAttributeMap, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, platedHoleProps, BoardOutlinePoint, boardProps, subcircuitProps, subpanelProps, capacitorProps, antennaProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, drcCheckProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, busProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, assemblyDeviceProps, assemblyMotorProps, assemblyScreenProps, assemblySubassemblyProps, assemblyPartProps, assemblyReferenceSurfaceProps, enclosureCutoutApertureProps, enclosureFdmBoxProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSymbolProps, schematicSectionProps, schematicSheetProps, schematicGraphicProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, analogTransientSimulationProps, analogDcOperatingPointSimulationProps, analogDcSweepSimulationProps, analogAcSweepSimulationProps, analogSweepParameterProps, pcbReturnCurrentSimulationProps, pcbReturnCurrentExcitationProps, voltageProbeProps, spicemodelProps, pcbBendProps, pcbStiffenerProps, pcbSoldermaskOpeningProps, assemblyPrintedPartProps, assemblyCableProps, AnalogTransientSimulationProps, AnalogDcSweepSimulationProps, AnalogAcSweepSimulationProps, AnalogSweepParameterProps, AssemblyCablePropsInput, AssemblySubassemblyPropsInput, AssemblyDevicePropsInput, AssemblyMotorPropsInput, AssemblyPartPropsInput, AssemblyPrintedPartPropsInput, AssemblyScreenPropsInput, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, PcbReturnCurrentSimulationProps, PcbReturnCurrentExcitationProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
5
5
|
export { FanoutTracePath, fanoutTracePath, kicadFootprintStrings } from '@tscircuit/props';
|
|
6
6
|
import * as react from 'react';
|
|
7
7
|
import react__default, { ReactElement, ReactNode, Attributes } from 'react';
|
|
@@ -2105,9 +2105,9 @@ interface IIsolatedCircuit {
|
|
|
2105
2105
|
interface IRootCircuit extends IIsolatedCircuit {
|
|
2106
2106
|
}
|
|
2107
2107
|
|
|
2108
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "ResolveFootprintPinLabels", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "CheckRefDesConvention", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicSheetRender", "SchematicReplaceNetLabelsWithSymbols", "SchematicLabelNetsWithConflictingNames", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbFlexRender", "PcbAutoplaceBreakoutPoints", "PcbTraceHintRender", "PcbManualTraceRender", "PcbPlacementDesignRuleChecks", "PcbTraceRender", "PcbRouteNetIslands", "PcbTraceTeardropRender", "PcbCopperPourRender", "PcbViaStitchRender", "PcbCopperPourCleanup", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "MissingManufacturerPartNumberWarning", "ComponentAvailabilityWarning", "PartOrientationAnalysis", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
2108
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "ResolveFootprintPinLabels", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "CheckRefDesConvention", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicSheetRender", "SchematicReplaceNetLabelsWithSymbols", "SchematicLabelNetsWithConflictingNames", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbFlexRender", "PcbAutoplaceBreakoutPoints", "PcbTraceHintRender", "PcbManualTraceRender", "PcbPlacementDesignRuleChecks", "PcbTraceRender", "PcbRouteNetIslands", "PcbTraceTeardropRender", "PcbCopperPourRender", "PcbViaStitchRender", "PcbCopperPourCleanup", "PcbSimulationRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "MissingManufacturerPartNumberWarning", "ComponentAvailabilityWarning", "PartOrientationAnalysis", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
2109
2109
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
2110
|
-
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "ResolveFootprintPinLabels" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "CheckRefDesConvention" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicSheetRender" | "SchematicReplaceNetLabelsWithSymbols" | "SchematicLabelNetsWithConflictingNames" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbFlexRender" | "PcbAutoplaceBreakoutPoints" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbPlacementDesignRuleChecks" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbTraceTeardropRender" | "PcbCopperPourRender" | "PcbViaStitchRender" | "PcbCopperPourCleanup" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "MissingManufacturerPartNumberWarning" | "ComponentAvailabilityWarning" | "PartOrientationAnalysis" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
2110
|
+
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "ResolveFootprintPinLabels" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "CheckRefDesConvention" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicSheetRender" | "SchematicReplaceNetLabelsWithSymbols" | "SchematicLabelNetsWithConflictingNames" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbFlexRender" | "PcbAutoplaceBreakoutPoints" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbPlacementDesignRuleChecks" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbTraceTeardropRender" | "PcbCopperPourRender" | "PcbViaStitchRender" | "PcbCopperPourCleanup" | "PcbSimulationRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "MissingManufacturerPartNumberWarning" | "ComponentAvailabilityWarning" | "PartOrientationAnalysis" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
2111
2111
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
2112
2112
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
2113
2113
|
initialized: boolean;
|
|
@@ -195443,6 +195443,78 @@ declare class PcbReturnCurrentSimulation extends PrimitiveComponent<typeof pcbRe
|
|
|
195443
195443
|
removeSimulationRender(): void;
|
|
195444
195444
|
}
|
|
195445
195445
|
|
|
195446
|
+
type SimulationReturnCurrentExcitationId = SimulationReturnCurrentExcitation["simulation_return_current_excitation_id"];
|
|
195447
|
+
/** Resolves user-selected contacts after PCB routing and placement settle. */
|
|
195448
|
+
declare class PcbReturnCurrentExcitation extends PrimitiveComponent<typeof pcbReturnCurrentExcitationProps> {
|
|
195449
|
+
simulation_return_current_excitation_id: SimulationReturnCurrentExcitationId | null;
|
|
195450
|
+
get config(): {
|
|
195451
|
+
componentName: string;
|
|
195452
|
+
zodProps: zod.ZodObject<{
|
|
195453
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
195454
|
+
source: zod.ZodString;
|
|
195455
|
+
load: zod.ZodString;
|
|
195456
|
+
ground: zod.ZodString;
|
|
195457
|
+
current: zod.ZodPipeline<zod.ZodEffects<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, number, string | number>, zod.ZodNumber>;
|
|
195458
|
+
returnSource: zod.ZodString;
|
|
195459
|
+
returnSink: zod.ZodString;
|
|
195460
|
+
sourceImpedance: zod.ZodPipeline<zod.ZodEffects<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, number, string | number>, zod.ZodNumber>;
|
|
195461
|
+
loadImpedance: zod.ZodPipeline<zod.ZodEffects<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, number, string | number>, zod.ZodNumber>;
|
|
195462
|
+
trace: zod.ZodOptional<zod.ZodString>;
|
|
195463
|
+
returnSourceLayer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6", "inner7", "inner8"]>, zod.ZodObject<{
|
|
195464
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6", "inner7", "inner8"]>;
|
|
195465
|
+
}, "strip", zod.ZodTypeAny, {
|
|
195466
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195467
|
+
}, {
|
|
195468
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195469
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | {
|
|
195470
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195471
|
+
}>>;
|
|
195472
|
+
returnSinkLayer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6", "inner7", "inner8"]>, zod.ZodObject<{
|
|
195473
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6", "inner7", "inner8"]>;
|
|
195474
|
+
}, "strip", zod.ZodTypeAny, {
|
|
195475
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195476
|
+
}, {
|
|
195477
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195478
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | {
|
|
195479
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195480
|
+
}>>;
|
|
195481
|
+
}, "strict", zod.ZodTypeAny, {
|
|
195482
|
+
source: string;
|
|
195483
|
+
current: number;
|
|
195484
|
+
load: string;
|
|
195485
|
+
ground: string;
|
|
195486
|
+
returnSource: string;
|
|
195487
|
+
returnSink: string;
|
|
195488
|
+
sourceImpedance: number;
|
|
195489
|
+
loadImpedance: number;
|
|
195490
|
+
name?: string | undefined;
|
|
195491
|
+
trace?: string | undefined;
|
|
195492
|
+
returnSourceLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | undefined;
|
|
195493
|
+
returnSinkLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | undefined;
|
|
195494
|
+
}, {
|
|
195495
|
+
source: string;
|
|
195496
|
+
current: string | number;
|
|
195497
|
+
load: string;
|
|
195498
|
+
ground: string;
|
|
195499
|
+
returnSource: string;
|
|
195500
|
+
returnSink: string;
|
|
195501
|
+
sourceImpedance: string | number;
|
|
195502
|
+
loadImpedance: string | number;
|
|
195503
|
+
name?: string | undefined;
|
|
195504
|
+
trace?: string | undefined;
|
|
195505
|
+
returnSourceLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | {
|
|
195506
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195507
|
+
} | undefined;
|
|
195508
|
+
returnSinkLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | {
|
|
195509
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8";
|
|
195510
|
+
} | undefined;
|
|
195511
|
+
}>;
|
|
195512
|
+
};
|
|
195513
|
+
doInitialPcbSimulationRender(): void;
|
|
195514
|
+
updatePcbSimulationRender(): void;
|
|
195515
|
+
removePcbSimulationRender(): void;
|
|
195516
|
+
}
|
|
195517
|
+
|
|
195446
195518
|
declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps> {
|
|
195447
195519
|
simulation_voltage_probe_id: string | null;
|
|
195448
195520
|
schematic_voltage_probe_id: string | null;
|
|
@@ -204301,6 +204373,7 @@ declare const enclosure: {
|
|
|
204301
204373
|
|
|
204302
204374
|
declare const simulation: {
|
|
204303
204375
|
readonly pcbreturncurrentsimulation: react.FunctionComponent<PcbReturnCurrentSimulationProps>;
|
|
204376
|
+
readonly pcbreturncurrentexcitation: react.FunctionComponent<PcbReturnCurrentExcitationProps>;
|
|
204304
204377
|
};
|
|
204305
204378
|
|
|
204306
204379
|
declare function resolveStaticFileImport(path: string, platform?: PlatformConfig): Promise<string>;
|
|
@@ -206041,6 +206114,7 @@ interface TscircuitElements {
|
|
|
206041
206114
|
analogacsweepsimulation: _tscircuit_props.AnalogAcSweepSimulationProps;
|
|
206042
206115
|
analogsweepparameter: _tscircuit_props.AnalogSweepParameterProps;
|
|
206043
206116
|
pcbreturncurrentsimulation: _tscircuit_props.PcbReturnCurrentSimulationProps;
|
|
206117
|
+
pcbreturncurrentexcitation: _tscircuit_props.PcbReturnCurrentExcitationProps;
|
|
206044
206118
|
spicemodel: _tscircuit_props.SpiceModelProps;
|
|
206045
206119
|
fiducial: _tscircuit_props.FiducialProps;
|
|
206046
206120
|
jscad: any;
|
|
@@ -206063,4 +206137,4 @@ declare module "react/jsx-runtime" {
|
|
|
206063
206137
|
}
|
|
206064
206138
|
}
|
|
206065
206139
|
|
|
206066
|
-
export { Ammeter, AnalogAcSweepSimulation, AnalogAnalysisSimulation, AnalogDcOperatingPointSimulation, AnalogDcSweepSimulation, AnalogSimulation, AnalogSweepParameter, AnalogTransientSimulation, Antenna, AssemblyCable, type AssemblyCableJsxProps, type AssemblyCadAssemblyJsxProps, AssemblyDevice, type AssemblyDeviceJsxProps, AssemblyMotor, type AssemblyMotorJsxProps, AssemblyPart, type AssemblyPartJsxProps, AssemblyPrintedPart, type AssemblyPrintedPartJsxProps, AssemblyReferenceSurface, AssemblyScreen, type AssemblyScreenJsxProps, AssemblySubassembly, type AssemblySubassemblyJsxProps, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingCacheDisabledReason, type AutoroutingCacheStatus, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingExecutionMetadata, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Bus, CadAssembly, CadModel, Capacitor, Chip, Circuit, type CircuitJsonMetadata, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, EnclosureCutoutAperture, EnclosureFdmBox, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbBend, type PcbGroupId, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbReturnCurrentSimulation, PcbSoldermaskOpening, PcbStiffener, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicGraphic, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicSymbol, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteBounds, type SimpleRouteBus, type SimpleRouteBusTermination, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimpleRoutePoint, type SimplifiedPcbTrace, type SingleLayerConnectionPoint, SmtPad, SolderJumper, type SolverEndedEvent, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, analog, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, assembly, createUseComponent, enclosure, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, simulation, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
206140
|
+
export { Ammeter, AnalogAcSweepSimulation, AnalogAnalysisSimulation, AnalogDcOperatingPointSimulation, AnalogDcSweepSimulation, AnalogSimulation, AnalogSweepParameter, AnalogTransientSimulation, Antenna, AssemblyCable, type AssemblyCableJsxProps, type AssemblyCadAssemblyJsxProps, AssemblyDevice, type AssemblyDeviceJsxProps, AssemblyMotor, type AssemblyMotorJsxProps, AssemblyPart, type AssemblyPartJsxProps, AssemblyPrintedPart, type AssemblyPrintedPartJsxProps, AssemblyReferenceSurface, AssemblyScreen, type AssemblyScreenJsxProps, AssemblySubassembly, type AssemblySubassemblyJsxProps, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingCacheDisabledReason, type AutoroutingCacheStatus, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingExecutionMetadata, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Bus, CadAssembly, CadModel, Capacitor, Chip, Circuit, type CircuitJsonMetadata, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, EnclosureCutoutAperture, EnclosureFdmBox, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbBend, type PcbGroupId, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbReturnCurrentExcitation, PcbReturnCurrentSimulation, PcbSoldermaskOpening, PcbStiffener, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicGraphic, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicSymbol, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteBounds, type SimpleRouteBus, type SimpleRouteBusTermination, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimpleRoutePoint, type SimplifiedPcbTrace, type SingleLayerConnectionPoint, SmtPad, SolderJumper, type SolverEndedEvent, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, analog, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, assembly, createUseComponent, enclosure, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, simulation, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -84,6 +84,7 @@ __export(components_exports, {
|
|
|
84
84
|
PcbNotePath: () => PcbNotePath,
|
|
85
85
|
PcbNoteRect: () => PcbNoteRect,
|
|
86
86
|
PcbNoteText: () => PcbNoteText,
|
|
87
|
+
PcbReturnCurrentExcitation: () => PcbReturnCurrentExcitation,
|
|
87
88
|
PcbReturnCurrentSimulation: () => PcbReturnCurrentSimulation,
|
|
88
89
|
PcbSoldermaskOpening: () => PcbSoldermaskOpening,
|
|
89
90
|
PcbStiffener: () => PcbStiffener,
|
|
@@ -1035,6 +1036,7 @@ var orderedRenderPhases = [
|
|
|
1035
1036
|
"PcbCopperPourRender",
|
|
1036
1037
|
"PcbViaStitchRender",
|
|
1037
1038
|
"PcbCopperPourCleanup",
|
|
1039
|
+
"PcbSimulationRender",
|
|
1038
1040
|
"PcbDesignRuleChecks",
|
|
1039
1041
|
"SilkscreenOverlapAdjustment",
|
|
1040
1042
|
"CadModelRender",
|
|
@@ -1128,6 +1130,16 @@ var asyncPhaseDependencies = {
|
|
|
1128
1130
|
"PcbViaStitchRender",
|
|
1129
1131
|
"PcbCopperPourCleanup"
|
|
1130
1132
|
],
|
|
1133
|
+
PcbSimulationRender: [
|
|
1134
|
+
"PcbFootprintStringRender",
|
|
1135
|
+
"FetchPartFootprint",
|
|
1136
|
+
"PcbPlacementDesignRuleChecks",
|
|
1137
|
+
"PcbTraceRender",
|
|
1138
|
+
"PcbRouteNetIslands",
|
|
1139
|
+
"PcbCopperPourRender",
|
|
1140
|
+
"PcbViaStitchRender",
|
|
1141
|
+
"PcbCopperPourCleanup"
|
|
1142
|
+
],
|
|
1131
1143
|
SilkscreenOverlapAdjustment: [
|
|
1132
1144
|
"PcbFootprintStringRender",
|
|
1133
1145
|
"FetchPartFootprint"
|
|
@@ -118341,7 +118353,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
118341
118353
|
var package_default = {
|
|
118342
118354
|
name: "@tscircuit/core",
|
|
118343
118355
|
type: "module",
|
|
118344
|
-
version: "0.0.
|
|
118356
|
+
version: "0.0.2121",
|
|
118345
118357
|
types: "dist/index.d.ts",
|
|
118346
118358
|
main: "dist/index.js",
|
|
118347
118359
|
module: "dist/index.js",
|
|
@@ -118378,7 +118390,7 @@ var package_default = {
|
|
|
118378
118390
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
118379
118391
|
"@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.21.tgz",
|
|
118380
118392
|
"@tscircuit/cableprinter": "^0.0.6",
|
|
118381
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
118393
|
+
"@tscircuit/capacity-autorouter": "^0.0.965",
|
|
118382
118394
|
"@tscircuit/checks": "^0.0.243",
|
|
118383
118395
|
"@tscircuit/circuit-json-util": "^0.0.119",
|
|
118384
118396
|
"@tscircuit/common": "^0.0.20",
|
|
@@ -133134,6 +133146,237 @@ var PcbReturnCurrentSimulation = class extends PrimitiveComponent2 {
|
|
|
133134
133146
|
}
|
|
133135
133147
|
};
|
|
133136
133148
|
|
|
133149
|
+
// lib/components/primitive-components/PcbReturnCurrentExcitation.ts
|
|
133150
|
+
import { pcbReturnCurrentExcitationProps } from "@tscircuit/props";
|
|
133151
|
+
|
|
133152
|
+
// lib/components/primitive-components/PcbReturnCurrentExcitation_doInitialPcbSimulationRender.ts
|
|
133153
|
+
var positionToleranceMm = 1e-6;
|
|
133154
|
+
function PcbReturnCurrentExcitation_doInitialPcbSimulationRender(excitation) {
|
|
133155
|
+
if (excitation.root?.pcbDisabled) return;
|
|
133156
|
+
const { db: db2 } = excitation.root;
|
|
133157
|
+
const props = excitation._parsedProps;
|
|
133158
|
+
const simulation2 = excitation.parent;
|
|
133159
|
+
if (simulation2?.componentName !== "PcbReturnCurrentSimulation") {
|
|
133160
|
+
excitation.renderError(
|
|
133161
|
+
"A PCB return-current excitation must be directly inside a PCB return-current simulation."
|
|
133162
|
+
);
|
|
133163
|
+
return;
|
|
133164
|
+
}
|
|
133165
|
+
if (!simulation2.simulation_experiment_id) {
|
|
133166
|
+
excitation.renderError(
|
|
133167
|
+
"The PCB return-current simulation has not been declared."
|
|
133168
|
+
);
|
|
133169
|
+
return;
|
|
133170
|
+
}
|
|
133171
|
+
const subcircuit = excitation.getSubcircuit();
|
|
133172
|
+
const resolvePcbPort = (selector, role) => {
|
|
133173
|
+
const ports = subcircuit.selectAll(selector).filter((component) => component.componentName === "Port");
|
|
133174
|
+
if (ports.length !== 1) {
|
|
133175
|
+
excitation.renderError(
|
|
133176
|
+
`${role} selector "${selector}" must identify exactly one physical PCB port.`
|
|
133177
|
+
);
|
|
133178
|
+
}
|
|
133179
|
+
const port = ports[0];
|
|
133180
|
+
const pcbPort = port?.pcb_port_id ? db2.pcb_port.get(port.pcb_port_id) : null;
|
|
133181
|
+
const hasPhysicalPad = pcbPort && (db2.pcb_smtpad.list({ pcb_port_id: pcbPort.pcb_port_id }).length > 0 || db2.pcb_plated_hole.list({ pcb_port_id: pcbPort.pcb_port_id }).length > 0);
|
|
133182
|
+
if (!pcbPort || !hasPhysicalPad) {
|
|
133183
|
+
excitation.renderError(
|
|
133184
|
+
`${role} selector "${selector}" needs a physical PCB pad or plated-hole port.`
|
|
133185
|
+
);
|
|
133186
|
+
}
|
|
133187
|
+
return pcbPort;
|
|
133188
|
+
};
|
|
133189
|
+
const signalSource = resolvePcbPort(props.source, "Signal source");
|
|
133190
|
+
const signalLoad = resolvePcbPort(props.load, "Signal load");
|
|
133191
|
+
const returnSource = resolvePcbPort(
|
|
133192
|
+
props.returnSource,
|
|
133193
|
+
"Return source (load-side ground)"
|
|
133194
|
+
);
|
|
133195
|
+
const returnSink = resolvePcbPort(
|
|
133196
|
+
props.returnSink,
|
|
133197
|
+
"Return sink (driver-side ground)"
|
|
133198
|
+
);
|
|
133199
|
+
if ((/* @__PURE__ */ new Set([
|
|
133200
|
+
signalSource.pcb_port_id,
|
|
133201
|
+
signalLoad.pcb_port_id,
|
|
133202
|
+
returnSource.pcb_port_id,
|
|
133203
|
+
returnSink.pcb_port_id
|
|
133204
|
+
])).size !== 4) {
|
|
133205
|
+
excitation.renderError(
|
|
133206
|
+
"Signal source, signal load, return source and return sink must be four distinct physical PCB ports."
|
|
133207
|
+
);
|
|
133208
|
+
}
|
|
133209
|
+
const groundNets = subcircuit.selectAll(props.ground.startsWith("net.") ? "net" : props.ground).filter(
|
|
133210
|
+
(component) => component.componentName === "Net" && (!props.ground.startsWith("net.") || component.getPortSelector() === props.ground)
|
|
133211
|
+
);
|
|
133212
|
+
if (groundNets.length !== 1 || !groundNets[0].source_net_id) {
|
|
133213
|
+
excitation.renderError(
|
|
133214
|
+
`Ground selector "${props.ground}" must identify exactly one source net.`
|
|
133215
|
+
);
|
|
133216
|
+
}
|
|
133217
|
+
const groundNet = db2.source_net.get(groundNets[0].source_net_id);
|
|
133218
|
+
const groundConnectivityKey = groundNet.subcircuit_connectivity_map_key;
|
|
133219
|
+
for (const [pcbPort, selector] of [
|
|
133220
|
+
[signalSource, props.source],
|
|
133221
|
+
[signalLoad, props.load]
|
|
133222
|
+
]) {
|
|
133223
|
+
if (groundConnectivityKey && db2.source_port.get(pcbPort.source_port_id)?.subcircuit_connectivity_map_key === groundConnectivityKey) {
|
|
133224
|
+
excitation.renderError(
|
|
133225
|
+
`Signal terminal "${selector}" is electrically connected to ground net "${groundNet.name}".`
|
|
133226
|
+
);
|
|
133227
|
+
}
|
|
133228
|
+
}
|
|
133229
|
+
for (const [pcbPort, selector] of [
|
|
133230
|
+
[returnSource, props.returnSource],
|
|
133231
|
+
[returnSink, props.returnSink]
|
|
133232
|
+
]) {
|
|
133233
|
+
const sourcePort = db2.source_port.get(pcbPort.source_port_id);
|
|
133234
|
+
if (!groundConnectivityKey || sourcePort?.subcircuit_connectivity_map_key !== groundConnectivityKey) {
|
|
133235
|
+
excitation.renderError(
|
|
133236
|
+
`Return contact "${selector}" is not electrically connected to ground net "${groundNet.name}".`
|
|
133237
|
+
);
|
|
133238
|
+
}
|
|
133239
|
+
}
|
|
133240
|
+
const contact = (pcbPort, selector, requestedLayer, role) => {
|
|
133241
|
+
const layers = [...new Set(pcbPort.layers)];
|
|
133242
|
+
if (!requestedLayer && layers.length !== 1) {
|
|
133243
|
+
excitation.renderError(
|
|
133244
|
+
`${role} "${selector}" spans multiple layers; specify ${role === "Return source" ? "returnSourceLayer" : "returnSinkLayer"}.`
|
|
133245
|
+
);
|
|
133246
|
+
}
|
|
133247
|
+
const layer = requestedLayer ?? layers[0];
|
|
133248
|
+
if (!layers.includes(layer)) {
|
|
133249
|
+
excitation.renderError(
|
|
133250
|
+
`${role} "${selector}" has no physical port on layer "${layer}".`
|
|
133251
|
+
);
|
|
133252
|
+
}
|
|
133253
|
+
return {
|
|
133254
|
+
contact_type: "pcb_port",
|
|
133255
|
+
pcb_port_id: pcbPort.pcb_port_id,
|
|
133256
|
+
x: pcbPort.x,
|
|
133257
|
+
y: pcbPort.y,
|
|
133258
|
+
layer
|
|
133259
|
+
};
|
|
133260
|
+
};
|
|
133261
|
+
const returnSourceContact = contact(
|
|
133262
|
+
returnSource,
|
|
133263
|
+
props.returnSource,
|
|
133264
|
+
props.returnSourceLayer,
|
|
133265
|
+
"Return source"
|
|
133266
|
+
);
|
|
133267
|
+
const returnSinkContact = contact(
|
|
133268
|
+
returnSink,
|
|
133269
|
+
props.returnSink,
|
|
133270
|
+
props.returnSinkLayer,
|
|
133271
|
+
"Return sink"
|
|
133272
|
+
);
|
|
133273
|
+
for (const [signalPort, referenceContact] of [
|
|
133274
|
+
[signalSource, returnSinkContact],
|
|
133275
|
+
[signalLoad, returnSourceContact]
|
|
133276
|
+
]) {
|
|
133277
|
+
if (Math.hypot(
|
|
133278
|
+
signalPort.x - referenceContact.x,
|
|
133279
|
+
signalPort.y - referenceContact.y
|
|
133280
|
+
) <= positionToleranceMm && signalPort.layers.includes(referenceContact.layer)) {
|
|
133281
|
+
excitation.renderError(
|
|
133282
|
+
"A signal terminal and its ground reference must occupy different physical PCB locations on the same layer."
|
|
133283
|
+
);
|
|
133284
|
+
}
|
|
133285
|
+
}
|
|
133286
|
+
let selectedSourceTraceId;
|
|
133287
|
+
if (props.trace) {
|
|
133288
|
+
const traces2 = subcircuit.selectAll(props.trace).filter((component) => component.componentName === "Trace");
|
|
133289
|
+
if (traces2.length !== 1 || !traces2[0].source_trace_id) {
|
|
133290
|
+
excitation.renderError(
|
|
133291
|
+
`Trace selector "${props.trace}" must identify exactly one routed source trace.`
|
|
133292
|
+
);
|
|
133293
|
+
}
|
|
133294
|
+
selectedSourceTraceId = traces2[0].source_trace_id;
|
|
133295
|
+
}
|
|
133296
|
+
const endpointMatches = (endpoint, pcbPort, end) => endpoint?.route_type === "wire" && Math.hypot(endpoint.x - pcbPort.x, endpoint.y - pcbPort.y) <= positionToleranceMm && pcbPort.layers.includes(endpoint.layer) && (!endpoint[`${end}_pcb_port_id`] || endpoint[`${end}_pcb_port_id`] === pcbPort.pcb_port_id);
|
|
133297
|
+
const traces = db2.pcb_trace.list().filter((pcbTrace) => {
|
|
133298
|
+
if (pcbTrace.subcircuit_id !== subcircuit.subcircuit_id) return false;
|
|
133299
|
+
if (selectedSourceTraceId && pcbTrace.source_trace_id !== selectedSourceTraceId)
|
|
133300
|
+
return false;
|
|
133301
|
+
const sourceTrace = pcbTrace.source_trace_id ? db2.source_trace.get(pcbTrace.source_trace_id) : null;
|
|
133302
|
+
if (!sourceTrace || sourceTrace.connected_source_port_ids.length !== 2 || !sourceTrace.connected_source_port_ids.includes(
|
|
133303
|
+
signalSource.source_port_id
|
|
133304
|
+
) || !sourceTrace.connected_source_port_ids.includes(signalLoad.source_port_id))
|
|
133305
|
+
return false;
|
|
133306
|
+
const first = pcbTrace.route[0];
|
|
133307
|
+
const last = pcbTrace.route.at(-1);
|
|
133308
|
+
return endpointMatches(first, signalSource, "start") && endpointMatches(last, signalLoad, "end") || endpointMatches(first, signalLoad, "start") && endpointMatches(last, signalSource, "end");
|
|
133309
|
+
});
|
|
133310
|
+
if (traces.length !== 1) {
|
|
133311
|
+
excitation.renderError(
|
|
133312
|
+
`The connection from "${props.source}" to "${props.load}" must have exactly one complete routed PCB trace${props.trace ? ` selected by "${props.trace}"` : "; use trace to disambiguate multiple routes"}. Split or branched routes are not supported.`
|
|
133313
|
+
);
|
|
133314
|
+
}
|
|
133315
|
+
const previousExcitations = db2.simulation_return_current_excitation.list({
|
|
133316
|
+
simulation_experiment_id: simulation2.simulation_experiment_id
|
|
133317
|
+
});
|
|
133318
|
+
if (previousExcitations.some(
|
|
133319
|
+
(previous) => previous.pcb_trace_id === traces[0].pcb_trace_id
|
|
133320
|
+
)) {
|
|
133321
|
+
excitation.renderError(
|
|
133322
|
+
"A PCB return-current simulation can excite each signal trace only once. Use separate experiments to compare different currents or directions."
|
|
133323
|
+
);
|
|
133324
|
+
}
|
|
133325
|
+
if (previousExcitations.some(
|
|
133326
|
+
(previous) => previous.ground_source_net_id !== groundNet.source_net_id
|
|
133327
|
+
)) {
|
|
133328
|
+
excitation.renderError(
|
|
133329
|
+
"All excitations in a PCB return-current simulation must use the same ground net. Use separate experiments for different ground nets."
|
|
133330
|
+
);
|
|
133331
|
+
}
|
|
133332
|
+
const inserted = db2.simulation_return_current_excitation.insert({
|
|
133333
|
+
simulation_experiment_id: simulation2.simulation_experiment_id,
|
|
133334
|
+
pcb_trace_id: traces[0].pcb_trace_id,
|
|
133335
|
+
ground_source_net_id: groundNet.source_net_id,
|
|
133336
|
+
current: props.current,
|
|
133337
|
+
return_source: returnSourceContact,
|
|
133338
|
+
return_sink: returnSinkContact,
|
|
133339
|
+
source_port: {
|
|
133340
|
+
signal_pcb_port_id: signalSource.pcb_port_id,
|
|
133341
|
+
reference_pcb_port_id: returnSink.pcb_port_id,
|
|
133342
|
+
reference_layer: returnSinkContact.layer,
|
|
133343
|
+
resistance: props.sourceImpedance
|
|
133344
|
+
},
|
|
133345
|
+
load_port: {
|
|
133346
|
+
signal_pcb_port_id: signalLoad.pcb_port_id,
|
|
133347
|
+
reference_pcb_port_id: returnSource.pcb_port_id,
|
|
133348
|
+
reference_layer: returnSourceContact.layer,
|
|
133349
|
+
resistance: props.loadImpedance
|
|
133350
|
+
}
|
|
133351
|
+
});
|
|
133352
|
+
excitation.simulation_return_current_excitation_id = inserted.simulation_return_current_excitation_id;
|
|
133353
|
+
}
|
|
133354
|
+
|
|
133355
|
+
// lib/components/primitive-components/PcbReturnCurrentExcitation.ts
|
|
133356
|
+
var PcbReturnCurrentExcitation = class extends PrimitiveComponent2 {
|
|
133357
|
+
simulation_return_current_excitation_id = null;
|
|
133358
|
+
get config() {
|
|
133359
|
+
return {
|
|
133360
|
+
componentName: "PcbReturnCurrentExcitation",
|
|
133361
|
+
zodProps: pcbReturnCurrentExcitationProps
|
|
133362
|
+
};
|
|
133363
|
+
}
|
|
133364
|
+
doInitialPcbSimulationRender() {
|
|
133365
|
+
PcbReturnCurrentExcitation_doInitialPcbSimulationRender(this);
|
|
133366
|
+
}
|
|
133367
|
+
updatePcbSimulationRender() {
|
|
133368
|
+
this.removePcbSimulationRender();
|
|
133369
|
+
this.doInitialPcbSimulationRender();
|
|
133370
|
+
}
|
|
133371
|
+
removePcbSimulationRender() {
|
|
133372
|
+
if (!this.simulation_return_current_excitation_id) return;
|
|
133373
|
+
this.root.db.simulation_return_current_excitation.delete(
|
|
133374
|
+
this.simulation_return_current_excitation_id
|
|
133375
|
+
);
|
|
133376
|
+
this.simulation_return_current_excitation_id = null;
|
|
133377
|
+
}
|
|
133378
|
+
};
|
|
133379
|
+
|
|
133137
133380
|
// lib/components/primitive-components/VoltageProbe.ts
|
|
133138
133381
|
import { voltageProbeProps } from "@tscircuit/props";
|
|
133139
133382
|
|
|
@@ -134592,6 +134835,9 @@ var enclosure = {
|
|
|
134592
134835
|
var simulation = {
|
|
134593
134836
|
pcbreturncurrentsimulation: createNamespacedElement(
|
|
134594
134837
|
"pcbreturncurrentsimulation"
|
|
134838
|
+
),
|
|
134839
|
+
pcbreturncurrentexcitation: createNamespacedElement(
|
|
134840
|
+
"pcbreturncurrentexcitation"
|
|
134595
134841
|
)
|
|
134596
134842
|
};
|
|
134597
134843
|
|
|
@@ -134912,6 +135158,7 @@ export {
|
|
|
134912
135158
|
PcbNotePath,
|
|
134913
135159
|
PcbNoteRect,
|
|
134914
135160
|
PcbNoteText,
|
|
135161
|
+
PcbReturnCurrentExcitation,
|
|
134915
135162
|
PcbReturnCurrentSimulation,
|
|
134916
135163
|
PcbSoldermaskOpening,
|
|
134917
135164
|
PcbStiffener,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2122",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
39
39
|
"@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.21.tgz",
|
|
40
40
|
"@tscircuit/cableprinter": "^0.0.6",
|
|
41
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
41
|
+
"@tscircuit/capacity-autorouter": "^0.0.965",
|
|
42
42
|
"@tscircuit/checks": "^0.0.243",
|
|
43
43
|
"@tscircuit/circuit-json-util": "^0.0.119",
|
|
44
44
|
"@tscircuit/common": "^0.0.20",
|