Skip to content

Commit

Permalink
FIX: edb cfg s param export (#914)
Browse files Browse the repository at this point in the history
* draft

* FIX: Edb cfg export S-parameter

* minor fix

* minor fix

---------

Co-authored-by: ring630 <@gmail.com>
  • Loading branch information
hui-zhou-a authored Nov 25, 2024
1 parent 6ac5005 commit 8313136
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/pyedb/configuration/cfg_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def __init__(self, pedb, pedb_object, **kwargs):
self.solder_ball_properties = kwargs.get("solder_ball_properties", {})
self.ic_die_properties = kwargs.get("ic_die_properties", {})
self.pin_pair_model = kwargs.get("pin_pair_model", [])
self.spice_model = kwargs.get("spice_model", None)
self.s_parameter_model = kwargs.get("s_parameter_model", None)
self.spice_model = kwargs.get("spice_model", {})
self.s_parameter_model = kwargs.get("s_parameter_model", {})
self.netlist_model = kwargs.get("netlist_model", {})

def retrieve_model_properties_from_edb(self):
Expand Down
12 changes: 6 additions & 6 deletions src/pyedb/configuration/cfg_s_parameter_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,24 @@ def apply(self):
ref_net = s_param.reference_net
comp.use_s_parameter_model(s_param.name, reference_net=ref_net)

def get_data_from_db(self):
def get_data_from_db(self, cfg_components):
db_comp_def = self._pedb.definitions.component
for name, compdef_obj in db_comp_def.items():
nport_models = compdef_obj.component_models
if not nport_models:
continue
else:
pin_order = compdef_obj.get_properties()["pin_order"]
temp_comps = compdef_obj.components
temp_comps = [i for i in cfg_components if i["definition"] == name]
for model_name, model_obj in nport_models.items():
temp_comp_list = []
reference_net_per_component = {}
for i in temp_comps.values():
s_param_model = i.model_properties.get("s_parameter_model")
for i in temp_comps:
s_param_model = i.get("s_parameter_model")
if s_param_model:
if s_param_model["model_name"] == model_name:
temp_comp_list.append(i.refdes)
reference_net_per_component[i.refdes] = s_param_model["reference_net"]
temp_comp_list.append(i["reference_designator"])
reference_net_per_component[i["reference_designator"]] = s_param_model["reference_net"]
else:
continue

Expand Down
11 changes: 7 additions & 4 deletions src/pyedb/configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,16 @@ def get_data_from_db(self, **kwargs):
data["sources"] = self.cfg_data.sources.get_data_from_db()
if kwargs.get("ports", False):
data["ports"] = self.cfg_data.ports.get_data_from_db()
if kwargs.get("components", False):
if kwargs.get("components", False) or kwargs.get("s_parameters", False):
self.cfg_data.components.retrieve_parameters_from_edb()
components = []
for i in self.cfg_data.components.components:
components.append(i.get_attributes())
data["components"] = components

if kwargs.get("components", False):
data["components"] = components
elif kwargs.get("s_parameters", False):
data["s_parameters"] = self.cfg_data.s_parameters.get_data_from_db(components)
if kwargs.get("nets", False):
data["nets"] = self.cfg_data.nets.get_data_from_db()
if kwargs.get("pin_groups", False):
Expand All @@ -316,8 +320,7 @@ def get_data_from_db(self, **kwargs):
data["padstacks"] = dict()
data["padstacks"]["definitions"] = definitions
data["padstacks"]["instances"] = instances
if kwargs.get("s_parameters", False):
data["s_parameters"] = self.cfg_data.s_parameters.get_data_from_db()

if kwargs.get("boundaries", False):
data["boundaries"] = self.cfg_data.boundaries.get_data_from_db()

Expand Down
20 changes: 0 additions & 20 deletions tests/legacy/system/test_edb_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,26 +606,6 @@ def test_component_lib(self):
network.write_touchstone(os.path.join(edbapp.directory, "test_export.s2p"))
assert os.path.isfile(os.path.join(edbapp.directory, "test_export.s2p"))

def test_properties(self, edb_examples):
edbapp = edb_examples.get_si_verse()
pp = {
"pin_pair_model": [
{
"first_pin": "2",
"second_pin": "1",
"is_parallel": True,
"resistance": "10ohm",
"resistance_enabled": True,
"inductance": "1nH",
"inductance_enabled": True,
"capacitance": "1nF",
"capacitance_enabled": True,
}
]
}
edbapp.components["C378"].model_properties = pp
assert edbapp.components["C378"].model_properties == pp

def test_export_gds_comp_xml(self, edb_examples):
edbapp = edb_examples.get_si_verse()
xml_output = os.path.join(self.local_scratch.path, "test.xml")
Expand Down
1 change: 1 addition & 0 deletions tests/legacy/system/test_edb_configuration_2p0.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ def test_06_s_parameters(self, edb_examples):
assert edbapp.components.nport_comp_definition["CAPC3216X180X55ML20T25"].reference_file
assert len(edbapp.components.nport_comp_definition["CAPC3216X180X55ML20T25"].components) == 9
assert len(edbapp.components.nport_comp_definition["CAPC3216X190X55ML30T25"].components) == 12
edbapp.configuration.get_data_from_db(s_parameters=True)
edbapp.close()

def test_07_boundaries(self, edb_examples):
Expand Down

0 comments on commit 8313136

Please sign in to comment.