@tscircuit/core 0.0.2119 → 0.0.2121
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 +108 -7
- package/dist/index.js +303 -3
- package/package.json +3 -3
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, voltageProbeProps, spicemodelProps, pcbBendProps, pcbStiffenerProps, pcbSoldermaskOpeningProps, assemblyPrintedPartProps, assemblyCableProps, AnalogTransientSimulationProps, AnalogDcSweepSimulationProps, AnalogAcSweepSimulationProps, AnalogSweepParameterProps, AssemblyCablePropsInput, AssemblySubassemblyPropsInput, AssemblyDevicePropsInput, AssemblyMotorPropsInput, AssemblyPartPropsInput, AssemblyPrintedPartPropsInput, AssemblyScreenPropsInput, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, 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;
|
|
@@ -194771,9 +194771,9 @@ declare class AnalogSimulation extends PrimitiveComponent<typeof analogSimulatio
|
|
|
194771
194771
|
doInitialSimulationRender(): void;
|
|
194772
194772
|
}
|
|
194773
194773
|
|
|
194774
|
-
type SimulationExperimentId = SimulationExperiment["simulation_experiment_id"];
|
|
194774
|
+
type SimulationExperimentId$1 = SimulationExperiment["simulation_experiment_id"];
|
|
194775
194775
|
declare abstract class AnalogAnalysisSimulation<PropsSchema extends ZodType> extends PrimitiveComponent<PropsSchema> {
|
|
194776
|
-
simulation_experiment_id: SimulationExperimentId | null;
|
|
194776
|
+
simulation_experiment_id: SimulationExperimentId$1 | null;
|
|
194777
194777
|
protected abstract insertSimulationExperiment(): SimulationExperiment | null;
|
|
194778
194778
|
getSpiceEngineName(): string | undefined;
|
|
194779
194779
|
usesIndependentGraphAxes(): boolean;
|
|
@@ -195421,6 +195421,100 @@ declare class AnalogSweepParameter extends PrimitiveComponent<typeof analogSweep
|
|
|
195421
195421
|
doInitialSimulationRender(): void;
|
|
195422
195422
|
}
|
|
195423
195423
|
|
|
195424
|
+
type SimulationExperimentId = SimulationExperiment["simulation_experiment_id"];
|
|
195425
|
+
/** Declares a pending experiment; running an EM solver is a separate operation. */
|
|
195426
|
+
declare class PcbReturnCurrentSimulation extends PrimitiveComponent<typeof pcbReturnCurrentSimulationProps> {
|
|
195427
|
+
simulation_experiment_id: SimulationExperimentId | null;
|
|
195428
|
+
get config(): {
|
|
195429
|
+
componentName: string;
|
|
195430
|
+
zodProps: zod.ZodObject<{
|
|
195431
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
195432
|
+
children: zod.ZodOptional<zod.ZodType<react.ReactNode, zod.ZodTypeDef, react.ReactNode>>;
|
|
195433
|
+
}, "strict", zod.ZodTypeAny, {
|
|
195434
|
+
name?: string | undefined;
|
|
195435
|
+
children?: react.ReactNode;
|
|
195436
|
+
}, {
|
|
195437
|
+
name?: string | undefined;
|
|
195438
|
+
children?: react.ReactNode;
|
|
195439
|
+
}>;
|
|
195440
|
+
};
|
|
195441
|
+
doInitialSimulationRender(): void;
|
|
195442
|
+
updateSimulationRender(): void;
|
|
195443
|
+
removeSimulationRender(): void;
|
|
195444
|
+
}
|
|
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
|
+
|
|
195424
195518
|
declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps> {
|
|
195425
195519
|
simulation_voltage_probe_id: string | null;
|
|
195426
195520
|
schematic_voltage_probe_id: string | null;
|
|
@@ -204277,6 +204371,11 @@ declare const enclosure: {
|
|
|
204277
204371
|
};
|
|
204278
204372
|
};
|
|
204279
204373
|
|
|
204374
|
+
declare const simulation: {
|
|
204375
|
+
readonly pcbreturncurrentsimulation: react.FunctionComponent<PcbReturnCurrentSimulationProps>;
|
|
204376
|
+
readonly pcbreturncurrentexcitation: react.FunctionComponent<PcbReturnCurrentExcitationProps>;
|
|
204377
|
+
};
|
|
204378
|
+
|
|
204280
204379
|
declare function resolveStaticFileImport(path: string, platform?: PlatformConfig): Promise<string>;
|
|
204281
204380
|
|
|
204282
204381
|
declare class RootCircuit extends IsolatedCircuit {
|
|
@@ -206014,6 +206113,8 @@ interface TscircuitElements {
|
|
|
206014
206113
|
analogdcsweepsimulation: _tscircuit_props.AnalogDcSweepSimulationProps;
|
|
206015
206114
|
analogacsweepsimulation: _tscircuit_props.AnalogAcSweepSimulationProps;
|
|
206016
206115
|
analogsweepparameter: _tscircuit_props.AnalogSweepParameterProps;
|
|
206116
|
+
pcbreturncurrentsimulation: _tscircuit_props.PcbReturnCurrentSimulationProps;
|
|
206117
|
+
pcbreturncurrentexcitation: _tscircuit_props.PcbReturnCurrentExcitationProps;
|
|
206017
206118
|
spicemodel: _tscircuit_props.SpiceModelProps;
|
|
206018
206119
|
fiducial: _tscircuit_props.FiducialProps;
|
|
206019
206120
|
jscad: any;
|
|
@@ -206036,4 +206137,4 @@ declare module "react/jsx-runtime" {
|
|
|
206036
206137
|
}
|
|
206037
206138
|
}
|
|
206038
206139
|
|
|
206039
|
-
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, 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, 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,8 @@ __export(components_exports, {
|
|
|
84
84
|
PcbNotePath: () => PcbNotePath,
|
|
85
85
|
PcbNoteRect: () => PcbNoteRect,
|
|
86
86
|
PcbNoteText: () => PcbNoteText,
|
|
87
|
+
PcbReturnCurrentExcitation: () => PcbReturnCurrentExcitation,
|
|
88
|
+
PcbReturnCurrentSimulation: () => PcbReturnCurrentSimulation,
|
|
87
89
|
PcbSoldermaskOpening: () => PcbSoldermaskOpening,
|
|
88
90
|
PcbStiffener: () => PcbStiffener,
|
|
89
91
|
PcbTrace: () => PcbTrace,
|
|
@@ -1034,6 +1036,7 @@ var orderedRenderPhases = [
|
|
|
1034
1036
|
"PcbCopperPourRender",
|
|
1035
1037
|
"PcbViaStitchRender",
|
|
1036
1038
|
"PcbCopperPourCleanup",
|
|
1039
|
+
"PcbSimulationRender",
|
|
1037
1040
|
"PcbDesignRuleChecks",
|
|
1038
1041
|
"SilkscreenOverlapAdjustment",
|
|
1039
1042
|
"CadModelRender",
|
|
@@ -1127,6 +1130,16 @@ var asyncPhaseDependencies = {
|
|
|
1127
1130
|
"PcbViaStitchRender",
|
|
1128
1131
|
"PcbCopperPourCleanup"
|
|
1129
1132
|
],
|
|
1133
|
+
PcbSimulationRender: [
|
|
1134
|
+
"PcbFootprintStringRender",
|
|
1135
|
+
"FetchPartFootprint",
|
|
1136
|
+
"PcbPlacementDesignRuleChecks",
|
|
1137
|
+
"PcbTraceRender",
|
|
1138
|
+
"PcbRouteNetIslands",
|
|
1139
|
+
"PcbCopperPourRender",
|
|
1140
|
+
"PcbViaStitchRender",
|
|
1141
|
+
"PcbCopperPourCleanup"
|
|
1142
|
+
],
|
|
1130
1143
|
SilkscreenOverlapAdjustment: [
|
|
1131
1144
|
"PcbFootprintStringRender",
|
|
1132
1145
|
"FetchPartFootprint"
|
|
@@ -118340,7 +118353,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
118340
118353
|
var package_default = {
|
|
118341
118354
|
name: "@tscircuit/core",
|
|
118342
118355
|
type: "module",
|
|
118343
|
-
version: "0.0.
|
|
118356
|
+
version: "0.0.2120",
|
|
118344
118357
|
types: "dist/index.d.ts",
|
|
118345
118358
|
main: "dist/index.js",
|
|
118346
118359
|
module: "dist/index.js",
|
|
@@ -118399,7 +118412,7 @@ var package_default = {
|
|
|
118399
118412
|
"@tscircuit/miniflex": "^0.0.4",
|
|
118400
118413
|
"@tscircuit/modelprinter": "^0.0.18",
|
|
118401
118414
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
118402
|
-
"@tscircuit/props": "^0.0.
|
|
118415
|
+
"@tscircuit/props": "^0.0.698",
|
|
118403
118416
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
118404
118417
|
"@tscircuit/schematic-trace-solver": "https://jscdn.tscircuit.com/@tscircuit/schematic-trace-solver/0.0.230.tgz",
|
|
118405
118418
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -118483,7 +118496,7 @@ var package_default = {
|
|
|
118483
118496
|
},
|
|
118484
118497
|
overrides: {
|
|
118485
118498
|
"@tscircuit/circuit-json-util": "^0.0.119",
|
|
118486
|
-
"@tscircuit/props": "^0.0.
|
|
118499
|
+
"@tscircuit/props": "^0.0.698",
|
|
118487
118500
|
"circuit-json": "^0.0.525",
|
|
118488
118501
|
"@tscircuit/cableprinter": "^0.0.6"
|
|
118489
118502
|
}
|
|
@@ -133090,6 +133103,280 @@ var AnalogSweepParameter = class extends PrimitiveComponent2 {
|
|
|
133090
133103
|
}
|
|
133091
133104
|
};
|
|
133092
133105
|
|
|
133106
|
+
// lib/components/primitive-components/PcbReturnCurrentSimulation.ts
|
|
133107
|
+
import { pcbReturnCurrentSimulationProps } from "@tscircuit/props";
|
|
133108
|
+
var PcbReturnCurrentSimulation = class extends PrimitiveComponent2 {
|
|
133109
|
+
simulation_experiment_id = null;
|
|
133110
|
+
get config() {
|
|
133111
|
+
return {
|
|
133112
|
+
componentName: "PcbReturnCurrentSimulation",
|
|
133113
|
+
zodProps: pcbReturnCurrentSimulationProps
|
|
133114
|
+
};
|
|
133115
|
+
}
|
|
133116
|
+
doInitialSimulationRender() {
|
|
133117
|
+
if (this.root?.pcbDisabled) return;
|
|
133118
|
+
if (this.parent?.componentName === "PcbReturnCurrentSimulation") {
|
|
133119
|
+
this.renderError(
|
|
133120
|
+
"A PCB return-current simulation cannot contain another simulation."
|
|
133121
|
+
);
|
|
133122
|
+
}
|
|
133123
|
+
if (this.children.some(
|
|
133124
|
+
(child) => child.componentName !== "PcbReturnCurrentExcitation"
|
|
133125
|
+
)) {
|
|
133126
|
+
this.renderError(
|
|
133127
|
+
"A PCB return-current simulation can contain only return-current excitations."
|
|
133128
|
+
);
|
|
133129
|
+
}
|
|
133130
|
+
const experiment = this.root.db.simulation_experiment.insert({
|
|
133131
|
+
name: this._parsedProps.name ?? "PCB return current",
|
|
133132
|
+
experiment_type: "pcb_return_current"
|
|
133133
|
+
});
|
|
133134
|
+
this.simulation_experiment_id = experiment.simulation_experiment_id;
|
|
133135
|
+
}
|
|
133136
|
+
updateSimulationRender() {
|
|
133137
|
+
if (!this.simulation_experiment_id) return;
|
|
133138
|
+
this.root.db.simulation_experiment.update(this.simulation_experiment_id, {
|
|
133139
|
+
name: this._parsedProps.name ?? "PCB return current"
|
|
133140
|
+
});
|
|
133141
|
+
}
|
|
133142
|
+
removeSimulationRender() {
|
|
133143
|
+
if (!this.simulation_experiment_id) return;
|
|
133144
|
+
this.root.db.simulation_experiment.delete(this.simulation_experiment_id);
|
|
133145
|
+
this.simulation_experiment_id = null;
|
|
133146
|
+
}
|
|
133147
|
+
};
|
|
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
|
+
|
|
133093
133380
|
// lib/components/primitive-components/VoltageProbe.ts
|
|
133094
133381
|
import { voltageProbeProps } from "@tscircuit/props";
|
|
133095
133382
|
|
|
@@ -134544,6 +134831,16 @@ var enclosure = {
|
|
|
134544
134831
|
}
|
|
134545
134832
|
};
|
|
134546
134833
|
|
|
134834
|
+
// lib/namespaced-elements/simulation.ts
|
|
134835
|
+
var simulation = {
|
|
134836
|
+
pcbreturncurrentsimulation: createNamespacedElement(
|
|
134837
|
+
"pcbreturncurrentsimulation"
|
|
134838
|
+
),
|
|
134839
|
+
pcbreturncurrentexcitation: createNamespacedElement(
|
|
134840
|
+
"pcbreturncurrentexcitation"
|
|
134841
|
+
)
|
|
134842
|
+
};
|
|
134843
|
+
|
|
134547
134844
|
// lib/RootCircuit.ts
|
|
134548
134845
|
var RootCircuit = class extends IsolatedCircuit {
|
|
134549
134846
|
isRootCircuit = true;
|
|
@@ -134861,6 +135158,8 @@ export {
|
|
|
134861
135158
|
PcbNotePath,
|
|
134862
135159
|
PcbNoteRect,
|
|
134863
135160
|
PcbNoteText,
|
|
135161
|
+
PcbReturnCurrentExcitation,
|
|
135162
|
+
PcbReturnCurrentSimulation,
|
|
134864
135163
|
PcbSoldermaskOpening,
|
|
134865
135164
|
PcbStiffener,
|
|
134866
135165
|
PcbTrace,
|
|
@@ -134932,6 +135231,7 @@ export {
|
|
|
134932
135231
|
renderPhaseIndexMap,
|
|
134933
135232
|
resolveStaticFileImport,
|
|
134934
135233
|
sel,
|
|
135234
|
+
simulation,
|
|
134935
135235
|
unrouteCircuitJson,
|
|
134936
135236
|
useCapacitor,
|
|
134937
135237
|
useChip,
|
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.2121",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@tscircuit/miniflex": "^0.0.4",
|
|
61
61
|
"@tscircuit/modelprinter": "^0.0.18",
|
|
62
62
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
63
|
-
"@tscircuit/props": "^0.0.
|
|
63
|
+
"@tscircuit/props": "^0.0.698",
|
|
64
64
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
65
65
|
"@tscircuit/schematic-trace-solver": "https://jscdn.tscircuit.com/@tscircuit/schematic-trace-solver/0.0.230.tgz",
|
|
66
66
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
},
|
|
145
145
|
"overrides": {
|
|
146
146
|
"@tscircuit/circuit-json-util": "^0.0.119",
|
|
147
|
-
"@tscircuit/props": "^0.0.
|
|
147
|
+
"@tscircuit/props": "^0.0.698",
|
|
148
148
|
"circuit-json": "^0.0.525",
|
|
149
149
|
"@tscircuit/cableprinter": "^0.0.6"
|
|
150
150
|
}
|