From 1df26cb37e45d6e0a1094b64733854e5d4ef062d Mon Sep 17 00:00:00 2001 From: svandenb-dev Date: Fri, 21 Jun 2024 15:40:33 +0200 Subject: [PATCH 1/4] hfsspi SimsetupInfo bug fixed --- .../edb_core/edb_data/hfss_pi_simulation_setup_data.py | 2 +- src/pyedb/dotnet/edb_core/utilities/simulation_setup.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pyedb/dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py b/src/pyedb/dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py index 299f839c7f..8d7e5d9e10 100644 --- a/src/pyedb/dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py +++ b/src/pyedb/dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py @@ -39,7 +39,7 @@ def __init__(self, pedb, edb_object=None): def create(self, name=None): """Create an HFSS setup.""" self._name = name - self._create(name) + self._create(name=name, simulation_setup_type=self._setup_type) return self @property diff --git a/src/pyedb/dotnet/edb_core/utilities/simulation_setup.py b/src/pyedb/dotnet/edb_core/utilities/simulation_setup.py index 4408f14fab..4bf44e4a78 100644 --- a/src/pyedb/dotnet/edb_core/utilities/simulation_setup.py +++ b/src/pyedb/dotnet/edb_core/utilities/simulation_setup.py @@ -100,7 +100,11 @@ def __init__(self, pedb, edb_object=None): @property def sim_setup_info(self): - return SimSetupInfo(self._pedb, sim_setup=self, edb_object=self._edb_object.GetSimSetupInfo()) + if self.type not in ["hfss_pi", "raptor_x"]: + return SimSetupInfo(self._pedb, sim_setup=self, edb_object=self._edb_object.GetSimSetupInfo()) + else: + if self._edb_setup_info: + return SimSetupInfo(self._pedb, sim_setup=self, edb_object=self._edb_setup_info) @sim_setup_info.setter def sim_setup_info(self, sim_setup_info): From 19355561b973aa5de048dc47d0e27c105b858932 Mon Sep 17 00:00:00 2001 From: svandenb-dev Date: Tue, 25 Jun 2024 20:12:45 +0200 Subject: [PATCH 2/4] temp --- .../dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/pyedb/dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py diff --git a/src/pyedb/dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py b/src/pyedb/dotnet/edb_core/edb_data/hfss_pi_simulation_setup_data.py deleted file mode 100644 index e69de29bb2..0000000000 From c170474b96358d8e43fdac6a77c8a199baa4cbe6 Mon Sep 17 00:00:00 2001 From: svandenb-dev Date: Fri, 28 Jun 2024 14:53:35 +0200 Subject: [PATCH 3/4] unit test --- src/pyedb/configuration/cfg_data.py | 8 +++----- src/pyedb/configuration/cfg_nets.py | 14 ++++++++++++++ src/pyedb/configuration/configuration.py | 7 ++++--- tests/legacy/system/test_edb_configuration_2p0.py | 14 ++++++++++++++ 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/pyedb/configuration/cfg_data.py b/src/pyedb/configuration/cfg_data.py index 0f7c226b9b..e32acc13a8 100644 --- a/src/pyedb/configuration/cfg_data.py +++ b/src/pyedb/configuration/cfg_data.py @@ -48,11 +48,9 @@ def __init__(self, pedb, **kwargs): if kwargs.get("boundaries", None): self.boundaries = CfgBoundaries(self, kwargs.get("boundaries", None)) - self.nets = None - if kwargs.get("nets"): - self.nets = CfgNets( - self, kwargs.get("nets", {}).get("signal_nets", []), kwargs.get("nets", {}).get("power_ground_nets", []) - ) + self.nets = CfgNets( + self, kwargs.get("nets", {}).get("signal_nets", []), kwargs.get("nets", {}).get("power_ground_nets", []) + ) self.components = CfgComponents(self._pedb, components_data=kwargs.get("components", [])) diff --git a/src/pyedb/configuration/cfg_nets.py b/src/pyedb/configuration/cfg_nets.py index d959289663..660c710983 100644 --- a/src/pyedb/configuration/cfg_nets.py +++ b/src/pyedb/configuration/cfg_nets.py @@ -41,3 +41,17 @@ def apply(self): for power_net in self.power_nets: if power_net in self._pedb.nets: self._pedb.nets.nets[power_net].is_power_ground = True + + def _load_data_from_db(self): + self.signal_nets = [] + self.power_nets = [] + for net in self._pedb.nets.signal: + self.signal_nets.append(net) + for net in self._pedb.nets.power: + self.power_nets.append(net) + + def get_data_from_db(self): + """Get net information.""" + self._load_data_from_db() + data = {"signal_nets": self.signal_nets, "power_ground_nets": self.power_nets} + return data diff --git a/src/pyedb/configuration/configuration.py b/src/pyedb/configuration/configuration.py index 16a124694c..2e6cd41c2d 100644 --- a/src/pyedb/configuration/configuration.py +++ b/src/pyedb/configuration/configuration.py @@ -273,10 +273,11 @@ def get_data_from_db(self, **kwargs): data["setups"] = self.cfg_data.setups.get_data_from_db() if kwargs.get("components", False): data["components"] = self.cfg_data.components.get_data_from_db() - + if kwargs.get("nets", False): + data["nets"] = self.cfg_data.nets.get_data_from_db() return data - def export(self, file_path, stackup=True, package_definitions=True, setups=True): + def export(self, file_path, stackup=True, package_definitions=True, setups=True, nets=True): """Export the configuration data from layout to a file. Parameters @@ -292,7 +293,7 @@ def export(self, file_path, stackup=True, package_definitions=True, setups=True) """ file_path = file_path if isinstance(file_path, Path) else Path(file_path) file_path = file_path if file_path.suffix == ".json" else file_path.with_suffix(".json") - data = self.get_data_from_db(stackup=stackup, package_definitions=package_definitions, setups=setups) + data = self.get_data_from_db(stackup=stackup, package_definitions=package_definitions, setups=setups, nets=nets) with open(file_path, "w") as f: json.dump(data, f, ensure_ascii=False, indent=4) return True if os.path.isfile(file_path) else False diff --git a/tests/legacy/system/test_edb_configuration_2p0.py b/tests/legacy/system/test_edb_configuration_2p0.py index b0e8bb122a..d3e9367e56 100644 --- a/tests/legacy/system/test_edb_configuration_2p0.py +++ b/tests/legacy/system/test_edb_configuration_2p0.py @@ -793,3 +793,17 @@ def test_16_export_to_external_file(self, edb_examples): data_file_path = Path(edb_examples.test_folder) / "test.json" edbapp.configuration.export(data_file_path) assert data_file_path.is_file() + with open(data_file_path) as f: + data = json.load(f) + assert "stackup" in data + assert data["stackup"]["materials"] + assert data["stackup"]["materials"][0]["name"] == "copper" + assert data["stackup"]["materials"][0]["conductivity"] == 5.8e7 + assert data["stackup"]["layers"] + data["stackup"]["layers"][0]["name"] = "1_Top" + data["stackup"]["layers"][0]["type"] = "signal" + data["stackup"]["layers"][0]["material"] = "copper" + assert data["nets"] + assert len(data["nets"]["signal_nets"]) == 342 + assert len(data["nets"]["power_ground_nets"]) == 6 + edbapp.close()() From 8fea2206299cdaa5c058e54af11664a25ca4636d Mon Sep 17 00:00:00 2001 From: svandenb-dev Date: Mon, 1 Jul 2024 11:10:30 +0200 Subject: [PATCH 4/4] unit test --- tests/legacy/system/test_edb_configuration_2p0.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/legacy/system/test_edb_configuration_2p0.py b/tests/legacy/system/test_edb_configuration_2p0.py index d3e9367e56..ecd333dcff 100644 --- a/tests/legacy/system/test_edb_configuration_2p0.py +++ b/tests/legacy/system/test_edb_configuration_2p0.py @@ -806,4 +806,4 @@ def test_16_export_to_external_file(self, edb_examples): assert data["nets"] assert len(data["nets"]["signal_nets"]) == 342 assert len(data["nets"]["power_ground_nets"]) == 6 - edbapp.close()() + edbapp.close()