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

Replace rlc with gap port bug fix #3862

Merged
merged 27 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6f3b815
edb intersection bug fix
svandenb-dev Jun 29, 2023
c9c9183
Merge remote-tracking branch 'origin/main'
svandenb-dev Jun 29, 2023
2c93929
Merge remote-tracking branch 'origin/main'
svandenb-dev Jun 30, 2023
13681b3
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 11, 2023
44b29bd
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 14, 2023
fa118ee
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 14, 2023
4f5170d
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 17, 2023
c532310
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 19, 2023
0ed1957
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 24, 2023
9c1f90f
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 26, 2023
b17e28d
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 27, 2023
0775a9f
Merge remote-tracking branch 'origin/main'
svandenb-dev Aug 21, 2023
8efa6e0
Merge remote-tracking branch 'origin/main'
svandenb-dev Aug 24, 2023
c32599f
Merge remote-tracking branch 'origin/main'
svandenb-dev Aug 28, 2023
64b538b
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 6, 2023
a4735a4
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 15, 2023
7ebf925
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 18, 2023
5a2c70b
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 21, 2023
38be8d7
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 21, 2023
d3cb775
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 22, 2023
52870ae
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 25, 2023
befd2f0
Merge remote-tracking branch 'origin/main'
svandenb-dev Oct 2, 2023
c84e923
Merge remote-tracking branch 'origin/main'
svandenb-dev Oct 31, 2023
f89f32b
Merge remote-tracking branch 'origin/main'
svandenb-dev Nov 8, 2023
15c110e
Merge remote-tracking branch 'origin/main'
svandenb-dev Nov 9, 2023
226f1b0
replace rlc by gap port bug fix
svandenb-dev Nov 10, 2023
57136a9
Merge branch 'main' into replace_rlc_with_gap_port_bug_fix
svandenb-dev Nov 10, 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
4 changes: 3 additions & 1 deletion _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,8 +1118,10 @@ def test_086_set_component_type(self):
assert comp.type == "Other"

def test_087_deactivate_rlc(self):
assert self.edbapp.components.deactivate_rlc_component(component="C1", create_circuit_port=True)
assert self.edbapp.components.deactivate_rlc_component(component="C1", create_circuit_port=False)
assert self.edbapp.ports["C1"]
assert self.edbapp.components["C1"].is_enabled is False
assert self.edbapp.components.deactivate_rlc_component(component="C2", create_circuit_port=True)
self.edbapp.components["C2"].is_enabled = False
assert self.edbapp.components["C2"].is_enabled is False
self.edbapp.components["C2"].is_enabled = True
Expand Down
32 changes: 21 additions & 11 deletions pyaedt/edb_core/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@
>>> from pyaedt import Edb
>>> edb_file = r'C:\my_edb_file.aedb'
>>> edb = Edb(edb_file)
>>> for cmp in list(edb.components.components.keys()):
>>> for cmp in list(edb.components.instances.keys()):
>>> edb.components.deactivate_rlc_component(component=cmp, create_circuit_port=False)
>>> edb.save_edb()
>>> edb.close_edb()
Expand All @@ -1078,12 +1078,10 @@
self._logger.info("Component %s passed to deactivate is not an RLC.", component.refdes)
return False
component.is_enabled = False
if create_circuit_port:
return self.add_port_on_rlc_component(component.refdes)
return True
return self.add_port_on_rlc_component(component=component.refdes, circuit_ports=create_circuit_port)

@pyaedt_function_handler()
def add_port_on_rlc_component(self, component=None):
def add_port_on_rlc_component(self, component=None, circuit_ports=True):
"""Deactivate RLC component and replace it with a circuit port.
The circuit port supports only 2-pin components.

Expand All @@ -1092,6 +1090,10 @@
component : str
Reference designator of the RLC component.

circuit_ports : bool
``True`` will replace RLC component by circuit ports, ``False`` gap ports compatible with HFSS 3D modeler
export.

Returns
-------
bool
Expand All @@ -1108,35 +1110,43 @@
pt = self._pedb.point_data(*pos_pin_loc)

pin_layers = self._padstack._get_pin_layer_range(pins[0])
pos_pin_term = self._pedb.edb_api.cell.terminal.PointTerminal.Create(
pos_pin_term = self._pedb.edb_api.cell.terminal.PadstackInstanceTerminal.Create(
self._active_layout,
pins[0].GetNet(),
"{}_{}".format(component.refdes, pins[0].GetName()),
pt,
pins[0],
pin_layers[0],
False,
)
if not pos_pin_term: # pragma: no cover
return False
neg_pin_loc = self.get_pin_position(pins[1])
pt = self._pedb.point_data(*neg_pin_loc)

neg_pin_term = self._pedb.edb_api.cell.terminal.PointTerminal.Create(
neg_pin_term = self._pedb.edb_api.cell.terminal.PadstackInstanceTerminal.Create(
svandenb-dev marked this conversation as resolved.
Show resolved Hide resolved
self._active_layout,
pins[1].GetNet(),
"{}_{}_ref".format(component.refdes, pins[1].GetName()),
pt,
pins[1],
pin_layers[0],
False,
)
if not neg_pin_term: # pragma: no cover
return False
pos_pin_term.SetBoundaryType(self._pedb.edb_api.cell.terminal.BoundaryType.PortBoundary)
pos_pin_term.SetIsCircuitPort(True)
pos_pin_term.SetName(component.refdes)
neg_pin_term.SetBoundaryType(self._pedb.edb_api.cell.terminal.BoundaryType.PortBoundary)
neg_pin_term.SetIsCircuitPort(True)
pos_pin_term.SetReferenceTerminal(neg_pin_term)
if circuit_ports:
pos_pin_term.SetIsCircuitPort(True)
neg_pin_term.SetIsCircuitPort(True)
else:
pos_pin_term.SetIsCircuitPort(False)
neg_pin_term.SetIsCircuitPort(False)

self._logger.info("Component {} has been replaced by port".format(component.refdes))
return True
return False

Check warning on line 1149 in pyaedt/edb_core/components.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/edb_core/components.py#L1149

Added line #L1149 was not covered by tests

@pyaedt_function_handler()
def add_rlc_boundary(self, component=None, circuit_type=True):
Expand Down
Loading