Skip to content
Draft
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
13 changes: 7 additions & 6 deletions examples/aedt_general/components/component_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# 3D components from older versions of AEDT
# that relied on the ACIS modeling kernel, to the new
# versions of AEDT that employ
# the Parasolid kernel. Specifically, if your
# the Parasolid kernel. Specifically, if your
# encrypted 3D
# components were created with version 22R2 or
# components were created with version 22R2 or
# earlier, you'll need to convert them
# to a version ≥ 23R1 that supports the Parasolid modeler.
#
Expand All @@ -27,6 +27,7 @@

from ansys.aedt.core import Desktop, Hfss, settings
from ansys.aedt.core.examples.downloads import download_file

# -

# ### Define constants
Expand All @@ -46,14 +47,14 @@

temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")

# ## Covert the encrypted component
# ## Convert the encrypted component
#
# ### Retrieve the component that will be converted
#
# The ``download_file()`` method provides access to a library
# of examples and models from the Ansys GitHub organization:
# of examples and models from the Ansys GitHub organization:
# [example-data repository](https://github.com/ansys/example-data/tree/master/pyaedt). Download the "old"
# encrypted 3D component and define a name to use for the new, coverted component.
# encrypted 3D component and define a name to use for the new, converted component.

# +
a3dcomp = download_file(
Expand Down Expand Up @@ -100,7 +101,7 @@
# Launch another instance of AEDT to enable conversion of the
# 3D component.
#
# After the new version of AEDT is started, the process ID
# After the new version of AEDT is started, the process ID
# is retrieved via the property ``aedt.aedt_process_id`` and is passed
# as an argument to `Hfss()`. This ensures that the newly created
# `hfss2` object
Expand Down
59 changes: 23 additions & 36 deletions examples/aedt_general/components/reuse_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import time

from ansys.aedt.core import Hfss

# -

# ### Define constants
Expand All @@ -36,15 +37,16 @@
# > **Note:** The final cell in the notebook cleans up the temporary folder. If you want to
# > retrieve the AEDT project and data, do so before executing the final cell in the notebook.
#
# This example creates two projects defined in `project_names.
# This example creates two projects defined in `project_names.
# The first will be used to
# create the patch antenna model and the 2nd project
# will be used to demonstrate the use 3D components.

temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
project_names = [os.path.join(temp_folder.name, "start_project.aedt"),
os.path.join(temp_folder.name, "final_project.aedt"),
]
project_names = [
os.path.join(temp_folder.name, "start_project.aedt"),
os.path.join(temp_folder.name, "final_project.aedt"),
]

# ### Launch HFSS
# AEDT is started when an instance of the ``Hfss()`` class is
Expand All @@ -65,20 +67,20 @@
#
# ### Define parameters
#
# Parameters can be defined in the HFSS design and subsequently
# Parameters can be defined in the HFSS design and subsequently
# used to optimiuze
# performance, run parametric studies or
# performance, run parametric studies or
# explore the impact of tolerance on performance.

hfss["thickness"] = "0.1mm"
hfss["width"] = "1mm"

# ### Build the antenna model
#
# The compact,
# [pythonic syntax](https://docs.python-guide.org/writing/style/#code-style)
# The compact,
# [pythonic syntax](https://docs.python-guide.org/writing/style/#code-style)
# allows you to create the model from simple
# primitives. This patch antenna is comprised of the FR-4 substrate, a rectangle,
# primitives. This patch antenna is comprised of the FR-4 substrate, a rectangle,
# and the coaxial
# probe feed. Each primitive is of type ``Object3D``.
#
Expand All @@ -95,9 +97,7 @@

feed_length = "0.1mm" # This parameter is defined only in Python and is not varied

patch = hfss.modeler.create_rectangle(
"XY", ["-width/2", "-width/2", "0mm"], ["width", "width"], name="patch"
)
patch = hfss.modeler.create_rectangle("XY", ["-width/2", "-width/2", "0mm"], ["width", "width"], name="patch")

inner_conductor = hfss.modeler.create_cylinder(
2,
Expand Down Expand Up @@ -127,14 +127,12 @@

# ### Assign boundaries to the via
#
# The following statement selects the outer surface of the cylinder
# The following statement selects the outer surface of the cylinder
# ``via_outer``, excluding the upper and lower faces, and assigns
# the "perfect conductor" boundary condition.

# +
side_face = [i for i in via_outer.faces if i.id not in
[via_outer.top_face_z.id, via_outer.bottom_face_z.id]
]
side_face = [i for i in via_outer.faces if i.id not in [via_outer.top_face_z.id, via_outer.bottom_face_z.id]]

hfss.assign_perfecte_to_sheets(side_face, name="feed_gnd")
hfss.assign_perfecte_to_sheets(substrate.bottom_face_z, name="ground_plane")
Expand All @@ -144,14 +142,10 @@

# ### Create wave port
#
# A wave port is assigned to the bottom face of the via. Note that the property `via_outer.bottom_face_z`
# A wave port is assigned to the bottom face of the via. Note that the property `via_outer.bottom_face_z`
# is a ``FacePrimitive`` object.

p1 = hfss.wave_port(
via_outer.bottom_face_z,
name="P1",
create_pec_cap=True
)
p1 = hfss.wave_port(via_outer.bottom_face_z, name="P1", create_pec_cap=True)

# ### Query the object properties
#
Expand Down Expand Up @@ -187,7 +181,7 @@

# ### Insert 3D components
#
# Place 4 antennas to make a small array.
# Place 4 antennas to make a small array.
# - The substrate thickness is modified by creating the parameter "p_thick" and
# assigning it to the "thickness" parameter of the components.
# - The first antenna is placed at the origin.
Expand Down Expand Up @@ -216,11 +210,8 @@
count = 1
for p in positions:
cs.append(hfss2.modeler.create_coordinate_system(origin=p, name="cs_" + str(count))) # Create the patch coordinate system.
elements.append(hfss2.modeler.insert_3d_component(component_path, # Place the patch element.
coordinate_system=cs[-1].name,
name="patch_" + str(count))
)
count +=1
elements.append(hfss2.modeler.insert_3d_component(component_path, coordinate_system=cs[-1].name, name="patch_" + str(count))) # Place the patch element.
count += 1

elements[-1].parameters["thickness"] = "p_thick"
elements[-1].parameters["width"] = "w"
Expand All @@ -234,7 +225,7 @@

# ### Move 3D components
#
# The position of each 3D component can be changed by modifying the ``origin``
# The position of each 3D component can be changed by modifying the ``origin``
# of the corresponding coordinate system.

hfss2.modeler.coordinate_systems[0].origin = [0, "2*w", 0]
Expand All @@ -243,10 +234,10 @@
#
# The volume of the solution domain is defined
# by an air region object. The following cell creates the
# region object and assigns the radiation boundary to the outer surfaces of
# region object and assigns the radiation boundary to the outer surfaces of
# the region.

hfss2.modeler.create_air_region( x_pos=2, y_pos=2, z_pos=2.5, x_neg=2, y_neg=2, z_neg=2, is_percentage=False)
hfss2.modeler.create_air_region(x_pos=2, y_pos=2, z_pos=2.5, x_neg=2, y_neg=2, z_neg=2, is_percentage=False)
hfss2.assign_radiation_boundary_to_faces(hfss2.modeler["Region"].faces)

# ### Create solution setup and optimetrics analysis
Expand All @@ -255,11 +246,7 @@

# +
setup1 = hfss2.create_setup(RangeStart="60GHz", RangeEnd="80GHz")
optim = hfss2.parametrics.add("w", start_point="0.8mm",
end_point="1.2mm",
step="0.05mm",
variation_type="LinearStep",
name="Sweep Patch Width")
optim = hfss2.parametrics.add("w", start_point="0.8mm", end_point="1.2mm", step="0.05mm", variation_type="LinearStep", name="Sweep Patch Width")

if hfss.valid_design:
print(f"The HFSS design '{hfss.design_name}' is ready to solve.")
Expand Down
9 changes: 3 additions & 6 deletions examples/aedt_general/configuration_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import ansys.aedt.core
from ansys.aedt.core.examples.downloads import download_icepak

# -

# Define constants.
Expand All @@ -54,9 +55,7 @@
#
# Download the Icepack project.

project_full_name = download_icepak(
local_path=temp_folder.name
)
project_full_name = download_icepak(local_path=temp_folder.name)

# ## Open project
#
Expand Down Expand Up @@ -117,9 +116,7 @@
# Export the configuration files. You can optionally disable the export and
# import sections. Supported formats are JSON and TOML files.

conf_file = ipk.configurations.export_config(
os.path.join(ipk.working_directory, "config.toml")
)
conf_file = ipk.configurations.export_config(os.path.join(ipk.working_directory, "config.toml"))
ipk.close_project()

# ## Create project
Expand Down
21 changes: 6 additions & 15 deletions examples/aedt_general/modeler/circuit_schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import ansys.aedt.core
from ansys.aedt.core.generic.constants import Setups

# -

# Define constants.
Expand Down Expand Up @@ -65,15 +66,9 @@
# Place components such as an inductor, resistor, and capacitor. The ``location`` argument
# provides the ``[x, y]`` coordinates to place the component.

inductor = circuit.modeler.schematic.create_inductor(
name="L1", value=1e-9, location=[0, 0]
)
resistor = circuit.modeler.schematic.create_resistor(
name="R1", value=50, location=[500, 0]
)
capacitor = circuit.modeler.schematic.create_capacitor(
name="C1", value=1e-12, location=[1000, 0]
)
inductor = circuit.modeler.schematic.create_inductor(name="L1", value=1e-9, location=[0, 0])
resistor = circuit.modeler.schematic.create_resistor(name="R1", value=50, location=[500, 0])
capacitor = circuit.modeler.schematic.create_capacitor(name="C1", value=1e-12, location=[1000, 0])

# ## Get all pins
#
Expand All @@ -88,9 +83,7 @@
#
# Place a port and a ground in the schematic.

port = circuit.modeler.schematic.create_interface_port(
name="myport", location=[-300, 50]
)
port = circuit.modeler.schematic.create_interface_port(name="myport", location=[-300, 50])
gnd = circuit.modeler.schematic.create_gnd(location=[1200, -100])

# ## Connect components
Expand All @@ -107,9 +100,7 @@
#
# Create a transient setup.

setup2 = circuit.create_setup(
name="MyTransient", setup_type=Setups.NexximTransient
)
setup2 = circuit.create_setup(name="MyTransient", setup_type=Setups.NexximTransient)
setup2.props["TransientData"] = ["0.01ns", "200ns"]
setup3 = circuit.create_setup(name="MyDC", setup_type=Setups.NexximDC)

Expand Down
1 change: 1 addition & 0 deletions examples/aedt_general/modeler/netlist_to_schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import ansys.aedt.core
from ansys.aedt.core.examples.downloads import download_netlist

# -

# ## Define constants.
Expand Down
Loading