Beispiel #1
0
def func(width: float):
    sim = Simulation(freq=freq,
                     unit=unit,
                     reference_frequency=ref_freq,
                     sim_dir=None)
    pcb_prop = common_pcbs["oshpark4"]
    pcb = PCB(
        sim=sim,
        pcb_prop=pcb_prop,
        length=pcb_len,
        width=pcb_width,
        layers=range(3),
        omit_copper=[0],
    )

    DifferentialMicrostrip(
        pcb=pcb,
        position=Coordinate2(0, 0),
        length=pcb_len,
        width=width,
        gap=trace_gap,
        propagation_axis=Axis("x"),
        port_number=1,
        excite=True,
        ref_impedance=50,
    )

    Mesh(
        sim=sim,
        metal_res=1 / 80,
        nonmetal_res=1 / 10,
        min_lines=9,
        expand_bounds=((0, 0), (0, 0), (10, 40)),
    )

    FieldDump(
        sim=sim,
        box=Box3(
            Coordinate3(-pcb_len / 2, -pcb_width / 2, 0),
            Coordinate3(pcb_len / 2, pcb_width / 2, 0),
        ),
        dump_type=DumpType.current_density_time,
    )

    sim.run(csx=False)
    return np.abs(sim.ports[0].impedance(freq=ref_freq))
Beispiel #2
0
    position=Coordinate2(0, trace_width / 2 + gap + via_gap),
    length=pcb_len,
    width=via_gap / 2,
)

ViaWall(
    pcb=pcb,
    position=Coordinate2(0, -trace_width / 2 - gap - via_gap),
    length=pcb_len,
    width=via_gap / 2,
)

dump = FieldDump(
    sim=sim,
    box=Box3(
        Coordinate3(-pcb_len / 2, -pcb_width / 2, 0),
        Coordinate3(pcb_len / 2, pcb_width / 2, 0),
    ),
)

mesh = Mesh(
    sim=sim,
    metal_res=1 / 120,
    nonmetal_res=1 / 40,
    smooth=(1.1, 1.5, 1.5),
    min_lines=25,
    expand_bounds=((0, 0), (24, 24), (24, 24)),
)

if os.getenv("_PYEMS_PYTEST"):
    sys.exit(0)
    radius=coax_rad,
    core_radius=core_rad,
    shield_thickness=mil_to_mm(5),
    dielectric=coax_dielectric,
    propagation_axis=Axis("x", direction=-1),
    port_number=2,
    ref_impedance=50,
)

mesh = Mesh(
    sim=sim,
    metal_res=1 / 120,
    nonmetal_res=1 / 10,
    min_lines=5,
    expand_bounds=((0, 0), (0, 0), (20, 20)),
)

box = mesh.sim_box(include_pml=False)
field = FieldDump(sim=sim, box=box, dump_type=DumpType.efield_time)

sim.run()
sim.view_field()

s11 = sim.s_param(1, 1)
s21 = sim.s_param(2, 1)
print_table(
    data=[sim.freq / 1e9, s11, s21],
    col_names=["freq", "s11", "s21"],
    prec=[4, 4, 4],
)
mesh = Mesh(
    sim=sim,
    metal_res=1 / 80,
    nonmetal_res=1 / 40,
    smooth=(1.1, 1.5, 1.5),
    min_lines=5,
    expand_bounds=((0, 0), (8, 8), (8, 8)),
)

# mesh.add_line_manual(0, -cap_dim.length / 2)
# mesh.add_line_manual(0, cap_dim.length / 2)

FieldDump(
    sim=sim,
    box=Box3(
        Coordinate3(-pcb_len / 2, -pcb_width / 2, 0),
        Coordinate3(pcb_len / 2, pcb_width / 2, 0),
    ),
    dump_type=DumpType.current_density_time,
)

sim.run()
sim.view_field()

print_table(
    data=[sim.freq / 1e9, sim.s_param(1, 1), sim.s_param(2, 1)],
    col_names=["freq", "s11", "s21"],
    prec=[2, 4, 4],
)
Beispiel #5
0
    propagation_axis=Axis("x"),
    trace_layer=3,
    gnd_layer=2,
    gnd_gap=(gcpw_gap, gcpw_gap),
    via_gap=(None, None),
    via=None,
    port_number=2,
    excite=False,
)

mesh = Mesh(
    sim=sim,
    metal_res=1 / 80,
    nonmetal_res=1 / 40,
    smooth=(1.3, 1.5, 1.5),
    min_lines=3,
    expand_bounds=((0, 0), (8, 8), (8, 8)),
)

dump = FieldDump(sim=sim, box=mesh.sim_box(include_pml=False))

sim.run()
sim.view_field()

print_table(
    data=[sim.freq / 1e9, sim.s_param(1, 1),
          sim.s_param(2, 1)],
    col_names=["freq", "s11", "s21"],
    prec=[4, 4, 4],
)
Beispiel #6
0
                         box=waveguide_box,
                         propagation_axis=2,
                         excite=True)
port.add_metal_shell(thickness=5)
network = Network(csx=csx, ports=[port])
network.generate_mesh(
    min_wavelength=wavelength(center_freq + delta_freq, unit),
    # metal_res=1 / 40,
    min_lines=2,
    expand_bounds=[20, 20, 20, 20, 10, 40],
)
network._write_csx()
network.view()

sim_box = network.get_sim_box()
field_dump = FieldDump(csx=csx, box=sim_box)

sim = Simulation(
    fdtd=fdtd,
    csx=csx,
    center_freq=center_freq,
    half_bandwidth=delta_freq,
    boundary_conditions=["PML_8", "PML_8", "PML_8", "PML_8", "PML_8", "PML_8"],
    network=network,
    field_dumps=[field_dump],
)

sim.simulate(nf2ff=True)
sim.view_field()

s11 = network.s_param(1, 1)