Export PCB board to OpenEMS?

I do not want to sound grumpy, but what I would really love is to make the exporter integrated in KiCad, not as an external executable (the same applies to the STEP exporter). I think this could be done without tclap, and using wxXml instead of TinyXML2, meaning there are no new dependencies.
Do not get me wrong, I think the idea is fantastic, especially that we have been thinking about adding EM simulator to KiCad for some time already. I also realize it is much faster to develop a tool outside KiCad and most likely this is the reason why @jcyrax has chosen this path. Still, I encourage to transform the tool to make it a part of KiCad, I can lend a hand if necessary.
I think you should also advertise the tool on the developers mailing list, this might be a huge benefit for the KiCad users. Well done @jcyrax, thank you for contributing to the KiCad community!

2 Likes

Well kicad nightly includes a step exporter. But kicad stepup will always be a bit more powerful because it has the full power of freecad behind it.

Something similar applies here. In open source there is generally the tendency to have multiple specialized tools for one job. and an easy way to transfer data between them. (This is one of the core ideas behind Linux. -> see command line pipe-lining)

1 Like

I think @orsonmmz is refering to the “integrated” exporter is a seperate program being ran from inside Kicad

@orsonmmz I agree, the integration would be the logical step. I wrote external tool because I needed it fast. Also, openEMS in practice can be used only with scripts. So nice GUI export will not get you very far. You need to write simulation script, add ports etc.

I meant integrating pcbmodelgen in KiCad source code, so there is no need to launch another tool. I am familiar with the Unix way and often appreciate it, but here IMHO it is not as elegant as it could be when integrated in the source code (e.g. see the code checking whether there is kicad2step executable present).

In my imaginary, perfect world there is a clean and stable API and all exporters are compiled to shared libraries, possibly out of KiCad source tree. Due to limited manpower we take decisions that get us faster to the goal, but not always through the most elegant solutions, therefore executing external tools is also acceptable. You asked me what I think, you get what I think;)

Sure, I realize that. Your program in the current form is already very useful, therefore I am grateful for your effort.

Launching openEMS from KiCad to get the simulation results is what I find justified. I think there is no easy way to interact with it using an API, as we do e.g. with ngspice. Then, even if we could receive raw results from openEMS, then we would need to render them - that would be another big job. Exporting an XML file + simulation script should be doable with the libraries we already have. One more advantage of having the exporter integrated is you do not need to write a .kicad_pcb parser to extract the data. With the frequently modified file format it might be a serious task to keep it up-to-date.

2 Likes

In general, the problem with external tools becomes an issue with general user knowledge of even their mere existence. In the other direction you run into bloat and possible raising bugs in some other code. Would a plugin manager maybe be a good compromise?

A new KiCad Developer wants to go all the way :smiley:
https://lists.launchpad.net/kicad-developers/msg32072.html

6 Likes

Makes my head hurt to just read what he wants to do. :wink: This is the kind of thing that happens though because Kicad has reached ‘critical mass’ so to speak. I may not code but I’d like to think that helping new users keeps adding to that mass.

3 Likes

Absolutely! You concentrating on helping new users allows those of us that program to push the envelope on that front while you’re covering this one!

Thank you!

2 Likes

This is amazing, every few months I check if any new open source field solvers have been developed to easily analyze a routed board. I’ll happily help test this out!

Having no experience in implementation of FEM, just using it sporadically, would it be smarter to implement electric and magnetics FEM solver in FreeCAD using calculix? You could even couple it with thermal solver.

Obviously the first step would have to be to realize step export of coper layers from Kicad to FreeCAD.

I think the best direction is to go trough FreeCAD, because at some point you will need other geometry in simulation domain. Lets say enclosures etc. I don’t think implementing design of geometry in KiCAD would be practical if its already done in FreeCAD.

I see the future as:
1)export PCB to FreeCAD (include copper etc)
2)create simulation domain and meshes and anything you need and export to OpenEMS or other tool
3)run simulation in dedicated tool

I don’t think the developer of this plugin will read this forum. If you want to give input you might want to contact him via the mailing list.

@jcyrax
Hi Janis, I agree very much…
Instead of exporting PCB to FreeCAD, the easiest option is to import PCB, tacks and pads in FreeCAD.
This would probably be a more feasible route, because it could be done entirely in python from FC and it will be based only on KiCad pcbnew file format.
FreeCAD is in fact the right environment for meshing and mechanical manipulation.

This is in fact what I did with StepUp to convert PCB and 3D models to STEP inside FreeCAD.

Maurice

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