Integrate ImpedenceFinder closed-form Z0 into the project Impedance tab.
Use the vendored Hammerstad-Jensen/Cohn engine for microstrip, stripline, and coupled-diff advice. Skip OpenEMS/pcbnew and refuse CPWG rather than inventing a number. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,6 +10,9 @@ import type {
|
||||
CreditSnapshot,
|
||||
DesignGraph,
|
||||
DeratingRow,
|
||||
ImpedanceKind,
|
||||
ImpedanceStackupResult,
|
||||
ImpedanceTraceResult,
|
||||
EdifSubDesign,
|
||||
FindingComment,
|
||||
LcscPayload,
|
||||
@@ -582,6 +585,28 @@ export async function fetchDerating(
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function computeImpedance(body: {
|
||||
mode: "trace" | "stackup";
|
||||
kind?: ImpedanceKind;
|
||||
h: number;
|
||||
er: number;
|
||||
t: number;
|
||||
w?: number | null;
|
||||
s?: number | null;
|
||||
target_z?: number | null;
|
||||
}): Promise<ImpedanceTraceResult | ImpedanceStackupResult> {
|
||||
const res = await authFetch(`${BASE}/api/impedance`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const detail = await res.json().catch(() => ({ detail: res.statusText }));
|
||||
throw new Error(typeof detail.detail === "string" ? detail.detail : "Impedance compute failed");
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function fetchReport(
|
||||
projectId: string,
|
||||
): Promise<ValidationReport> {
|
||||
|
||||
@@ -320,6 +320,32 @@ export interface DeratingSettings {
|
||||
electrolytic: number;
|
||||
}
|
||||
|
||||
export type ImpedanceKind = "microstrip" | "stripline" | "cpw" | "diff";
|
||||
|
||||
export interface ImpedanceTraceResult {
|
||||
kind: ImpedanceKind;
|
||||
z0?: number | null;
|
||||
zodd?: number | null;
|
||||
zeven?: number | null;
|
||||
zdiff?: number | null;
|
||||
w_mm?: number | null;
|
||||
s_mm?: number | null;
|
||||
}
|
||||
|
||||
export interface ImpedanceTarget {
|
||||
kind: string;
|
||||
w_mm: number | null;
|
||||
s_mm: number | null;
|
||||
z0: number | null;
|
||||
zdiff: number | null;
|
||||
formula: string;
|
||||
}
|
||||
|
||||
export interface ImpedanceStackupResult {
|
||||
targets: Record<string, ImpedanceTarget>;
|
||||
kicad_dru: string;
|
||||
}
|
||||
|
||||
export interface NetlistPreviewDesignator {
|
||||
ref: string;
|
||||
pins: { number: string; net_name: string }[];
|
||||
|
||||
Reference in New Issue
Block a user