thliebig / openEMS-Project

openEMS is a free and open electromagnetic field solver using the FDTD method.
356 stars 65 forks source link

Hyperlynx import (hyp2mat) fails with filled zones #17

Closed cweickhmann closed 2 months ago

cweickhmann commented 2 years ago

Hi!

Not sure if this is the right place, but the hyp2mat repo is archived. I am not sure if this is a conversion problem in hyp2mat or if I'm making a mistake in openEMS. If this is not the right place, feel free to simply close the issue.

2022-06-02_14-47

When exporting the above simple structure from Kicad 6.0.5 using their Hyperlynx exporter, I obtain the attached hyp-file, which according to a Kicad developer with access to the Hyperlynx software is correctly opening in the commercial product (cf. here).

{VERSION=2.14}
{UNITS=ENGLISH LENGTH}

{BOARD "/home/localadmin_cweickhm/Dokumente/Circuits/kicad/openEMS-export/simple_test_1/simple_test_1.kicad_pcb"
  (PERIMETER_SEGMENT X1=2.637795276 Y1=2.125984252 X2=0.787401575 Y2=2.125984252)
  (PERIMETER_SEGMENT X1=0.787401575 Y1=2.125984252 X2=0.787401575 Y2=1.574803150)
  (PERIMETER_SEGMENT X1=0.787401575 Y1=1.574803150 X2=2.637795276 Y2=1.574803150)
  (PERIMETER_SEGMENT X1=2.637795276 Y1=1.574803150 X2=2.637795276 Y2=2.125984252)
}

{STACKUP
  (SIGNAL T=0.00137795 P=0 C=1.724e-08 L="F.Cu" M=COPPER)
  (DIELECTRIC T=0.0610236 C=4.5 L="DE_F.Cu" M="FR4")
  (SIGNAL T=0.00137795 P=0 C=1.724e-08 L="B.Cu" M=COPPER)
}

{DEVICES
  (? REF="J1" L="F.Cu")
  (? REF="C1" L="F.Cu")
  (? REF="R1" L="F.Cu")
  (? REF="J2" L="F.Cu")
  (? REF="L1" L="F.Cu")
}

{PADSTACK=0, 0.059055118
  ("MDEF", 0, 0.080708661, 0.080708661, 180.0, M)
}

{PADSTACK=1, 0.066929134
  ("MDEF", 0, 0.088582677, 0.088582677, 180.0, M)
}

{PADSTACK=2, 0.000000000
  ("F.Cu", 1, 0.046259843, 0.057086614, 180.0, M)
}

{PADSTACK=3, 0.000000000
  ("F.Cu", 1, 0.040354331, 0.055118110, 180.0, M)
}

{PADSTACK=4, 0.000000000
  ("F.Cu", 1, 0.045275591, 0.055118110, 180.0, M)
}

{NET="GND"
  (PIN X=1.1629921260 Y=1.9503937008 R="J1.2" P=1)
  (PIN X=1.1629921260 Y=1.7503937008 R="J1.2" P=1)
  (PIN X=0.9629921260 Y=1.7503937008 R="J1.2" P=1)
  (PIN X=0.9629921260 Y=1.9503937008 R="J1.2" P=1)
  (PIN X=2.2622047244 Y=1.9503937008 R="J2.2" P=1)
  (PIN X=2.4622047244 Y=1.7503937008 R="J2.2" P=1)
  (PIN X=2.4622047244 Y=1.9503937008 R="J2.2" P=1)
  (PIN X=2.2622047244 Y=1.7503937008 R="J2.2" P=1)
}

{NET="Net-(C1-Pad1)"
  (PIN X=1.0629921260 Y=1.8503937008 R="J1.1" P=0)
  (PIN X=1.4931102362 Y=1.8503937008 R="C1.1" P=2)
  (SEG X1=1.4931102362 Y1=1.8503937008 X2=1.0629921260 Y2=1.8503937008 W=0.0098425197 L="F.Cu")
}

{NET="Net-(C1-Pad2)"
  (PIN X=1.5748031496 Y=1.8503937008 R="C1.2" P=2)
  (PIN X=1.6907480315 Y=1.8503937008 R="L1.1" P=4)
  (SEG X1=1.5748031496 Y1=1.8503937008 X2=1.6907480315 Y2=1.8503937008 W=0.0098425197 L="F.Cu")
}

{NET="Net-(L1-Pad2)"
  (PIN X=1.8778543307 Y=1.8492125984 R="R1.1" P=3)
  (PIN X=1.7714566929 Y=1.8503937008 R="L1.2" P=4)
  (SEG X1=1.8766732283 Y1=1.8503937008 X2=1.8778543307 Y2=1.8492125984 W=0.0098425197 L="F.Cu")
  (SEG X1=1.7714566929 Y1=1.8503937008 X2=1.8766732283 Y2=1.8503937008 W=0.0098425197 L="F.Cu")
}

{NET="Net-(R1-Pad2)"
  (PIN X=1.9497047244 Y=1.8492125984 R="R1.2" P=3)
  (PIN X=2.3622047244 Y=1.8503937008 R="J2.1" P=0)
  (SEG X1=1.9497047244 Y1=1.8492125984 X2=1.9508858268 Y2=1.8503937008 W=0.0098425197 L="F.Cu")
  (SEG X1=1.9508858268 Y1=1.8503937008 X2=2.3622047244 Y2=1.8503937008 W=0.0098425197 L="F.Cu")
}

I use the following script to do the import in openEMS:

close all
clear
clc

physical_constants;
f_max = 400e6;

CSX = InitCSX();
%% CSX = ImportHyperLynx(CSX, '../kicad/T 218MHz RF Test Circuits/main/main.hyp');
CSX = ImportHyperLynx(CSX, '../kicad/openEMS-export/simple_test_1/simple_test_1.hyp');

Sim_Path = 'tmp';
Sim_CSX = 'brd.xml';
[status, message, messageid] = mkdir(Sim_Path);

FDTD = InitFDTD();
FDTD = SetGaussExcite(FDTD, f_max/2, f_max/2);

WriteOpenEMS([Sim_Path '/' Sim_CSX], FDTD, CSX);
CSXGeomPlot([Sim_Path '/' Sim_CSX]);

The result looks okay when the filled zones are removed:

2022-06-02_14-52

But if they are included, the result looks broken:

2022-06-02_14-49

I am not sure if this is a conversion problem in hyp2mat or if I'm making a mistake in openEMS.

In case anyone is wondering why I need that top ground layer anyways: If you design CPW or GCPW lines, this is necessary and by far the most convenient way to design this in Kicad.

thliebig commented 2 months ago

Maybe the Discussion page would be a better place to get help on this problem...