From e767081223f643ba429ba2ac478f77805ecb034d Mon Sep 17 00:00:00 2001 From: gkorompi <156683163+gkorompi@users.noreply.github.com> Date: Wed, 22 May 2024 16:50:41 +0300 Subject: [PATCH] FIX: import thermal (#497) * FIX: import thermal * FIX: import thermal * FIX: import thermal * FIX: import thermal * FIX: import thermal * FIX: import thermal * FIX: dcir settings * FIX: * MISC: Auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci * FIX: * MISC: Auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci --------- Co-authored-by: ring630 <@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: svandenb-dev <74993647+svandenb-dev@users.noreply.github.com> --- .../edb_data/siwave_simulation_setup_data.py | 6 +- .../edb_core/sim_setup_data/__init__.py | 3 + .../edb_core/sim_setup_data/data/__init__.py | 3 + .../sim_setup_data/data/siw_dc_ir_settings.py | 235 ++++++++++++++++++ .../sim_setup_data/data/siw_dc_ir_settings.py | 46 ---- tests/legacy/system/test_edb.py | 23 ++ 6 files changed, 268 insertions(+), 48 deletions(-) create mode 100644 src/pyedb/dotnet/edb_core/sim_setup_data/__init__.py create mode 100644 src/pyedb/dotnet/edb_core/sim_setup_data/data/__init__.py create mode 100644 src/pyedb/dotnet/edb_core/sim_setup_data/data/siw_dc_ir_settings.py delete mode 100644 src/pyedb/dotnet/sim_setup_data/data/siw_dc_ir_settings.py diff --git a/src/pyedb/dotnet/edb_core/edb_data/siwave_simulation_setup_data.py b/src/pyedb/dotnet/edb_core/edb_data/siwave_simulation_setup_data.py index a9bb935193..d25e42f211 100644 --- a/src/pyedb/dotnet/edb_core/edb_data/siwave_simulation_setup_data.py +++ b/src/pyedb/dotnet/edb_core/edb_data/siwave_simulation_setup_data.py @@ -26,8 +26,10 @@ convert_netdict_to_pydict, convert_pydict_to_netdict, ) +from pyedb.dotnet.edb_core.sim_setup_data.data.siw_dc_ir_settings import ( + SiwaveDCIRSettings, +) 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 @@ -986,7 +988,7 @@ def get_sim_setup_info(self): val = val.replace("SourceTermsToGround(", "").replace(")", "").split(",") for v in val: source = v.split("=") - sources[source[0]] = source[1] + sources[source[0]] = int(source[1].replace("'", "")) edb_sim_setup_info.SimulationSettings.DCIRSettings.SourceTermsToGround = convert_pydict_to_netdict( sources ) diff --git a/src/pyedb/dotnet/edb_core/sim_setup_data/__init__.py b/src/pyedb/dotnet/edb_core/sim_setup_data/__init__.py new file mode 100644 index 0000000000..c23e620fca --- /dev/null +++ b/src/pyedb/dotnet/edb_core/sim_setup_data/__init__.py @@ -0,0 +1,3 @@ +from pathlib import Path + +workdir = Path(__file__).parent diff --git a/src/pyedb/dotnet/edb_core/sim_setup_data/data/__init__.py b/src/pyedb/dotnet/edb_core/sim_setup_data/data/__init__.py new file mode 100644 index 0000000000..c23e620fca --- /dev/null +++ b/src/pyedb/dotnet/edb_core/sim_setup_data/data/__init__.py @@ -0,0 +1,3 @@ +from pathlib import Path + +workdir = Path(__file__).parent diff --git a/src/pyedb/dotnet/edb_core/sim_setup_data/data/siw_dc_ir_settings.py b/src/pyedb/dotnet/edb_core/sim_setup_data/data/siw_dc_ir_settings.py new file mode 100644 index 0000000000..785524ae37 --- /dev/null +++ b/src/pyedb/dotnet/edb_core/sim_setup_data/data/siw_dc_ir_settings.py @@ -0,0 +1,235 @@ +# 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. + +from pyedb.dotnet.edb_core.general import ( + convert_netdict_to_pydict, + convert_pydict_to_netdict, +) + + +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() + + @property + def import_thermal_data(self): + """Import Thermal Data. + + Returns + ------- + bool + ``True`` when activated, ``False`` deactivated. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.ImportThermalData + + @import_thermal_data.setter + def import_thermal_data(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.ImportThermalData = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def dc_report_show_active_devices(self): + """DC Report Show Active Devices. + + Returns + ------- + bool + ``True`` when activated, ``False`` deactivated. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.DCReportShowActiveDevices + + @dc_report_show_active_devices.setter + def dc_report_show_active_devices(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.DCReportShowActiveDevices = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def per_pin_use_pin_format(self): + """Per Pin Use Pin Format. + + Returns + ------- + bool + ``True`` when activated, ``False`` deactivated. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.PerPinUsePinFormat + + @per_pin_use_pin_format.setter + def per_pin_use_pin_format(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.PerPinUsePinFormat = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def use_loop_res_for_per_pin(self): + """Use loop Res Per Pin. + + Returns + ------- + bool + ``True`` when activated, ``False`` deactivated. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.UseLoopResForPerPin + + @use_loop_res_for_per_pin.setter + def use_loop_res_for_per_pin(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.UseLoopResForPerPin = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def dc_report_config_file(self): + """DC Report Config File. + + Returns + ------- + str + path to the DC report configuration file. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.DCReportConfigFile + + @dc_report_config_file.setter + def dc_report_config_file(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.DCReportConfigFile = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def full_dc_report_path(self): + """Full DC Report Path. + + Returns + ------- + str + full path to the DC report file. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.FullDCReportPath + + @full_dc_report_path.setter + def full_dc_report_path(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.FullDCReportPath = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def icepak_temp_file(self): + """Icepack Temp File. + + Returns + ------- + str + path to the temp Icepak file. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.IcepakTempFile + + @icepak_temp_file.setter + def icepak_temp_file(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.IcepakTempFile = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def per_pin_res_path(self): + """Per Pin Res Path. + + Returns + ------- + str + path for per pin res. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.PerPinResPath + + @per_pin_res_path.setter + def per_pin_res_path(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.PerPinResPath = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def via_report_path(self): + """Via Report Path. + + Returns + ------- + str + path for the Via Report. + """ + return self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.ViaReportPath + + @via_report_path.setter + def via_report_path(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.ViaReportPath = value + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() + + @property + def source_terms_to_ground(self): + """A dictionary of SourceName, NodeToGround pairs, + where NodeToGround is one of 0 (unspecified), 1 (negative), 2 (positive). + + + Returns + ------- + dict + str: source name, + int: node to ground pairs, 0 (unspecified), 1 (negative), 2 (positive) . + """ + temp = self._parent.get_sim_setup_info.SimulationSettings.DCIRSettings.SourceTermsToGround + return convert_netdict_to_pydict(temp) + + @source_terms_to_ground.setter + def source_terms_to_ground(self, value): + edb_setup_info = self._parent.get_sim_setup_info + edb_setup_info.SimulationSettings.DCIRSettings.SourceTermsToGround = convert_pydict_to_netdict(value) + self._parent._edb_object = self._parent._set_edb_setup_info(edb_setup_info) + self._parent._update_setup() diff --git a/src/pyedb/dotnet/sim_setup_data/data/siw_dc_ir_settings.py b/src/pyedb/dotnet/sim_setup_data/data/siw_dc_ir_settings.py deleted file mode 100644 index f0f1f0c3c2..0000000000 --- a/src/pyedb/dotnet/sim_setup_data/data/siw_dc_ir_settings.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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() diff --git a/tests/legacy/system/test_edb.py b/tests/legacy/system/test_edb.py index b3523ab0ad..33e29a3ff0 100644 --- a/tests/legacy/system/test_edb.py +++ b/tests/legacy/system/test_edb.py @@ -1896,3 +1896,26 @@ def test_create_hfss_pi_setup(self): assert setup.settings.snap_length_threshold == "5um" setup.settings.surface_roughness_model = "Hammerstad" assert setup.settings.surface_roughness_model == "Hammerstad" + + def test_dcir_properties(self, edb_examples): + edbapp = edb_examples.get_si_verse() + setup = edbapp.create_siwave_dc_setup() + setup.dc_ir_settings.export_dc_thermal_data = True + assert setup.dc_ir_settings.export_dc_thermal_data == True + assert not setup.dc_ir_settings.import_thermal_data + setup.dc_ir_settings.dc_report_show_active_devices = True + assert setup.dc_ir_settings.dc_report_show_active_devices == True + assert not setup.dc_ir_settings.per_pin_use_pin_format + assert setup.dc_ir_settings.use_loop_res_for_per_pin + setup.dc_ir_settings.dc_report_config_file = edbapp.edbpath + assert setup.dc_ir_settings.dc_report_config_file + setup.dc_ir_settings.full_dc_report_path = edbapp.edbpath + assert setup.dc_ir_settings.full_dc_report_path + setup.dc_ir_settings.icepak_temp_file = edbapp.edbpath + assert setup.dc_ir_settings.icepak_temp_file + setup.dc_ir_settings.per_pin_res_path = edbapp.edbpath + assert setup.dc_ir_settings.per_pin_res_path + setup.dc_ir_settings.via_report_path = edbapp.edbpath + assert setup.dc_ir_settings.via_report_path + setup.dc_ir_settings.source_terms_to_ground = {"test": 1} + assert setup.dc_ir_settings.source_terms_to_ground