Skip to content

Commit

Permalink
Merge branch 'main' into release/0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcapodi78 authored and maxcapodi78 committed Sep 22, 2023
2 parents f411f41 + 59073b7 commit 4d9a5b6
Show file tree
Hide file tree
Showing 16 changed files with 289,354 additions and 63 deletions.
289,116 changes: 289,116 additions & 0 deletions _unittest/example_models/T21/y4bm_rdl_dq_byte0.s26p

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1622,13 +1622,23 @@ def test_120_edb_create_port(self):
port_name="df_port",
)
assert edb.ports["df_port"]
assert not edb.are_port_reference_terminals_connected()
p, n = edb.ports["df_port"].terminals
assert edb.ports["df_port"].decouple()
p.couple_ports(n)

traces_id = [i.id for i in traces]
paths = [i[1] for i in trace_paths]
_, df_port = edb.hfss.create_bundle_wave_port(traces_id, paths)
assert df_port.name
assert df_port.terminals
df_port.horizontal_extent_factor = 10
df_port.vertical_extent_factor = 10
df_port.deembed = True
df_port.deembed_length = "1mm"
assert df_port.horizontal_extent_factor == 10
assert df_port.vertical_extent_factor == 10
assert df_port.deembed
assert df_port.deembed_length == 1e-3
edb.close()

def test_120b_edb_create_port(self):
Expand Down Expand Up @@ -1662,7 +1672,6 @@ def test_120b_edb_create_port(self):
trace_pathes[1][0],
horizontal_extent_factor=8,
)
assert not edb.are_port_reference_terminals_connected()

paths = [i[1] for i in trace_pathes]
assert edb.hfss.create_bundle_wave_port(traces, paths)
Expand Down
8 changes: 6 additions & 2 deletions _unittest/test_21_Circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,20 @@ def test_24_new_connect_components(self):
def test_25_import_model(self):
self.aedtapp.insert_design("Touch_import")
touch = os.path.join(local_path, "example_models", test_subfolder, "SSN_ssn.s6p")
t1 = self.aedtapp.modeler.schematic.create_touchsthone_component(touch)
t1 = self.aedtapp.modeler.schematic.create_touchstone_component(touch)
assert t1
assert len(t1.pins) == 6
assert t1.model_data
t1.model_data.props["NexximCustomization"]["Passivity"] = 7
assert t1.model_data.update()
t2 = self.aedtapp.modeler.schematic.create_touchsthone_component(touch)
t2 = self.aedtapp.modeler.schematic.create_touchstone_component(touch)
assert t2
t2.model_data.props["NexximCustomization"]["Passivity"] = 0
assert t2.model_data.update()
touch = os.path.join(local_path, "example_models", test_subfolder, "y4bm_rdl_dq_byte0.s26p")
t1 = self.aedtapp.modeler.schematic.create_touchstone_component(touch)
assert t1
assert len(t1.pins) == 26

def test_25_zoom_to_fit(self):
self.aedtapp.insert_design("zoom_test")
Expand Down
2 changes: 1 addition & 1 deletion _unittest_solvers/test_00_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def test_04c_3dl_analyze_setup(self):
assert os.path.exists(self.hfss3dl_solve.export_mesh_stats("Setup1"))

@pytest.mark.skipif(is_linux, reason="To be investigated on linux.")
def test_04d_3dl_export_touchsthone(self):
def test_04d_3dl_export_touchstone(self):
filename = os.path.join(self.local_scratch.path, "touchstone.s2p")
solution_name = "Setup1"
sweep_name = "Sweep1"
Expand Down
1 change: 1 addition & 0 deletions pyaedt/application/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ def excitations(self):
try:
list_names = list(self.oboundary.GetExcitations())
del list_names[1::2]
list_names = list(set(list_names))
return list_names
except:
return []
Expand Down
8 changes: 7 additions & 1 deletion pyaedt/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,14 @@ def _init_grpc(self, non_graphical, new_aedt_session, version, student_version,
return
elif new_aedt_session:
installer = os.path.join(self._main.sDesktopinstallDirectory, "ansysedt")
if student_version: # pragma: no cover
installer = os.path.join(self._main.sDesktopinstallDirectory, "ansysedtsv")
if not is_linux:
installer = os.path.join(self._main.sDesktopinstallDirectory, "ansysedt.exe")
if student_version: # pragma: no cover
installer = os.path.join(self._main.sDesktopinstallDirectory, "ansysedtsv.exe")
else:
installer = os.path.join(self._main.sDesktopinstallDirectory, "ansysedt.exe")

out, self.port = launch_aedt(installer, non_graphical, self.port, student_version)
self.launched_by_pyaedt = True
oApp = self._initialize(
Expand Down
23 changes: 18 additions & 5 deletions pyaedt/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pyaedt.edb_core.edb_data.design_options import EdbDesignOptions
from pyaedt.edb_core.edb_data.edbvalue import EdbValue
from pyaedt.edb_core.edb_data.hfss_simulation_setup_data import HfssSimulationSetup
from pyaedt.edb_core.edb_data.ports import ExcitationBundle
from pyaedt.edb_core.edb_data.ports import BundleWavePort
from pyaedt.edb_core.edb_data.ports import ExcitationProbes
from pyaedt.edb_core.edb_data.ports import ExcitationSources
from pyaedt.edb_core.edb_data.ports import GapPort
Expand All @@ -31,6 +31,8 @@
from pyaedt.edb_core.edb_data.siwave_simulation_setup_data import SiwaveDCSimulationSetup
from pyaedt.edb_core.edb_data.siwave_simulation_setup_data import SiwaveSYZSimulationSetup
from pyaedt.edb_core.edb_data.sources import SourceType
from pyaedt.edb_core.edb_data.terminals import BundleTerminal
from pyaedt.edb_core.edb_data.terminals import EdgeTerminal
from pyaedt.edb_core.edb_data.terminals import Terminal
from pyaedt.edb_core.edb_data.variables import Variable
from pyaedt.edb_core.general import TerminalType
Expand Down Expand Up @@ -344,7 +346,18 @@ def variables(self):
@property
def terminals(self):
"""Get terminals belonging to active layout."""
return {i.GetName(): GapPort(self, i) for i in self.layout.terminals}
temp = {}
for i in self.layout.terminals:
terminal_type = i.ToString().split(".")[-1]
if terminal_type == TerminalType.EdgeTerminal.name:
ter = EdgeTerminal(self, i)
elif terminal_type == TerminalType.BundleTerminal.name:
ter = BundleTerminal(self, i)
else:
ter = Terminal(self, i)
temp[ter.name] = ter

return temp

@property
def excitations(self):
Expand All @@ -353,7 +366,7 @@ def excitations(self):
temp = {}
for ter in terms:
if "BundleTerminal" in ter.GetType().ToString():
temp[ter.GetName()] = ExcitationBundle(self, ter)
temp[ter.GetName()] = BundleWavePort(self, ter)
else:
temp[ter.GetName()] = GapPort(self, ter)
return temp
Expand All @@ -374,7 +387,7 @@ def ports(self):
for t in temp:
t2 = Terminal(self, t)
if t2.terminal_type == TerminalType.BundleTerminal.name:
bundle_ter = ExcitationBundle(self, t)
bundle_ter = BundleWavePort(self, t)
ports[bundle_ter.name] = bundle_ter
elif t2.hfss_type == "Wave":
ports[t2.name] = WavePort(self, t)
Expand Down Expand Up @@ -3119,7 +3132,7 @@ def are_port_reference_terminals_connected(self, common_reference=None):
>>> edb.cutout(["Net1"])
>>> assert edb.are_port_reference_terminals_connected()
"""
all_sources = [i for i in self.excitations.values() if not isinstance(i, (WavePort, GapPort))]
all_sources = [i for i in self.excitations.values() if not isinstance(i, (WavePort, GapPort, BundleWavePort))]
all_sources.extend([i for i in self.sources.values()])
if not all_sources:
return True
Expand Down
92 changes: 73 additions & 19 deletions pyaedt/edb_core/edb_data/ports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pyaedt.edb_core.edb_data.terminals import BundleTerminal
from pyaedt.edb_core.edb_data.terminals import EdgeTerminal
from pyaedt.edb_core.edb_data.terminals import Terminal

Expand Down Expand Up @@ -68,8 +69,7 @@ class WavePort(EdgeTerminal):
>>> from pyaedt import Edb
>>> edb = Edb("myaedb.aedb")
>>> exc = edb.excitations
>>> print(exc["Port1"].name)
>>> exc = edb.ports
"""

def __init__(self, pedb, edb_terminal):
Expand Down Expand Up @@ -124,11 +124,23 @@ def deembed(self):
"""Whether deembed is active."""
return self._edb_object.GetPortPostProcessingProp().DoDeembed

@deembed.setter
def deembed(self, value):
p = self._edb_object.GetPortPostProcessingProp()
p.DoDeembed = value
self._edb_object.SetPortPostProcessingProp(p)

@property
def deembed_length(self):
"""Deembed Length."""
return self._edb_object.GetPortPostProcessingProp().DeembedLength.ToDouble()

@deembed_length.setter
def deembed_length(self, value):
p = self._edb_object.GetPortPostProcessingProp()
p.DeembedLength = self._pedb.edb_value(value)
self._edb_object.SetPortPostProcessingProp(p)


class ExcitationSources(Terminal):
"""Manage sources properties.
Expand Down Expand Up @@ -198,29 +210,71 @@ def __init__(self, pedb, edb_terminal):
Terminal.__init__(self, pedb, edb_terminal)


class ExcitationBundle:
"""Manages multi terminal excitation properties."""
class BundleWavePort(BundleTerminal):
"""Manages bundle wave port properties.
Parameters
----------
pedb : pyaedt.edb.Edb
EDB object from the ``Edblib`` library.
edb_object : Ansys.Ansoft.Edb.Cell.Terminal.BundleTerminal
BundleTerminal instance from EDB.
"""

def __init__(self, pedb, edb_object):
super().__init__(pedb, edb_object)

@property
def _wave_port(self):
return WavePort(self._pedb, self.terminals[0]._edb_object)

@property
def horizontal_extent_factor(self):
"""Horizontal extent factor."""
return self._wave_port.horizontal_extent_factor

@horizontal_extent_factor.setter
def horizontal_extent_factor(self, value):
self._wave_port.horizontal_extent_factor = value

@property
def vertical_extent_factor(self):
"""Vertical extent factor."""
return self._wave_port.vertical_extent_factor

def __init__(self, pedb, edb_bundle_terminal):
self._pedb = pedb
self._edb_bundle_terminal = edb_bundle_terminal
@vertical_extent_factor.setter
def vertical_extent_factor(self, value):
self._wave_port.vertical_extent_factor = value

@property
def name(self):
"""Port Name."""
return list(self.terminals.values())[0].name
def radial_extent_factor(self):
"""Radial extent factor."""
return self._wave_port.radial_extent_factor

@property
def edb(self): # pragma: no cover
"""Get edb."""
return self._pedb.edb_api
def pec_launch_width(self):
"""Launch width for the printed electronic component (PEC)."""
return self._wave_port.pec_launch_width

@pec_launch_width.setter
def pec_launch_width(self, value):
self._wave_port.pec_launch_width = value

@property
def terminals(self):
"""Get terminals belonging to this excitation."""
return {i.GetName(): GapPort(self._pedb, i) for i in list(self._edb_bundle_terminal.GetTerminals())}
def deembed(self):
"""Whether deembed is active."""
return self._wave_port.deembed

@deembed.setter
def deembed(self, value):
self._wave_port.deembed = value

@property
def reference_net_name(self):
"""Reference Name. Not applicable to Differential pairs."""
return
def deembed_length(self):
"""Deembed Length."""
return self._wave_port.deembed_length

@deembed_length.setter
def deembed_length(self, value):
self._wave_port.deembed_length = value
2 changes: 1 addition & 1 deletion pyaedt/edb_core/edb_data/simulation_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ class SimulationConfigurationAc(object):
def __init__(self):
self._sweep_interpolating = True
self._use_q3d_for_dc = False
self._relative_error = 0.5
self._relative_error = 0.005
self._use_error_z0 = False
self._percentage_error_z0 = 1
self._enforce_causality = True
Expand Down
52 changes: 52 additions & 0 deletions pyaedt/edb_core/edb_data/terminals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pyaedt.edb_core.edb_data.padstacks_data import EDBPadstackInstance
from pyaedt.edb_core.edb_data.primitives_data import cast
from pyaedt.edb_core.general import TerminalType
from pyaedt.edb_core.general import convert_py_list_to_net_list


class Terminal(Connectable):
Expand Down Expand Up @@ -352,3 +353,54 @@ def _get_closest_pin(self, ref_pin, pin_list, gnd_net=None):
class EdgeTerminal(Terminal):
def __init__(self, pedb, edb_object):
super().__init__(pedb, edb_object)

@pyaedt_function_handler
def couple_ports(self, port):
"""Create a bundle wave port.
Parameters
----------
port : :class:`pyaedt.edb_core.ports.WavePort`, :class:`pyaedt.edb_core.ports.GapPort`, list, optional
Ports to be added.
Returns
-------
:class:`pyaedt.edb_core.ports.BundleWavePort`
"""
if not isinstance(port, (list, tuple)):
port = [port]
temp = [self._edb_object]
temp.extend([i._edb_object for i in port])
edb_list = convert_py_list_to_net_list(temp, self._edb.cell.terminal.Terminal)
_edb_bundle_terminal = self._edb.cell.terminal.BundleTerminal.Create(edb_list)
return self._pedb.ports[self.name]


class BundleTerminal(Terminal):
"""Manages bundle terminal properties.
Parameters
----------
pedb : pyaedt.edb.Edb
EDB object from the ``Edblib`` library.
edb_object : Ansys.Ansoft.Edb.Cell.Terminal.BundleTerminal
BundleTerminal instance from EDB.
"""

def __init__(self, pedb, edb_object):
super().__init__(pedb, edb_object)

@property
def terminals(self):
"""Get terminals belonging to this excitation."""
return [EdgeTerminal(self._pedb, i) for i in list(self._edb_object.GetTerminals())]

@property
def name(self):
return self.terminals[0].name

@pyaedt_function_handler
def decouple(self):
"""Ungroup a bundle of terminals."""
return self._edb_object.Ungroup()
6 changes: 3 additions & 3 deletions pyaedt/edb_core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import math

from pyaedt.edb_core.edb_data.hfss_extent_info import HfssExtentInfo
from pyaedt.edb_core.edb_data.ports import ExcitationBundle
from pyaedt.edb_core.edb_data.ports import BundleWavePort
from pyaedt.edb_core.edb_data.ports import WavePort
from pyaedt.edb_core.edb_data.primitives_data import EDBPrimitives
from pyaedt.edb_core.edb_data.simulation_configuration import SimulationConfiguration
Expand Down Expand Up @@ -539,7 +539,7 @@ def create_differential_wave_port(
_edb_boundle_terminal = self._edb.cell.terminal.BundleTerminal.Create(edb_list)
# _edb_boundle_terminal.SetName("Wave_"+port_name)
pos_term._edb_object.SetName(port_name)
return port_name, ExcitationBundle(self._pedb, _edb_boundle_terminal)
return port_name, BundleWavePort(self._pedb, _edb_boundle_terminal)

@pyaedt_function_handler
def create_bundle_wave_port(
Expand Down Expand Up @@ -601,7 +601,7 @@ def create_bundle_wave_port(

edb_list = convert_py_list_to_net_list([i._edb_object for i in terminals], self._edb.cell.terminal.Terminal)
_edb_bundle_terminal = self._edb.cell.terminal.BundleTerminal.Create(edb_list)
return port_name, ExcitationBundle(self._pedb, _edb_bundle_terminal)
return port_name, BundleWavePort(self._pedb, _edb_bundle_terminal)

@pyaedt_function_handler()
def create_hfss_ports_on_padstack(self, pinpos, portname=None):
Expand Down
1 change: 1 addition & 0 deletions pyaedt/generic/general_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ def _retry_ntimes(n, function, *args, **kwargs):
"PushExcitations",
"Rename",
"RestoreProjectArchive",
"ImportGerber",
]
# if func_name and func_name not in inclusion_list and not func_name.startswith("Get"):
if func_name and func_name not in inclusion_list:
Expand Down
Loading

0 comments on commit 4d9a5b6

Please sign in to comment.