Skip to content

Commit

Permalink
FEAT: Broadband simulation setup support with SimulationConfiguration…
Browse files Browse the repository at this point in the history
… class (#421)

* ic db

* ic db

* ic db

* ic db

* switching 24.2

* layermap support added

* layermap support added

* stackup loading mode

* updating all cells

* updating all cells

* RaptorXSimulationSettings

* RaptorX setup support added

* RaptorX setup Frequency sweep added

* RaptorX setup test added

* IC Layout removed

* simsetup

* more files

* RaptorX setup logger added

* RaptorX setup logger added

* Test AEDT version with RaptorX fix

* Test AEDT version with RaptorX fix

* Update src/pyedb/dotnet/edb_core/utilities/simulation_setup.py

Co-authored-by: Sébastien Morais <[email protected]>

* Update src/pyedb/dotnet/edb_core/utilities/simulation_setup.py

Co-authored-by: Sébastien Morais <[email protected]>

* Update tests/legacy/system/conftest.py

Co-authored-by: Hui Zhou <[email protected]>

* Update tests/legacy/system/test_edb.py

Co-authored-by: Hui Zhou <[email protected]>

* Update simulation_setup.py

* MISC: Auto fixes from pre-commit.com hooks

For more information, see https://pre-commit.ci

* bug fix

* RaptorX bug introduced fix

* RaptorX bug introduced fix

* RaptorX bug introduced fix

* Update src/pyedb/dotnet/edb_core/edb_data/simulation_configuration.py

Co-authored-by: Sébastien Morais <[email protected]>

---------

Co-authored-by: Sébastien Morais <[email protected]>
Co-authored-by: Hui Zhou <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored May 2, 2024
1 parent bd06c01 commit 127ab51
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
from pyedb.generic.general_methods import generate_unique_name, pyedb_function_handler


class AdaptiveType(object):
(SingleFrequency, MultiFrequency, BroadBand) = range(0, 3)


class MeshOperation(object):
"""Mesh Operation Class."""

Expand Down
49 changes: 49 additions & 0 deletions src/pyedb/dotnet/edb_core/edb_data/simulation_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import os

from pyedb.dotnet.clr_module import Dictionary
from pyedb.dotnet.edb_core.edb_data.hfss_simulation_setup_data import AdaptiveType
from pyedb.dotnet.edb_core.edb_data.sources import Source, SourceType
from pyedb.generic.constants import (
BasisOrder,
Expand Down Expand Up @@ -1249,6 +1250,9 @@ def __init__(self):
self._snap_length_threshold = "2.5um"
self._min_plane_area_to_mesh = "4mil2" # Newly Added
self._mesh_sizefactor = 0.0
self._adaptive_type = AdaptiveType.SingleFrequency
self._adaptive_low_freq = "0GHz"
self._adaptive_high_freq = "20GHz"

@property
def sweep_interpolating(self): # pragma: no cover
Expand Down Expand Up @@ -1902,6 +1906,51 @@ def mesh_sizefactor(self, value):
if value > 0.0:
self._do_lambda_refinement = False

@property
def adaptive_type(self):
"""HFSS adaptive type.
Returns
-------
class: pyedb.dotnet.edb_core.edb_data.hfss_simulation_setup_data.AdaptiveType
"""
return self._adaptive_type

@adaptive_type.setter
def adaptive_type(self, value):
if isinstance(value, int) and value in range(3):
self._adaptive_type = value

@property
def adaptive_low_freq(self):
"""HFSS broadband low frequency adaptive meshing.
Returns
-------
str
"""
return self._adaptive_low_freq

@adaptive_low_freq.setter
def adaptive_low_freq(self, value):
if isinstance(value, str):
self._adaptive_low_freq = value

@property
def adaptive_high_freq(self):
"""HFSS broadband high frequency adaptive meshing.
Returns
-------
str
"""
return self._adaptive_high_freq

@adaptive_high_freq.setter
def adaptive_high_freq(self, value):
if isinstance(value, str):
self._adaptive_high_freq = value


class SimulationConfiguration(object):
"""Provides an ASCII simulation configuration file parser.
Expand Down
40 changes: 29 additions & 11 deletions src/pyedb/dotnet/edb_core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,25 +1276,43 @@ def configure_hfss_analysis_setup(self, simulation_setup=None):
as argument"
)
return False
adapt = self._pedb.simsetupdata.AdaptiveFrequencyData()
adapt.AdaptiveFrequency = simulation_setup.mesh_freq
adapt.MaxPasses = int(simulation_setup.max_num_passes)
adapt.MaxDelta = str(simulation_setup.max_mag_delta_s)
simsetup_info = self._pedb.simsetupdata.SimSetupInfo[self._pedb.simsetupdata.HFSSSimulationSettings]()
simsetup_info.Name = simulation_setup.setup_name

if simulation_setup.ac_settings.adaptive_type == 0:
adapt = self._pedb.simsetupdata.AdaptiveFrequencyData()
adapt.AdaptiveFrequency = simulation_setup.mesh_freq
adapt.MaxPasses = int(simulation_setup.max_num_passes)
adapt.MaxDelta = str(simulation_setup.max_mag_delta_s)
if is_ironpython:
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList.Clear()
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList.Add(adapt)
else:
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList = (
convert_py_list_to_net_list([adapt])
)
elif simulation_setup.ac_settings.adaptive_type == 2:
low_freq_adapt_data = self._pedb.simsetupdata.AdaptiveFrequencyData()
low_freq_adapt_data.MaxDelta = str(simulation_setup.max_mag_delta_s)
low_freq_adapt_data.MaxPasses = int(simulation_setup.max_num_passes)
low_freq_adapt_data.AdaptiveFrequency = simulation_setup.ac_settings.adaptive_low_freq
high_freq_adapt_data = self._pedb.simsetupdata.AdaptiveFrequencyData()
high_freq_adapt_data.MaxDelta = str(simulation_setup.max_mag_delta_s)
high_freq_adapt_data.MaxPasses = int(simulation_setup.max_num_passes)
high_freq_adapt_data.AdaptiveFrequency = simulation_setup.ac_settings.adaptive_high_freq
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptType = (
self._pedb.simsetupdata.AdaptiveSettings.TAdaptType.kBroadband
)
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList.Clear()
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList.Add(low_freq_adapt_data)
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList.Add(high_freq_adapt_data)

simsetup_info.SimulationSettings.CurveApproxSettings.ArcAngle = simulation_setup.arc_angle
simsetup_info.SimulationSettings.CurveApproxSettings.UseArcToChordError = (
simulation_setup.use_arc_to_chord_error
)
simsetup_info.SimulationSettings.CurveApproxSettings.ArcToChordError = simulation_setup.arc_to_chord_error
if is_ironpython:
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList.Clear()
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList.Add(adapt)
else:
simsetup_info.SimulationSettings.AdaptiveSettings.AdaptiveFrequencyDataList = convert_py_list_to_net_list(
[adapt]
)

simsetup_info.SimulationSettings.InitialMeshSettings.LambdaRefine = simulation_setup.do_lambda_refinement
if simulation_setup.mesh_sizefactor > 0.0:
simsetup_info.SimulationSettings.InitialMeshSettings.MeshSizefactor = simulation_setup.mesh_sizefactor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"filename": null,
"open_edb_after_build": true,
"dc_settings": {
"dc_compute_inductance": false,
"dc_contact_radius": "100um",
"dc_slide_position": 1,
"dc_use_dc_custom_settings": false,
"dc_plot_jv": true,
"dc_min_plane_area_to_mesh": "8mil2",
"dc_min_void_area_to_mesh": "0.734mil2",
"dc_error_energy": 0.02,
"dc_max_init_mesh_edge_length": "5.0mm",
"dc_max_num_pass": 5,
"dc_min_num_pass": 1,
"dc_mesh_bondwires": true,
"dc_num_bondwire_sides": 8,
"dc_mesh_vias": true,
"dc_num_via_sides": 8,
"dc_percent_local_refinement": 0.2,
"dc_perform_adaptive_refinement": true,
"dc_refine_bondwires": true,
"dc_refine_vias": true,
"dc_report_config_file": "",
"dc_report_show_Active_devices": true,
"dc_export_thermal_data": true,
"dc_full_report_path": "",
"dc_icepak_temp_file": "",
"dc_import_thermal_data": false,
"dc_per_pin_res_path": "",
"dc_per_pin_use_pin_format": true,
"dc_use_loop_res_for_per_pin": true,
"dc_via_report_path": "",
"dc_source_terms_to_ground": {}
},
"ac_settings": {
"sweep_interpolating": true,
"use_q3d_for_dc": false,
"relative_error": 0.005,
"use_error_z0": false,
"percentage_error_z0": 1,
"enforce_causality": true,
"enforce_passivity": false,
"passivity_tolerance": 0.0001,
"sweep_name": "Sweep1",
"radiation_box": 2,
"start_freq": "0.0GHz",
"stop_freq": "10.0GHz",
"sweep_type": 0,
"step_freq": "0.025GHz",
"decade_count": 100,
"mesh_freq": "3GHz",
"max_num_passes": 30,
"max_mag_delta_s": 0.03,
"min_num_passes": 1,
"basis_order": -1,
"do_lambda_refinement": true,
"arc_angle": "30deg",
"start_azimuth": 0,
"max_arc_points": 8,
"use_arc_to_chord_error": true,
"arc_to_chord_error": "1um",
"defeature_abs_length": "1um",
"defeature_layout": true,
"minimum_void_surface": 0,
"max_suf_dev": 0.001,
"process_padstack_definitions": false,
"return_current_distribution": true,
"ignore_non_functional_pads": true,
"include_inter_plane_coupling": true,
"xtalk_threshold": -50,
"min_void_area": "0.01mm2",
"min_pad_area_to_mesh": "0.01mm2",
"snap_length_threshold": "2.5um",
"min_plane_area_to_mesh": "4mil2",
"mesh_sizefactor": 0.0,
"adaptive_type": 2,
"adaptive_low_freq": "0GHz",
"adaptive_high_freq": "20GHz"
},
"batch_solve_settings": {
"signal_nets": [],
"power_nets": [],
"components": [],
"cutout_subdesign_type": 1,
"cutout_subdesign_expansion": 0.001,
"cutout_subdesign_round_corner": true,
"use_default_cutout": false,
"generate_excitations": true,
"add_frequency_sweep": true,
"include_only_selected_nets": false,
"generate_solder_balls": true,
"coax_solder_ball_diameter": [],
"use_default_coax_port_radial_extension": true,
"trim_reference_size": false,
"output_aedb": null,
"signal_layers_properties": {},
"coplanar_instances": [],
"signal_layer_etching_instances": [],
"etching_factor_instances": [],
"use_dielectric_extent_multiple": true,
"dielectric_extent": 0.001,
"use_airbox_horizontal_multiple": true,
"airbox_horizontal_extent": 0.1,
"use_airbox_negative_vertical_extent_multiple": true,
"airbox_negative_vertical_extent": 0.1,
"use_airbox_positive_vertical_extent_multiple": true,
"airbox_positive_vertical_extent": 0.1,
"honor_user_dielectric": false,
"truncate_airbox_at_ground": false,
"use_radiation_boundary": true,
"do_cutout_subdesign": true,
"do_pin_group": true,
"sources": []
},
"setup_name": "Pyaedt_setup",
"solver_type": 6
}
12 changes: 12 additions & 0 deletions tests/legacy/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1833,3 +1833,15 @@ def test_icepak(self, edb_examples):
edbapp.siwave.icepak_component_file = edb_examples.get_local_file_folder("siwave/icepak_component.pwrd")
assert edbapp.siwave.icepak_component_file == edb_examples.get_local_file_folder("siwave/icepak_component.pwrd")
edbapp.close()

def test_adaptive_broadband_setup_from_configfile(self):
source_path = os.path.join(local_path, "example_models", test_subfolder, "ANSYS-HSD_V1.aedb")
target_path = os.path.join(self.local_scratch.path, "test_adaptive_broadband.aedb")
self.local_scratch.copyfolder(source_path, target_path)
edbapp = Edb(target_path, edbversion=desktop_version)
cfg_file = os.path.join(target_path, "config_adaptive_broadband.json")
sim_config = edbapp.new_simulation_configuration()
sim_config.import_json(cfg_file)
assert edbapp.build_simulation_project(sim_config)
assert edbapp.setups["Pyaedt_setup"].adaptive_settings.adapt_type == "kBroadband"
edbapp.close()

0 comments on commit 127ab51

Please sign in to comment.