Recently I’ve discovered OpenEMS and I would like to use it to simulate some RF board that I’ve created using Kicad. But seems that there are a big hole between those tools.
Perhaps the way to go would be to create a python script that reads the .kicad_pcb file and generates a octave/mathlab .m file for OpenEMS ?
I don’t have experience with generating an .m file but I do have experience with reading and manipulating KiCAD PCB files in C++. The PCB file format is based on S-expressions and simple to parse. You could also do this in Python.
An alternative route would be to generate a Hyperlynx ASCII file and import that using hyp2mat. Although I couldn’t find a specification for the Hyperlynx file format, a couple of projects use it so I expect the information is out there somewhere.
My colleague showed me this tool recently, seems pretty handy for simulations
I found Eagles implementation here: https://github.com/plusea/EAGLE/blob/master/ulp/hyperlynx.ulp
Perhaps it could be ported to kicad and python? Even cooler would be an addition kinda like the NGspice engine, but that probably way out in the future (and more minded on the devs list)
The FOSS layout editor pcb-rnd can load a kicad layout and can export a layout in hyperlynx format, allowing a Kicad user to get to hyperlynx format.
The hyperlynx export code was written by the same guy who wrote hyp2mat.
pcb-rnd can be also invoked as a headless cli utility, allowing scripted or batch conversion with the right command line flags, so there wouldn’t be too much preventing a pretty seamless solution.
Alternatively, you could look at the hyperlynx export code
Hi. I’ve written small software to convert KiCAD PCB files to use in openEMS.
It converts PCB file to Octave/Matlab function file that can be used directly with openEMS
structures. Additional feature is it can generate automatic mesh lines for PCB
geometry. There are some other functions, but all is not documented completely.
Probably it could be done, but my program needs configuration file, at least for
some of the functions. Now you must pass JSON configuration with it.
There are many options that are not PCB related, but more for FDTD.
For example, you can set if copper layers are simulated as real material with
thickness or zero thickness polygon (one mesh line) .
I’m trying to build it on MSYS2 chain (the one from KiCad winbuilder)
I could install both: TinyXML2 and TCLAP
I also made the config to complete cd pcbmodelgen cmake -G "MinGW Makefiles" -DTINYXML2_INCLUDE_DIR==../../../../../../mingw64/mingw32/include/ -DTINYXML2_LIBRARY=../../../../../../mingw32/lib -DTCLAP_INCLUDE_DIR=../tclap-1.2.1/include
but the command make just fails… @jcyrax would you give me a tip?
Thx
@maui I think you need to run cmake in new build directory that is not project directory.
Create directory build and from there run:
cmake [all parameters] …/
If it doesn’t work, please include what output do you get from running make.
@jcyrax
tried to create a build dir and run the command… still the same error…
here the Makefile created, with the CMakeLists.txt slightly modified Makefile.zip (5.8 KB)
@maui I made some changes in code and CMakeLists.txt it may be the fix, but not sure.
Tried, also, to compile on Win, but my MinGW has some bug with c++11 support.
Hope this helps.