Skip to content

FEAT: Assign wave port in Driven Terminal #6358

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

Merged
merged 8 commits into from
Jul 10, 2025
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
1 change: 1 addition & 0 deletions doc/changelog.d/6358.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assign wave port in driven terminal
24 changes: 20 additions & 4 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
@pyaedt_function_handler(objectname="assignment", portname="port_name")
def _create_lumped_driven(self, assignment, int_line_start, int_line_stop, impedance, port_name, renorm, deemb):
assignment = self.modeler.convert_to_selections(assignment, True)
# TODO: Integration line should be consistent with _create_waveport_driven
start = [str(i) + self.modeler.model_units for i in int_line_start]
stop = [str(i) + self.modeler.model_units for i in int_line_stop]
props = {}
Expand Down Expand Up @@ -6876,7 +6877,14 @@

name = self._get_unique_source_name(name, "Port")

if "Modal" in self.solution_type:
if (
self.solution_type == SolutionsHfss.DrivenModal
or (
self.solution_type in [SolutionsHfss.DrivenTerminal, SolutionsHfss.Transient]
and self.desktop_class.aedt_version_id >= "2024.1"
)
and not reference
):
return self._create_lumped_driven(sheet_name, point0, point1, impedance, name, renormalize, deembed)
else:
faces = self.modeler.get_object_faces(sheet_name)
Expand Down Expand Up @@ -7074,15 +7082,22 @@
self._create_pec_cap(face, assignment, dist / 10)
name = self._get_unique_source_name(name, "Port")

if self.solution_type == SolutionsHfss.DrivenModal:
if (

Check warning on line 7085 in src/ansys/aedt/core/hfss.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/hfss.py#L7085

Added line #L7085 was not covered by tests
self.solution_type == SolutionsHfss.DrivenModal
or (
self.solution_type in [SolutionsHfss.DrivenTerminal, SolutionsHfss.Transient]
and self.desktop_class.aedt_version_id >= "2024.1"
)
and not reference
):
if isinstance(characteristic_impedance, str):
characteristic_impedance = [characteristic_impedance] * modes
elif modes != len(characteristic_impedance):
raise ValueError("List of characteristic impedance is not set correctly.")
return self._create_waveport_driven(
sheet_name, int_start, int_stop, impedance, name, renormalize, modes, deembed, characteristic_impedance
)
elif reference:
elif reference: # pragma: no cover
if isinstance(sheet_name, int):
faces = [sheet_name]
else:
Expand All @@ -7103,7 +7118,8 @@
impedance=impedance,
terminals_rename=terminals_rename,
)
else:

else: # pragma: no cover
raise AEDTRuntimeError("Reference conductors are missing.")

@pyaedt_function_handler()
Expand Down
28 changes: 24 additions & 4 deletions tests/system/general/test_20_HFSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ def test_05_create_wave_port_from_sheets(self):
o5 = self.aedtapp.modeler.create_circle(Plane.YZ, udp, 10, name="sheet1")
self.aedtapp.solution_type = "Terminal"
outer_1 = self.aedtapp.modeler["outer_1"]
# TODO: Consider allowing a TEM port to be created.
with pytest.raises(AEDTRuntimeError, match="Reference conductors are missing."):
self.aedtapp.wave_port(o5)

port = self.aedtapp.wave_port(
assignment=o5,
Expand Down Expand Up @@ -176,7 +173,6 @@ def test_05_create_wave_port_from_sheets(self):
assert port.props["DoDeembed"] is False

# Get the object for "outer_1".
outer_1 = self.aedtapp.modeler["outer_1"]
bottom_port = self.aedtapp.wave_port(
outer_1.bottom_face_z, reference=outer_1.name, create_pec_cap=True, name="bottom_probe_port"
)
Expand Down Expand Up @@ -2022,3 +2018,27 @@ def test_boundaries_layered_impedance(self):

coat4 = self.aedtapp.assign_layered_impedance([b.id, b.name, b.faces[0]], **args)
assert coat4.properties["Layer 2/Material"] == "vacuum"

def test_port_driven(self):
self.aedtapp.insert_design("hfss_wave_port")
circle = self.aedtapp.modeler.create_circle(Plane.YZ, [0, 0, 0], 10, name="sheet1")

self.aedtapp.solution_type = "Terminal"
port = self.aedtapp.wave_port(assignment=circle)
assert port.name in self.aedtapp.ports
port.delete()

self.aedtapp.solution_type = "Eigenmode"
with pytest.raises(AEDTRuntimeError):
self.aedtapp.wave_port(assignment=circle)

self.aedtapp.solution_type = "Modal"
start = [0.0, -10.0, 0.0]
end = [0.0, 10.0, 0.0]
port = self.aedtapp.lumped_port(assignment=circle, integration_line=[start, end])
assert port.name in self.aedtapp.ports
port.delete()

self.aedtapp.solution_type = "Eigenmode"
with pytest.raises(AEDTRuntimeError):
self.aedtapp.lumped_port(assignment=circle)