pyedb 0.43.0__py3-none-any.whl → 0.45.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 (68) hide show
  1. pyedb/__init__.py +1 -1
  2. pyedb/configuration/cfg_boundaries.py +21 -15
  3. pyedb/configuration/cfg_components.py +8 -8
  4. pyedb/configuration/cfg_general.py +14 -6
  5. pyedb/configuration/cfg_modeler.py +8 -0
  6. pyedb/configuration/cfg_operations.py +40 -1
  7. pyedb/configuration/cfg_package_definition.py +41 -1
  8. pyedb/configuration/cfg_padstacks.py +611 -256
  9. pyedb/configuration/cfg_pin_groups.py +1 -1
  10. pyedb/configuration/cfg_ports_sources.py +234 -66
  11. pyedb/configuration/cfg_s_parameter_models.py +81 -1
  12. pyedb/configuration/cfg_setup.py +167 -33
  13. pyedb/configuration/cfg_stackup.py +44 -0
  14. pyedb/configuration/configuration.py +13 -3
  15. pyedb/dotnet/database/cell/primitive/path.py +12 -0
  16. pyedb/dotnet/database/edb_data/design_options.py +19 -1
  17. pyedb/dotnet/database/edb_data/padstacks_data.py +9 -4
  18. pyedb/dotnet/database/geometry/point_data.py +26 -0
  19. pyedb/dotnet/database/geometry/polygon_data.py +13 -2
  20. pyedb/dotnet/database/nets.py +13 -3
  21. pyedb/dotnet/database/padstack.py +6 -2
  22. pyedb/dotnet/database/utilities/simulation_setup.py +7 -17
  23. pyedb/dotnet/database/utilities/siwave_simulation_setup.py +30 -0
  24. pyedb/dotnet/edb.py +41 -18
  25. pyedb/grpc/database/components.py +2 -3
  26. pyedb/grpc/database/definition/component_def.py +15 -0
  27. pyedb/grpc/database/definition/component_pin.py +1 -1
  28. pyedb/grpc/database/definition/materials.py +27 -0
  29. pyedb/grpc/database/definition/package_def.py +20 -2
  30. pyedb/grpc/database/definition/padstack_def.py +5 -2
  31. pyedb/grpc/database/hfss.py +10 -1
  32. pyedb/grpc/database/hierarchy/component.py +4 -2
  33. pyedb/grpc/database/hierarchy/pingroup.py +12 -8
  34. pyedb/grpc/database/layers/layer.py +28 -0
  35. pyedb/grpc/database/layers/stackup_layer.py +281 -40
  36. pyedb/grpc/database/layout/layout.py +12 -6
  37. pyedb/grpc/database/layout_validation.py +2 -2
  38. pyedb/grpc/database/modeler.py +8 -8
  39. pyedb/grpc/database/padstacks.py +15 -9
  40. pyedb/grpc/database/ports/ports.py +3 -3
  41. pyedb/grpc/database/primitive/bondwire.py +3 -3
  42. pyedb/grpc/database/primitive/circle.py +1 -1
  43. pyedb/grpc/database/primitive/padstack_instance.py +13 -3
  44. pyedb/grpc/database/primitive/path.py +2 -2
  45. pyedb/grpc/database/primitive/polygon.py +3 -3
  46. pyedb/grpc/database/primitive/primitive.py +1 -1
  47. pyedb/grpc/database/primitive/rectangle.py +2 -2
  48. pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +78 -30
  49. pyedb/grpc/database/simulation_setup/siwave_simulation_setup.py +73 -30
  50. pyedb/grpc/database/simulation_setup/sweep_data.py +12 -1
  51. pyedb/grpc/database/siwave.py +10 -1
  52. pyedb/grpc/database/source_excitations.py +19 -9
  53. pyedb/grpc/database/stackup.py +26 -10
  54. pyedb/grpc/database/terminal/bundle_terminal.py +3 -3
  55. pyedb/grpc/database/terminal/edge_terminal.py +95 -2
  56. pyedb/grpc/database/terminal/padstack_instance_terminal.py +42 -2
  57. pyedb/grpc/database/terminal/pingroup_terminal.py +48 -2
  58. pyedb/grpc/database/terminal/point_terminal.py +10 -1
  59. pyedb/grpc/database/terminal/terminal.py +4 -4
  60. pyedb/grpc/database/utility/hfss_extent_info.py +14 -10
  61. pyedb/grpc/edb.py +21 -17
  62. pyedb/grpc/edb_init.py +19 -15
  63. pyedb/grpc/rpc_session.py +11 -8
  64. pyedb/misc/misc.py +13 -0
  65. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/METADATA +6 -6
  66. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/RECORD +68 -68
  67. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/LICENSE +0 -0
  68. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/WHEEL +0 -0
@@ -40,7 +40,7 @@ class CfgPinGroups:
40
40
  layout_pin_groups = self._pedb.siwave.pin_groups
41
41
  for pg_name, pg_obj in layout_pin_groups.items():
42
42
  if self._pedb.grpc:
43
- pins = pg_obj.pins
43
+ pins = list(pg_obj.pins.values())
44
44
  refdes = pins[0].component.name
45
45
  cfg_pg = CfgPinGroup(
46
46
  self._pedb,
@@ -33,9 +33,33 @@ from pyedb.dotnet.database.geometry.point_data import PointData
33
33
  class CfgTerminalInfo(CfgBase):
34
34
  CFG_TERMINAL_TYPES = ["pin", "net", "pin_group", "nearest_pin", "coordinates"]
35
35
 
36
+ class Grpc:
37
+ def __init__(self, parent):
38
+ self.parent = parent
39
+ self._pedb = parent._pedb
40
+
41
+ def update_contact_radius(self, radius):
42
+ from ansys.edb.core.utility.value import Value as GrpcValue
43
+
44
+ self.parent.contact_radius = GrpcValue(radius).value
45
+
46
+ class DotNet(Grpc):
47
+ def __init__(self, parent):
48
+ super().__init__(parent)
49
+
50
+ def update_contact_radius(self, radius):
51
+ self.parent.contact_radius = self._pedb.edb_value(radius).ToDouble()
52
+
36
53
  def __init__(self, pedb, **kwargs):
37
54
  self._pedb = pedb
38
- if "pin" in kwargs:
55
+ if self._pedb.grpc:
56
+ self.api = self.Grpc(self)
57
+ else:
58
+ self.api = self.DotNet(self)
59
+
60
+ if kwargs.get("padstack"):
61
+ self.type = "padstack"
62
+ elif "pin" in kwargs:
39
63
  self.type = "pin"
40
64
  elif "net" in kwargs:
41
65
  self.type = "net"
@@ -52,7 +76,7 @@ class CfgTerminalInfo(CfgBase):
52
76
 
53
77
  self.contact_type = kwargs.get("contact_type", "default") # options are full, center, quad, inline
54
78
  contact_radius = "0.1mm" if kwargs.get("contact_radius") is None else kwargs.get("contact_radius")
55
- self.contact_radius = self._pedb.edb_value(contact_radius).ToDouble()
79
+ self.api.update_contact_radius(contact_radius)
56
80
  self.num_of_contact = kwargs.get("num_of_contact", 4)
57
81
  self.contact_expansion = kwargs.get("contact_expansion", 1)
58
82
 
@@ -60,7 +84,7 @@ class CfgTerminalInfo(CfgBase):
60
84
  return {self.type: self.value}
61
85
 
62
86
 
63
- class CfgCoordianteTerminalInfo(CfgTerminalInfo):
87
+ class CfgCoordinateTerminalInfo(CfgTerminalInfo):
64
88
  def __init__(self, pedb, **kwargs):
65
89
  super().__init__(pedb, **kwargs)
66
90
 
@@ -84,8 +108,27 @@ class CfgNearestPinTerminalInfo(CfgTerminalInfo):
84
108
 
85
109
 
86
110
  class CfgSources:
111
+ class Grpc:
112
+ def __init__(self, parent):
113
+ self.parent = parent
114
+ self._pedb = parent._pedb
115
+
116
+ def get_pin_group_name(self, src):
117
+ return src.pin_group.name
118
+
119
+ class DotNet(Grpc):
120
+ def __init__(self, parent):
121
+ super().__init__(parent)
122
+
123
+ def get_pin_group_name(self, src):
124
+ return src._edb_object.GetPinGroup().GetName()
125
+
87
126
  def __init__(self, pedb, sources_data):
88
127
  self._pedb = pedb
128
+ if self._pedb.grpc:
129
+ self.api = self.Grpc(self)
130
+ else:
131
+ self.api = self.DotNet(self)
89
132
  self.sources = [CfgSource(self._pedb, **src) for src in sources_data]
90
133
 
91
134
  def apply(self):
@@ -104,18 +147,18 @@ class CfgSources:
104
147
 
105
148
  if src.terminal_type == "PinGroupTerminal":
106
149
  refdes = ""
107
- pg = self._pedb.siwave.pin_groups[src._edb_object.GetPinGroup().GetName()]
150
+ pg = self._pedb.siwave.pin_groups[self.api.get_pin_group_name(src)]
108
151
  pos_term_info = {"pin_group": pg.name}
109
152
  elif src.terminal_type == "PadstackInstanceTerminal":
110
153
  refdes = src.component.refdes if src.component else ""
111
- pos_term_info = {"pin": src.padstack_instance.component_pin}
154
+ pos_term_info = {"padstack": src.padstack_instance.aedt_name}
112
155
 
113
156
  neg_term = self._pedb.terminals[src.ref_terminal.name]
114
157
  if neg_term.terminal_type == "PinGroupTerminal":
115
- pg = self._pedb.siwave.pin_groups[neg_term._edb_object.GetPinGroup().GetName()]
158
+ pg = self._pedb.siwave.pin_groups[self.api.get_pin_group_name(neg_term)]
116
159
  neg_term_info = {"pin_group": pg.name}
117
160
  elif neg_term.terminal_type == "PadstackInstanceTerminal":
118
- neg_term_info = {"pin": neg_term.padstack_instance.component_pin}
161
+ neg_term_info = {"padstack": neg_term.padstack_instance.aedt_name}
119
162
 
120
163
  cfg_src = CfgSource(
121
164
  self._pedb,
@@ -137,13 +180,74 @@ class CfgSources:
137
180
 
138
181
 
139
182
  class CfgPorts:
183
+ class Grpc:
184
+ def __init__(self, parent):
185
+ self.parent = parent
186
+ self._pedb = parent._pedb
187
+
188
+ def get_pin_group(self, port):
189
+ return self._pedb.siwave.pin_groups[port._edb_object.pin_group.name]
190
+
191
+ def get_edge_info(self, port):
192
+ return port._edb_object.GetEdges()[0].GetParameters()
193
+
194
+ def _get_edge_port_from_edb(self, p, port_type):
195
+ # primitive, point = p._edb_object.GetEdges()[0].GetParameters()
196
+ edges = p.edges
197
+ primitive = None
198
+ point = None
199
+ primitive = Primitive(self._pedb, primitive)
200
+ point = PointData(self._pedb, point)
201
+
202
+ cfg_port = CfgEdgePort(
203
+ self._pedb,
204
+ name=p.name,
205
+ type=port_type,
206
+ primitive_name=primitive.aedt_name,
207
+ point_on_edge=[point._edb_object.X.ToString(), point._edb_object.Y.ToString()],
208
+ horizontal_extent_factor=p.horizontal_extent_factor,
209
+ vertical_extent_factor=p.vertical_extent_factor,
210
+ pec_launch_width=p.pec_launch_width,
211
+ )
212
+ return cfg_port
213
+
214
+ class DotNet(Grpc):
215
+ def __init__(self, parent):
216
+ super().__init__(parent)
217
+
218
+ def get_pin_group(self, port):
219
+ return self._pedb.siwave.pin_groups[port._edb_object.GetPinGroup().GetName()]
220
+
221
+ def _get_edge_port_from_edb(self, p, port_type):
222
+ _, primitive, point = p._edb_object.GetEdges()[0].GetParameters()
223
+
224
+ primitive = Primitive(self._pedb, primitive)
225
+ point = PointData(self._pedb, point)
226
+
227
+ cfg_port = CfgEdgePort(
228
+ self._pedb,
229
+ name=p.name,
230
+ type=port_type,
231
+ primitive_name=primitive.aedt_name,
232
+ point_on_edge=[point._edb_object.X.ToString(), point._edb_object.Y.ToString()],
233
+ horizontal_extent_factor=p.horizontal_extent_factor,
234
+ vertical_extent_factor=p.vertical_extent_factor,
235
+ pec_launch_width=p.pec_launch_width,
236
+ )
237
+ return cfg_port
238
+
140
239
  def __init__(self, pedb, ports_data):
141
240
  self._pedb = pedb
142
-
241
+ if self._pedb.grpc:
242
+ self.api = self.Grpc(self)
243
+ else:
244
+ self.api = self.DotNet(self)
143
245
  self.ports = []
144
246
  for p in ports_data:
145
247
  if p["type"] == "wave_port":
146
248
  self.ports.append(CfgEdgePort(self._pedb, **p))
249
+ elif p["type"] == "gap_port":
250
+ self.ports.append(CfgEdgePort(self._pedb, **p))
147
251
  elif p["type"] == "diff_wave_port":
148
252
  self.ports.append(CfgDiffWavePort(self._pedb, **p))
149
253
  elif p["type"] in ["coax", "circuit"]:
@@ -156,8 +260,11 @@ class CfgPorts:
156
260
  for i in self._pedb.layout.primitives:
157
261
  if i.aedt_name:
158
262
  edb_primitives[i.aedt_name] = i
263
+ for i in self._pedb.layout.padstack_instances:
264
+ if i.aedt_name:
265
+ edb_primitives[i.aedt_name] = i
159
266
  for p in self.ports:
160
- if p.type in ["wave_port", "diff_wave_port"]:
267
+ if p.type in ["wave_port", "diff_wave_port", "gap_port"]:
161
268
  p.set_parameters_to_edb(edb_primitives)
162
269
  else:
163
270
  p.set_parameters_to_edb()
@@ -171,20 +278,22 @@ class CfgPorts:
171
278
  if not p.ref_terminal:
172
279
  if p.terminal_type == "PadstackInstanceTerminal":
173
280
  port_type = "coax"
174
- elif p.hfss_type == "Wave":
175
- port_type = "wave_port"
281
+ elif p.terminal_type == "PinGroupTerminal":
282
+ port_type = "circuit"
283
+ elif p.terminal_type == "EdgeTerminal":
284
+ port_type = "wave_port" if p.hfss_type == "Wave" else "gap_port"
176
285
  else:
177
- port_type = "gap_port"
286
+ raise ValueError("Unknown terminal type")
178
287
  else:
179
288
  port_type = "circuit"
180
289
 
181
290
  if p.terminal_type == "PinGroupTerminal":
182
291
  refdes = ""
183
- pg = self._pedb.siwave.pin_groups[p._edb_object.GetPinGroup().GetName()]
292
+ pg = self.api.get_pin_group(p)
184
293
  pos_term_info = {"pin_group": pg.name}
185
294
  elif p.terminal_type == "PadstackInstanceTerminal":
186
295
  refdes = p.component.refdes if p.component else ""
187
- pos_term_info = {"pin": p.padstack_instance.component_pin}
296
+ pos_term_info = {"padstack": p.padstack_instance.aedt_name}
188
297
  elif p.terminal_type == "PointTerminal":
189
298
  refdes = ""
190
299
  pos_term_info = {"coordinates": {"layer": p.layer.name, "point": p.location, "net": p.net.name}}
@@ -192,10 +301,11 @@ class CfgPorts:
192
301
  if port_type == "circuit":
193
302
  neg_term = self._pedb.terminals[p.ref_terminal.name]
194
303
  if neg_term.terminal_type == "PinGroupTerminal":
195
- pg = self._pedb.siwave.pin_groups[neg_term._edb_object.GetPinGroup().GetName()]
304
+ pg = self.api.get_pin_group(neg_term)
305
+ # pg = self._pedb.siwave.pin_groups[neg_term._edb_object.GetPinGroup().GetName()]
196
306
  neg_term_info = {"pin_group": pg.name}
197
307
  elif neg_term.terminal_type == "PadstackInstanceTerminal":
198
- neg_term_info = {"pin": neg_term.padstack_instance.component_pin}
308
+ neg_term_info = {"padstack": neg_term.padstack_instance.aedt_name}
199
309
  elif neg_term.terminal_type == "PointTerminal":
200
310
  neg_term_info = {
201
311
  "coordinates": {
@@ -222,22 +332,7 @@ class CfgPorts:
222
332
  positive_terminal=pos_term_info,
223
333
  )
224
334
  else:
225
- _, primitive, point = p._edb_object.GetEdges()[0].GetParameters()
226
-
227
- primitive = Primitive(self._pedb, primitive)
228
- point = PointData(self._pedb, point)
229
-
230
- cfg_port = CfgEdgePort(
231
- self._pedb,
232
- name=p.name,
233
- type=port_type,
234
- primitive_name=primitive.aedt_name,
235
- point_on_edge=[point._edb_object.X.ToString(), point._edb_object.Y.ToString()],
236
- horizontal_extent_factor=p.horizontal_extent_factor,
237
- vertical_extent_factor=p.vertical_extent_factor,
238
- pec_launch_width=p.pec_launch_width,
239
- )
240
-
335
+ cfg_port = self.api._get_edge_port_from_edb(p, port_type)
241
336
  self.ports.append(cfg_port)
242
337
  return self.export_properties()
243
338
 
@@ -269,7 +364,7 @@ class CfgCircuitElement(CfgBase):
269
364
 
270
365
  pos = kwargs["positive_terminal"] # {"pin" : "A1"}
271
366
  if list(pos.keys())[0] == "coordinates":
272
- self.positive_terminal_info = CfgCoordianteTerminalInfo(self._pedb, **pos)
367
+ self.positive_terminal_info = CfgCoordinateTerminalInfo(self._pedb, **pos)
273
368
  else:
274
369
  self.positive_terminal_info = CfgTerminalInfo(self._pedb, **pos)
275
370
  if not self.positive_terminal_info.reference_designator:
@@ -279,7 +374,7 @@ class CfgCircuitElement(CfgBase):
279
374
  if len(neg) == 0:
280
375
  self.negative_terminal_info = None
281
376
  elif list(neg.keys())[0] == "coordinates":
282
- self.negative_terminal_info = CfgCoordianteTerminalInfo(self._pedb, **neg)
377
+ self.negative_terminal_info = CfgCoordinateTerminalInfo(self._pedb, **neg)
283
378
  elif list(neg.keys())[0] == "nearest_pin":
284
379
  self.negative_terminal_info = CfgNearestPinTerminalInfo(self._pedb, **neg)
285
380
  else:
@@ -306,6 +401,11 @@ class CfgCircuitElement(CfgBase):
306
401
  self._pedb.nets.find_or_create_net(net_name)
307
402
  pos_coor_terminal[self.name] = self._pedb.get_point_terminal(self.name, net_name, point, layer)
308
403
 
404
+ elif pos_type == "padstack":
405
+ for pds in self._pedb.layout.padstack_instances:
406
+ if pds.aedt_name == pos_value:
407
+ pos_objs.update({pos_value: pds})
408
+ break
309
409
  elif pos_type == "pin":
310
410
  pins = {
311
411
  pos_value: self._pedb.components.instances[self.positive_terminal_info.reference_designator].pins[
@@ -403,6 +503,11 @@ class CfgCircuitElement(CfgBase):
403
503
  ) # terminal type pin or net
404
504
  # create pin group
405
505
  neg_obj = self._create_pin_group(pins, self.negative_terminal_info.reference_designator, True)
506
+ elif neg_type == "padstack":
507
+ for pds in self._pedb.layout.padstack_instances:
508
+ if pds.aedt_name == neg_value:
509
+ neg_obj = {neg_value: pds}
510
+ break
406
511
  elif neg_type == "pin":
407
512
  terminal_name = f"{self.negative_terminal_info.reference_designator}_{neg_value}"
408
513
  neg_obj = {
@@ -412,9 +517,8 @@ class CfgCircuitElement(CfgBase):
412
517
  }
413
518
  else:
414
519
  raise Exception(f"Wrong negative terminal type {neg_type}.")
415
- self.neg_terminal = [
416
- j.create_terminal(i) if not j.terminal else j.terminal for i, j in neg_obj.items()
417
- ][0]
520
+ neg_term = [j.create_terminal(i) if not j.terminal else j.terminal for i, j in neg_obj.items()][0]
521
+ self.neg_terminal = neg_term
418
522
 
419
523
  def _get_pins(self, terminal_type, terminal_value, reference_designator):
420
524
  terminal_value = terminal_value if isinstance(terminal_value, list) else [terminal_value]
@@ -663,8 +767,99 @@ class CfgProbe(CfgCircuitElement):
663
767
 
664
768
 
665
769
  class CfgEdgePort:
770
+ class Grpc:
771
+ def __init__(self, parent):
772
+ self.parent = parent
773
+ self._pedb = parent._pedb
774
+
775
+ def set_parameters_to_edb(self, edb_primitives):
776
+ from ansys.edb.core.geometry.point_data import PointData as GrpcPointData
777
+ from ansys.edb.core.terminal.edge_terminal import (
778
+ EdgeTerminal as GrpcEdgeTerminal,
779
+ )
780
+ from ansys.edb.core.terminal.edge_terminal import (
781
+ PrimitiveEdge as GrpcPrimitiveEdge,
782
+ )
783
+ from ansys.edb.core.utility.value import Value as GrpcValue
784
+
785
+ from pyedb.grpc.database.ports.ports import WavePort
786
+
787
+ point_on_edge = GrpcPointData(self.parent.point_on_edge)
788
+ primitive = edb_primitives[self.parent.primitive_name]
789
+ pos_edge = GrpcPrimitiveEdge.create(primitive, point_on_edge)
790
+ edge_term = GrpcEdgeTerminal.create(
791
+ layout=primitive.layout, name=self.parent.name, net=primitive.net, edges=[pos_edge], is_ref=False
792
+ )
793
+ edge_term.impedance = GrpcValue(50)
794
+ wave_port = WavePort(self._pedb, edge_term)
795
+ wave_port.horizontal_extent_factor = self.parent.horizontal_extent_factor
796
+ wave_port.vertical_extent_factor = self.parent.vertical_extent_factor
797
+ wave_port.pec_launch_width = self.parent.pec_launch_width
798
+ if self.parent.type == "wave_port":
799
+ wave_port.hfss_type = "Wave"
800
+ else:
801
+ wave_port.hfss_type = "Gap"
802
+ wave_port.do_renormalize = True
803
+ return wave_port
804
+
805
+ def export_properties(self):
806
+ return {
807
+ "name": self.name,
808
+ "type": self.type,
809
+ "primitive_name": self.primitive_name,
810
+ "point_on_edge": self.point_on_edge,
811
+ "horizontal_extent_factor": self.horizontal_extent_factor,
812
+ "vertical_extent_factor": self.vertical_extent_factor,
813
+ "pec_launch_width": self.pec_launch_width,
814
+ }
815
+
816
+ class DotNet(Grpc):
817
+ def __init__(self, parent):
818
+ super().__init__(parent)
819
+
820
+ def set_parameters_to_edb(self, edb_primitives):
821
+ point_on_edge = PointData(self._pedb, x=self.parent.point_on_edge[0], y=self.parent.point_on_edge[1])
822
+ primitive = edb_primitives[self.parent.primitive_name]
823
+ pos_edge = self._pedb.edb_api.cell.terminal.PrimitiveEdge.Create(
824
+ primitive._edb_object, point_on_edge._edb_object
825
+ )
826
+ pos_edge = convert_py_list_to_net_list(pos_edge, self._pedb.edb_api.cell.terminal.Edge)
827
+ edge_term = self._pedb.edb_api.cell.terminal.EdgeTerminal.Create(
828
+ primitive._edb_object.GetLayout(),
829
+ primitive._edb_object.GetNet(),
830
+ self.parent.name,
831
+ pos_edge,
832
+ isRef=False,
833
+ )
834
+ edge_term.SetImpedance(self._pedb.edb_value(50))
835
+ wave_port = WavePort(self._pedb, edge_term)
836
+ wave_port.horizontal_extent_factor = self.parent.horizontal_extent_factor
837
+ wave_port.vertical_extent_factor = self.parent.vertical_extent_factor
838
+ wave_port.pec_launch_width = self.parent.pec_launch_width
839
+ if self.parent.type == "wave_port":
840
+ wave_port.hfss_type = "Wave"
841
+ else:
842
+ wave_port.hfss_type = "Gap"
843
+ wave_port.do_renormalize = True
844
+ return wave_port
845
+
846
+ def export_properties(self):
847
+ return {
848
+ "name": self.parent.name,
849
+ "type": self.parent.type,
850
+ "primitive_name": self.parent.primitive_name,
851
+ "point_on_edge": self.parent.point_on_edge,
852
+ "horizontal_extent_factor": self.parent.horizontal_extent_factor,
853
+ "vertical_extent_factor": self.parent.vertical_extent_factor,
854
+ "pec_launch_width": self.parent.pec_launch_width,
855
+ }
856
+
666
857
  def __init__(self, pedb, **kwargs):
667
858
  self._pedb = pedb
859
+ if self._pedb.grpc:
860
+ self.api = self.Grpc(self)
861
+ else:
862
+ self.api = self.DotNet(self)
668
863
  self.name = kwargs["name"]
669
864
  self.type = kwargs["type"]
670
865
  self.primitive_name = kwargs["primitive_name"]
@@ -674,37 +869,10 @@ class CfgEdgePort:
674
869
  self.pec_launch_width = kwargs.get("pec_launch_width", "0.01mm")
675
870
 
676
871
  def set_parameters_to_edb(self, edb_primitives):
677
- point_on_edge = PointData(self._pedb, x=self.point_on_edge[0], y=self.point_on_edge[1])
678
- primitive = edb_primitives[self.primitive_name]
679
- pos_edge = self._pedb.edb_api.cell.terminal.PrimitiveEdge.Create(
680
- primitive._edb_object, point_on_edge._edb_object
681
- )
682
- pos_edge = convert_py_list_to_net_list(pos_edge, self._pedb.edb_api.cell.terminal.Edge)
683
- edge_term = self._pedb.edb_api.cell.terminal.EdgeTerminal.Create(
684
- primitive._edb_object.GetLayout(), primitive._edb_object.GetNet(), self.name, pos_edge, isRef=False
685
- )
686
- edge_term.SetImpedance(self._pedb.edb_value(50))
687
- wave_port = WavePort(self._pedb, edge_term)
688
- wave_port.horizontal_extent_factor = self.horizontal_extent_factor
689
- wave_port.vertical_extent_factor = self.vertical_extent_factor
690
- wave_port.pec_launch_width = self.pec_launch_width
691
- if self.type == "wave_port":
692
- wave_port.hfss_type = "Wave"
693
- else:
694
- wave_port.hfss_type = "Gap"
695
- wave_port.do_renormalize = True
696
- return wave_port
872
+ return self.api.set_parameters_to_edb(edb_primitives)
697
873
 
698
874
  def export_properties(self):
699
- return {
700
- "name": self.name,
701
- "type": self.type,
702
- "primitive_name": self.primitive_name,
703
- "point_on_edge": self.point_on_edge,
704
- "horizontal_extent_factor": self.horizontal_extent_factor,
705
- "vertical_extent_factor": self.vertical_extent_factor,
706
- "pec_launch_width": self.pec_launch_width,
707
- }
875
+ return self.api.export_properties()
708
876
 
709
877
 
710
878
  class CfgDiffWavePort:
@@ -80,7 +80,7 @@ class CfgSParameters:
80
80
  else:
81
81
  pin_order = compdef_obj.get_properties()["pin_order"]
82
82
  temp_comps = [i for i in cfg_components if i["definition"] == name]
83
- for model_name, model_obj in nport_models.items():
83
+ for model_obj in nport_models:
84
84
  temp_comp_list = []
85
85
  reference_net_per_component = {}
86
86
  for i in temp_comps:
@@ -125,6 +125,86 @@ class CfgSParameters:
125
125
  def __init__(self, parent):
126
126
  super().__init__(parent)
127
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
+
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
164
+ 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
180
+
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
+ )
191
+ )
192
+
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
207
+
128
208
  def __init__(self, pedb, data, path_lib=None):
129
209
  self._pedb = pedb
130
210
  if self._pedb.grpc: