multisim2kicad 0.0.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Multisim schematic XML -> Schematic IR (Multisim units, Y-down).
3
+ *
4
+ * Model (verified on the corpus, see plans/converter.md "Findings"):
5
+ * - Placed parts are `CIITSymbolComp`. Their drawing objects live in
6
+ * `Objects > Item > <Class>`, each with its own affine `Transformer-M**`
7
+ * (Windows XFORM: x' = x*M00 + y*M10 + M20, y' = x*M01 + y*M11 + M21)
8
+ * into the symbol frame.
9
+ * - Symbol orientation is `OrientationFlip`: bits 0-1 rotate (0, 1 = r270,
10
+ * 2 = r180, 3 = r90 in (x, y) -> (y, -x) terms), 0x100 mirrors y, 0x1000
11
+ * mirrors x; the mirror applies before the rotation. The symbol's own
12
+ * `Transformer` matrix is always identity and its M20/M21 is not a reliable
13
+ * origin, so the translation is recovered from the pins.
14
+ * - Each pin connector's `ConnectList` names a sheet-level `CODPinComp`
15
+ * whose CenterX/Y is where wiring attaches (absolute).
16
+ * - Wires are `CIITLinkComp` polylines. User-named nets carry an
17
+ * `NI_EWB_NET_NAME` modifier.
18
+ * - `CVirtualConnector` = named net connector (`NI_EWB_VIRTUAL_GLOBAL` /
19
+ * `_LOCAL`), emitted as global / local labels.
20
+ * - Ground / supply symbols are `CIITSymbolComp`s whose Ci component is in
21
+ * the POWER_SOURCES family with a single pin; emitted as power ports whose
22
+ * name is the Ci refdes (= the net name, e.g. "0", "VCC").
23
+ */
24
+ import type { Dihedral, Schematic, SchPoint } from "../ir/types.ts";
25
+ import { type XmlInput } from "./doc.ts";
26
+ export declare const applyD: (t: Dihedral, p: SchPoint) => SchPoint;
27
+ /** OrientationFlip -> dihedral (mirror first, then rotate). */
28
+ export declare function flipToDihedral(flip: number): Dihedral;
29
+ /** Placement stats, for the converter summary and the plan's findings. */
30
+ export declare const placementStats: {
31
+ symbols: number;
32
+ pins: number;
33
+ pinsOnTarget: number;
34
+ raw: number;
35
+ composed: number;
36
+ unattached: number;
37
+ };
38
+ export declare function parseSchematicXml(input: XmlInput): Schematic;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Multisim's simulation settings -> ngspice directives.
3
+ *
4
+ * Each sheet's `CIITDiagram` carries a `SimState` attribute: Multisim's own
5
+ * serialization, `KEY:type{value}` with `list` values nesting
6
+ * (`SIMULATION_INFO > ANALYSES > TRAN > ANALYSIS > TSTOP:double{0.5}`).
7
+ * Per analysis (OP, AC, TRAN, ...) it keeps the settings, an `ANALYSIS_ID`
8
+ * (non-zero once that analysis has results in the design) and `ASYS_OPT`,
9
+ * the SPICE options with an `IsEnabled` flag each. Multisim enables
10
+ * `rshunt=1e12` (plus `trtol=7 itl4=100 convlimit`) by default, which is
11
+ * why it simulates designs with floating nets that plain ngspice rejects.
12
+ */
13
+ export interface SimStateNode {
14
+ key: string;
15
+ type: string;
16
+ value?: string;
17
+ items?: SimStateNode[];
18
+ }
19
+ /** Parse a `SimState` string. Throws on text that isn't one. */
20
+ export declare function parseSimState(t: string): SimStateNode[];
21
+ export interface SimSettings {
22
+ /** `.options ...`, or undefined when none apply. */
23
+ options?: string;
24
+ /** The analysis to run (`.tran ...`, `.ac ...`, `.op`), from those Multisim has results for, plus any note on it. */
25
+ analysis?: string;
26
+ /** The other analyses Multisim has results for (KiCad's directive runs one). */
27
+ skipped: string[];
28
+ }
29
+ /**
30
+ * Settings from a sheet's `SimState` attribute (the root sheet's speaks for
31
+ * the design). `digital`: the design has XSPICE event-driven parts.
32
+ */
33
+ export declare function simSettings(simState: string, o?: {
34
+ digital?: boolean;
35
+ }): SimSettings;
@@ -0,0 +1,303 @@
1
+ /**
2
+ * Multisim simulation data -> KiCad simulator (ngspice) fields.
3
+ *
4
+ * Every simulated `CiComponent` carries a *netlist template* (attribute
5
+ * strings[1][5]) that Multisim expands into SPICE lines:
6
+ *
7
+ * - `%p` the component name (refdes), `%m` its model's name,
8
+ * - `%tNAME` the node on the terminal (pin) called NAME,
9
+ * - `#N` parameter N of its `CiaParamList`,
10
+ * - `%vN?A%v:B%v;` A when parameter N is set (non-zero), else B.
11
+ *
12
+ * Models (`.SUBCKT` / `.MODEL` text) live in `CiModel` objects, referenced
13
+ * by the component's `Model` attribute. Their names are scoped by Multisim
14
+ * (`2N7002PW/NXP__MOS_ENH_N__1`), and the template references them by `%m`.
15
+ *
16
+ * KiCad mapping, from most to least native:
17
+ * 1. Plain resistors, capacitors and inductors use KiCad's built-in R / C / L
18
+ * models (or nothing at all when KiCad infers them from the value).
19
+ * 2. `x%p %tA %tB ... %m` parts (a vendor `.SUBCKT`) point at that
20
+ * subcircuit in the design's model library, with a pin map.
21
+ * 3. Anything else (sources, diode `.MODEL`s, inline subcircuits, ...)
22
+ * becomes a small wrapper subcircuit holding exactly what Multisim would
23
+ * netlist, so the simulation matches Multisim's.
24
+ * Parts with no template have no simulation model in Multisim and are
25
+ * excluded from simulation.
26
+ */
27
+ import type { SchematicSheet, SchematicSymbol, SimSpec } from "../ir/types.ts";
28
+ import type { EwElement } from "./doc.ts";
29
+ import { type DChip } from "./dchip.ts";
30
+ export interface SpiceDesign {
31
+ /** Sim spec per `CiComponent` id. */
32
+ byComponent: Map<string, SimSpec>;
33
+ /** The design's model library text (models + wrappers); empty when none. */
34
+ library: string;
35
+ /** Top-level netlist lines for a KiCad text directive (couplings across parts). */
36
+ directives: string[];
37
+ warnings: string[];
38
+ }
39
+ export interface ModelDef {
40
+ /** Sanitised name used in the library. */
41
+ name: string;
42
+ kind: "subckt" | "model";
43
+ /** Subcircuit node names, in order. */
44
+ nodes: string[];
45
+ text: string;
46
+ /** The model was a Multisim `d_chip`, now this subcircuit (instances need rewriting). */
47
+ dchip?: DChip;
48
+ /** Why parts of the text could not be translated (a `d_chip` left as it was). */
49
+ issues?: string[];
50
+ }
51
+ /**
52
+ * KiCad leaves power symbols (`#PWR` references) out of the simulation, but
53
+ * Multisim simulates its supply symbols (VCC is a 5 V source to ground). For
54
+ * each supply net whose symbol has a model, add a one-pin, simulation-only
55
+ * part carrying that model, touching a copy of the net's power symbol,
56
+ * parked to the right of the root page.
57
+ */
58
+ /**
59
+ * Where simulation-only additions go: right of everything on the page
60
+ * (Multisim content can sit past its edge) and of the parked extra-page
61
+ * sheet symbols at width + 40.
62
+ */
63
+ export declare function parkingX(page: SchematicSheet): number;
64
+ export declare function supplySymbols(sheets: SchematicSheet[], page: SchematicSheet): {
65
+ symbols: SchematicSymbol[];
66
+ warnings: string[];
67
+ };
68
+ /** SPICE-safe identifier: Multisim names carry `/`, `-`, `+`, ... */
69
+ export declare const spiceName: (s: string) => string;
70
+ /**
71
+ * Multisim's resistor template pairs `rR1 a b 10k vresR1` with a
72
+ * `.model vresR1 r(TC1=.. TC2=..)` that is often empty. In PSpice mode
73
+ * (which the model files need) a resistor's model name goes before its
74
+ * value, so the pair breaks: drop the model and put its temperature
75
+ * coefficients on the resistor itself.
76
+ */
77
+ export declare function inlineResistorModels(text: string): string;
78
+ /**
79
+ * Subcircuit parameters named like functions (NI's PI block has `max=60
80
+ * min=-60` and uses `limit(..., min, max)`) become `p_<name>`: in the
81
+ * subcircuit that declares them, and in every call's `PARAMS:`.
82
+ */
83
+ export declare function renameReservedParams(text: string): string;
84
+ /**
85
+ * PSpice's integral `sdt(x)`, which ngspice lacks, as XSPICE's integrator:
86
+ * a B source carries `x` onto a node, an `int` block integrates it (from 0
87
+ * at the operating point, as PSpice does), and the expression reads its
88
+ * output. The new lines go after the element that used it, in its scope.
89
+ */
90
+ export declare function sdtToIntegrator(text: string): string;
91
+ /** A transfer function: numerator / denominator polynomials in s (index = power), times e^(-delay*s). */
92
+ interface Rational {
93
+ num: number[];
94
+ den: number[];
95
+ delay: number;
96
+ }
97
+ /**
98
+ * Read a PSpice `LAPLACE` transfer function, `e^(-1m*s)/(1+0.001*s)`, into
99
+ * a rational function of s and a pure delay. Numbers only (with SPICE
100
+ * suffixes); undefined for anything else (parameters, other functions).
101
+ */
102
+ export declare function parseLaplace(expr: string): Rational | undefined;
103
+ /**
104
+ * PSpice's `E/G name n+ n- LAPLACE {input} {H(s)}` (no ngspice equivalent)
105
+ * as XSPICE: a B source carries the input onto a node, a lossless line
106
+ * delays it when H has an `e^(-sT)` factor, an `s_xfer` block applies the
107
+ * rational part, and the original E / G drives from its output.
108
+ */
109
+ export declare function laplaceToXspice(text: string, warnings?: string[]): string;
110
+ /**
111
+ * Multisim's `adc_bridge (in_low=a in_high=b schmitt=true)`: a Schmitt input
112
+ * that switches high at `in_high` and low at `in_low`. XSPICE's bridge has
113
+ * no hysteresis (it ignores `schmitt`), so an XSPICE `hyst` block takes the
114
+ * input first (rising threshold `b`, falling `a`, output 0..1) and the bridge
115
+ * reads that at 0.5.
116
+ */
117
+ export declare function schmittBridges(text: string): string;
118
+ /**
119
+ * A capacitor's `IC=` in a vendor model: PSpice (which these models target)
120
+ * holds that voltage during the bias point, and models lean on it to start
121
+ * their latches in a known state (Basso's PWM controllers). ngspice uses
122
+ * device `IC=` only with `uic`, so such latches leave the operating point
123
+ * without a solution. A `.nodeset` for each grounded one gives ngspice the
124
+ * same starting state, without holding the node once the bias point is found.
125
+ */
126
+ export declare function capacitorIcNodesets(text: string): string;
127
+ /** Rewrite the Multisim-only SPICE that real models use into ngspice. */
128
+ export declare function ngspiceDialect(text: string): string;
129
+ /** A model's definition: find its `.SUBCKT` / `.MODEL` head and rename it SPICE-safe. */
130
+ export declare function modelDef(localName: string, textIn: string): ModelDef | undefined;
131
+ /**
132
+ * Expand a Multisim netlist template. `node` maps a terminal name to the
133
+ * node it should print; unknown terminals are reported via `missing`.
134
+ */
135
+ export declare function expandTemplate(template: string, o: {
136
+ ref: string;
137
+ params: string[];
138
+ node: (terminal: string) => string | undefined;
139
+ /**
140
+ * `%tNAME?%t:d%t;NAME`: the digital side of pin NAME (`d`, or `r` for
141
+ * bidirectional pins), which Multisim bridges to the pin's analog node
142
+ * with the pin's interface model.
143
+ */
144
+ digital?: (terminal: string, prefix: string) => string;
145
+ /** `%sN`: the component's string parameters (MOSFET geometry, ...). */
146
+ strings?: string[];
147
+ /** Circuit parameter names (lower case): values using them get braces. */
148
+ circuitParams?: ReadonlySet<string>;
149
+ model?: string;
150
+ missing?: (t: string) => void;
151
+ }): string;
152
+ /** The component's netlist template (attribute strings[1][5]). */
153
+ export declare const netlistTemplate: (comp: EwElement) => string;
154
+ /** A SPICE number with an optional scale suffix / unit: `10k`, `1.5e-3`, `100nF`. */
155
+ export declare const isSpiceNumber: (v: string) => boolean;
156
+ /** The component's `CiaParamList` parameter values (`parameters`, or `strings`). */
157
+ export declare function componentParams(comp: EwElement, list?: "parameters" | "strings"): string[];
158
+ /**
159
+ * Circuit parameters (Multisim's per-sheet `.param`s) as one simulator
160
+ * directive per sheet title: names from `CircuitParamNameList`, values
161
+ * (numbers or expressions) from `CircuitParamValueList`.
162
+ */
163
+ export declare function circuitParams(root: EwElement): Map<string, string>;
164
+ /**
165
+ * Multisim's interactive potentiometer: a script (in `*` comments) sets the
166
+ * two halves from the slider at run time; the netlisted values are 1 mOhm
167
+ * placeholders. Fix them at the saved setting:
168
+ * R1 = total * setting% (clamped like the script), R2 = total - R1.
169
+ */
170
+ export declare function staticPot(lines: string): string;
171
+ /**
172
+ * The first `.MODEL` type in `text` that ngspice lacks, if any; or a PSpice
173
+ * source form it lacks: a `FREQ` response table (no exact time-domain
174
+ * equivalent), or a `LAPLACE` that `laplaceToXspice` couldn't translate.
175
+ */
176
+ export declare function unsupportedModelType(text: string): string | undefined;
177
+ /** One simulated section of a part: its template, parameters, model and terminals. */
178
+ export interface SimSection {
179
+ template: string;
180
+ params: string[];
181
+ /** String parameters (`%sN`). */
182
+ strings?: string[];
183
+ /** The design's circuit parameter names (lower case). */
184
+ circuitParams?: ReadonlySet<string>;
185
+ model?: ModelDef;
186
+ /** Terminal name -> symbol pin number. */
187
+ pins: Map<string, string>;
188
+ /** Digital pins: terminal name -> its interface (A/D, D/A bridge) model. */
189
+ pinModels?: Map<string, PinModel>;
190
+ }
191
+ /** A digital pin's interface model and the template that instantiates it. */
192
+ export interface PinModel {
193
+ model: ModelDef;
194
+ template: string;
195
+ }
196
+ /**
197
+ * A pin interface model: Multisim keeps an ideal (`*#L1`, standard XSPICE
198
+ * `adc_bridge` / `dac_bridge`) and a real (`*#L2`, Multisim-only code
199
+ * models) variant in one text; ngspice gets the ideal one.
200
+ */
201
+ export declare function pinModelDef(id: string, text: string): ModelDef | undefined;
202
+ /**
203
+ * An XSPICE `dac_bridge` output is an ideal voltage source, so two outputs
204
+ * tied together, or one driving a source (NI's pin-model demo), make a
205
+ * singular matrix. Multisim's real pin models have an output impedance; a
206
+ * 1 mOhm series resistor keeps the ideal level within microvolts while
207
+ * letting such circuits solve.
208
+ */
209
+ export declare function dacOutputResistance(text: string): string;
210
+ /**
211
+ * A tri-state / bidirectional pin model with an enable pin. Multisim's
212
+ * `dac_hiz` turns its digital input's high-Z into the voltage that opens the
213
+ * output switch; an ngspice `dac_bridge` can't see high-Z (it holds its
214
+ * level). The variant takes an extra last node, `en` (1 while the logic
215
+ * drives the pin, from the translated chip), and a plain `dac_bridge` makes
216
+ * the switch voltage from that. `undefined` for a model without `dac_hiz`.
217
+ */
218
+ export declare function enablePinModel(pm: PinModel): PinModel | undefined;
219
+ /** Split out top-level `.subckt ... .ends` blocks (with anything nested in them). */
220
+ export declare function hoistSubckts(text: string): {
221
+ body: string;
222
+ blocks: string[];
223
+ };
224
+ /** The models and wrapper subcircuits a design or library needs, deduplicated. */
225
+ export declare class SpiceLibrary {
226
+ private models;
227
+ private wrappers;
228
+ private names;
229
+ private texts;
230
+ readonly warnings: string[];
231
+ useModel(m: ModelDef): void;
232
+ /**
233
+ * A wrapper subcircuit around `lines`; identical bodies share one.
234
+ * Subcircuits defined inside `lines` (templates that carry their own)
235
+ * move to the top level: KiCad's library reader misreads the outer
236
+ * subcircuit's pins when another is nested in it.
237
+ */
238
+ wrapper(base: string, nodes: string[], linesIn: string, comment: string): string;
239
+ /** Nodes every subcircuit shares (cross-part probes, see `Xref`). */
240
+ readonly globals: Set<string>;
241
+ text(header: string): string;
242
+ }
243
+ /**
244
+ * Cross-part references. Multisim netlists flat, so a part's expression can
245
+ * read another part's current (`I(Vsensor1)`) or any net (`V(pri)`). Here
246
+ * each part is its own subcircuit, where ngspice would look those names up
247
+ * locally (and fail, or read a floating node). The part that owns the name
248
+ * gets a probe instead: a B source copying the current or voltage onto a
249
+ * `.global` node, which the expression reads.
250
+ */
251
+ export interface Xref {
252
+ /** In: the part's lines moved to the top level (couplings); the part itself is excluded. */
253
+ moved?: boolean;
254
+ /** In: always build a wrapper (a probe needs one), even for an ideal R/C/L or a vendor subcircuit. */
255
+ wrap?: boolean;
256
+ /** In: node names the expressions read -> what to read instead (a pin's node or a global). */
257
+ nodes?: Map<string, string>;
258
+ /** In: device names whose current the expressions read -> the global node carrying it. */
259
+ currents?: Map<string, string>;
260
+ /** In: probes to add, onto global nodes: a pin's voltage, or a device's current. */
261
+ probes?: {
262
+ global: string;
263
+ pin?: string;
264
+ device?: string;
265
+ }[];
266
+ /** Out: whether the part became a wrapper. */
267
+ wrapped?: boolean;
268
+ /** Out: devices the wrapper defines, and the node of each pin. */
269
+ devices?: string[];
270
+ pinNodes?: Map<string, string>;
271
+ /** Out: names the expressions read but the wrapper doesn't define (lowercase). */
272
+ readsNodes?: string[];
273
+ readsCurrents?: string[];
274
+ /** Out: the wrapper is only mutual inductances (`K`) coupling inductors it doesn't define. */
275
+ couplings?: {
276
+ name: string;
277
+ inductors: string[];
278
+ k: string;
279
+ }[];
280
+ }
281
+ /**
282
+ * KiCad simulation spec for one part from its sections (one per Multisim
283
+ * section that carries a template). KiCad simulates a part as one element
284
+ * across all its units, so several sections become one wrapper.
285
+ */
286
+ export declare function simSpec(ref: string, sectionsIn: SimSection[], lib: SpiceLibrary, wrapperBase?: string, xref?: Xref): SimSpec;
287
+ /**
288
+ * Build KiCad simulation specs for every simulated component of a design.
289
+ * `items` is the design's Ci objects by class (`collectCiItems`). The
290
+ * sections of one part (same circuit and refdes) share one spec.
291
+ */
292
+ export declare function parseSpice(items: Map<string, {
293
+ id: string;
294
+ body: EwElement;
295
+ }[]>, circuitParamNames?: ReadonlySet<string>,
296
+ /** Final refdes per `CiComponent` placement (`MultisimDesign.finalNames`), for cross-part references. */
297
+ finals?: Map<string, string[]>,
298
+ /** Pins on each net users named (`flattenNetlist`), for expressions that read `V(name)`. */
299
+ namedNets?: Map<string, {
300
+ refdes: string;
301
+ pin: string;
302
+ }[]>): SpiceDesign;
303
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Ultiboard drawing primitives (UBPolygon, UBRectangle, UBRoundedRectangle,
3
+ * UBPie, UBArc, UBEllipse) -> geometry in absolute nm, EW's Y-up frame.
4
+ *
5
+ * Conventions verified on corpus samples:
6
+ * - Points live in `Object > Point`.
7
+ * - UBPie / UBArc: points are [start, end, center] plus `Radius`; the sweep
8
+ * runs counter-clockwise (Y-up) from start to end; start == end is a full
9
+ * circle.
10
+ * - UBRectangle / UBRoundedRectangle: the first 4 points are the corners in
11
+ * order (the rectangle may be rotated); a 5th point, when present, is an
12
+ * anchor and is ignored. UBRoundedRectangle adds `Radius`.
13
+ */
14
+ import type { EwElement } from "./doc.ts";
15
+ import type { PadPrimitive, Point } from "../ir/types.ts";
16
+ export declare function points(item: EwElement | undefined): Point[];
17
+ /** CCW sweep from start to end around center; (0, 2pi], full circle when start == end. */
18
+ export declare function ccwSweep(center: Point, start: Point, end: Point): number;
19
+ /** Points along a CCW arc (inclusive of both ends). */
20
+ export declare function arcPoints(center: Point, radius: number, a0: number, sweep: number): Point[];
21
+ /** Polygon for a rectangle given by 4 corners, with corners rounded by `r`. */
22
+ export declare function roundedPolygon(corners: Point[], r: number): Point[];
23
+ /**
24
+ * A UB primitive as filled/stroked geometry. Returns undefined for tags this
25
+ * module doesn't know. Filled outlines come back as `poly`; UBArc as `arc`
26
+ * (or `circle` when it closes on itself).
27
+ */
28
+ export declare function ubPrimitive(tag: string, item: EwElement): PadPrimitive | undefined;
29
+ export declare const UB_PRIMITIVE_TAGS: string[];
30
+ /** Filled outline of a primitive (circles flattened); undefined for strokes (arcs). */
31
+ export declare function primitiveOutline(p: PadPrimitive): Point[] | undefined;
32
+ /** Bounding box of a set of primitives. */
33
+ export declare function primitivesBBox(prims: PadPrimitive[]): {
34
+ xMin: number;
35
+ xMax: number;
36
+ yMin: number;
37
+ yMax: number;
38
+ };
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Multisim's own netlist, read from the `Ci*` objects in a `.ms1x` file.
3
+ *
4
+ * Each `CiCircuit` (one per unique sheet / subcircuit) owns `CiComponent`s
5
+ * (refdes in `LocalName`), `CiPort`s (one per symbol pin, pointing back at
6
+ * its component and holding the pin-number CSV) and `CiNode`s (nets: name in
7
+ * `LocalName`, member ports in `Ports > Item@CiID`). Hierarchical instances
8
+ * are `CiInstComponent`s; flattening them needs the per-instance refdes map
9
+ * and is Phase D1 work, so for now this returns each circuit separately and
10
+ * reports whether the design is hierarchical.
11
+ *
12
+ * This is EW format knowledge, so it is a candidate to move into ewd (Phase
13
+ * B3) once it settles.
14
+ */
15
+ import { type EwElement, type XmlInput } from "../parse/doc.ts";
16
+ export interface CiPinRef {
17
+ refdes: string;
18
+ pin: string;
19
+ }
20
+ /**
21
+ * - `part`: a real component (has a manufacturer/family record).
22
+ * - `power`: ground / supply symbols (family `POWER_SOURCES`).
23
+ * - `connector`: virtual net joiners (on/off-page connectors, net-label
24
+ * components); their attribute record is a single type code.
25
+ */
26
+ export type CiComponentKind = "part" | "power" | "connector";
27
+ export interface CiCircuitNetlist {
28
+ id: string;
29
+ /** Net name -> pins on it. Only `part` pins with pin numbers are included. */
30
+ nets: Map<string, CiPinRef[]>;
31
+ /** Refdes of every `part` in this circuit. */
32
+ components: string[];
33
+ /** Refdes -> kind, for every component (parts, power, connectors). */
34
+ kinds: Map<string, CiComponentKind>;
35
+ instances: string[];
36
+ }
37
+ export interface CiNetlist {
38
+ circuits: CiCircuitNetlist[];
39
+ hierarchical: boolean;
40
+ /** CiComponent id (as referenced by a drawing's `CiComponent=` attr) -> refdes + kind. */
41
+ componentsById: Map<string, {
42
+ refdes: string;
43
+ kind: CiComponentKind;
44
+ part?: string;
45
+ }>;
46
+ }
47
+ /** Every `<Item CiID=.. Class="Ci...">` wrapper's body element, by class, in document order. */
48
+ export declare function collectCiItems(root: EwElement): Map<string, {
49
+ id: string;
50
+ body: EwElement;
51
+ }[]>;
52
+ /** A Ci object's `CiaCollString` records: direct ones, then those wrapped in `Item`s. */
53
+ export declare function ciCollStrings(body: EwElement): EwElement[];
54
+ /** The decoded `Value`s of one `CiaCollString`. */
55
+ export declare const collValues: (coll: EwElement | undefined) => string[];
56
+ /**
57
+ * The part's EW database name. Database parts list `family, name, family`
58
+ * in their attribute strings (`MicroFit, 43650-04-11, MicroFit, ...`;
59
+ * virtual parts the same further in); basic parts (resistors) are all
60
+ * numbers and have none.
61
+ */
62
+ export declare function dbPartName(body: EwElement): string | undefined;
63
+ /** Pin-number CSV lives at strings[6] of a CiPort's second CiaCollString. */
64
+ export declare function portPinNumbers(port: EwElement): string[];
65
+ /**
66
+ * A pin's drawn number(s) (`CIITPinSymbolComp@PinNumber`). Instruments
67
+ * (multimeters, scopes, analyzers) show "##" as a placeholder; like an empty
68
+ * number, it means "use the pin name".
69
+ */
70
+ export declare function drawnPinNumbers(raw: string): string[];
71
+ export declare function parseCiNetlist(input: XmlInput): CiNetlist;
package/package.json CHANGED
@@ -1,7 +1,62 @@
1
1
  {
2
2
  "name": "multisim2kicad",
3
- "version": "0.0.0",
4
- "description": "Placeholder claiming the name. Real releases (0.1.0+) are published from CI: https://github.com/cinderblock/multisim2kicad",
3
+ "version": "0.2.0",
4
+ "description": "Convert NI Multisim schematics, Ultiboard boards and component databases (Electronics Workbench) to KiCad",
5
+ "author": "Cameron Tacklind <cameron@tacklind.com>",
5
6
  "license": "ISC",
6
- "repository": { "type": "git", "url": "git+https://github.com/cinderblock/multisim2kicad.git" }
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/cinderblock/multisim2kicad.git"
10
+ },
11
+ "homepage": "https://github.com/cinderblock/multisim2kicad#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/cinderblock/multisim2kicad/issues"
14
+ },
15
+ "keywords": [
16
+ "kicad",
17
+ "electronics-workbench",
18
+ "multisim",
19
+ "ultiboard",
20
+ "ewprj",
21
+ "ms14",
22
+ "converter",
23
+ "national-instruments",
24
+ "eda",
25
+ "cli"
26
+ ],
27
+ "type": "module",
28
+ "bin": {
29
+ "multisim2kicad": "dist/cli.js"
30
+ },
31
+ "main": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "import": "./dist/index.js"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "files": [
41
+ "dist"
42
+ ],
43
+ "engines": {
44
+ "node": ">=20"
45
+ },
46
+ "scripts": {
47
+ "dev": "bun run src/cli.ts",
48
+ "start": "bun run src/cli.ts",
49
+ "test": "bun test",
50
+ "typecheck": "tsc --noEmit -p .",
51
+ "corpus": "bun run scripts/corpus.ts",
52
+ "build": "bun run build.ts && tsc -p tsconfig.build.json",
53
+ "prepublishOnly": "bun run scripts/guard-publish.ts && bun run typecheck && bun test && bun run build"
54
+ },
55
+ "dependencies": {
56
+ "electronics-workbench-decoder": "^0.4.1"
57
+ },
58
+ "devDependencies": {
59
+ "@types/bun": "latest",
60
+ "typescript": "^5.5.0"
61
+ }
7
62
  }