Description
Before submitting the issue
- I have searched among the existing issues
- I am using a Python virtual environment
Description of the bug
I've a customer that has generated a script to create an EDB and solve it in 2024R1. The same script, modified to call AEDT 2025R1, fails with an error on adapting ports.
If I take the project created with AEDT 2024R1 and simply run it in 2025R1, it works fine. The issue appears to be the script.
Steps To Reproduce
Run the script below. Note this is using Python 3.13, NOT 3.10.
# # Pre-layout Parameterized PCB
#
# This example shows how to use the EDB interface along with HFSS 3D Layout to create and solve a
# parameterized layout. The layout shows a differential via transition on a printed circuit board
# with back-to-back microstrip to stripline transitions.
# The model is fully parameterized to enable investigation of the transition performance on the
# many degrees of freedom.
#
# The resulting model is shown below
#
# <img src="_static\pre_layout_parameterized_pcb.png" width="500">
# ## Preparation
# Import the required packages
# +
import os
import tempfile
import time
from ansys.aedt.core import Hfss3dLayout
from pyedb import Edb
# -
# ## Define constants
AEDT_VERSION = "2024.1"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
# ## Launch EDB
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
aedb_path = os.path.join(temp_folder.name, "pcb.aedb")
edb = Edb(edbpath=aedb_path, edbversion=AEDT_VERSION)
# ## Create layout
# ### Define the parameters.
# +
params = {
"$ms_width": "0.4mm",
"$sl_width": "0.2mm",
"$ms_spacing": "0.2mm",
"$sl_spacing": "0.1mm",
"$via_spacing": "0.5mm",
"$via_diam": "0.3mm",
"$pad_diam": "0.6mm",
"$anti_pad_diam": "0.7mm",
"$pcb_len": "15mm",
"$pcb_w": "5mm",
"$x_size": "1.2mm",
"$y_size": "1mm",
"$corner_rad": "0.5mm",
}
for par_name in params:
edb.add_project_variable(par_name, params[par_name])
# -
# ### Create stackup
# Define the stackup layers from bottom to top.
layers = [
{
"name": "bottom",
"layer_type": "signal",
"thickness": "35um",
"material": "copper",
},
{
"name": "diel_3",
"layer_type": "dielectric",
"thickness": "275um",
"material": "FR4_epoxy",
},
{
"name": "sig_2",
"layer_type": "signal",
"thickness": "35um",
"material": "copper",
},
{
"name": "diel_2",
"layer_type": "dielectric",
"thickness": "275um",
"material": "FR4_epoxy",
},
{
"name": "sig_1",
"layer_type": "signal",
"thickness": "35um",
"material": "copper",
},
{
"name": "diel_1",
"layer_type": "dielectric",
"thickness": "275um",
"material": "FR4_epoxy",
},
{"name": "top", "layer_type": "signal", "thickness": "35um", "material": "copper"},
]
# Define the bottom layer
prev = None
for layer in layers:
edb.stackup.add_layer(
layer["name"],
base_layer=prev,
layer_type=layer["layer_type"],
thickness=layer["thickness"],
material=layer["material"],
)
prev = layer["name"]
# ### Create a parametrized padstack for the signal via.
# Create a padstack definition.
signal_via_padstack = "automated_via"
edb.padstacks.create(
padstackname=signal_via_padstack,
holediam="$via_diam",
paddiam="$pad_diam",
antipaddiam="",
antipad_shape="Bullet",
x_size="$x_size",
y_size="$y_size",
corner_radius="$corner_rad",
start_layer=layers[-1]["name"],
stop_layer=layers[-3]["name"],
)
# Assign net names. There are only two signal nets.
net_p = "p"
net_n = "n"
# Place the signal vias.
edb.padstacks.place(
position=["$pcb_len/3", "($ms_width+$ms_spacing+$via_spacing)/2"],
definition_name=signal_via_padstack,
net_name=net_p,
via_name="",
rotation=90.0,
)
edb.padstacks.place(
position=["2*$pcb_len/3", "($ms_width+$ms_spacing+$via_spacing)/2"],
definition_name=signal_via_padstack,
net_name=net_p,
via_name="",
rotation=90.0,
)
edb.padstacks.place(
position=["$pcb_len/3", "-($ms_width+$ms_spacing+$via_spacing)/2"],
definition_name=signal_via_padstack,
net_name=net_n,
via_name="",
rotation=-90.0,
)
edb.padstacks.place(
position=["2*$pcb_len/3", "-($ms_width+$ms_spacing+$via_spacing)/2"],
definition_name=signal_via_padstack,
net_name=net_n,
via_name="",
rotation=-90.0,
)
# ### Draw parametrized traces
#
# Trace width and the routing (Microstrip-Stripline-Microstrip).
# Applies to both p and n nets.
# Trace width, n and p
width = ["$ms_width", "$sl_width", "$ms_width"]
# Routing layer, n and p
route_layer = [layers[-1]["name"], layers[4]["name"], layers[-1]["name"]]
# Define points for three traces in the "p" net
points_p = [
[
["0.0", "($ms_width+$ms_spacing)/2"],
["$pcb_len/3-2*$via_spacing", "($ms_width+$ms_spacing)/2"],
["$pcb_len/3-$via_spacing", "($ms_width+$ms_spacing+$via_spacing)/2"],
["$pcb_len/3", "($ms_width+$ms_spacing+$via_spacing)/2"],
],
[
["$pcb_len/3", "($ms_width+$sl_spacing+$via_spacing)/2"],
["$pcb_len/3+$via_spacing", "($ms_width+$sl_spacing+$via_spacing)/2"],
["$pcb_len/3+2*$via_spacing", "($sl_width+$sl_spacing)/2"],
["2*$pcb_len/3-2*$via_spacing", "($sl_width+$sl_spacing)/2"],
["2*$pcb_len/3-$via_spacing", "($ms_width+$sl_spacing+$via_spacing)/2"],
["2*$pcb_len/3", "($ms_width+$sl_spacing+$via_spacing)/2"],
],
[
["2*$pcb_len/3", "($ms_width+$ms_spacing+$via_spacing)/2"],
["2*$pcb_len/3+$via_spacing", "($ms_width+$ms_spacing+$via_spacing)/2"],
["2*$pcb_len/3+2*$via_spacing", "($ms_width+$ms_spacing)/2"],
["$pcb_len", "($ms_width+$ms_spacing)/2"],
],
]
# Define points for three traces in the "n" net
points_n = [
[
["0.0", "-($ms_width+$ms_spacing)/2"],
["$pcb_len/3-2*$via_spacing", "-($ms_width+$ms_spacing)/2"],
["$pcb_len/3-$via_spacing", "-($ms_width+$ms_spacing+$via_spacing)/2"],
["$pcb_len/3", "-($ms_width+$ms_spacing+$via_spacing)/2"],
],
[
["$pcb_len/3", "-($ms_width+$sl_spacing+$via_spacing)/2"],
["$pcb_len/3+$via_spacing", "-($ms_width+$sl_spacing+$via_spacing)/2"],
["$pcb_len/3+2*$via_spacing", "-($ms_width+$sl_spacing)/2"],
["2*$pcb_len/3-2*$via_spacing", "-($ms_width+$sl_spacing)/2"],
["2*$pcb_len/3-$via_spacing", "-($ms_width+$sl_spacing+$via_spacing)/2"],
["2*$pcb_len/3", "-($ms_width+$sl_spacing+$via_spacing)/2"],
],
[
["2*$pcb_len/3", "-($ms_width+$ms_spacing+$via_spacing)/2"],
["2*$pcb_len/3 + $via_spacing", "-($ms_width+$ms_spacing+$via_spacing)/2"],
["2*$pcb_len/3 + 2*$via_spacing", "-($ms_width+$ms_spacing)/2"],
["$pcb_len", "-($ms_width + $ms_spacing)/2"],
],
]
# Add traces to the EDB.
trace_p = []
trace_n = []
for n in range(len(points_p)):
trace_p.append(
edb.modeler.create_trace(
points_p[n], route_layer[n], width[n], net_p, "Flat", "Flat"
)
)
trace_n.append(
edb.modeler.create_trace(
points_n[n], route_layer[n], width[n], net_n, "Flat", "Flat"
)
)
placehere = trace_p[0].get_closest_point(["0.0", "($ms_width+$ms_spacing)/2"])
placehere2 = trace_n[0].get_closest_point(["0.0", "-($ms_width+$ms_spacing)/2"])
#
# Create the wave ports by creating two single-ended waveports then coupling
# them together.
#
name1, wave_port1 = edb.hfss.create_wave_port(
trace_p[0].id,
placehere,
)
name2, wave_port2 = edb.hfss.create_wave_port(
trace_n[0].id,
placehere2,
)
wave_port1.couple_ports(wave_port2)
#
# The original call for creating the first differential wave port is commented
# out below:
#
#diff1 = edb.hfss.create_differential_wave_port(
# trace_p[0].id,
# placehere,
# trace_n[0].id,
# placehere2,
# "wave_port_1",
#)
edb.hfss.create_differential_wave_port(
trace_p[2].id,
["$pcb_len", "($ms_width+$ms_spacing)/2"],
trace_n[2].id,
["$pcb_len", "-($ms_width + $ms_spacing)/2"],
"wave_port_2",
)
# Draw a conducting rectangle on the the ground layers.
gnd_poly = [
[0.0, "-$pcb_w/2"],
["$pcb_len", "-$pcb_w/2"],
["$pcb_len", "$pcb_w/2"],
[0.0, "$pcb_w/2"],
]
gnd_shape = edb.modeler.Shape("polygon", points=gnd_poly)
# Void in ground for traces on the signal routing layer
# +
void_poly = [
[
"$pcb_len/3",
"-($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2-$via_spacing/2",
],
[
"$pcb_len/3 + $via_spacing",
"-($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2-$via_spacing/2",
],
[
"$pcb_len/3 + 2*$via_spacing",
"-($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2",
],
[
"2*$pcb_len/3 - 2*$via_spacing",
"-($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2",
],
[
"2*$pcb_len/3 - $via_spacing",
"-($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2-$via_spacing/2",
],
[
"2*$pcb_len/3",
"-($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2-$via_spacing/2",
],
[
"2*$pcb_len/3",
"($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2+$via_spacing/2",
],
[
"2*$pcb_len/3 - $via_spacing",
"($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2+$via_spacing/2",
],
[
"2*$pcb_len/3 - 2*$via_spacing",
"($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2",
],
[
"$pcb_len/3 + 2*$via_spacing",
"($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2",
],
[
"$pcb_len/3 + $via_spacing",
"($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2+$via_spacing/2",
],
[
"$pcb_len/3",
"($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2+$via_spacing/2",
],
["$pcb_len/3", "($ms_width+$ms_spacing+$via_spacing+$anti_pad_diam)/2"],
]
void_shape = edb.modeler.Shape("polygon", points=void_poly)
# -
# Add ground conductors.
for layer in layers[:-1:2]:
# add void if the layer is the signal routing layer.
void = [void_shape] if layer["name"] == route_layer[1] else []
edb.modeler.create_polygon(
main_shape=gnd_shape, layer_name=layer["name"], voids=void, net_name="gnd"
)
# Plot the layout.
edb.nets.plot(None)
# Save the EDB.
edb.save_edb()
edb.close_edb()
# ## Open the project in HFSS 3D Layout.
h3d = Hfss3dLayout(
project=aedb_path,
version=AEDT_VERSION,
non_graphical=NG_MODE,
new_desktop=True,
)
# ### Add a HFSS simulation setup
# +
setup = h3d.create_setup()
setup.props["AdaptiveSettings"]["SingleFrequencyDataList"]["AdaptiveFrequencyData"][
"MaxPasses"
] = 3
h3d.create_linear_count_sweep(
setup=setup.name,
unit="GHz",
start_frequency=0,
stop_frequency=10,
num_of_freq_points=1001,
name="sweep1",
sweep_type="Interpolating",
interpolation_tol_percent=1,
interpolation_max_solutions=255,
save_fields=False,
use_q3d_for_dc=False,
)
# -
# ### Define the differential pairs to used to calculate differential and common mode s-parameters
h3d.set_differential_pair(
differential_mode="In", assignment="wave_port_1:T1", reference="wave_port_1:T2"
)
h3d.set_differential_pair(
differential_mode="Out", assignment="wave_port_2:T1", reference="wave_port_2:T2"
)
# Solve the project.
h3d.analyze(cores=NUM_CORES)
# Plot the results and shut down AEDT.
#solutions = h3d.post.get_solution_data(
# expressions=["dB(S(In,In))", "dB(S(In,Out))"], context="Differential Pairs"
#)
#solutions.plot()
# Wait 120 seconds to give us time to view any error messages
##time.sleep(120)
# ## Release AEDT
h3d.save_project()
h3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
# Note that the ground nets are only connected to each other due
# to the wave ports. The problem with poor grounding can be seen in the
# S-parameters. This example can be downloaded as a Jupyter Notebook, so
# you can modify it. Try changing parameters or adding ground vias to improve performance.
#
# The final cell cleans up the temporary directory, removing all files.
temp_folder.cleanup()
Which Operating System are you using?
Windows
Which Python version are you using?
3.10
Installed packages
annotated-types==0.7.0
ansys-acp-core==0.2.0
ansys-additive-core==0.19.1
ansys-additive-widgets==0.2.1
ansys-api-acp==0.3.0
ansys-api-additive==2.2.1
ansys-api-dbu==0.3.22
ansys-api-dyna==0.4.2
ansys-api-edb==1.0.10
ansys-api-fluent==0.3.35
ansys-api-geometry==0.4.62
ansys-api-mapdl==0.5.2
ansys-api-mechanical==0.1.2
ansys-api-meshing-prime==0.1.4
ansys-api-modelcenter==0.3.1
ansys-api-platform-instancemanagement==1.1.3
ansys-api-pyensight==0.4.7
ansys-api-sherlock==0.1.46
ansys-api-speos==0.14.2
ansys-api-systemcoupling==0.2.0
ansys-api-tools-filetransfer==0.1.1
ansys-api-workbench==0.2.0
ansys-conceptev-core==0.9.4
ansys-dpf-composites==0.7.0
ansys-dpf-core==0.13.8
ansys-dpf-post==0.9.3
ansys-dyna-core==0.8.0
ansys-dynamicreporting-core==0.10.1
ansys-edb-core==0.1.10
ansys-engineeringworkflow-api==0.1.0
ansys-fluent-core==0.32.0
ansys-geometry-core==0.10.8
ansys-grantami-bomanalytics==2.2.0
ansys-grantami-bomanalytics-openapi==3.1.0
ansys-grantami-jobqueue==1.1.0
ansys-grantami-recordlists==1.3.0
ansys-grantami-serverapi-openapi==4.0.0
ansys-hps-client==0.10.1
ansys-hps-data-transfer-client==0.2.1
ansys-mapdl-core==0.70.1
ansys-mapdl-reader==0.55.1
ansys-math-core==0.2.4
ansys-mechanical-core==0.11.17
ansys-mechanical-env==0.1.12
ansys-mechanical-stubs==0.1.6
ansys-meshing-prime==0.8.1
ansys-modelcenter-workflow==0.1.1
ansys-motorcad-core==0.7.2
ansys-openapi-common==2.3.0
ansys-optislang-core==1.0.0
ansys-platform-instancemanagement==1.1.2
ansys-pyensight-core==0.10.2
ansys-pythonnet==3.1.0rc6
ansys-rocky-core==0.3.2
ansys-seascape==0.2.0
ansys-sherlock-core==0.9.0
ansys-simai-core==0.3.0
ansys-sound-core==0.1.3
ansys-speos-core==0.5.1
ansys-systemcoupling-core==0.9.0
ansys-tools-filetransfer==0.1.1
ansys-tools-local-product-launcher==0.1.1
ansys-tools-path==0.7.1
ansys-turbogrid-api==0.4.6
ansys-turbogrid-core==0.4.5
ansys-units==0.6.0
ansys-workbench-core==0.9.0
anyio==4.9.0
appdirs==1.4.4
asgiref==3.8.1
asttokens==3.0.0
asyncio-atexit==1.0.1
attrs==25.3.0
backoff==2.2.1
bcrypt==4.3.0
beartype==0.20.2
bleach==6.2.0
bokeh==3.4.3
build==1.2.2.post1
cachetools==5.5.2
certifi==2025.4.26
cffi==1.17.1
chardet==5.2.0
charset-normalizer==3.4.2
click==8.2.1
clr_loader==0.2.7.post0
colorama==0.4.6
comtypes==1.4.11
contourpy==1.3.2
cryptography==45.0.3
cycler==0.12.1
dataclasses-json==0.6.7
decorator==5.2.1
defusedxml==0.7.1
Deprecated==1.2.18
dill==0.4.0
Django==4.2.21
django-guardian==2.4.0
djangorestframework==3.16.0
dnspython==2.7.0
docker==7.1.0
docutils==0.21.2
elementpath==4.8.0
email_validator==2.2.0
executing==2.2.0
fabric==3.2.2
filelock==3.18.0
flexcache==0.3
flexparser==0.4
fonttools==4.58.1
fpdf2==2.8.3
geomdl==5.4.0
google-api-core==2.24.2
google-api-python-client==2.170.0
google-auth==2.40.2
google-auth-httplib2==0.2.0
googleapis-common-protos==1.70.0
grpcio==1.67.1
grpcio-health-checking==1.62.3
grpcio-status==1.62.3
h11==0.16.0
hollerith==0.6.0
httpcore==1.0.9
httplib2==0.22.0
httpx==0.27.2
humanfriendly==10.0
idna==3.10
importlib_metadata==8.7.0
invoke==2.2.0
ipython==9.2.0
ipython_pygments_lexers==1.1.1
jaraco.functools==4.1.0
jedi==0.19.2
Jinja2==3.1.6
joblib==1.5.1
jsonschema==4.24.0
jsonschema-specifications==2025.4.1
kiwisolver==1.4.8
linkify-it-py==2.0.3
lxml==5.4.0
Markdown==3.8
markdown-it-py==3.0.0
MarkupSafe==3.0.2
marshmallow==3.26.1
marshmallow-oneofschema==3.2.0
matplotlib==3.10.3
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.2
mdurl==0.1.2
more-itertools==10.7.0
msal==1.32.3
msal-extensions==1.3.1
mypy_extensions==1.1.0
networkx==3.5
nltk==3.9.1
numpy==2.2.6
overrides==7.7.0
packaging==25.0
pandas==2.2.3
panel==1.4.4
param==2.2.0
paramiko==3.5.1
parso==0.8.4
patsy==1.0.1
pillow==11.2.1
Pint==0.24.4
platformdirs==4.3.8
plumbum==1.9.0
pooch==1.8.2
portend==3.2.1
prompt_toolkit==3.0.51
proto-plus==1.26.1
protobuf==4.25.8
psutil==7.0.0
psycopg==3.2.9
psycopg-binary==3.2.9
pure_eval==0.2.3
pyaedt==0.17.0
pyansys==2025.2.0b1
pyansys-tools-report==0.8.2
pyansys-tools-variableinterop==0.1.1
pyansys-tools-versioning==0.6.0
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydantic==2.10.6
pydantic-settings==2.9.1
pydantic_core==2.27.2
pyedb==0.49.0
pygltflib==1.16.4
Pygments==2.19.1
pygranta==2025.1.0
pyiges==0.3.1
PyJWT==2.10.1
PyNaCl==1.5.0
pyparsing==3.2.3
pypiwin32==223
pypng==0.20220715.0
pyproject_hooks==1.2.0
pyreadline3==3.5.4
Pyro5==5.15
pyspnego==0.11.2
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
python-pptx==0.6.19
pytwin==0.9.1
pytz==2025.2
pyvista==0.45.2
pyviz_comms==3.0.4
pywin32==310
PyYAML==6.0.2
referencing==0.36.2
regex==2024.11.6
requests==2.32.3
requests-negotiate-sspi==0.5.2
requests-toolbelt==1.0.0
requests_ntlm==1.3.0
rpds-py==0.25.1
rpyc==6.0.2
rsa==4.9.1
rtree==1.4.0
scikit-rf==1.7.0
scipy==1.15.3
scooby==0.10.1
semver==3.0.4
serpent==1.41
setuptools==80.9.0
shapely==2.1.1
six==1.17.0
sniffio==1.3.1
sqlparse==0.5.3
sseclient-py==1.8.0
sspilib==0.3.1
stack-data==0.6.3
statsmodels==0.14.4
tabulate==0.9.0
tempora==5.8.0
tenacity==8.5.0
toml==0.10.2
tomli==2.2.1
tomli_w==1.2.0
tornado==6.5.1
tqdm==4.67.1
traitlets==5.14.3
transformations==2025.1.1
truststore==0.10.1
typing-inspect==0.9.0
typing-inspection==0.4.1
typing_extensions==4.13.2
tzdata==2025.2
tzlocal==5.3.1
uc-micro-py==1.0.3
uritemplate==4.1.1
urllib3==2.3.0
vtk==9.4.2
wakepy==0.10.2.post1
wcwidth==0.2.13
webencodings==0.5.1
websockets==15.0.1
WMI==1.5.1
wrapt==1.17.2
XlsxWriter==3.2.3
xmlschema==3.4.5
xyzservices==2025.4.0
zipp==3.22.0