Download this example

Download this example as a Jupyter Notebook or as a Python script.


Set up EDB for Power Distribution Network Analysis#

This example shows how to set up the electronics database (EDB) for power integrity analysis from a single configuration file.

Perform imports and define constants#

Perform required imports.

[1]:
import json
import os
import tempfile

from ansys.aedt.core import Hfss3dLayout
from ansys.aedt.core.examples.downloads import download_file
from pyedb import Edb

Define constants.

[2]:
AEDT_VERSION = "2025.2"
NG_MODE = False

Download the example PCB data.

[3]:
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
download_file(source="touchstone", name="GRM32_DC0V_25degC_series.s2p", local_path=temp_folder.name)
file_edb = download_file(source="edb/ANSYS-HSD_V1.aedb", local_path=temp_folder.name)

Load example layout#

[4]:
edbapp = Edb(file_edb, edbversion=AEDT_VERSION)
C:\actions-runner\_work\pyaedt-examples\pyaedt-examples\.venv\lib\site-packages\pyedb\misc\decorators.py:55: UserWarning: Argument `edbversion` is deprecated for method `Edb`; use `version` instead.
  warnings.warn(
C:\actions-runner\_work\pyaedt-examples\pyaedt-examples\.venv\lib\site-packages\pyedb\generic\design_types.py:301: UserWarning: Your ANSYS AEDT version is eligible to gRPC version.You might consider switching to that version for better user experience.For more information please check this link: https://edb.docs.pyansys.com/version/dev/grpc_api/index.html
  warnings.warn(GRPC_GENERAL_WARNING, UserWarning)
PyEDB INFO: Star initializing Edb 04:07:42.827035
INFO:Edb:Star initializing Edb 04:07:42.827035
PyEDB INFO: Edb version 2025.2
INFO:Edb:Edb version 2025.2
PyEDB INFO: Logger is initialized. Log file is saved to C:\Users\ansys\AppData\Local\Temp\pyedb_ansys.log.
INFO:Edb:Logger is initialized. Log file is saved to C:\Users\ansys\AppData\Local\Temp\pyedb_ansys.log.
PyEDB INFO: legacy v0.61.0
INFO:Edb:legacy v0.61.0
PyEDB INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
INFO:Edb:Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyEDB INFO: Database ANSYS-HSD_V1.aedb Opened in 2025.2
INFO:Edb:Database ANSYS-HSD_V1.aedb Opened in 2025.2
PyEDB INFO: Cell main Opened
INFO:Edb:Cell main Opened
PyEDB INFO: Builder was initialized.
INFO:Edb:Builder was initialized.
PyEDB INFO: open_edb completed in 9.0812 seconds.
INFO:Edb:open_edb completed in 9.0812 seconds.
PyEDB INFO: EDB initialization completed in 9.1625 seconds.
INFO:Edb:EDB initialization completed in 9.1625 seconds.

Create an empty dictionary to host all configurations#

[5]:
cfg = dict()

Assign S-parameter model to capactitors.#

Set S-parameter library path.

[6]:
cfg["general"] = {"s_parameter_library": os.path.join(temp_folder.name, "touchstone")}

Assign the S-parameter model.

Keywords

  • name. Name of the S-parameter model in AEDT.

  • component_definition. Known as component part number of part name.

  • file_path. Touchstone file or full path to the touchstone file.

  • apply_to_all. When set to True, assign the S-parameter model to all components share the same component_definition. When set to False, Only components in “components” are assigned.

  • components. when apply_to_all=False, components in the list are assigned an S-parameter model. When apply_to_all=False, components in the list are NOT assigned.

  • reference_net. Reference net of the S-parameter model.

[7]:
cfg["s_parameters"] = [
    {
        "name": "GRM32_DC0V_25degC_series",
        "component_definition": "CAPC0603X33X15LL03T05",
        "file_path": "GRM32_DC0V_25degC_series.s2p",
        "apply_to_all": False,
        "components": ["C110", "C206"],
        "reference_net": "GND",
    }
]

Define ports#

Create a circuit port between power and ground nets.

Keywords

  • name. Name of the port.

  • reference_desinator.

  • type. Type of the port. Supported types are ‘ciruict’, ‘coax’.

  • positive_terminal. Positive terminal of the port. Supported types are ‘net’, ‘pin’, ‘pin_group’, ‘coordinates’.

  • negative_terminal. Positive terminal of the port. Supported types are ‘net’, ‘pin’, ‘pin_group’, ‘coordinates’.

[8]:
cfg["ports"] = [
    {
        "name": "port1",
        "reference_designator": "U1",
        "type": "circuit",
        "positive_terminal": {"net": "1V0"},
        "negative_terminal": {"net": "GND"},
    }
]

Define SIwave SYZ analysis setup#

Keywords

  • name. Name of the setup.

  • type. Type of the analysis setup. Supported types are ‘siwave_ac’, ‘siwave_dc’, ‘hfss’.

  • pi_slider_position. PI slider position. Supported values are from ‘0’, ‘1’, ‘2’. 0:speed, 1:balanced, 2:accuracy.

  • freq_sweep. List of frequency sweeps.

    • name. Name of the sweep.

    • type. Type of the sweep. Supported types are ‘interpolation’, ‘discrete’, ‘broadband’.

    • frequencies. Frequency distribution.

      • distribution. Supported distributions are ‘linear_count’, ‘linear_scale’, ‘log_scale’.

      • start. Start frequency. Example, 1e6, “1MHz”.

      • stop. Stop frequency. Example, 1e9, “1GHz”.

      • increment.

[9]:
cfg["setups"] = [
    {
        "name": "siwave_syz",
        "type": "siwave_ac",
        "pi_slider_position": 1,
        "freq_sweep": [
            {
                "name": "Sweep1",
                "type": "interpolation",
                "frequencies": [{"distribution": "log_scale", "start": 1e6, "stop": 1e9, "increment": 20}],
            }
        ],
    }
]

Define Cutout#

Keywords

  • signal_list. List of nets to be kept after cutout.

  • reference_list. List of nets as reference planes.

  • extent_type. Supported extend types are ‘Conforming’, ‘ConvexHull’, ‘Bounding’. For optional input arguments, refer to method pyedb.Edb.cutout()

[10]:
cfg["operations"] = {
    "cutout": {
        "signal_list": ["1V0"],
        "reference_list": ["GND"],
        "extent_type": "ConvexHull",
    }
}

Write configuration into as json file#

[11]:
file_json = os.path.join(temp_folder.name, "edb_configuration.json")
with open(file_json, "w") as f:
    json.dump(cfg, f, indent=4, ensure_ascii=False)

Import configuration into example layout#

[12]:
edbapp.configuration.load(config_file=file_json)
[12]:
<pyedb.configuration.cfg_data.CfgData at 0x18e95b7c1c0>

Apply configuration to EDB.

[13]:
edbapp.configuration.run()
PyEDB INFO: Updating boundaries finished. Time lapse 0:00:00.015849
INFO:Edb:Updating boundaries finished. Time lapse 0:00:00.015849
PyEDB INFO: Updating nets finished. Time lapse 0:00:00
INFO:Edb:Updating nets finished. Time lapse 0:00:00
PyEDB INFO: Updating components finished. Time lapse 0:00:00
INFO:Edb:Updating components finished. Time lapse 0:00:00
PyEDB INFO: Creating pin groups finished. Time lapse 0:00:00
INFO:Edb:Creating pin groups finished. Time lapse 0:00:00
PyEDB INFO: Placing sources finished. Time lapse 0:00:00
INFO:Edb:Placing sources finished. Time lapse 0:00:00
PyEDB INFO: Applying materials finished. Time lapse 0:00:00
INFO:Edb:Applying materials finished. Time lapse 0:00:00
PyEDB INFO: Updating stackup finished. Time lapse 0:00:00
INFO:Edb:Updating stackup finished. Time lapse 0:00:00
PyEDB INFO: Applying padstacks finished. Time lapse 0:00:00
INFO:Edb:Applying padstacks finished. Time lapse 0:00:00
PyEDB INFO: Applying S-parameters finished. Time lapse 0:00:00.015649
INFO:Edb:Applying S-parameters finished. Time lapse 0:00:00.015649
PyEDB INFO: Applying package definitions finished. Time lapse 0:00:00
INFO:Edb:Applying package definitions finished. Time lapse 0:00:00
PyEDB INFO: Applying modeler finished. Time lapse 0:00:00
INFO:Edb:Applying modeler finished. Time lapse 0:00:00
PyEDB INFO: Placing ports finished. Time lapse 0:00:00.684278
INFO:Edb:Placing ports finished. Time lapse 0:00:00.684278
PyEDB INFO: Placing terminals completed in 0.0000 seconds.
INFO:Edb:Placing terminals completed in 0.0000 seconds.
PyEDB INFO: Placing probes finished. Time lapse 0:00:00
INFO:Edb:Placing probes finished. Time lapse 0:00:00
PyEDB INFO: -----------------------------------------
C:\actions-runner\_work\pyaedt-examples\pyaedt-examples\.venv\lib\site-packages\pyedb\misc\decorators.py:55: UserWarning: Argument `signal_list` is deprecated for method `cutout`; use `signal_nets` instead.
  warnings.warn(
C:\actions-runner\_work\pyaedt-examples\pyaedt-examples\.venv\lib\site-packages\pyedb\misc\decorators.py:55: UserWarning: Argument `reference_list` is deprecated for method `cutout`; use `reference_nets` instead.
  warnings.warn(
INFO:Edb:-----------------------------------------
PyEDB INFO: Trying cutout with (0.002)*(1000.0)mm expansion size
INFO:Edb:Trying cutout with (0.002)*(1000.0)mm expansion size
PyEDB INFO: -----------------------------------------
INFO:Edb:-----------------------------------------
PyEDB INFO: Cutout Multithread started.
INFO:Edb:Cutout Multithread started.
PyEDB INFO: Net clean up Elapsed time: 0m 1sec
INFO:Edb:Net clean up Elapsed time: 0m 1sec
PyEDB INFO: Extent Creation Elapsed time: 0m 0sec
INFO:Edb:Extent Creation Elapsed time: 0m 0sec
PyEDB INFO: 1310 Padstack Instances deleted. Elapsed time: 0m 1sec
INFO:Edb:1310 Padstack Instances deleted. Elapsed time: 0m 1sec
PyEDB INFO: 265 Primitives deleted. Elapsed time: 0m 3sec
INFO:Edb:265 Primitives deleted. Elapsed time: 0m 3sec
PyEDB INFO: 702 components deleted
INFO:Edb:702 components deleted
PyEDB INFO: Cutout completed. Elapsed time: 0m 5sec
INFO:Edb:Cutout completed. Elapsed time: 0m 5sec
PyEDB INFO: EDB file save completed in 0.0787 seconds.
INFO:Edb:EDB file save completed in 0.0787 seconds.
PyEDB INFO: Cutout completed in 1 iterations with expansion size of (0.002)*(1000.0)mm Elapsed time: 0m 5sec
INFO:Edb:Cutout completed in 1 iterations with expansion size of (0.002)*(1000.0)mm Elapsed time: 0m 5sec
PyEDB INFO: Applying operations completed in 5.1304 seconds.
INFO:Edb:Applying operations completed in 5.1304 seconds.
[13]:
True

Save and close EDB.

[14]:
edbapp.save()
edbapp.close()
PyEDB INFO: Save Edb file completed in 0.0633 seconds.
INFO:Edb:Save Edb file completed in 0.0633 seconds.
PyEDB INFO: Close Edb file completed in 0.0788 seconds.
INFO:Edb:Close Edb file completed in 0.0788 seconds.
[14]:
True

The configured EDB file is saved in a temp folder.

[15]:
print(temp_folder.name)
C:\Users\ansys\AppData\Local\Temp\tmppyb_jyu1.ansys

Load edb into HFSS 3D Layout.#

[16]:
h3d = Hfss3dLayout(edbapp.edbpath, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True)
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)].
INFO:Global:Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)].
PyAEDT INFO: PyAEDT version 0.22.dev0.
INFO:Global:PyAEDT version 0.22.dev0.
PyAEDT INFO: Initializing new Desktop session.
INFO:Global:Initializing new Desktop session.
PyAEDT INFO: Log on console is enabled.
INFO:Global:Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_ada82fd1-72f2-4202-afe2-fc8fc47a3174.log is enabled.
INFO:Global:Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_ada82fd1-72f2-4202-afe2-fc8fc47a3174.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
INFO:Global:Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
INFO:Global:Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
INFO:Global:Launching PyAEDT with gRPC plugin.
PyAEDT INFO: New AEDT session is starting on gRPC port 57517.
INFO:Global:New AEDT session is starting on gRPC port 57517.
PyAEDT INFO: Electronics Desktop started on gRPC port: 57517 after 10.825552940368652 seconds.
INFO:Global:Electronics Desktop started on gRPC port: 57517 after 10.825552940368652 seconds.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v252\AnsysEM
INFO:Global:AEDT installation Path C:\Program Files\ANSYS Inc\v252\AnsysEM
PyAEDT INFO: Ansoft.ElectronicsDesktop.2025.2 version started with process ID 6028.
INFO:Global:Ansoft.ElectronicsDesktop.2025.2 version started with process ID 6028.
PyAEDT INFO: EDB folder C:\Users\ansys\AppData\Local\Temp\tmppyb_jyu1.ansys\edb\ANSYS-HSD_V1.aedb has been imported to project ANSYS-HSD_V1
INFO:Global:EDB folder C:\Users\ansys\AppData\Local\Temp\tmppyb_jyu1.ansys\edb\ANSYS-HSD_V1.aedb has been imported to project ANSYS-HSD_V1
PyAEDT INFO: Active Design set to 0;main
INFO:Global:Active Design set to 0;main
PyAEDT INFO: Active Design set to 0;main
INFO:Global:Active Design set to 0;main
PyAEDT INFO: Aedt Objects correctly read
INFO:Global:Aedt Objects correctly read

Analyze#

[17]:
h3d.analyze()
PyAEDT INFO: Project ANSYS-HSD_V1 Saved correctly
INFO:Global:Project ANSYS-HSD_V1 Saved correctly
PyAEDT INFO: Solving all design setups. Analysis started...
INFO:Global:Solving all design setups. Analysis started...
PyAEDT INFO: Design setup None solved correctly in 0.0h 0.0m 40.0s
INFO:Global:Design setup None solved correctly in 0.0h 0.0m 40.0s
[17]:
True

Plot impedance#

[18]:
solutions = h3d.post.get_solution_data(expressions="Z(port1,port1)")
solutions.plot()
PyAEDT INFO: Parsing C:\Users\ansys\AppData\Local\Temp\tmppyb_jyu1.ansys\edb\ANSYS-HSD_V1.aedt.
INFO:Global:Parsing C:\Users\ansys\AppData\Local\Temp\tmppyb_jyu1.ansys\edb\ANSYS-HSD_V1.aedt.
PyAEDT INFO: File C:\Users\ansys\AppData\Local\Temp\tmppyb_jyu1.ansys\edb\ANSYS-HSD_V1.aedt correctly loaded. Elapsed time: 0m 0sec
INFO:Global:File C:\Users\ansys\AppData\Local\Temp\tmppyb_jyu1.ansys\edb\ANSYS-HSD_V1.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.2988440990447998
INFO:Global:aedt file load time 0.2988440990447998
PyAEDT INFO: PostProcessor class has been initialized! Elapsed time: 0m 0sec
INFO:Global:PostProcessor class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Post class has been initialized! Elapsed time: 0m 0sec
INFO:Global:Post class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Loading Modeler.
INFO:Global:Loading Modeler.
PyAEDT INFO: Modeler loaded.
INFO:Global:Modeler loaded.
PyAEDT INFO: EDB loaded.
INFO:Global:EDB loaded.
PyAEDT INFO: Layers loaded.
INFO:Global:Layers loaded.
PyAEDT INFO: Primitives loaded.
INFO:Global:Primitives loaded.
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 0sec
INFO:Global:Modeler class has been initialized! Elapsed time: 0m 0sec
PyEDB INFO: Star initializing Edb 04:09:09.165880
C:\actions-runner\_work\pyaedt-examples\pyaedt-examples\.venv\lib\site-packages\pyedb\generic\design_types.py:301: UserWarning: Your ANSYS AEDT version is eligible to gRPC version.You might consider switching to that version for better user experience.For more information please check this link: https://edb.docs.pyansys.com/version/dev/grpc_api/index.html
  warnings.warn(GRPC_GENERAL_WARNING, UserWarning)
INFO:Edb:Star initializing Edb 04:09:09.165880
PyEDB INFO: Edb version 2025.2
INFO:Edb:Edb version 2025.2
PyEDB INFO: Logger is initialized. Log file is saved to C:\Users\ansys\AppData\Local\Temp\pyedb_ansys.log.
INFO:Edb:Logger is initialized. Log file is saved to C:\Users\ansys\AppData\Local\Temp\pyedb_ansys.log.
PyEDB INFO: legacy v0.61.0
INFO:Edb:legacy v0.61.0
PyEDB INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
INFO:Edb:Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyEDB INFO: Database ANSYS-HSD_V1.aedb Opened in 2025.2
INFO:Edb:Database ANSYS-HSD_V1.aedb Opened in 2025.2
PyEDB INFO: Cell main Opened
INFO:Edb:Cell main Opened
PyEDB INFO: Builder was initialized.
INFO:Edb:Builder was initialized.
PyEDB INFO: open_edb completed in 0.1422 seconds.
INFO:Edb:open_edb completed in 0.1422 seconds.
PyEDB INFO: EDB initialization completed in 0.1580 seconds.
INFO:Edb:EDB initialization completed in 0.1580 seconds.
PyAEDT WARNING: No report category provided. Automatically identified Standard
WARNING:Global:No report category provided. Automatically identified Standard
PyAEDT INFO: Solution Data Correctly Loaded.
INFO:Global:Solution Data Correctly Loaded.
Time to initialize solution data:0.016078948974609375
Time to initialize solution data:0.016078948974609375
[18]:
../../../_images/examples_edb_use_configuration_pdn_analysis_37_47.png
../../../_images/examples_edb_use_configuration_pdn_analysis_37_48.png

Shut Down Electronics Desktop#

[19]:
h3d.close_desktop()
PyAEDT INFO: Desktop has been released and closed.
INFO:Global:Desktop has been released and closed.
[19]:
True

All project files are saved in the folder temp_file.dir. If you’ve run this example as a Jupyter notebook you can retrieve those project files.


Download this example

Download this example as a Jupyter Notebook or as a Python script.