This repository contains simple examples of simulations of RF signal propagation in microstrip and related transmission lines.
-
microstrip: simple microstrip line -
microstrip_blob: simple microstrip line, with a circular blob in the middle, from which signal reflects backwards -
cpw: simple grounded coplanar waveguide -
cpw_vias: simple coplanar waveguide, with via fence around the trace -
cpw_more_vias: simple coplanar waveguide, with via fence around the trace, as well as vias in the rest of the ground pour -
cpw_fewer_vias: CPW with only a couple vias around the trace -
cpw_wide: CPW on a wide PCB, to be able to see the waves launched away from the trace
The simulations are done in openEMS (Github page). The geometry is prepared in KiCad and converted to the form needed by openEMS by gerber2ems (quick tutorial). After the simulation has finished, the fields can be viewed in ParaView. I used Python version 3.10 set up as an Anaconda environment.
-
Create a new Anaconda environment:
$ conda create -n test python=3.10 $ conda activate testReplace
testwith any desired environment name. -
Obtain
gerber2emsand install it:$ git clone git@github.com:antmicro/gerber2ems.git $ cd gerber2ems $ pip install . -
Download openEMS and install the Python interface:
$ cd C:\openEMS\python $ pip install CSXCAD-0.6.3-cp310-cp310-win_amd64.whl $ pip install openEMS-0.0.36-cp310-cp310-win_amd64.whl -
Install
h5py:$ pip install h5py
-
Go into one of the example folders, such as
microstrip, and open the KiCad project (basic.kicad_pro). -
In KiCad, open the PCB Editor and go to File → Plot. Make sure the Output directory is set to
fab, and press Plot. Under Generate Drill Files..., press Generate Drill File.Still in the PCB Editor, go to File → Fabrication Outputs → Component Placement. Make sure the output directory is set to
faband press Generate Position File. -
In the
fabdirectory, openstackup.jsonin a text editor and verify that the layer stackup is as desired for the simulation. In particular, check the dielectric thickness, epsilon, and the loss tangent. -
Open
simulation.jsonin a text editor and adjust the values as desired. Note that all dimensions are in microns. In particular, make sure the mesh spacing is appropriate to the features on the PCB, that the margin is sufficient, and the that ports have the correct width, length, and impedance. -
Open the Anaconda Prompt and activate the correct environment:
$ conda activate py10 -
Change to the simulation directory and start the simulation:
$ gerber2ems -a --export-field
While waiting for the simulation to complete, examine the files in
ems/geometry. The Gerber files from KiCad get converted to PNG images, and the
exact physical and mesh geometry is encoded in geometry.xml. The XML file can
be opened in the AppCSXCAD viewer
(included in the openEMS distribution).
When at least a couple timesteps have completed, the fields will be available
for viewing under ems/simulation/0. Open the e_field... group of files in
ParaView, select Apply in the left Properties sidebar, and change the "Solid
Color" to "E-Field". Click "Rescale to data range over all timesteps" to adjust
the data range, the press play to view the field animation.
Once the simulation completes, ems/results will contain a Smith chart, S
parameters, and the port impedance.
Jakob Kastelic, Stanford Research Systems
