Skip to content

Commit

Permalink
Merge branch 'main' into raptor_x_simluation_setup
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys authored Apr 25, 2024
2 parents 153b6e1 + 0f0518d commit 408d446
Show file tree
Hide file tree
Showing 24 changed files with 1,174 additions and 76 deletions.
28 changes: 5 additions & 23 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,15 @@ concurrency:
jobs:

check_title:
name: Check PR title
if: github.event_name == 'pull_request'
name: Check the title of the pull request
runs-on: ubuntu-latest
steps:
- name: Get PR title
env:
REPOSITORY_OWNER: ${{ github.repository_owner }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
PULL_REQUEST_NUMBER: ${{ github.event.number }}
uses: actions/github-script@v7
- name: Check commit name
uses: ansys/actions/commit-style@v6
with:
script: |
const response = await github.graphql(`query {
repository(owner: "${{ env.REPOSITORY_OWNER }}", name: "${{ env.REPOSITORY_NAME }}") {
pullRequest(number: ${{ env.PULL_REQUEST_NUMBER }}) {
title
}
}
}`)
const title = response.repository.pullRequest.title;
core.exportVariable('PR_TITLE', title);
- name: Check PR title format
run: |
if ! [[ "${{ env.PR_TITLE }}" =~ ^(FEATURE:|REFACT:|IMPROVE:|TEST:|DOC:|MAINT:|FIX:|CHORE:|CI:).* ]]; then
echo "ERROR: Pull Request title does not start with one of the valid prefixes: FEATURE:, REFACT:, IMPROVE:, TEST:, DOC:, MAINT:, FIX:, CHORE:, or CI:"
exit 1
fi
token: ${{ secrets.GITHUB_TOKEN }}
use-upper-case: true

doc-style:
name: Documentation style check
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ doc = [
"pypandoc>=1.10.0,<1.14",
# NOTE: Remove recommonmark once examples are reworked.
"recommonmark",
"Sphinx>=7.1.0,<7.3",
"Sphinx>=7.1.0,<7.4",
"sphinx-autobuild==2024.2.4; python_version == '3.8'",
"sphinx-autobuild==2024.2.4; python_version > '3.8'",
"sphinx-copybutton>=0.5.0,<0.6",
Expand Down
2 changes: 1 addition & 1 deletion src/pyedb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non
#

pyedb_path = os.path.dirname(__file__)
__version__ = "0.8.dev0"
__version__ = "0.9.dev0"
version = __version__

#
Expand Down
22 changes: 11 additions & 11 deletions src/pyedb/dotnet/edb_core/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ def create_port_on_component(
Type of port to create. ``CoaxPort`` generates solder balls.
``CircuitPort`` generates circuit ports on pins belonging to the net list.
do_pingroup : bool
True activate pingroup during port creation (only used with combination of CoaxPort),
True activate pingroup during port creation (only used with combination of CircPort),
False will take the closest reference pin and generate one port per signal pin.
refnet : string or list of string.
list of the reference net.
Expand Down Expand Up @@ -1016,17 +1016,10 @@ def create_port_on_component(
else:
self._logger.info("No pins found on component {} for the net {}".format(component, net))
else:
ref_pin_group = self.create_pingroup_from_pins(ref_pins)
if not ref_pin_group:
self._logger.warning("failed to create reference pin group")
return False
ref_pin_group_term = self._create_pin_group_terminal(ref_pin_group, isref=True)
for net in net_list:
pins = [pin for pin in cmp_pins if pin.GetNet().GetName() == net]
for pin in pins:
pin_group = self.create_pingroup_from_pins([pin])
pin_group_term = self._create_pin_group_terminal(pin_group, isref=False)
pin_group_term.SetReferenceTerminal(ref_pin_group_term)
self.create_port_on_pins(component, pin, ref_pins)
return True

@pyedb_function_handler()
Expand Down Expand Up @@ -1335,18 +1328,21 @@ def add_rlc_boundary(self, component=None, circuit_type=True):
return True

@pyedb_function_handler()
def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None):
def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None, term_type="circuit"):
"""Creates an EDB pin group terminal from a given EDB pin group.
Parameters
----------
pingroup : Edb pin group.
isref : bool
Specify if this terminal a reference terminal.
term_name : Terminal name (Optional). If not provided default name is Component name, Pin name, Net name.
str.
term_type: Type of terminal, gap, circuit or auto.
str.
Returns
-------
Edb pin group terminal.
Expand All @@ -1360,6 +1356,10 @@ def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None):
pingroup_term = self._edb.cell.terminal.PinGroupTerminal.Create(
self._active_layout, pingroup.GetNet(), term_name, pingroup, isref
)
if term_type == "circuit":
pingroup_term.SetIsCircuitPort(True)
elif term_type == "auto":
pingroup_term.SetIsAutoPort(True)
return pingroup_term

@pyedb_function_handler()
Expand Down Expand Up @@ -2295,7 +2295,7 @@ def get_pin_from_component(self, component, netName=None, pinName=None):
Filter on the net name as an alternative to
``pinName``. The default is ``None``.
pinName : str, optional
Filter on the pin name an an alternative to
Filter on the pin name an alternative to
``netName``. The default is ``None``.
Returns
Expand Down
18 changes: 17 additions & 1 deletion src/pyedb/dotnet/edb_core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ def _load_sources(self):
elif src_type == "current":
src_obj = self._pedb.create_current_source(pos_terminal, neg_terminal)
src_obj.magnitude = src["magnitude"]
src_obj.name = name

@pyedb_function_handler
def _load_setups(self):
Expand All @@ -401,6 +402,13 @@ def _load_setups(self):
self._pedb.logger.warning("Setup {} already existing. Editing it.".format(name))
edb_setup = self._pedb.setups[name]
edb_setup.set_dc_slider(setup["dc_slider_position"])
dc_ir_settings = setup.get("dc_ir_settings", None)
if dc_ir_settings:
for k, v in dc_ir_settings.items():
if k not in dir(edb_setup.dc_ir_settings):
self._pedb.logger.error(f"Invalid keyword {k}")
else:
setattr(edb_setup.dc_ir_settings, k, v)
else:
if setup_type.lower() == "hfss":
if name not in self._pedb.setups:
Expand Down Expand Up @@ -553,13 +561,21 @@ def _load_spice_models(self):
@pyedb_function_handler
def _load_pin_groups(self):
"""Imports pin groups information from JSON."""
comps = self._pedb.components.components
for pg in self.data["pin_groups"]:
name = pg["name"]
ref_designator = pg["reference_designator"]
if "pins" in pg:
self._pedb.siwave.create_pin_group(ref_designator, pg["pins"], name)
elif "net" in pg:
self._pedb.siwave.create_pin_group_on_net(ref_designator, pg["net"], name)
nets = pg["net"]
nets = nets if isinstance(nets, list) else [nets]
comp = comps[ref_designator]
pins = [p for p, obj in comp.pins.items() if obj.net_name in nets]
self._pedb.siwave.create_pin_group(ref_designator, pins, name)
else:
pins = [i for i in comps[ref_designator].pins.keys()]
self._pedb.siwave.create_pin_group(ref_designator, pins, name)

@pyedb_function_handler
def _load_nets(self):
Expand Down
9 changes: 5 additions & 4 deletions src/pyedb/dotnet/edb_core/dotnet/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,11 @@ def __init__(self, edbversion, student_version=False):
"""Initialize DLLs."""
from pyedb.dotnet.clr_module import _clr, edb_initialized

if settings.enable_screen_logs:
self._logger.enable_stdout_log()
else: # pragma: no cover
self._logger.disable_stdout_log()
if not settings.use_pyaedt_log:
if settings.enable_screen_logs:
self._logger.enable_stdout_log()
else: # pragma: no cover
self._logger.disable_stdout_log()
if not edb_initialized: # pragma: no cover
self._logger.error("Failed to initialize Dlls.")
return
Expand Down
2 changes: 1 addition & 1 deletion src/pyedb/dotnet/edb_core/edb_data/components_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def solder_ball_height(self):

@solder_ball_height.setter
def solder_ball_height(self, value):
if "GetSolderBallProperty" in dir(self.component_property) and value:
if "GetSolderBallProperty" in dir(self.component_property):
sball_height = round(self._edb.utility.Value(value).ToDouble(), 9)
cmp_property = self.component_property
solder_ball_prop = cmp_property.GetSolderBallProperty().Clone()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
convert_pydict_to_netdict,
)
from pyedb.dotnet.edb_core.utilities.simulation_setup import BaseSimulationSetup
from pyedb.dotnet.sim_setup_data.data.siw_dc_ir_settings import SiwaveDCIRSettings
from pyedb.generic.general_methods import is_linux, pyedb_function_handler


Expand Down Expand Up @@ -1144,6 +1145,11 @@ def create(self, name=None):
self.set_dc_slider(1)
return self

@property
def dc_ir_settings(self):
"""DC IR settings."""
return SiwaveDCIRSettings(self)

@pyedb_function_handler
def get_configurations(self):
"""Get SIwave DC simulation settings.
Expand Down
16 changes: 8 additions & 8 deletions src/pyedb/dotnet/edb_core/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def update(self, input_dict: dict):
for attribute in ATTRIBUTES:
if attribute in input_dict:
setattr(self, attribute, input_dict[attribute])
if "loss_tangent" in input_dict:
if "loss_tangent" in input_dict: # pragma: no cover
setattr(self, "loss_tangent", input_dict["loss_tangent"])

# Update DS model
Expand Down Expand Up @@ -534,7 +534,7 @@ def add_material(self, name: str, **kwargs):
material_def = self.__edb_definition.MaterialDef.Create(self.__edb.active_db, name)
material = Material(self.__edb, material_def)
attributes_input_dict = {key: val for (key, val) in kwargs.items() if key in ATTRIBUTES + DC_ATTRIBUTES}
if "loss_tangent" in kwargs:
if "loss_tangent" in kwargs: # pragma: no cover
warnings.warn(
"This key is deprecated in versions >0.7.0 and will soon be removed. "
"Use key dielectric_loss_tangent instead.",
Expand Down Expand Up @@ -637,7 +637,7 @@ def add_djordjevicsarkar_dielectric(
material = self.__add_dielectric_material_model(name, material_model)
for key, value in kwargs.items():
setattr(material, key, value)
if "loss_tangent" in kwargs:
if "loss_tangent" in kwargs: # pragma: no cover
warnings.warn(
"This key is deprecated in versions >0.7.0 and will soon be removed. "
"Use key dielectric_loss_tangent instead.",
Expand Down Expand Up @@ -703,7 +703,7 @@ def add_debye_material(
material = self.__add_dielectric_material_model(name, material_model)
for key, value in kwargs.items():
setattr(material, key, value)
if "loss_tangent" in kwargs:
if "loss_tangent" in kwargs: # pragma: no cover
warnings.warn(
"This key is deprecated in versions >0.7.0 and will soon be removed. "
"Use key dielectric_loss_tangent instead.",
Expand Down Expand Up @@ -766,7 +766,7 @@ def add_multipole_debye_material(
material = self.__add_dielectric_material_model(name, material_model)
for key, value in kwargs.items():
setattr(material, key, value)
if "loss_tangent" in kwargs:
if "loss_tangent" in kwargs: # pragma: no cover
warnings.warn(
"This key is deprecated in versions >0.7.0 and will soon be removed. "
"Use key dielectric_loss_tangent instead.",
Expand Down Expand Up @@ -842,7 +842,7 @@ def update_material(self, material_name, input_dict):

material = self[material_name]
attributes_input_dict = {key: val for (key, val) in input_dict.items() if key in ATTRIBUTES + DC_ATTRIBUTES}
if "loss_tangent" in input_dict:
if "loss_tangent" in input_dict: # pragma: no cover
warnings.warn(
"This key is deprecated in versions >0.7.0 and will soon be removed. "
"Use key dielectric_loss_tangent instead.",
Expand All @@ -864,7 +864,7 @@ def load_material(self, material):
self.add_conductor_material(material_name, material_conductivity)
else:
material_permittivity = material["permittivity"]
if "loss_tangent" in material:
if "loss_tangent" in material: # pragma: no cover
warnings.warn(
"This key is deprecated in versions >0.7.0 and will soon be removed. "
"Use key dielectric_loss_tangent instead.",
Expand Down Expand Up @@ -938,7 +938,7 @@ def load_amat(self, amat_file):
if "tangent_delta" in material_properties:
material_properties["dielectric_loss_tangent"] = material_properties["tangent_delta"]
del material_properties["tangent_delta"]
elif "loss_tangent" in material_properties:
elif "loss_tangent" in material_properties: # pragma: no cover
warnings.warn(
"This key is deprecated in versions >0.7.0 and will soon be removed. "
"Use key dielectric_loss_tangent instead.",
Expand Down
31 changes: 31 additions & 0 deletions src/pyedb/dotnet/edb_core/siwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,3 +1454,34 @@ def place_voltage_probe(
p_terminal = self._pedb.get_point_terminal(name, positive_net_name, positive_location, positive_layer)
n_terminal = self._pedb.get_point_terminal(name + "_ref", negative_net_name, negative_location, negative_layer)
return self._pedb.create_voltage_probe(p_terminal, n_terminal)

@property
def icepak_use_minimal_comp_defaults(self):
"""Icepak default setting. If "True", only resistor are active in Icepak simulation.
The power dissipation of the resistors are calculated from DC results.
"""
siwave_id = self._pedb.edb_api.ProductId.SIWave
cell = self._pedb.active_cell._active_cell
_, value = cell.GetProductProperty(siwave_id, 422, "")
return bool(value)

@icepak_use_minimal_comp_defaults.setter
def icepak_use_minimal_comp_defaults(self, value):
value = "True" if bool(value) else ""
siwave_id = self._pedb.edb_api.ProductId.SIWave
cell = self._pedb.active_cell._active_cell
cell.SetProductProperty(siwave_id, 422, value)

@property
def icepak_component_file(self):
"""Icepak component file path."""
siwave_id = self._pedb.edb_api.ProductId.SIWave
cell = self._pedb.active_cell._active_cell
_, value = cell.GetProductProperty(siwave_id, 420, "")
return value

@icepak_component_file.setter
def icepak_component_file(self, value):
siwave_id = self._pedb.edb_api.ProductId.SIWave
cell = self._pedb.active_cell._active_cell
cell.SetProductProperty(siwave_id, 420, value)
2 changes: 1 addition & 1 deletion src/pyedb/dotnet/edb_core/stackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,7 @@ def import_stackup(self, file_path):
>>> edb.stackup.import_stackup("stackup.xml")
"""

self._logger.warning("Method export_stackup is deprecated. Use .export.")
self._logger.warning("Method import_stackup is deprecated. Use .load")
return self.load(file_path)

@pyedb_function_handler()
Expand Down
46 changes: 46 additions & 0 deletions src/pyedb/dotnet/sim_setup_data/data/siw_dc_ir_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


class SiwaveDCIRSettings:
"""Class for DC IR settings."""

def __init__(self, parent):
self._parent = parent

@property
def export_dc_thermal_data(self):
"""Export DC Thermal Data.
Returns
-------
bool
``True`` when activated, ``False`` deactivated.
"""
return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.ExportDCThermalData

@export_dc_thermal_data.setter
def export_dc_thermal_data(self, value):
edb_setup_info = self._parent.get_sim_setup_info
edb_setup_info.SimulationSettings.DCIRSettings.ExportDCThermalData = value
self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info)
self._parent._update_setup()
Loading

0 comments on commit 408d446

Please sign in to comment.