pyedb 0.54.0__py3-none-any.whl → 0.56.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyedb might be problematic. Click here for more details.

Files changed (105) hide show
  1. pyedb/__init__.py +1 -8
  2. pyedb/configuration/cfg_boundaries.py +69 -151
  3. pyedb/configuration/cfg_components.py +201 -460
  4. pyedb/configuration/cfg_data.py +4 -2
  5. pyedb/configuration/cfg_general.py +13 -36
  6. pyedb/configuration/cfg_modeler.py +2 -1
  7. pyedb/configuration/cfg_nets.py +21 -35
  8. pyedb/configuration/cfg_operations.py +22 -151
  9. pyedb/configuration/cfg_package_definition.py +56 -112
  10. pyedb/configuration/cfg_padstacks.py +292 -688
  11. pyedb/configuration/cfg_pin_groups.py +32 -79
  12. pyedb/configuration/cfg_ports_sources.py +19 -6
  13. pyedb/configuration/cfg_s_parameter_models.py +67 -172
  14. pyedb/configuration/cfg_setup.py +102 -295
  15. pyedb/configuration/configuration.py +64 -5
  16. pyedb/dotnet/database/Variables.py +26 -19
  17. pyedb/dotnet/database/cell/connectable.py +38 -9
  18. pyedb/dotnet/database/cell/hierarchy/component.py +28 -28
  19. pyedb/dotnet/database/cell/hierarchy/model.py +1 -1
  20. pyedb/dotnet/database/cell/layout.py +63 -2
  21. pyedb/dotnet/database/cell/layout_obj.py +2 -2
  22. pyedb/dotnet/database/cell/primitive/path.py +6 -8
  23. pyedb/dotnet/database/cell/primitive/primitive.py +3 -24
  24. pyedb/dotnet/database/cell/terminal/edge_terminal.py +2 -2
  25. pyedb/dotnet/database/cell/terminal/padstack_instance_terminal.py +1 -1
  26. pyedb/dotnet/database/cell/terminal/pingroup_terminal.py +1 -1
  27. pyedb/dotnet/database/cell/terminal/point_terminal.py +1 -1
  28. pyedb/dotnet/database/cell/terminal/terminal.py +24 -24
  29. pyedb/dotnet/database/cell/voltage_regulator.py +0 -21
  30. pyedb/dotnet/database/components.py +137 -124
  31. pyedb/dotnet/database/definition/component_def.py +4 -4
  32. pyedb/dotnet/database/definition/component_model.py +1 -1
  33. pyedb/dotnet/database/definition/package_def.py +2 -3
  34. pyedb/dotnet/database/dotnet/database.py +3 -199
  35. pyedb/dotnet/database/dotnet/primitive.py +3 -3
  36. pyedb/dotnet/database/edb_data/control_file.py +5 -5
  37. pyedb/dotnet/database/edb_data/hfss_extent_info.py +6 -6
  38. pyedb/dotnet/database/edb_data/layer_data.py +23 -23
  39. pyedb/dotnet/database/edb_data/padstacks_data.py +63 -88
  40. pyedb/dotnet/database/edb_data/primitives_data.py +5 -5
  41. pyedb/dotnet/database/edb_data/sources.py +6 -6
  42. pyedb/dotnet/database/edb_data/variables.py +1 -1
  43. pyedb/dotnet/database/geometry/point_data.py +14 -10
  44. pyedb/dotnet/database/geometry/polygon_data.py +3 -3
  45. pyedb/dotnet/database/hfss.py +46 -48
  46. pyedb/dotnet/database/layout_validation.py +14 -11
  47. pyedb/dotnet/database/materials.py +10 -11
  48. pyedb/dotnet/database/modeler.py +97 -91
  49. pyedb/dotnet/database/nets.py +19 -22
  50. pyedb/dotnet/database/padstack.py +171 -83
  51. pyedb/dotnet/database/siwave.py +42 -42
  52. pyedb/dotnet/database/stackup.py +140 -72
  53. pyedb/dotnet/database/utilities/heatsink.py +4 -4
  54. pyedb/dotnet/database/utilities/obj_base.py +2 -2
  55. pyedb/dotnet/database/utilities/simulation_setup.py +2 -2
  56. pyedb/dotnet/database/utilities/value.py +16 -16
  57. pyedb/dotnet/edb.py +230 -152
  58. pyedb/edb_logger.py +12 -27
  59. pyedb/extensions/create_cell_array.py +394 -0
  60. pyedb/extensions/via_design_backend.py +6 -3
  61. pyedb/generic/data_handlers.py +6 -7
  62. pyedb/generic/design_types.py +81 -30
  63. pyedb/generic/filesystem.py +5 -2
  64. pyedb/generic/general_methods.py +2 -122
  65. pyedb/generic/process.py +44 -108
  66. pyedb/generic/settings.py +79 -19
  67. pyedb/grpc/database/components.py +26 -4
  68. pyedb/grpc/database/control_file.py +5 -5
  69. pyedb/grpc/database/definition/materials.py +1 -1
  70. pyedb/grpc/database/definition/package_def.py +3 -3
  71. pyedb/grpc/database/definition/padstack_def.py +53 -0
  72. pyedb/grpc/database/geometry/polygon_data.py +1 -1
  73. pyedb/grpc/database/layout/layout.py +81 -5
  74. pyedb/grpc/database/layout_validation.py +5 -5
  75. pyedb/grpc/database/modeler.py +24 -16
  76. pyedb/grpc/database/net/net.py +15 -14
  77. pyedb/grpc/database/nets.py +70 -0
  78. pyedb/grpc/database/padstacks.py +122 -17
  79. pyedb/grpc/database/primitive/padstack_instance.py +175 -7
  80. pyedb/grpc/database/primitive/polygon.py +2 -2
  81. pyedb/grpc/database/simulation_setup/siwave_cpa_simulation_setup.py +3 -2
  82. pyedb/grpc/database/siwave.py +1 -1
  83. pyedb/grpc/database/source_excitations.py +12 -5
  84. pyedb/grpc/database/stackup.py +1 -1
  85. pyedb/grpc/database/terminal/bundle_terminal.py +1 -1
  86. pyedb/grpc/database/terminal/padstack_instance_terminal.py +1 -1
  87. pyedb/grpc/database/terminal/pingroup_terminal.py +1 -1
  88. pyedb/grpc/database/utility/value.py +1 -0
  89. pyedb/grpc/database/utility/xml_control_file.py +5 -5
  90. pyedb/grpc/edb.py +80 -30
  91. pyedb/grpc/edb_init.py +3 -3
  92. pyedb/grpc/rpc_session.py +14 -13
  93. pyedb/libraries/common.py +366 -0
  94. pyedb/libraries/rf_libraries/base_functions.py +1358 -0
  95. pyedb/libraries/rf_libraries/planar_antennas.py +628 -0
  96. pyedb/misc/decorators.py +61 -0
  97. pyedb/misc/misc.py +0 -13
  98. pyedb/modeler/geometry_operators.py +6 -6
  99. pyedb/siwave.py +6 -8
  100. pyedb/siwave_core/__init__.py +0 -0
  101. pyedb/siwave_core/cpa/__init__.py +0 -0
  102. {pyedb-0.54.0.dist-info → pyedb-0.56.0.dist-info}/METADATA +1 -2
  103. {pyedb-0.54.0.dist-info → pyedb-0.56.0.dist-info}/RECORD +105 -98
  104. {pyedb-0.54.0.dist-info → pyedb-0.56.0.dist-info}/WHEEL +0 -0
  105. {pyedb-0.54.0.dist-info → pyedb-0.56.0.dist-info}/licenses/LICENSE +0 -0
@@ -26,64 +26,34 @@ from pyedb.configuration.cfg_common import CfgBase
26
26
  class CfgPinGroups:
27
27
  """Manage configuration pin group class."""
28
28
 
29
- class Grpc:
30
- def __init__(self, parent):
31
- self.parent = parent
32
- self._pedb = parent._pedb
33
-
34
- def set_pingroup_to_edb(self):
35
- for pg in self.parent.pin_groups:
36
- pg.create()
37
-
38
- def get_data_from_edb(self):
39
- self.parent.pin_groups = []
40
- layout_pin_groups = self._pedb.siwave.pin_groups
41
- for pg_name, pg_obj in layout_pin_groups.items():
42
- if self._pedb.grpc:
43
- pins = list(pg_obj.pins.values())
44
- refdes = pins[0].component.name
45
- cfg_pg = CfgPinGroup(
46
- self._pedb,
47
- name=pg_name,
48
- reference_designator=refdes,
49
- pins=[pin.component_pin for pin in pins],
50
- )
51
- self.parent.pin_groups.append(cfg_pg)
52
- return self.parent.export_properties()
53
-
54
- class DotNet(Grpc):
55
- def __init__(self, parent):
56
- self.parent = parent
57
- super().__init__(parent)
58
-
59
- def get_data_from_edb(self):
60
- self.parent.pin_groups = []
61
- layout_pin_groups = self._pedb.siwave.pin_groups
62
- for pg_name, pg_obj in layout_pin_groups.items():
63
- pins = list(pg_obj.pins.keys())
64
- refdes = list(pg_obj.pins.values())[0].component.name
65
- cfg_pg = CfgPinGroup(
66
- self._pedb,
67
- name=pg_name,
68
- reference_designator=refdes,
69
- pins=pins,
70
- )
71
- self.parent.pin_groups.append(cfg_pg)
72
- return self.parent.export_properties()
29
+ def set_pingroup_to_edb(self):
30
+ for pg in self.pin_groups:
31
+ pg.create()
32
+
33
+ def get_data_from_edb(self):
34
+ self.pin_groups = []
35
+ layout_pin_groups = self._pedb.siwave.pin_groups
36
+ for pg_name, pg_obj in layout_pin_groups.items():
37
+ pins = list(pg_obj.pins.keys())
38
+ refdes = list(pg_obj.pins.values())[0].component.name
39
+ cfg_pg = CfgPinGroup(
40
+ self._pedb,
41
+ name=pg_name,
42
+ reference_designator=refdes,
43
+ pins=pins,
44
+ )
45
+ self.pin_groups.append(cfg_pg)
46
+ return self.export_properties()
73
47
 
74
48
  def __init__(self, pedb, pingroup_data):
75
49
  self._pedb = pedb
76
- if self._pedb.grpc:
77
- self.api = self.Grpc(self)
78
- else:
79
- self.api = self.DotNet(self)
80
50
  self.pin_groups = [CfgPinGroup(self._pedb, **pg) for pg in pingroup_data]
81
51
 
82
52
  def apply(self):
83
- self.api.set_pingroup_to_edb()
53
+ self.set_pingroup_to_edb()
84
54
 
85
55
  def get_data_from_db(self):
86
- return self.api.get_data_from_edb()
56
+ return self.get_data_from_edb()
87
57
 
88
58
  def export_properties(self):
89
59
  pin_groups = []
@@ -93,43 +63,26 @@ class CfgPinGroups:
93
63
 
94
64
 
95
65
  class CfgPinGroup(CfgBase):
96
- class Grpc:
97
- def __init__(self, parent):
98
- self.parent = parent
99
- self._pedb = parent._pedb
100
-
101
- def create(self):
102
- if self.parent.pins:
103
- pins = self.parent.pins if isinstance(self.parent.pins, list) else [self.parent.pins]
104
- self._pedb.siwave.create_pin_group(self.parent.reference_designator, pins, self.parent.name)
105
- elif self.parent.net:
106
- nets = self.parent.net if isinstance(self.parent.net, list) else [self.parent.net]
107
- comp = self._pedb.components.instances[self.parent.reference_designator]
108
- pins = [p for p, obj in comp.pins.items() if obj.net_name in nets]
109
- if not self._pedb.siwave.create_pin_group(self.parent.reference_designator, pins, self.parent.name):
110
- raise RuntimeError(f"Failed to create pin group {self.parent.name}")
111
- else:
112
- raise RuntimeError(f"No net and pins defined for defining pin group {self.parent.name}")
113
-
114
- class DotNet(Grpc):
115
- def __init__(self, parent):
116
- super().__init__(parent)
66
+ def create(self):
67
+ if self.pins:
68
+ pins = self.pins if isinstance(self.pins, list) else [self.pins]
69
+ self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name)
70
+ elif self.net:
71
+ nets = self.net if isinstance(self.net, list) else [self.net]
72
+ comp = self._pedb.components.instances[self.reference_designator]
73
+ pins = [p for p, obj in comp.pins.items() if obj.net_name in nets]
74
+ if not self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name):
75
+ raise RuntimeError(f"Failed to create pin group {self.name}")
76
+ else:
77
+ raise RuntimeError(f"No net and pins defined for defining pin group {self.name}")
117
78
 
118
79
  def __init__(self, pedb, **kwargs):
119
80
  self._pedb = pedb
120
- if self._pedb.grpc:
121
- self.api = self.Grpc(self)
122
- else:
123
- self.api = self.DotNet(self)
124
81
  self.name = kwargs["name"]
125
82
  self.reference_designator = kwargs.get("reference_designator")
126
83
  self.pins = kwargs.get("pins")
127
84
  self.net = kwargs.get("net")
128
85
 
129
- def create(self):
130
- """Apply pin group on layout."""
131
- self.api.create()
132
-
133
86
  def export_properties(self):
134
87
  if self.pins:
135
88
  return {
@@ -130,6 +130,7 @@ class CfgSources:
130
130
  self._pedb,
131
131
  name=name,
132
132
  type=src_type,
133
+ impedance=src.impedance,
133
134
  magnitude=magnitude,
134
135
  reference_designator=refdes,
135
136
  positive_terminal=pos_term_info,
@@ -236,6 +237,7 @@ class CfgPorts:
236
237
  self._pedb,
237
238
  name=p.name,
238
239
  type=port_type,
240
+ impedance=p.impedance,
239
241
  reference_designator=refdes,
240
242
  positive_terminal=pos_term_info,
241
243
  negative_terminal=neg_term_info,
@@ -245,6 +247,7 @@ class CfgPorts:
245
247
  self._pedb,
246
248
  name=p.name,
247
249
  type=port_type,
250
+ impedance=p.impedance,
248
251
  reference_designator=refdes,
249
252
  positive_terminal=pos_term_info,
250
253
  )
@@ -275,6 +278,7 @@ class CfgCircuitElement(CfgBase):
275
278
  self._pedb = pedb
276
279
  self.name = kwargs["name"]
277
280
  self.type = kwargs["type"]
281
+ self.impedance = kwargs.get("impedance", None)
278
282
  self.reference_designator = kwargs.get("reference_designator", None)
279
283
  self.distributed = kwargs.get("distributed", False)
280
284
  self._elem_num = 1
@@ -558,6 +562,7 @@ class CfgPort(CfgCircuitElement):
558
562
  elem = self._pedb.create_port(j, self.neg_terminal[name], is_circuit_port)
559
563
  else:
560
564
  elem = self._pedb.create_port(j, self.neg_terminal, is_circuit_port)
565
+ elem.impedance = self.impedance if self.impedance else self._pedb.edb_value(50)
561
566
  if not self.distributed:
562
567
  elem.name = self.name
563
568
  circuit_elements.append(elem)
@@ -567,6 +572,7 @@ class CfgPort(CfgCircuitElement):
567
572
  data = {
568
573
  "name": self.name,
569
574
  "type": self.type,
575
+ "impedance": self.impedance,
570
576
  "reference_designator": self.reference_designator,
571
577
  "positive_terminal": self.positive_terminal_info.export_properties(),
572
578
  }
@@ -596,6 +602,12 @@ class CfgSource(CfgCircuitElement):
596
602
  elem = create_xxx_source(j, self.neg_terminal[name])
597
603
  else:
598
604
  elem = create_xxx_source(j, self.neg_terminal)
605
+
606
+ if self.impedance:
607
+ elem.impedance = self.impedance
608
+ else:
609
+ elem.impedance = 5e7 if self.type == "current" else 1e-6
610
+
599
611
  if self._elem_num == 1:
600
612
  elem.name = self.name
601
613
  elem.magnitude = self.magnitude
@@ -650,6 +662,7 @@ class CfgSource(CfgCircuitElement):
650
662
  "name": self.name,
651
663
  "reference_designator": self.reference_designator,
652
664
  "type": self.type,
665
+ "impedance": self.impedance,
653
666
  "magnitude": self.magnitude,
654
667
  "positive_terminal": self.positive_terminal_info.export_properties(),
655
668
  "negative_terminal": self.negative_terminal_info.export_properties(),
@@ -676,11 +689,11 @@ class CfgProbe(CfgCircuitElement):
676
689
 
677
690
  class CfgEdgePort:
678
691
  def set_parameters_to_edb(self):
679
- point_on_edge = PointData(self._pedb, x=self.point_on_edge[0], y=self.point_on_edge[1])
692
+ point_on_edge = PointData.create_from_xy(self._pedb, x=self.point_on_edge[0], y=self.point_on_edge[1])
680
693
  primitive = self._pedb.layout.primitives_by_aedt_name[self.primitive_name]
681
- pos_edge = self._pedb.core.cell.terminal.PrimitiveEdge.Create(primitive._edb_object, point_on_edge._edb_object)
682
- pos_edge = convert_py_list_to_net_list(pos_edge, self._pedb.core.cell.terminal.Edge)
683
- edge_term = self._pedb.core.cell.terminal.EdgeTerminal.Create(
694
+ pos_edge = self._pedb.core.Cell.Terminal.PrimitiveEdge.Create(primitive._edb_object, point_on_edge._edb_object)
695
+ pos_edge = convert_py_list_to_net_list(pos_edge, self._pedb.core.Cell.Terminal.Edge)
696
+ edge_term = self._pedb.core.Cell.Terminal.EdgeTerminal.Create(
684
697
  primitive._edb_object.GetLayout(),
685
698
  primitive._edb_object.GetNet(),
686
699
  self.name,
@@ -753,9 +766,9 @@ class CfgDiffWavePort:
753
766
  pos_term = self.positive_port.set_parameters_to_edb()
754
767
  neg_term = self.negative_port.set_parameters_to_edb()
755
768
  edb_list = convert_py_list_to_net_list(
756
- [pos_term._edb_object, neg_term._edb_object], self._pedb.core.cell.terminal.Terminal
769
+ [pos_term._edb_object, neg_term._edb_object], self._pedb.core.Cell.Terminal.Terminal
757
770
  )
758
- _edb_boundle_terminal = self._pedb.core.cell.terminal.BundleTerminal.Create(edb_list)
771
+ _edb_boundle_terminal = self._pedb.core.Cell.Terminal.BundleTerminal.Create(edb_list)
759
772
  _edb_boundle_terminal.SetName(self.name)
760
773
  pos, neg = list(_edb_boundle_terminal.GetTerminals())
761
774
  pos.SetName(self.name + ":T1")
@@ -36,186 +36,81 @@ class CfgSParameterModel:
36
36
 
37
37
 
38
38
  class CfgSParameters:
39
- class Grpc:
40
- def __init__(self, parent):
41
- self.parent = parent
42
- self._pedb = parent._pedb
43
-
44
- def apply(self):
45
- for s_param in self.parent.s_parameters_models:
46
- fpath = s_param.file_path
47
- if not Path(fpath).anchor:
48
- fpath = str(Path(self.parent.path_libraries) / fpath)
49
- comp_def = self._pedb.definitions.component[s_param.component_definition]
50
- if s_param.pin_order:
51
- comp_def.set_properties(pin_order=s_param.pin_order)
52
- comp_def.add_n_port_model(fpath, s_param.name)
53
- comp_list = dict()
54
- if s_param.apply_to_all:
55
- comp_list.update(
56
- {
57
- refdes: comp
58
- for refdes, comp in comp_def.components.items()
59
- if refdes not in s_param.components
60
- }
61
- )
62
- else:
63
- comp_list.update(
64
- {refdes: comp for refdes, comp in comp_def.components.items() if refdes in s_param.components}
65
- )
66
-
67
- for refdes, comp in comp_list.items():
68
- if refdes in s_param.reference_net_per_component:
69
- ref_net = s_param.reference_net_per_component[refdes]
70
- else:
71
- ref_net = s_param.reference_net
72
- comp.use_s_parameter_model(s_param.name, reference_net=ref_net)
73
-
74
- def get_data_from_db(self, cfg_components):
75
- db_comp_def = self._pedb.definitions.component
76
- for name, compdef_obj in db_comp_def.items():
77
- nport_models = compdef_obj.component_models
78
- if not nport_models:
79
- continue
80
- else:
81
- pin_order = compdef_obj.get_properties()["pin_order"]
82
- temp_comps = [i for i in cfg_components if i["definition"] == name]
83
- for model_obj in nport_models:
84
- temp_comp_list = []
85
- reference_net_per_component = {}
86
- for i in temp_comps:
87
- s_param_model = i.get("s_parameter_model")
88
- if s_param_model:
89
- if s_param_model["model_name"] == model_name:
90
- temp_comp_list.append(i["reference_designator"])
91
- reference_net_per_component[i["reference_designator"]] = s_param_model[
92
- "reference_net"
93
- ]
94
- else:
95
- continue
96
-
97
- self.parent.s_parameters_models.append(
98
- CfgSParameterModel(
99
- name=model_name,
100
- component_definition=name,
101
- file_path=model_obj.reference_file,
102
- apply_to_all=False,
103
- components=temp_comp_list,
104
- reference_net_per_component=reference_net_per_component,
105
- pin_order=pin_order,
106
- )
107
- )
108
-
109
- data = []
110
- for i in self.parent.s_parameters_models:
111
- data.append(
112
- {
113
- "name": i.name,
114
- "component_definition": i.component_definition,
115
- "file_path": i.file_path,
116
- "apply_to_all": i.apply_to_all,
117
- "components": i.components,
118
- "reference_net_per_component": i.reference_net_per_component,
119
- "pin_order": i.pin_order,
120
- }
39
+ def apply(self):
40
+ for s_param in self.s_parameters_models:
41
+ fpath = s_param.file_path
42
+ if not Path(fpath).anchor:
43
+ fpath = str(Path(self.path_libraries) / fpath)
44
+ comp_def = self._pedb.definitions.component[s_param.component_definition]
45
+ if s_param.pin_order:
46
+ comp_def.set_properties(pin_order=s_param.pin_order)
47
+ comp_def.add_n_port_model(fpath, s_param.name)
48
+ comp_list = dict()
49
+ if s_param.apply_to_all:
50
+ comp_list.update(
51
+ {refdes: comp for refdes, comp in comp_def.components.items() if refdes not in s_param.components}
52
+ )
53
+ else:
54
+ comp_list.update(
55
+ {refdes: comp for refdes, comp in comp_def.components.items() if refdes in s_param.components}
121
56
  )
122
- return data
123
-
124
- class DotNet(Grpc):
125
- def __init__(self, parent):
126
- super().__init__(parent)
127
-
128
- def apply(self):
129
- for s_param in self.parent.s_parameters_models:
130
- fpath = s_param.file_path
131
- if not Path(fpath).anchor:
132
- fpath = str(Path(self.parent.path_libraries) / fpath)
133
- comp_def = self._pedb.definitions.component[s_param.component_definition]
134
- if s_param.pin_order:
135
- comp_def.set_properties(pin_order=s_param.pin_order)
136
- comp_def.add_n_port_model(fpath, s_param.name)
137
- comp_list = dict()
138
- if s_param.apply_to_all:
139
- comp_list.update(
140
- {
141
- refdes: comp
142
- for refdes, comp in comp_def.components.items()
143
- if refdes not in s_param.components
144
- }
145
- )
146
- else:
147
- comp_list.update(
148
- {refdes: comp for refdes, comp in comp_def.components.items() if refdes in s_param.components}
149
- )
150
-
151
- for refdes, comp in comp_list.items():
152
- if refdes in s_param.reference_net_per_component:
153
- ref_net = s_param.reference_net_per_component[refdes]
154
- else:
155
- ref_net = s_param.reference_net
156
- comp.use_s_parameter_model(s_param.name, reference_net=ref_net)
157
57
 
158
- def get_data_from_db(self, cfg_components):
159
- db_comp_def = self._pedb.definitions.component
160
- for name, compdef_obj in db_comp_def.items():
161
- nport_models = compdef_obj.component_models
162
- if not nport_models:
163
- continue
58
+ for refdes, comp in comp_list.items():
59
+ if refdes in s_param.reference_net_per_component:
60
+ ref_net = s_param.reference_net_per_component[refdes]
164
61
  else:
165
- pin_order = compdef_obj.get_properties()["pin_order"]
166
- temp_comps = [i for i in cfg_components if i["definition"] == name]
167
- for model_name, model_obj in nport_models.items():
168
- temp_comp_list = []
169
- reference_net_per_component = {}
170
- for i in temp_comps:
171
- s_param_model = i.get("s_parameter_model")
172
- if s_param_model:
173
- if s_param_model["model_name"] == model_name:
174
- temp_comp_list.append(i["reference_designator"])
175
- reference_net_per_component[i["reference_designator"]] = s_param_model[
176
- "reference_net"
177
- ]
178
- else:
179
- continue
62
+ ref_net = s_param.reference_net
63
+ comp.use_s_parameter_model(s_param.name, reference_net=ref_net)
180
64
 
181
- self.parent.s_parameters_models.append(
182
- CfgSParameterModel(
183
- name=model_name,
184
- component_definition=name,
185
- file_path=model_obj.reference_file,
186
- apply_to_all=False,
187
- components=temp_comp_list,
188
- reference_net_per_component=reference_net_per_component,
189
- pin_order=pin_order,
190
- )
65
+ def get_data_from_db(self, cfg_components):
66
+ db_comp_def = self._pedb.definitions.component
67
+ for name, compdef_obj in db_comp_def.items():
68
+ nport_models = compdef_obj.component_models
69
+ if not nport_models:
70
+ continue
71
+ else:
72
+ pin_order = compdef_obj.get_properties()["pin_order"]
73
+ temp_comps = [i for i in cfg_components if i["definition"] == name]
74
+ for model_name, model_obj in nport_models.items():
75
+ temp_comp_list = []
76
+ reference_net_per_component = {}
77
+ for i in temp_comps:
78
+ s_param_model = i.get("s_parameter_model")
79
+ if s_param_model:
80
+ if s_param_model["model_name"] == model_name:
81
+ temp_comp_list.append(i["reference_designator"])
82
+ reference_net_per_component[i["reference_designator"]] = s_param_model["reference_net"]
83
+ else:
84
+ continue
85
+
86
+ self.s_parameters_models.append(
87
+ CfgSParameterModel(
88
+ name=model_name,
89
+ component_definition=name,
90
+ file_path=model_obj.reference_file,
91
+ apply_to_all=False,
92
+ components=temp_comp_list,
93
+ reference_net_per_component=reference_net_per_component,
94
+ pin_order=pin_order,
191
95
  )
96
+ )
192
97
 
193
- data = []
194
- for i in self.parent.s_parameters_models:
195
- data.append(
196
- {
197
- "name": i.name,
198
- "component_definition": i.component_definition,
199
- "file_path": i.file_path,
200
- "apply_to_all": i.apply_to_all,
201
- "components": i.components,
202
- "reference_net_per_component": i.reference_net_per_component,
203
- "pin_order": i.pin_order,
204
- }
205
- )
206
- return data
98
+ data = []
99
+ for i in self.s_parameters_models:
100
+ data.append(
101
+ {
102
+ "name": i.name,
103
+ "component_definition": i.component_definition,
104
+ "file_path": i.file_path,
105
+ "apply_to_all": i.apply_to_all,
106
+ "components": i.components,
107
+ "reference_net_per_component": i.reference_net_per_component,
108
+ "pin_order": i.pin_order,
109
+ }
110
+ )
111
+ return data
207
112
 
208
113
  def __init__(self, pedb, data, path_lib=None):
209
114
  self._pedb = pedb
210
- if self._pedb.grpc:
211
- self.api = self.Grpc(self)
212
- else:
213
- self.api = self.DotNet(self)
214
115
  self.path_libraries = path_lib
215
116
  self.s_parameters_models = [CfgSParameterModel(**i) for i in data]
216
-
217
- def apply(self):
218
- self.api.apply()
219
-
220
- def get_data_from_db(self, cfg_components):
221
- return self.api.get_data_from_db(cfg_components)