Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Siwave SYZ bug fix and refactor #3840

Merged
merged 67 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
d3b429a
fix
samomania21 Nov 1, 2023
ea7e89c
fix
samomania21 Nov 1, 2023
fd8cbd4
fix
samomania21 Nov 2, 2023
153bfe2
fix
samomania21 Nov 2, 2023
0e96de3
fix
samomania21 Nov 2, 2023
d40a99e
fix
samomania21 Nov 2, 2023
3d1092b
fix
samomania21 Nov 2, 2023
14ca27a
fix
samomania21 Nov 2, 2023
9e4b946
fix
samomania21 Nov 2, 2023
a55af55
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 2, 2023
de15d37
fix
samomania21 Nov 2, 2023
cb52d94
fix
samomania21 Nov 3, 2023
233e3c3
fix
samomania21 Nov 3, 2023
119cc20
Update pyaedt/edb_core/edb_data/simulation_setup.py
MaxJPRey Nov 3, 2023
c9fa1a5
fix
samomania21 Nov 3, 2023
eb5f49f
fix
samomania21 Nov 4, 2023
fa5a38e
fix
samomania21 Nov 4, 2023
35b50b3
Merge remote-tracking branch 'origin/freq_sweep_bug_fix' into freq_sw…
samomania21 Nov 4, 2023
4e86b43
fix
samomania21 Nov 4, 2023
443c79e
fix
samomania21 Nov 4, 2023
fb9810e
fix
samomania21 Nov 4, 2023
8fe918e
fix
samomania21 Nov 4, 2023
ce23745
fix
samomania21 Nov 4, 2023
c9c974c
fix
samomania21 Nov 5, 2023
b864ed8
fix
samomania21 Nov 5, 2023
8bb833c
fix
samomania21 Nov 5, 2023
fa86a63
Merge branch 'main' into freq_sweep_bug_fix
samomania21 Nov 5, 2023
5e6c28d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 5, 2023
856608a
fix
samomania21 Nov 5, 2023
0988ccb
fix
samomania21 Nov 5, 2023
2df4eb0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 5, 2023
c8e6fa0
fix
samomania21 Nov 5, 2023
d181f7f
Merge remote-tracking branch 'origin/freq_sweep_bug_fix' into freq_sw…
samomania21 Nov 5, 2023
f4ff124
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 5, 2023
093b79b
fix
samomania21 Nov 5, 2023
8715192
Merge remote-tracking branch 'origin/freq_sweep_bug_fix' into freq_sw…
samomania21 Nov 5, 2023
8d33dc4
fix
samomania21 Nov 5, 2023
69160bd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 5, 2023
5763bdd
fix
samomania21 Nov 6, 2023
fb460e9
fix
samomania21 Nov 6, 2023
4f9c69d
fix
samomania21 Nov 6, 2023
f92761b
Merge remote-tracking branch 'origin/freq_sweep_bug_fix' into freq_sw…
samomania21 Nov 6, 2023
132cb9c
fix
samomania21 Nov 6, 2023
6fbf3da
fix
samomania21 Nov 6, 2023
769b987
fix
samomania21 Nov 6, 2023
fdde290
Update pyaedt/edb_core/edb_data/simulation_setup.py
hui-zhou-a Nov 6, 2023
a7b52c1
Update pyaedt/generic/LoadAEDTFile.py
hui-zhou-a Nov 6, 2023
835df9a
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
bd5d254
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
2ff38fd
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
c240b0c
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
9df3bba
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
9503e67
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
26e7012
Update pyaedt/edb_core/edb_data/simulation_setup.py
hui-zhou-a Nov 6, 2023
cd3b323
Update pyaedt/edb_core/edb_data/simulation_setup.py
hui-zhou-a Nov 6, 2023
9f243dc
Update pyaedt/edb_core/edb_data/simulation_setup.py
hui-zhou-a Nov 6, 2023
e671e1a
Update pyaedt/edb_core/edb_data/simulation_setup.py
hui-zhou-a Nov 6, 2023
7446c16
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
a4e5bfb
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
bd3c341
fix
samomania21 Nov 6, 2023
faf1b98
Update pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
hui-zhou-a Nov 6, 2023
dc7d54e
fix
samomania21 Nov 6, 2023
c932e28
Merge remote-tracking branch 'origin/freq_sweep_bug_fix' into freq_sw…
samomania21 Nov 6, 2023
665daf3
fix
samomania21 Nov 6, 2023
76614e9
fix
samomania21 Nov 7, 2023
bc4bbd7
fix
samomania21 Nov 8, 2023
bd8e2c7
Update pyaedt/edb.py
svandenb-dev Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 48 additions & 142 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,7 @@ def test_129_hfss_simulation_setup(self):
setup1.hfss_solver_settings.relative_residual = 0.0002
setup1.hfss_solver_settings.use_shell_elements = True

setup1b = edbapp.setups["setup1"]
hfss_solver_settings = edbapp.setups["setup1"].hfss_solver_settings
assert hfss_solver_settings.order_basis == "first"
assert hfss_solver_settings.relative_residual == 0.0002
Expand Down Expand Up @@ -2226,72 +2227,55 @@ def test_129_hfss_simulation_setup(self):

def test_130_siwave_dc_simulation_setup(self):
setup1 = self.edbapp.create_siwave_dc_setup("DC1")
assert setup1.name == "DC1"
assert not setup1.compute_inductance
assert setup1.contact_radius == "0.1mm"
assert setup1.dc_slider_position == 1
assert setup1.enabled
assert setup1.energy_error == 3.0
assert setup1.max_init_mesh_edge_length == "2.5mm"
assert setup1.max_num_pass == 5
assert setup1.min_num_pass == 1
assert setup1.mesh_bondwires
assert setup1.mesh_vias
assert setup1.min_plane_area == "0.25mm2"
assert setup1.min_void_area == "0.01mm2"
assert setup1.num_bondwire_sides == 8
assert setup1.num_via_sides == 8
assert setup1.percent_local_refinement == 20.0
assert setup1.perform_adaptive_refinement
assert setup1.plot_jv
assert not setup1.refine_bondwires
assert not setup1.refine_vias
setup1.name = "DC2"
setup1.compute_inductance = True
setup1.contact_radius = "0.2mm"
setup1.dc_slider_position = 2
setup1.energy_error = 2.0
setup1.max_init_mesh_edge_length = "5.5mm"
setup1.max_num_pass = 3
setup1.min_num_pass = 2
setup1.mesh_bondwires = False
setup1.mesh_vias = False
assert not setup1.mesh_bondwires
assert not setup1.mesh_vias
setup1.min_plane_area = "0.5mm2"
setup1.min_void_area = "0.021mm2"
setup1.num_bondwire_sides = 6
setup1.num_via_sides = 10
setup1.percent_local_refinement = 10.0
setup1.perform_adaptive_refinement = False
setup1.plot_jv = False
setup1.refine_bondwires = True
setup1.refine_vias = True

assert setup1.name == "DC2"
assert setup1.compute_inductance
assert setup1.contact_radius == "0.2mm"
assert setup1.dc_slider_position == 2
assert setup1.energy_error == 2.0
assert setup1.max_init_mesh_edge_length == "5.5mm"
assert setup1.max_num_pass == 3
assert setup1.min_num_pass == 2
assert setup1.mesh_bondwires
assert setup1.mesh_vias
assert setup1.min_plane_area == "0.5mm2"
assert setup1.min_void_area == "0.021mm2"
assert setup1.num_bondwire_sides == 6
assert setup1.num_via_sides == 10
assert setup1.percent_local_refinement == 10.0
assert not setup1.perform_adaptive_refinement
assert not setup1.plot_jv
assert setup1.refine_bondwires
assert setup1.refine_vias
setup1.dc_settings.restore_default()
setup1.dc_advanced_settings.restore_default()

settings = self.edbapp.setups["DC1"].get_configurations()
for k, v in setup1.dc_settings.defaults.items():
if k in ["compute_inductance", "plot_jv"]:
continue
print(k)
assert settings["dc_settings"][k] == v

for k, v in setup1.dc_advanced_settings.defaults.items():
print(k)
assert settings["dc_advanced_settings"][k] == v

for p in [0, 1, 2]:
setup1.set_dc_slider(p)
settings = self.edbapp.setups["DC1"].get_configurations()
for k, v in setup1.dc_settings.dc_defaults.items():
print(k)
assert settings["dc_settings"][k] == v[p]

for k, v in setup1.dc_advanced_settings.dc_defaults.items():
print(k)
assert settings["dc_advanced_settings"][k] == v[p]

def test_131_siwave_ac_simulation_setup(self):
setup1 = self.edbapp.create_siwave_syz_setup("AC1")
assert setup1.name == "AC1"
assert setup1.enabled
setup1.advanced_settings.restore_default()

settings = self.edbapp.setups["AC1"].get_configurations()
for k, v in setup1.advanced_settings.defaults.items():
if k in ["min_plane_area_to_mesh"]:
continue
assert settings["advanced_settings"][k] == v

for p in [0, 1, 2]:
setup1.set_si_slider(p)
settings = self.edbapp.setups["AC1"].get_configurations()
for k, v in setup1.advanced_settings.si_defaults.items():
assert settings["advanced_settings"][k] == v[p]

for p in [0, 1, 2]:
setup1.set_pi_slider(p)
settings = self.edbapp.setups["AC1"].get_configurations()
for k, v in setup1.advanced_settings.pi_defaults.items():
assert settings["advanced_settings"][k] == v[p]

sweep = setup1.add_frequency_sweep(
"sweep1",
frequency_sweep=[
Expand All @@ -2300,7 +2284,6 @@ def test_131_siwave_ac_simulation_setup(self):
["linear scale", "0.1GHz", "10GHz", "0.1GHz"],
],
)
assert "sweep1" in setup1.frequency_sweeps
assert "0" in sweep.frequencies
assert not sweep.adaptive_sampling
assert not sweep.adv_dc_extrapolation
Expand All @@ -2323,6 +2306,7 @@ def test_131_siwave_ac_simulation_setup(self):

sweep.adaptive_sampling = True
sweep.adv_dc_extrapolation = True
sweep.compute_dc_point = True
sweep.auto_s_mat_only_solve = False
sweep.enforce_causality = True
sweep.enforce_dc_and_causality = True
Expand All @@ -2342,6 +2326,7 @@ def test_131_siwave_ac_simulation_setup(self):

assert sweep.adaptive_sampling
assert sweep.adv_dc_extrapolation
assert sweep.compute_dc_point
assert not sweep.auto_s_mat_only_solve
assert sweep.enforce_causality
assert sweep.enforce_dc_and_causality
Expand All @@ -2359,85 +2344,6 @@ def test_131_siwave_ac_simulation_setup(self):
assert sweep.save_rad_fields_only
assert sweep.use_q3d_for_dc

setup1.pi_slider_postion = 0
setup1.pi_slider_postion = 1
setup1.pi_slider_postion = 2
setup1.si_slider_postion = 0
setup1.si_slider_postion = 1
setup1.si_slider_postion = 2
assert setup1.automatic_mesh
assert setup1.enabled
assert setup1.dc_settings
assert setup1.ignore_non_functional_pads
assert setup1.include_coplane_coupling
assert setup1.include_fringe_coupling
assert not setup1.include_infinite_ground
assert not setup1.include_inter_plane_coupling
assert setup1.include_split_plane_coupling
assert setup1.include_trace_coupling
assert not setup1.include_vi_sources
assert setup1.infinite_ground_location == "0"
assert setup1.max_coupled_lines == 40
assert setup1.mesh_frequency == "4GHz"
assert setup1.min_pad_area_to_mesh == "1mm2"
assert setup1.min_plane_area_to_mesh == "6.25e-6mm2"
assert setup1.min_void_area == "2mm2"
assert setup1.name == "AC1"
assert setup1.perform_erc
assert setup1.return_current_distribution
assert setup1.snap_length_threshold == "2.5um"
assert setup1.use_si_settings
assert setup1.use_custom_settings
assert setup1.xtalk_threshold == "-34"

setup1.automatic_mesh = False
setup1.enabled = False
setup1.ignore_non_functional_pads = False
setup1.include_coplane_coupling = False
setup1.include_fringe_coupling = False
setup1.include_infinite_ground = True
setup1.include_inter_plane_coupling = True
setup1.include_split_plane_coupling = False
setup1.include_trace_coupling = False
assert setup1.use_custom_settings
setup1.include_vi_sources = True
setup1.infinite_ground_location = "0.1"
setup1.max_coupled_lines = 10
setup1.mesh_frequency = "3GHz"
setup1.min_pad_area_to_mesh = "2mm2"
setup1.min_plane_area_to_mesh = "5.25e-6mm2"
setup1.min_void_area = "1mm2"
setup1.name = "AC2"
setup1.perform_erc = False
setup1.return_current_distribution = True
setup1.snap_length_threshold = "3.5um"
setup1.use_si_settings = False
assert not setup1.use_custom_settings
setup1.xtalk_threshold = "-44"

assert not setup1.automatic_mesh
assert not setup1.enabled
assert not setup1.ignore_non_functional_pads
assert not setup1.include_coplane_coupling
assert not setup1.include_fringe_coupling
assert setup1.include_infinite_ground
assert setup1.include_inter_plane_coupling
assert not setup1.include_split_plane_coupling
assert not setup1.include_trace_coupling
assert setup1.include_vi_sources
assert setup1.infinite_ground_location == "0.1"
assert setup1.max_coupled_lines == 10
assert setup1.mesh_frequency == "3GHz"
assert setup1.min_pad_area_to_mesh == "2mm2"
assert setup1.min_plane_area_to_mesh == "5.25e-6mm2"
assert setup1.min_void_area == "1mm2"
assert setup1.name == "AC2"
assert not setup1.perform_erc
assert setup1.return_current_distribution
assert setup1.snap_length_threshold == "3.5um"
assert not setup1.use_si_settings
assert setup1.xtalk_threshold == "-44"

def test_132_via_plating_ratio_check(self):
assert self.edbapp.padstacks.check_and_fix_via_plating()

Expand All @@ -2450,7 +2356,7 @@ def test_133_siwave_build_ac_prject(self):
simconfig.solver_type = SolverType.SiwaveSYZ
simconfig.mesh_freq = "40.25GHz"
edbapp.build_simulation_project(simconfig)
assert edbapp.siwave_ac_setups[simconfig.setup_name].mesh_frequency == simconfig.mesh_freq
assert edbapp.siwave_ac_setups[simconfig.setup_name].advanced_settings.mesh_frequency == simconfig.mesh_freq
edbapp.close()

def test_134_create_port_between_pin_and_layer(self):
Expand Down
2 changes: 1 addition & 1 deletion examples/00-EDB/01_edb_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
edb.siwave.create_current_source_on_net("IC2", "NetD3_2", "IC2", "GND", 1.0, 0, "I1")
setup = edb.siwave.add_siwave_dc_analysis("myDCIR_4")
setup.use_dc_custom_settings = True
setup.dc_slider_position = 0
setup.set_dc_slider = 0
setup.add_source_terminal_to_ground("V1", 1)


Expand Down
36 changes: 15 additions & 21 deletions pyaedt/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@
self._siwave = None
self._hfss = None
self._nets = None
self._setups = {}
self._layout_instance = None
self._variables = None
self._active_cell = None
Expand Down Expand Up @@ -3195,7 +3194,7 @@
self.edbpath = legacy_name
self.open_edb()
return True
except: # pragma: no cover
except:

Check warning on line 3197 in pyaedt/edb.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/edb.py#L3197

Added line #L3197 was not covered by tests
return False

@pyaedt_function_handler()
Expand Down Expand Up @@ -3324,15 +3323,15 @@
Dict[str, :class:`pyaedt.edb_core.edb_data.siwave_simulation_setup_data.SiwaveSYZSimulationSetup`]

"""
setups = {}
for i in list(self.active_cell.SimulationSetups):
if i.GetName() not in self._setups:
if i.GetType() == self.edb_api.utility.utility.SimulationSetupType.kHFSS:
self._setups[i.GetName()] = HfssSimulationSetup(self, i.GetName(), i)
elif i.GetType() == self.edb_api.utility.utility.SimulationSetupType.kSIWave:
self._setups[i.GetName()] = SiwaveSYZSimulationSetup(self, i.GetName(), i)
elif i.GetType() == self.edb_api.utility.utility.SimulationSetupType.kSIWaveDCIR:
self._setups[i.GetName()] = SiwaveDCSimulationSetup(self, i.GetName(), i)
return self._setups
if i.GetType() == self.edb_api.utility.utility.SimulationSetupType.kHFSS:
setups[i.GetName()] = HfssSimulationSetup(self, i)
elif i.GetType() == self.edb_api.utility.utility.SimulationSetupType.kSIWave:
setups[i.GetName()] = SiwaveSYZSimulationSetup(self, i)
elif i.GetType() == self.edb_api.utility.utility.SimulationSetupType.kSIWaveDCIR:
setups[i.GetName()] = SiwaveDCSimulationSetup(self, i)
return setups

@property
def hfss_setups(self):
Expand All @@ -3353,7 +3352,7 @@
-------
Dict[str, :class:`pyaedt.edb_core.edb_data.siwave_simulation_setup_data.SiwaveDCSimulationSetup`]
"""
return {name: i for name, i in self.setups.items() if i.setup_type == "kSIWaveDCIR"}
return {name: i for name, i in self.setups.items() if isinstance(i, SiwaveDCSimulationSetup)}

Check warning on line 3355 in pyaedt/edb.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/edb.py#L3355

Added line #L3355 was not covered by tests

@property
def siwave_ac_setups(self):
Expand All @@ -3363,7 +3362,7 @@
-------
Dict[str, :class:`pyaedt.edb_core.edb_data.siwave_simulation_setup_data.SiwaveSYZSimulationSetup`]
"""
return {name: i for name, i in self.setups.items() if i.setup_type == "kSIWave"}
return {name: i for name, i in self.setups.items() if isinstance(i, SiwaveSYZSimulationSetup)}

def create_hfss_setup(self, name=None):
"""Create a setup from a template.
svandenb-dev marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -3384,8 +3383,7 @@
"""
if name in self.setups:
return False
setup = HfssSimulationSetup(self, name)
self._setups[name] = setup
setup = HfssSimulationSetup(self).create(name)
return setup

@pyaedt_function_handler()
Expand Down Expand Up @@ -3414,11 +3412,8 @@
name = generate_unique_name("Siwave_SYZ")
if name in self.setups:
return False
setup = SiwaveSYZSimulationSetup(self, name)
setup.si_slider_postion = 1
setup.pi_slider_postion = 1
self._setups[name] = setup
return setup
SiwaveSYZSimulationSetup(self).create(name)
return self.setups[name]

@pyaedt_function_handler()
def create_siwave_dc_setup(self, name=None):
Expand All @@ -3443,8 +3438,7 @@
name = generate_unique_name("Siwave_DC")
if name in self.setups:
return False
setup = SiwaveDCSimulationSetup(self, name)
self._setups[name] = setup
setup = SiwaveDCSimulationSetup(self).create(name)
return setup

@pyaedt_function_handler()
Expand Down
Loading
Loading