Skip to content

Commit

Permalink
Added new methods to identify terminal nets connections plus excitati…
Browse files Browse the repository at this point in the history
…ons refactoring (#1984)

* Added new methods to identify terminal nets connections
in particular method
are_port_reference_terminals_connected is doing the following:
- get all ports
- get references object
- get reference net
- for each reference object is getting connected objects
- checks for intersections of those list to see if there is a common return path between ports.

* Fixed doctstrings

* Fixed doctstrings

* Fixed doctstrings

* Fixed doctstrings

* added Unit Tests

* added coverage

* minor improvement on create_cutout_multithread

* minor fix on unit test

* fix bugs in ironpython

* fix bugs in ironpython

* fix bugs in ironpython

* Improvements on create_cutout methods

* Improved documentation

* Improved documentation

* Improved documentation

* Improved documentation

* Apply suggestions from code review

* Update pyaedt/edb_core/edb_data/padstacks_data.py

* Apply suggestions from code review

* Apply suggestions from code review

* Add documentation for ExcitationSources.

* Fix documentation warning.

* Improve docstring for get_padstack_terminal_reference_pin.

* Added UT

Co-authored-by: maxcapodi78 <Shark78>
Co-authored-by: Maxime Rey <[email protected]>
Co-authored-by: MaxJPRey <[email protected]>
  • Loading branch information
3 people authored Nov 17, 2022
1 parent bc04c13 commit 57f3ca6
Show file tree
Hide file tree
Showing 12 changed files with 729 additions and 73 deletions.
52 changes: 50 additions & 2 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def test_07_vias_creation(self):
padstack_instance = self.edbapp.core_padstack.padstack_instances[padstack_id]
assert padstack_instance.is_pin
assert padstack_instance.position
if not is_ironpython:
assert padstack_instance.start_layer in padstack_instance.layer_range_names
assert padstack_instance.stop_layer in padstack_instance.layer_range_names
padstack_instance.position = [0.001, 0.002]
assert padstack_instance.position == [0.001, 0.002]
assert padstack_instance.parametrize_position()
Expand Down Expand Up @@ -380,6 +383,11 @@ def test_38_create_voltage_source(self):
)
pins = self.edbapp.core_components.get_pin_from_component("U2A5")
assert "VSource_" in self.edbapp.core_siwave.create_voltage_source_on_pin(pins[300], pins[10], 3.3, 0)
if not is_ironpython:
assert len(self.edbapp.sources) > 0
assert len(self.edbapp.probes) == 0
assert list(self.edbapp.sources.values())[0].magnitude == 3.3
assert list(self.edbapp.sources.values())[0].phase == 0

def test_39_create_current_source(self):
assert self.edbapp.core_siwave.create_current_source_on_net("U2A5", "DDR3_DM1", "U2A5", "GND", 0.1, 0) != ""
Expand Down Expand Up @@ -577,7 +585,13 @@ def test_55b_create_cutout(self):
self.local_scratch.copyfolder(source_path, target_path)
edbapp = Edb(target_path, edbversion=desktop_version)
output = os.path.join(self.local_scratch.path, "cutout.aedb")
assert edbapp.create_cutout(["A0_N", "A0_P"], ["GND"], output_aedb_path=output, open_cutout_at_end=False)
assert edbapp.create_cutout(
["A0_N", "A0_P"],
["GND"],
output_aedb_path=output,
open_cutout_at_end=False,
use_pyaedt_extent_computing=True,
)
assert edbapp.create_cutout(
["A0_N", "A0_P"],
["GND"],
Expand Down Expand Up @@ -649,11 +663,28 @@ def test_55d_create_custom_cutout(self):
signal_list=["V3P3_S0"],
reference_list=["GND"],
number_of_threads=4,
extent_type="Bounding",
extent_type="ConvexHull",
custom_extent=points,
)
edbapp.close_edb()

@pytest.mark.skipif(is_ironpython, reason="Method works in CPython only")
def test_55e_create_custom_cutout(self):
source_path = os.path.join(local_path, "example_models", test_subfolder, "Galileo.aedb")
target_path = os.path.join(self.local_scratch.path, "Galileo_cutout_4.aedb")
self.local_scratch.copyfolder(source_path, target_path)

edbapp = Edb(target_path, edbversion=desktop_version)

assert edbapp.create_cutout_multithread(
signal_list=["V3P3_S0"],
reference_list=["GND"],
number_of_threads=4,
extent_type="ConvexHull",
use_pyaedt_extent_computing=True,
)
edbapp.close_edb()

def test_56_rvalue(self):
assert resistor_value_parser("100meg")

Expand Down Expand Up @@ -2151,6 +2182,7 @@ def test_A118_edb_create_port(self):
["-40mm", "-10.2mm"],
horizontal_extent_factor=8,
)
assert not edb.are_port_reference_terminals_connected()
edb.close_edb()

def test_A119_insert_layer(self):
Expand Down Expand Up @@ -2506,6 +2538,19 @@ def test_128B_build_project(self):
sim_setup.step_freq = 10e6
sim_setup.use_default_cutout = False
assert edbapp.build_simulation_project(sim_setup)
assert edbapp.are_port_reference_terminals_connected()
port1 = list(edbapp.excitations.values())[0]
assert port1.magnitude == 0.0
assert port1.phase == 0
assert port1.reference_net_name == "GND"
assert not port1.deembed
assert port1.impedance == 50.0
assert port1.deembed_length == 0
assert not port1.is_circuit
assert not port1.renormalize
assert port1.renormalize_z0 == (50.0, 0.0)
assert not port1.get_pin_group_terminal_reference_pin()
assert not port1.get_pad_edge_terminal_reference_pin()

def test_129_get_component_bounding_box(self):
target_path = os.path.join(local_path, "example_models", test_subfolder, "Galileo.aedb")
Expand All @@ -2515,3 +2560,6 @@ def test_129_get_component_bounding_box(self):
component = edbapp.core_components.components["U2A5"]
assert component.bounding_box
assert isinstance(component.rotation, float)

def test_130_eligible_power_nets(self):
assert "GND" in [i.name for i in self.edbapp.core_nets.eligible_power_nets]
4 changes: 4 additions & 0 deletions doc/source/API/CoreEdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ These classes are the containers of data read from the EDB file:
primitives_data.EDBPrimitives
simulation_configuration.SiwaveDCSetupTemplate
simulation_configuration.SimulationConfiguration
sources.ExcitationPorts
sources.ExcitationProbes
sources.ExcitationSources
sources.ExcitationDifferential


.. code:: python
Expand Down
16 changes: 9 additions & 7 deletions pyaedt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@
except ImportError:
msg = "pythonnet or dotnetcore not installed. Pyaedt will work only in client mode."
warnings.warn(msg)
try:
# work around a number formatting bug in the EDB API for non-English locales
# described in #1980
import clr

# work around a number formatting bug in the EDB API for non-English locales
# described in #1980
import clr as _clr

_clr.AddReference("System.Runtime")
from System.Globalization import CultureInfo as _CultureInfo
# _clr.AddReference("System.Runtime")
from System.Globalization import CultureInfo as _CultureInfo

_CultureInfo.DefaultThreadCurrentCulture = _CultureInfo.InvariantCulture
_CultureInfo.DefaultThreadCurrentCulture = _CultureInfo.InvariantCulture
except ImportError:
warnings.warn("pythonnet not installed. Invariant Culture will not be applied.")

from pyaedt.generic import constants
from pyaedt.generic.general_methods import _pythonver
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/aedt_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def remove_file_logger(self, project_name):
handler.close()
if handler in handlers:
self._global.removeHandler(handler)
self.info("logger file pyaedt_{}.log removed from handlers.".format(project_name))
self.info("logger file pyaedt_{}.log removed from handlers.".format(project_name))

def remove_all_project_file_logger(self):
"""Remove all the local files from the logger handlers list."""
Expand Down
Loading

0 comments on commit 57f3ca6

Please sign in to comment.