Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy example work again #15

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,928 changes: 2,928 additions & 0 deletions _unittest/test_00_EDB.py

Large diffs are not rendered by default.

174 changes: 174 additions & 0 deletions examples/legacy/01_edb_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
"""
EDB: Siwave analysis from EDB setup
-----------------------------------
This example shows how you can use EDB to interact with a layout.
"""
###############################################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Perform required imports.

import shutil

import os
import time
import pyedb
from pyedb.legacy.downloads import download_file

temp_folder = pyedb.generate_unique_folder_name()
targetfile = download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)

siwave_file = os.path.join(os.path.dirname(targetfile), "ANSYS-HSD_V1.siw")
print(targetfile)
aedt_file = targetfile[:-4] + "aedt"


###############################################################################
# Launch EDB
# ~~~~~~~~~~
# Launch the :class:`pyaedt.Edb` class, using EDB 2023 R2 and SI units.
edb_version = "2023.1"
if os.path.exists(aedt_file):
os.remove(aedt_file)
edb = pyedb.Edb(edbpath=targetfile, edbversion=edb_version)

###############################################################################
# Compute nets and components
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Computes nets and components.
# There are queries for nets, stackups, layers, components, and geometries.

print("Nets {}".format(len(edb.nets.netlist)))
start = time.time()
print("Components {}".format(len(edb.components.components.keys())))
print("elapsed time = ", time.time() - start)

###############################################################################
# Get pin position
# ~~~~~~~~~~~~~~~~
# Get the position for a specific pin.
# The next section shows how to get all pins for a specific component and
# the positions of each of them.
# Each pin is a list of ``[X, Y]`` coordinate positions.

pins = edb.components["U2"].pins
for pin in edb.components["U2"].pins.values():
print(pin.position)

###############################################################################
# Get all nets connected to a component
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Get all nets connected to a specific component.

edb.components.get_component_net_connection_info("U2")

###############################################################################
# Compute rats
# ~~~~~~~~~~~~
# Computes rats.

rats = edb.components.get_rats()

###############################################################################
# Get all DC-connected net lists through inductance
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Get all DC-connected net lists through inductance.
# The inputs needed are ground net lists. The returned list contains all nets
# connected to a ground through an inductor.

GROUND_NETS = ["GND", "GND_DP"]
dc_connected_net_list = edb.nets.get_dcconnected_net_list(GROUND_NETS)
print(dc_connected_net_list)

###############################################################################
# Get power tree based on a specific net
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Get the power tree based on a specific net.

VRM = "U1"
OUTPUT_NET = "AVCC_1V3"
powertree_df, component_list_columns, net_group = edb.nets.get_powertree(OUTPUT_NET, GROUND_NETS)
for el in powertree_df:
print(el)

###############################################################################
# Delete all RLCs with only one pin
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Delete all RLCs with only one pin. This method provides a useful way of
# removing components not needed in the simulation.

edb.components.delete_single_pin_rlc()

###############################################################################
# Delete components
# ~~~~~~~~~~~~~~~~~
# Delete manually one or more components.

edb.components.delete("C380")

###############################################################################
# Delete nets
# ~~~~~~~~~~~
# Delete manually one or more nets.

edb.nets.delete("PDEN")

###############################################################################
# Get stackup limits
# ~~~~~~~~~~~~~~~~~~
# Get the stackup limits (top and bottom layers and elevations).

print(edb.stackup.limits())



###############################################################################
# Create voltage source and Siwave DCIR analysis
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Create a voltage source and then set up a DCIR analysis.

edb.siwave.create_voltage_source_on_net("U1", "AVCC_1V3", "U1", "GND", 1.3, 0, "V1")
edb.siwave.create_current_source_on_net("IC2", "NetD3_2", "IC2", "GND", 1.0, 0, "I1")
setup = edb.siwave.add_siwave_dc_analysis("myDCIR_4")
setup.use_dc_custom_settings = True
setup.dc_slider_position = 0
setup.add_source_terminal_to_ground("V1", 1)



###############################################################################
# Save modifications
# ~~~~~~~~~~~~~~~~~~
# Save modifications.

edb.save_edb()
edb.nets.plot(None, "1_Top",plot_components_on_top=True)

siw_file = edb.solve_siwave()

###############################################################################
# Export Siwave Reports
# ~~~~~~~~~~~~~~~~~~~~~
# Export all DC Reports quantities.
outputs = edb.export_siwave_dc_results(siw_file, setup.name, )

###############################################################################
# Close EDB
# ~~~~~~~~~
# Close EDB. After EDB is closed, it can be opened by AEDT.

edb.close_edb()

###############################################################################
# Postprocess in Siwave
# ~~~~~~~~~~~~~~~~~~~~~
# Open Siwave and generate a report. This works on Window only.

# from pyaedt import Siwave
# siwave = Siwave("2023.2")
# siwave.open_project(siwave_file)
# report_file = os.path.join(temp_folder,'Ansys.htm')
#
# siwave.export_siwave_report("myDCIR_4", report_file)
# siwave.close_project()
# siwave.quit_application()
86 changes: 86 additions & 0 deletions examples/legacy/02_edb_to_ipc2581.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"""
EDB: IPC2581 export
-------------------
This example shows how you can use PyAEDT to export an IPC2581 file.
"""

###############################################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Perform required imports, which includes importing a section.

import os
import pyedb
from pyedb.legacy.downloads import download_file

###############################################################################
# Download file
# ~~~~~~~~~~~~~
# Download the AEDB file and copy it in the temporary folder.


temp_folder = pyedb.generate_unique_folder_name()
targetfile = download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)


ipc2581_file = os.path.join(temp_folder, "Ansys_Hsd.xml")

print(targetfile)


###############################################################################
# Launch EDB
# ~~~~~~~~~~
# Launch the :class:`pyaedt.Edb` class, using EDB 2023 R2 and SI units.

edb = pyedb.Edb(edbpath=targetfile, edbversion="2023.2")


###############################################################################
# Parametrize net
# ~~~~~~~~~~~~~~~
# Parametrize a net.

edb.modeler.parametrize_trace_width(
"A0_N", parameter_name=pyedb.generate_unique_name("Par"), variable_value="0.4321mm"
)

###############################################################################
# Cutout
# ~~~~~~
# Create a cutout.
signal_list = []
for net in edb.nets.netlist:
if "PCIe" in net:
signal_list.append(net)
power_list = ["GND"]
edb.cutout(signal_list=signal_list, reference_list=power_list, extent_type="ConvexHull",
expansion_size=0.002,
use_round_corner=False,
number_of_threads=4,
remove_single_pin_components=True,
use_pyaedt_extent_computing=True,
extent_defeature=0,
)

###############################################################################
# Plot cutout
# ~~~~~~~~~~~
# Plot cutout before exporting to IPC2581 file.

edb.nets.plot(None, None, color_by_net=True)

###############################################################################
# Create IPC2581 file
# ~~~~~~~~~~~~~~~~~~~
# Create the IPC2581 file.

edb.export_to_ipc2581(ipc2581_file, "inch")
print("IPC2581 File has been saved to {}".format(ipc2581_file))

###############################################################################
# Close EDB
# ~~~~~~~~~
# Close EDB.

edb.close_edb()
65 changes: 65 additions & 0 deletions examples/legacy/05_Plot_nets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""
EDB: plot nets with Matplotlib
------------------------------
This example shows how you can use the ``Edb`` class to plot a net or a layout.
"""

###############################################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Perform required imports, which includes importing a section.

import pyedb
from pyedb.legacy.downloads import download_file

###############################################################################
# Download file
# ~~~~~~~~~~~~~
# Download the AEDT file and copy it into the temporary folder.

temp_folder = pyedb.generate_unique_folder_name()

targetfolder = download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)


###############################################################################
# Launch EDB
# ~~~~~~~~~~
# Launch the :class:`pyaedt.Edb` class, using EDB 2023 R2 and SI units.

edb = pyedb.Edb(edbpath=targetfolder, edbversion="2023.2")

###############################################################################
# Plot custom set of nets colored by layer
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Plot a custom set of nets colored by layer (default).

edb.nets.plot("AVCC_1V3")

###############################################################################
# Plot custom set of nets colored by nets
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Plot a custom set of nets colored by nets.

edb.nets.plot(["GND", "GND_DP", "AVCC_1V3"], color_by_net=True)

###############################################################################
# Plot all nets on a layer colored by nets
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Plot all nets on a layer colored by nets

edb.nets.plot(None, ["1_Top"], color_by_net=True, plot_components_on_top=True)

###############################################################################
# Plot stackup and some padstack definition
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Plot all nets on a layer colored by nets

edb.stackup.plot(scale_elevation=False,plot_definitions=["c100hn140", "c35"])

###############################################################################
# Close EDB
# ~~~~~~~~~
# Close EDB.

edb.close_edb()
Loading
Loading