Skip to content

feat: add coilToTikz electrical-schematic generator + topology mocks#11

Open
gpitel wants to merge 1 commit into
OpenMagnetics:mainfrom
gpitel:feat/coil-to-tikz-upstream
Open

feat: add coilToTikz electrical-schematic generator + topology mocks#11
gpitel wants to merge 1 commit into
OpenMagnetics:mainfrom
gpitel:feat/coil-to-tikz-upstream

Conversation

@gpitel

@gpitel gpitel commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Adds assets/js/coilToTikz.js — a pure function that turns a MAS coil (functionalDescription / isolationSide / connections) into an electrical-schematic tikzpicture, plus assets/js/mockCoils.js with 8 topology fixtures. Two new files, no changes to existing code.

It groups windings by isolation side, draws each as a coil across the core, and renders every shared node (incl. Blind junctions) as a parallel vertical rail with junction dots. Output is plain TikZ (decorations.pathmorphing) that compiles through the backend's /process_latex_svg endpoint. Verified byte-identical to the MagneticDesigner schematic.py reference across all 8 topology mocks.

Examples — input MAS coil → rendered schematic

1. basic — primary + secondary, no blind connection

P  (primary)   connections: [Pin 1, Pin 2]
S  (secondary) connections: [Pin 3, Pin 4]

basic

2. star_b1 — three primaries commoned at blind junction B1

P1 (primary)   [Pin 1, Blind B1]
P2 (primary)   [Pin 2, Blind B1]
P3 (primary)   [Pin 3, Blind B1]
S  (secondary) [Pin S1, Pin S2]

star_b1

3. blind_chain — primaries in series via B1, B2 (parallel rails)

P1 (primary)   [Pin 1,    Blind B1]
P2 (primary)   [Blind B1, Blind B2]
P3 (primary)   [Blind B2, Pin 2]
S  (secondary) [Pin 3, Pin 4]

blind_chain

Notes

  • Pure generator; no UI wiring (a summary-panel renderer can consume it separately).
  • Cross-isolation-group shared nodes are annotated but not drawn as wires in v1 (noted inline in the TikZ).

🤖 Generated with Claude Code

Port of the MagneticDesigner calc/schematic.py generator to JS: builds an
electrical-schematic tikzpicture from a MAS coil (functionalDescription /
isolationSide / connections), grouping windings by isolation side and drawing
every shared node as a parallel vertical rail. Output is plain TikZ
(decorations.pathmorphing) that compiles through the /process_latex endpoint.
Verified byte-identical to the Python reference across 8 topology mocks;
mockCoils.js bundles those mocks for the playground.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 551e4a3)
@gpitel gpitel force-pushed the feat/coil-to-tikz-upstream branch from 44b784b to 1822997 Compare June 29, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant