pyedb 0.42.0__py3-none-any.whl → 0.44.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.
- pyedb/__init__.py +1 -1
- pyedb/configuration/cfg_boundaries.py +155 -72
- pyedb/configuration/cfg_components.py +1 -1
- pyedb/configuration/cfg_general.py +34 -16
- pyedb/configuration/cfg_modeler.py +162 -67
- pyedb/configuration/cfg_nets.py +33 -17
- pyedb/configuration/cfg_operations.py +63 -31
- pyedb/configuration/cfg_package_definition.py +113 -52
- pyedb/configuration/cfg_padstacks.py +611 -256
- pyedb/configuration/cfg_pin_groups.py +75 -33
- pyedb/configuration/cfg_ports_sources.py +75 -15
- pyedb/configuration/cfg_s_parameter_models.py +125 -70
- pyedb/configuration/cfg_setup.py +301 -257
- pyedb/configuration/cfg_stackup.py +166 -90
- pyedb/configuration/configuration.py +342 -209
- pyedb/dotnet/database/edb_data/design_options.py +19 -1
- pyedb/dotnet/database/edb_data/padstacks_data.py +16 -6
- pyedb/dotnet/database/geometry/polygon_data.py +4 -2
- pyedb/dotnet/database/padstack.py +6 -2
- pyedb/dotnet/database/sim_setup_data/data/sweep_data.py +63 -10
- pyedb/dotnet/database/utilities/simulation_setup.py +14 -30
- pyedb/dotnet/database/utilities/siwave_simulation_setup.py +30 -0
- pyedb/dotnet/edb.py +75 -105
- pyedb/grpc/database/components.py +1 -1
- pyedb/grpc/database/definition/component_def.py +15 -0
- pyedb/grpc/database/definition/component_pin.py +1 -1
- pyedb/grpc/database/definition/materials.py +27 -0
- pyedb/grpc/database/definition/package_def.py +20 -2
- pyedb/grpc/database/definition/padstack_def.py +5 -2
- pyedb/grpc/database/hierarchy/component.py +4 -2
- pyedb/grpc/database/hierarchy/pingroup.py +12 -8
- pyedb/grpc/database/layers/layer.py +28 -0
- pyedb/grpc/database/layers/stackup_layer.py +281 -40
- pyedb/grpc/database/layout/layout.py +12 -6
- pyedb/grpc/database/modeler.py +8 -8
- pyedb/grpc/database/primitive/bondwire.py +3 -3
- pyedb/grpc/database/primitive/circle.py +1 -1
- pyedb/grpc/database/primitive/padstack_instance.py +13 -3
- pyedb/grpc/database/primitive/path.py +2 -2
- pyedb/grpc/database/primitive/polygon.py +3 -3
- pyedb/grpc/database/primitive/primitive.py +1 -1
- pyedb/grpc/database/primitive/rectangle.py +2 -2
- pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +73 -30
- pyedb/grpc/database/source_excitations.py +7 -7
- pyedb/grpc/database/stackup.py +14 -6
- pyedb/grpc/database/terminal/bundle_terminal.py +3 -3
- pyedb/grpc/database/terminal/edge_terminal.py +2 -2
- pyedb/grpc/database/terminal/padstack_instance_terminal.py +42 -2
- pyedb/grpc/database/terminal/pingroup_terminal.py +35 -2
- pyedb/grpc/database/terminal/point_terminal.py +10 -1
- pyedb/grpc/database/terminal/terminal.py +4 -4
- pyedb/grpc/database/utility/hfss_extent_info.py +14 -10
- pyedb/grpc/edb.py +8 -8
- pyedb/misc/misc.py +13 -0
- {pyedb-0.42.0.dist-info → pyedb-0.44.0.dist-info}/METADATA +1 -1
- {pyedb-0.42.0.dist-info → pyedb-0.44.0.dist-info}/RECORD +58 -58
- {pyedb-0.42.0.dist-info → pyedb-0.44.0.dist-info}/LICENSE +0 -0
- {pyedb-0.42.0.dist-info → pyedb-0.44.0.dist-info}/WHEEL +0 -0
|
@@ -26,28 +26,40 @@ from pyedb.configuration.cfg_common import CfgBase
|
|
|
26
26
|
class CfgPinGroups:
|
|
27
27
|
"""Manage configuration pin group class."""
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
self
|
|
31
|
-
|
|
29
|
+
class Grpc:
|
|
30
|
+
def __init__(self, parent):
|
|
31
|
+
self.parent = parent
|
|
32
|
+
self._pedb = parent._pedb
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
def set_pingroup_to_edb(self):
|
|
35
|
+
for pg in self.parent.pin_groups:
|
|
36
|
+
pg.create()
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 = pg_obj.pins
|
|
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():
|
|
51
63
|
pins = list(pg_obj.pins.keys())
|
|
52
64
|
refdes = list(pg_obj.pins.values())[0].component.name
|
|
53
65
|
cfg_pg = CfgPinGroup(
|
|
@@ -56,8 +68,22 @@ class CfgPinGroups:
|
|
|
56
68
|
reference_designator=refdes,
|
|
57
69
|
pins=pins,
|
|
58
70
|
)
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
self.parent.pin_groups.append(cfg_pg)
|
|
72
|
+
return self.parent.export_properties()
|
|
73
|
+
|
|
74
|
+
def __init__(self, pedb, pingroup_data):
|
|
75
|
+
self._pedb = pedb
|
|
76
|
+
if self._pedb.grpc:
|
|
77
|
+
self.api = self.Grpc(self)
|
|
78
|
+
else:
|
|
79
|
+
self.api = self.DotNet(self)
|
|
80
|
+
self.pin_groups = [CfgPinGroup(self._pedb, **pg) for pg in pingroup_data]
|
|
81
|
+
|
|
82
|
+
def apply(self):
|
|
83
|
+
self.api.set_pingroup_to_edb()
|
|
84
|
+
|
|
85
|
+
def get_data_from_db(self):
|
|
86
|
+
return self.api.get_data_from_edb()
|
|
61
87
|
|
|
62
88
|
def export_properties(self):
|
|
63
89
|
pin_groups = []
|
|
@@ -67,8 +93,34 @@ class CfgPinGroups:
|
|
|
67
93
|
|
|
68
94
|
|
|
69
95
|
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)
|
|
117
|
+
|
|
70
118
|
def __init__(self, pedb, **kwargs):
|
|
71
119
|
self._pedb = pedb
|
|
120
|
+
if self._pedb.grpc:
|
|
121
|
+
self.api = self.Grpc(self)
|
|
122
|
+
else:
|
|
123
|
+
self.api = self.DotNet(self)
|
|
72
124
|
self.name = kwargs["name"]
|
|
73
125
|
self.reference_designator = kwargs.get("reference_designator")
|
|
74
126
|
self.pins = kwargs.get("pins")
|
|
@@ -76,17 +128,7 @@ class CfgPinGroup(CfgBase):
|
|
|
76
128
|
|
|
77
129
|
def create(self):
|
|
78
130
|
"""Apply pin group on layout."""
|
|
79
|
-
|
|
80
|
-
pins = self.pins if isinstance(self.pins, list) else [self.pins]
|
|
81
|
-
self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name)
|
|
82
|
-
elif self.net:
|
|
83
|
-
nets = self.net if isinstance(self.net, list) else [self.net]
|
|
84
|
-
comp = self._pedb.components.instances[self.reference_designator]
|
|
85
|
-
pins = [p for p, obj in comp.pins.items() if obj.net_name in nets]
|
|
86
|
-
if not self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name):
|
|
87
|
-
raise RuntimeError(f"Failed to create pin group {self.name}")
|
|
88
|
-
else:
|
|
89
|
-
raise RuntimeError(f"No net and pins defined for defining pin group {self.name}")
|
|
131
|
+
self.api.create()
|
|
90
132
|
|
|
91
133
|
def export_properties(self):
|
|
92
134
|
if self.pins:
|
|
@@ -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
|
|
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.
|
|
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
|
|
87
|
+
class CfgCoordinateTerminalInfo(CfgTerminalInfo):
|
|
64
88
|
def __init__(self, pedb, **kwargs):
|
|
65
89
|
super().__init__(pedb, **kwargs)
|
|
66
90
|
|
|
@@ -108,14 +132,14 @@ class CfgSources:
|
|
|
108
132
|
pos_term_info = {"pin_group": pg.name}
|
|
109
133
|
elif src.terminal_type == "PadstackInstanceTerminal":
|
|
110
134
|
refdes = src.component.refdes if src.component else ""
|
|
111
|
-
pos_term_info = {"
|
|
135
|
+
pos_term_info = {"padstack": src.padstack_instance.aedt_name}
|
|
112
136
|
|
|
113
137
|
neg_term = self._pedb.terminals[src.ref_terminal.name]
|
|
114
138
|
if neg_term.terminal_type == "PinGroupTerminal":
|
|
115
139
|
pg = self._pedb.siwave.pin_groups[neg_term._edb_object.GetPinGroup().GetName()]
|
|
116
140
|
neg_term_info = {"pin_group": pg.name}
|
|
117
141
|
elif neg_term.terminal_type == "PadstackInstanceTerminal":
|
|
118
|
-
neg_term_info = {"
|
|
142
|
+
neg_term_info = {"padstack": neg_term.padstack_instance.aedt_name}
|
|
119
143
|
|
|
120
144
|
cfg_src = CfgSource(
|
|
121
145
|
self._pedb,
|
|
@@ -137,9 +161,30 @@ class CfgSources:
|
|
|
137
161
|
|
|
138
162
|
|
|
139
163
|
class CfgPorts:
|
|
164
|
+
class Grpc:
|
|
165
|
+
def __init__(self, parent):
|
|
166
|
+
self.parent = parent
|
|
167
|
+
self._pedb = parent._pedb
|
|
168
|
+
|
|
169
|
+
def get_pin_group(self, port):
|
|
170
|
+
return self._pedb.siwave.pin_groups[port._edb_object.pin_group.name]
|
|
171
|
+
|
|
172
|
+
def get_edge_info(self, port):
|
|
173
|
+
return port._edb_object.GetEdges()[0].GetParameters()
|
|
174
|
+
|
|
175
|
+
class DotNet(Grpc):
|
|
176
|
+
def __init__(self, parent):
|
|
177
|
+
super().__init__(parent)
|
|
178
|
+
|
|
179
|
+
def get_pin_group(self, port):
|
|
180
|
+
return self._pedb.siwave.pin_groups[port._edb_object.GetPinGroup().GetName()]
|
|
181
|
+
|
|
140
182
|
def __init__(self, pedb, ports_data):
|
|
141
183
|
self._pedb = pedb
|
|
142
|
-
|
|
184
|
+
if self._pedb.grpc:
|
|
185
|
+
self.api = self.Grpc(self)
|
|
186
|
+
else:
|
|
187
|
+
self.api = self.DotNet(self)
|
|
143
188
|
self.ports = []
|
|
144
189
|
for p in ports_data:
|
|
145
190
|
if p["type"] == "wave_port":
|
|
@@ -156,6 +201,9 @@ class CfgPorts:
|
|
|
156
201
|
for i in self._pedb.layout.primitives:
|
|
157
202
|
if i.aedt_name:
|
|
158
203
|
edb_primitives[i.aedt_name] = i
|
|
204
|
+
for i in self._pedb.layout.padstack_instances:
|
|
205
|
+
if i.aedt_name:
|
|
206
|
+
edb_primitives[i.aedt_name] = i
|
|
159
207
|
for p in self.ports:
|
|
160
208
|
if p.type in ["wave_port", "diff_wave_port"]:
|
|
161
209
|
p.set_parameters_to_edb(edb_primitives)
|
|
@@ -171,6 +219,8 @@ class CfgPorts:
|
|
|
171
219
|
if not p.ref_terminal:
|
|
172
220
|
if p.terminal_type == "PadstackInstanceTerminal":
|
|
173
221
|
port_type = "coax"
|
|
222
|
+
elif p.terminal_type == "PinGroupTerminal":
|
|
223
|
+
port_type = "circuit"
|
|
174
224
|
elif p.hfss_type == "Wave":
|
|
175
225
|
port_type = "wave_port"
|
|
176
226
|
else:
|
|
@@ -180,11 +230,11 @@ class CfgPorts:
|
|
|
180
230
|
|
|
181
231
|
if p.terminal_type == "PinGroupTerminal":
|
|
182
232
|
refdes = ""
|
|
183
|
-
pg = self.
|
|
233
|
+
pg = self.api.get_pin_group(p)
|
|
184
234
|
pos_term_info = {"pin_group": pg.name}
|
|
185
235
|
elif p.terminal_type == "PadstackInstanceTerminal":
|
|
186
236
|
refdes = p.component.refdes if p.component else ""
|
|
187
|
-
pos_term_info = {"
|
|
237
|
+
pos_term_info = {"padstack": p.padstack_instance.aedt_name}
|
|
188
238
|
elif p.terminal_type == "PointTerminal":
|
|
189
239
|
refdes = ""
|
|
190
240
|
pos_term_info = {"coordinates": {"layer": p.layer.name, "point": p.location, "net": p.net.name}}
|
|
@@ -192,10 +242,11 @@ class CfgPorts:
|
|
|
192
242
|
if port_type == "circuit":
|
|
193
243
|
neg_term = self._pedb.terminals[p.ref_terminal.name]
|
|
194
244
|
if neg_term.terminal_type == "PinGroupTerminal":
|
|
195
|
-
pg = self.
|
|
245
|
+
pg = self.api.get_pin_group(neg_term)
|
|
246
|
+
# pg = self._pedb.siwave.pin_groups[neg_term._edb_object.GetPinGroup().GetName()]
|
|
196
247
|
neg_term_info = {"pin_group": pg.name}
|
|
197
248
|
elif neg_term.terminal_type == "PadstackInstanceTerminal":
|
|
198
|
-
neg_term_info = {"
|
|
249
|
+
neg_term_info = {"padstack": neg_term.padstack_instance.aedt_name}
|
|
199
250
|
elif neg_term.terminal_type == "PointTerminal":
|
|
200
251
|
neg_term_info = {
|
|
201
252
|
"coordinates": {
|
|
@@ -269,7 +320,7 @@ class CfgCircuitElement(CfgBase):
|
|
|
269
320
|
|
|
270
321
|
pos = kwargs["positive_terminal"] # {"pin" : "A1"}
|
|
271
322
|
if list(pos.keys())[0] == "coordinates":
|
|
272
|
-
self.positive_terminal_info =
|
|
323
|
+
self.positive_terminal_info = CfgCoordinateTerminalInfo(self._pedb, **pos)
|
|
273
324
|
else:
|
|
274
325
|
self.positive_terminal_info = CfgTerminalInfo(self._pedb, **pos)
|
|
275
326
|
if not self.positive_terminal_info.reference_designator:
|
|
@@ -279,7 +330,7 @@ class CfgCircuitElement(CfgBase):
|
|
|
279
330
|
if len(neg) == 0:
|
|
280
331
|
self.negative_terminal_info = None
|
|
281
332
|
elif list(neg.keys())[0] == "coordinates":
|
|
282
|
-
self.negative_terminal_info =
|
|
333
|
+
self.negative_terminal_info = CfgCoordinateTerminalInfo(self._pedb, **neg)
|
|
283
334
|
elif list(neg.keys())[0] == "nearest_pin":
|
|
284
335
|
self.negative_terminal_info = CfgNearestPinTerminalInfo(self._pedb, **neg)
|
|
285
336
|
else:
|
|
@@ -306,6 +357,11 @@ class CfgCircuitElement(CfgBase):
|
|
|
306
357
|
self._pedb.nets.find_or_create_net(net_name)
|
|
307
358
|
pos_coor_terminal[self.name] = self._pedb.get_point_terminal(self.name, net_name, point, layer)
|
|
308
359
|
|
|
360
|
+
elif pos_type == "padstack":
|
|
361
|
+
for pds in self._pedb.layout.padstack_instances:
|
|
362
|
+
if pds.aedt_name == pos_value:
|
|
363
|
+
pos_objs.update({pos_value: pds})
|
|
364
|
+
break
|
|
309
365
|
elif pos_type == "pin":
|
|
310
366
|
pins = {
|
|
311
367
|
pos_value: self._pedb.components.instances[self.positive_terminal_info.reference_designator].pins[
|
|
@@ -403,6 +459,11 @@ class CfgCircuitElement(CfgBase):
|
|
|
403
459
|
) # terminal type pin or net
|
|
404
460
|
# create pin group
|
|
405
461
|
neg_obj = self._create_pin_group(pins, self.negative_terminal_info.reference_designator, True)
|
|
462
|
+
elif neg_type == "padstack":
|
|
463
|
+
for pds in self._pedb.layout.padstack_instances:
|
|
464
|
+
if pds.aedt_name == neg_value:
|
|
465
|
+
neg_obj = {neg_value: pds}
|
|
466
|
+
break
|
|
406
467
|
elif neg_type == "pin":
|
|
407
468
|
terminal_name = f"{self.negative_terminal_info.reference_designator}_{neg_value}"
|
|
408
469
|
neg_obj = {
|
|
@@ -412,9 +473,8 @@ class CfgCircuitElement(CfgBase):
|
|
|
412
473
|
}
|
|
413
474
|
else:
|
|
414
475
|
raise Exception(f"Wrong negative terminal type {neg_type}.")
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
][0]
|
|
476
|
+
neg_term = [j.create_terminal(i) if not j.terminal else j.terminal for i, j in neg_obj.items()][0]
|
|
477
|
+
self.neg_terminal = neg_term
|
|
418
478
|
|
|
419
479
|
def _get_pins(self, terminal_type, terminal_value, reference_designator):
|
|
420
480
|
terminal_value = terminal_value if isinstance(terminal_value, list) else [terminal_value]
|
|
@@ -36,81 +36,136 @@ 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_name, model_obj in nport_models.items():
|
|
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
|
+
}
|
|
121
|
+
)
|
|
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
|
+
|
|
39
158
|
def __init__(self, pedb, data, path_lib=None):
|
|
40
159
|
self._pedb = pedb
|
|
160
|
+
if self._pedb.grpc:
|
|
161
|
+
self.api = self.Grpc(self)
|
|
162
|
+
else:
|
|
163
|
+
self.api = self.DotNet(self)
|
|
41
164
|
self.path_libraries = path_lib
|
|
42
165
|
self.s_parameters_models = [CfgSParameterModel(**i) for i in data]
|
|
43
166
|
|
|
44
167
|
def apply(self):
|
|
45
|
-
|
|
46
|
-
fpath = s_param.file_path
|
|
47
|
-
if not Path(fpath).anchor:
|
|
48
|
-
fpath = str(Path(self.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
|
-
{refdes: comp for refdes, comp in comp_def.components.items() if refdes not in s_param.components}
|
|
57
|
-
)
|
|
58
|
-
else:
|
|
59
|
-
comp_list.update(
|
|
60
|
-
{refdes: comp for refdes, comp in comp_def.components.items() if refdes in s_param.components}
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
for refdes, comp in comp_list.items():
|
|
64
|
-
if refdes in s_param.reference_net_per_component:
|
|
65
|
-
ref_net = s_param.reference_net_per_component[refdes]
|
|
66
|
-
else:
|
|
67
|
-
ref_net = s_param.reference_net
|
|
68
|
-
comp.use_s_parameter_model(s_param.name, reference_net=ref_net)
|
|
168
|
+
self.api.apply()
|
|
69
169
|
|
|
70
170
|
def get_data_from_db(self, cfg_components):
|
|
71
|
-
|
|
72
|
-
for name, compdef_obj in db_comp_def.items():
|
|
73
|
-
nport_models = compdef_obj.component_models
|
|
74
|
-
if not nport_models:
|
|
75
|
-
continue
|
|
76
|
-
else:
|
|
77
|
-
pin_order = compdef_obj.get_properties()["pin_order"]
|
|
78
|
-
temp_comps = [i for i in cfg_components if i["definition"] == name]
|
|
79
|
-
for model_name, model_obj in nport_models.items():
|
|
80
|
-
temp_comp_list = []
|
|
81
|
-
reference_net_per_component = {}
|
|
82
|
-
for i in temp_comps:
|
|
83
|
-
s_param_model = i.get("s_parameter_model")
|
|
84
|
-
if s_param_model:
|
|
85
|
-
if s_param_model["model_name"] == model_name:
|
|
86
|
-
temp_comp_list.append(i["reference_designator"])
|
|
87
|
-
reference_net_per_component[i["reference_designator"]] = s_param_model["reference_net"]
|
|
88
|
-
else:
|
|
89
|
-
continue
|
|
90
|
-
|
|
91
|
-
self.s_parameters_models.append(
|
|
92
|
-
CfgSParameterModel(
|
|
93
|
-
name=model_name,
|
|
94
|
-
component_definition=name,
|
|
95
|
-
file_path=model_obj.reference_file,
|
|
96
|
-
apply_to_all=False,
|
|
97
|
-
components=temp_comp_list,
|
|
98
|
-
reference_net_per_component=reference_net_per_component,
|
|
99
|
-
pin_order=pin_order,
|
|
100
|
-
)
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
data = []
|
|
104
|
-
for i in self.s_parameters_models:
|
|
105
|
-
data.append(
|
|
106
|
-
{
|
|
107
|
-
"name": i.name,
|
|
108
|
-
"component_definition": i.component_definition,
|
|
109
|
-
"file_path": i.file_path,
|
|
110
|
-
"apply_to_all": i.apply_to_all,
|
|
111
|
-
"components": i.components,
|
|
112
|
-
"reference_net_per_component": i.reference_net_per_component,
|
|
113
|
-
"pin_order": i.pin_order,
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
return data
|
|
171
|
+
return self.api.get_data_from_db(cfg_components)
|