Export PCB board to OpenEMS?

In case you haven’t seen this, a script for importing a complete board with tracks, zones etc. Into freecad has been made

So that would be step 1 :slight_smile:

2 Likes

It looks like Tom did some work to export hyperlynx, see https://lists.launchpad.net/kicad-developers/msg40034.html

2 Likes

A pity that this is to an expensive commercial application, but the code can be used as a guide to producing other formats.

The interesting point is that KiCad lacks a stackup description. It would not be hard to add this feature to Master now, even if the only immediate use was the impedance calculators.
Raised as a wishlist https://bugs.launchpad.net/kicad/+bug/1823349

A full stackup manager is planned for v6 (At least for pad stackups but i would assume also for general copper stackup) If the development resources are there to get to it is another topic and will be revealed in two years or so when KiCad reaches feature freeze for v6.

My mistake, OpenEMS can read Hyperlynx files
http://openems.de/index.php/Tutorial:_Importing_with_hyp2mat.html

First: I confes that I’ve never done anything with field solvers, but I did a quick search anyway: https://duckduckgo.com/html?q=“freecad”+“openems” and there seem to be more interest in this direction.
It’s even in the KiCon 2019 agenda:
https://kicad-kicon.com/talks/
Darrell Harmon Microwave Design with KiCad

This talk will cover basics of distributed element microwave PCB design and the challenges associated with this in KiCad. Show usage of pyopenems to generate both a PcbNew module and an OpenEMS 3D electromagnetic simulation model based on a single Python based description of the desired geometry.

For me the EMS is more interesting than ngspice. Simulation is of limited use without opensource device models, but I can model RF pcb structures like couplers and baluns

Gave this a spin today.

I tried the example test_pcb.kicad_pcb and everything pretty much worked.

But when I tried it on my pcb, I got a warning, no errors, and no output:

  pcbmodelgen -p meander.kicad_pcb -c pcbmodelgen.json

Warning: kicad_pcb file version 4.x, may experience some issues
kicad_pcb version (generator pcbnew)

Created an issue on the github for modelgen, but saw this thread and wondered if anyone had used modelgen since 2019? Has the pcb file format changed so that modelgen can no longer handle it?

Hi Dave

Kicad now support’s native Hyperlynx export, which should work as input to OpenEMS.
Remember to add an issue of you find any.

1 Like

Wow, that sounds great.

Just learning openEMS, so I’ll have to dig into using Hyperlynx.

I’ll report back.

Thanks!

Some of the pads got imported (not all). No traces and not ground planes:

The pcb looks like this:

I didn’t take care to make sure the boundary conditions, etc make sense yet. I just grabbed them from another example, so maybe that’s the problem.

I’ll take some more care and go line by line in the openEMS octave file and see if I can figure it out from there.

But progress!

Actually, top and bottom level gnd polygons are shown. I forgot I haven’t routed this version of the pcb yet.

Some, but not all of the top sized pads are shown and there’s a strange wedge cut-out of the bottom side ground polygon.

Where/how should I report issues I find?

Is there a HyperLynx viewer I can use to determine whether openEMS is interpreting the data incorrectly or if the pcbNew export is messing it up?

I simplified the pcb to nothing but the top/bottom ground planes, vias, and the antenna. Now the perimeter of the ground plane polygons look good, but the antenna trace isn’t shown in AppCSXCAD:

Here’s the simplified pcb from pcbNew:

The antenna trace is contained within a footprint. Maybe I need to somehow “flatten” footprints?

Or maybe the “net tie” inside the antenna footprint confuses the export or the read?

Confirmed that the trace that’s inside the footprint gets exported correctly when it is drawn on the pcb:

Is there a setting or some way I can get the metal layers inside footprints exported?

Issues should be reported here: Issues · KiCad Source Code · GitLab
If I recall correctly Tom Aka @twl was the one who made the Hyperlynx export.
Perhaps he has some advices on using it.

Ok, wilco.

Seems this is already a reported issue:

2 Likes

3 posts were split to a new topic: Improved OpenEMS iterface