pyedb 0.52.0__py3-none-any.whl → 0.53.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.

@@ -0,0 +1,961 @@
1
+ from ansys.edb.core.database import ProductIdType as GrpcProductIdType
2
+ from ansys.edb.core.utility.value import Value as GrpcValue
3
+
4
+ import pyedb.siwave_core.cpa.simulation_setup_data_model
5
+ from pyedb.siwave_core.cpa.simulation_setup_data_model import SIwaveCpaSetup, Vrm
6
+ from pyedb.siwave_core.product_properties import SIwaveProperties
7
+
8
+
9
+ class ChannelSetup:
10
+ """
11
+ Represents the setup configuration for a channel in SIwave CPA simulations.
12
+
13
+ Attributes:
14
+ die_name (str): The name of the die associated with the channel setup.
15
+ pin_grouping_mode (str): The mode for pin grouping. Options are "perpin", "ploc", or "usediepingroups".
16
+ channel_component_exposure (dict): A dictionary mapping component names to their exposure status (True/False).
17
+ vrm (list): A list of VRM (Voltage Regulator Module) configurations.
18
+ """
19
+
20
+ def __init__(self, pedb, cfg_channel_setup=None):
21
+ """
22
+ Initializes the ChannelSetup instance.
23
+
24
+ Args:
25
+ pedb: The database object representing the active cell.
26
+ cfg_channel_setup: Optional configuration object to initialize the channel setup.
27
+ """
28
+ self._pedb = pedb
29
+ self.__init_values()
30
+ if cfg_channel_setup:
31
+ self._apply_cfg_object(cfg_channel_setup)
32
+
33
+ def __init_values(self):
34
+ """
35
+ Initializes default values for the channel setup attributes.
36
+ """
37
+ self.die_name = ""
38
+ self.pin_grouping_mode = "perpin"
39
+ self.channel_component_exposure = {}
40
+
41
+ def _apply_cfg_object(self, channel_setup):
42
+ """
43
+ Applies the configuration object to set up the channel.
44
+
45
+ Args:
46
+ channel_setup: The configuration object containing channel setup data.
47
+ """
48
+ self.die_name = channel_setup.die_name
49
+ self.channel_component_exposure = channel_setup.channel_component_exposure
50
+ self.pin_grouping_mode = channel_setup.pin_grouping_mode
51
+ self.vrm = channel_setup.vrm_setup if hasattr(channel_setup, "vrm_setup") else [] # type: ignore[union-attr]
52
+
53
+ @property
54
+ def die_name(self):
55
+ """
56
+ Gets the die name from the database.
57
+
58
+ Returns:
59
+ str: The die name.
60
+ """
61
+ return self._pedb.active_cell.get_product_property(
62
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_DIE_NAME
63
+ ).value
64
+
65
+ @die_name.setter
66
+ def die_name(self, value):
67
+ """
68
+ Sets the die name in the database.
69
+
70
+ Args:
71
+ value (str): The die name to set.
72
+ """
73
+ self._pedb.active_cell.set_product_property(
74
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_DIE_NAME, value
75
+ )
76
+
77
+ @property
78
+ def pin_grouping_mode(self):
79
+ """
80
+ Gets the pin grouping mode from the database.
81
+
82
+ Returns:
83
+ str: The pin grouping mode ("perpin", "ploc", or "usediepingroups").
84
+ """
85
+ mode_mapping = {-1: "perpin", 0: "ploc", 1: "usediepingroups"}
86
+ pg_mode = self._pedb.active_cell.get_product_property(
87
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_PIN_GROUPING_MODE
88
+ ).value
89
+ return mode_mapping[int(pg_mode.split(":")[1])] if pg_mode else "perpin"
90
+
91
+ @pin_grouping_mode.setter
92
+ def pin_grouping_mode(self, value):
93
+ """
94
+ Sets the pin grouping mode in the database.
95
+
96
+ Args:
97
+ value (str or int): The pin grouping mode ("perpin", "ploc", or "usediepingroups") or its
98
+ corresponding integer value.
99
+
100
+ Raises:
101
+ ValueError: If the provided value is not supported.
102
+ """
103
+ mapping = {"perpin": -1, "ploc": 0, "usediepingroups": 1}
104
+ if isinstance(value, str):
105
+ if not value in mapping:
106
+ raise ValueError(f"value {value} not supported, must be {list(mapping.keys())}")
107
+ value = mapping[value]
108
+ if not value in [-1, 0, 1]:
109
+ raise ValueError(f"wrong value {value}")
110
+ self._pedb.active_cell.set_product_property(
111
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_PIN_GROUPING_MODE, self.die_name + ":" + str(value)
112
+ )
113
+
114
+ @property
115
+ def channel_component_exposure(self):
116
+ """
117
+ Gets the channel component exposure configuration from the database.
118
+
119
+ Returns:
120
+ dict: A dictionary mapping component names to their exposure status (True/False).
121
+ """
122
+ cmp_exposure = self._pedb.active_cell.get_product_property(
123
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_COMPONENT_EXPOSURE_CONFIG
124
+ ).value
125
+ cmp_dict = {}
126
+ for comp in cmp_exposure.split("*"):
127
+ _comp = comp.split(":")
128
+ cmp_dict[_comp[0]] = bool(_comp[1])
129
+ return cmp_dict
130
+
131
+ @channel_component_exposure.setter
132
+ def channel_component_exposure(self, value):
133
+ """
134
+ Sets the channel component exposure configuration in the database.
135
+
136
+ Args:
137
+ value (dict): A dictionary mapping component names to their exposure status (True/False).
138
+
139
+ Raises:
140
+ ValueError: If the input is not a dictionary.
141
+ """
142
+ if not isinstance(value, dict):
143
+ raise ValueError("Channel component exposure input must be a dictionary.")
144
+ channel_comp_exposure = ""
145
+ for comp, enabled in value.items():
146
+ if channel_comp_exposure:
147
+ channel_comp_exposure += "*"
148
+ channel_comp_exposure += f"{comp}:{int(enabled)}"
149
+ self._pedb.active_cell.set_product_property(
150
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_COMPONENT_EXPOSURE_CONFIG, channel_comp_exposure
151
+ )
152
+
153
+ @property
154
+ def vrm(self):
155
+ """
156
+ Gets the VRM (Voltage Regulator Module) setup from the database.
157
+
158
+ Returns:
159
+ list: A list of Vrm objects representing the VRM setup.
160
+
161
+ Raises:
162
+ ValueError: If the VRM format is invalid.
163
+ """
164
+ vrm = self._pedb.active_cell.get_product_property(
165
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_VRM_SETUP
166
+ ).value
167
+ vrm_list = []
168
+ for _vrm in vrm.split("*"):
169
+ vrm_obj = Vrm()
170
+ _vrm_values = _vrm.split(":")
171
+ if len(_vrm_values) != 4:
172
+ raise ValueError(
173
+ f"Invalid VRM format: {_vrm}. Expected format is 'name:voltage:power_net:reference_net'."
174
+ )
175
+ vrm_obj.name = _vrm_values[0]
176
+ vrm_obj.voltage = float(_vrm_values[1])
177
+ vrm_obj.power_net = _vrm_values[2]
178
+ vrm_obj.reference_net = _vrm_values[3]
179
+ vrm_list.append(vrm_obj)
180
+ return vrm_list
181
+
182
+ @vrm.setter
183
+ def vrm(self, value):
184
+ """
185
+ Sets the VRM (Voltage Regulator Module) setup in the database.
186
+
187
+ Args:
188
+ value (list): A list of Vrm objects representing the VRM setup.
189
+
190
+ Raises:
191
+ ValueError: If the input is not a list.
192
+ """
193
+ if not isinstance(value, list):
194
+ raise ValueError("vrm setter must have list as input.")
195
+ vrm_str = ""
196
+ for vrm in value:
197
+ if isinstance(vrm, pyedb.siwave_core.cpa.simulation_setup_data_model.Vrm):
198
+ if vrm_str:
199
+ vrm_str += "*"
200
+ vrm_str += vrm.name
201
+ vrm_str += ":"
202
+ vrm_str += str(vrm.voltage)
203
+ vrm_str += ":"
204
+ vrm_str += vrm.power_net
205
+ vrm_str += ":"
206
+ vrm_str += vrm.reference_net
207
+ self._pedb.active_cell.set_product_property(
208
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_VRM_SETUP, vrm_str
209
+ )
210
+
211
+
212
+ class SolverOptions:
213
+ """
214
+ Represents solver options configuration for SIwave CPA simulations.
215
+
216
+ Attributes:
217
+ extraction_mode (str): Extraction mode ('si' or 'pi')
218
+ custom_refinement (bool): Whether to use custom refinement settings
219
+ extraction_frequency (str): Frequency for extraction (e.g. '10Ghz')
220
+ compute_capacitance (bool): Whether to compute capacitance
221
+ compute_dc_parameters (bool): Whether to compute DC parameters
222
+ compute_dc_rl (bool): Whether to compute DC RL parameters
223
+ compute_dc_cg (bool): Whether to compute DC CG parameters
224
+ compute_ac_rl (bool): Whether to compute AC RL parameters
225
+ ground_power_nets_for_si (bool): Whether to ground power nets for SI analysis
226
+ small_hole_diameter (float|str): Small hole diameter value or 'auto'
227
+ adaptive_refinement_cg_max_passes (int): Max passes for CG adaptive refinement
228
+ adaptive_refinement_rl_max_passes (int): Max passes for RL adaptive refinement
229
+ adaptive_refinement_cg_percent_error (float): Target error for CG refinement
230
+ adaptive_refinement_rl_percent_error (float): Target error for RL refinement
231
+ rl_percent_refinement_per_pass (float): RL refinement percentage per pass
232
+ cg_percent_refinement_per_pass (float): CG refinement percentage per pass
233
+ return_path_net_for_loop_parameters (bool): Whether to use return path net
234
+ """
235
+
236
+ def __init__(self, pedb, cfg_solver_options=None):
237
+ """
238
+ Initialize solver options.
239
+
240
+ Args:
241
+ pedb: Database object containing the active cell
242
+ cfg_solver_options: Optional configuration object to initialize settings
243
+ """
244
+ self._pedb = pedb
245
+ self.__init_values()
246
+ if cfg_solver_options:
247
+ self._apply_cfg_object(cfg_solver_options)
248
+
249
+ def __init_values(self):
250
+ """Initialize default values for solver options."""
251
+ self.mode = "si"
252
+ self.custom_refinement = False
253
+ self.extraction_frequency = "10Ghz"
254
+ self.compute_capacitance = True
255
+ self.compute_dc_rl = True
256
+ self.compute_dc_parameters = True
257
+ self.compute_dc_cg = True
258
+ self.compute_ac_rl = True
259
+ self.ground_power_nets_for_si = True
260
+ self.small_hole_diameter = 0.0
261
+ self.adaptive_refinement_cg_max_passes = 10
262
+ self.adaptive_refinement_rl_max_passes = 10
263
+ self.adaptive_refinement_cg_percent_error = 0.02
264
+ self.adaptive_refinement_rl_percent_error = 0.02
265
+ self.rl_percent_refinement_per_pass = 0.33
266
+ self.cg_percent_refinement_per_pass = 0.33
267
+ self.return_path_net_for_loop_parameters = True
268
+
269
+ def _apply_cfg_object(self, solver_options):
270
+ """
271
+ Applies the configuration object to set up solver options.
272
+
273
+ Args:
274
+ solver_options: The configuration object containing solver options data.
275
+ - extraction_mode (str): The extraction mode ('si' or 'pi').
276
+ - custom_refinement (bool): Whether to use custom refinement settings.
277
+ - extraction_frequency (str): Frequency for extraction (e.g., '10Ghz').
278
+ - compute_capacitance (bool): Whether to compute capacitance.
279
+ - compute_dc_parameters (bool): Whether to compute DC parameters.
280
+ - compute_dc_rl (bool): Whether to compute DC RL parameters.
281
+ - compute_dc_cg (bool): Whether to compute DC CG parameters.
282
+ - compute_ac_rl (bool): Whether to compute AC RL parameters.
283
+ - ground_power_nets_for_si (bool): Whether to ground power nets for SI analysis.
284
+ - small_hole_diameter (float|str): Small hole diameter value or 'auto'.
285
+ - adaptive_refinement_cg_max_passes (int): Max passes for CG adaptive refinement.
286
+ - adaptive_refinement_rl_max_passes (int): Max passes for RL adaptive refinement.
287
+ - adaptive_refinement_cg_percent_error (float): Target error for CG refinement.
288
+ - adaptive_refinement_rl_percent_error (float): Target error for RL refinement.
289
+ - rl_percent_refinement_per_pass (float): RL refinement percentage per pass.
290
+ - cg_percent_refinement_per_pass (float): CG refinement percentage per pass.
291
+ - return_path_net_for_loop_parameters (bool): Whether to use return path net for loop parameters.
292
+
293
+ Raises:
294
+ AttributeError: If the `solver_options` object does not have the expected attributes.
295
+ """
296
+ self.extraction_mode = solver_options.extraction_mode
297
+ self.custom_refinement = solver_options.custom_refinement
298
+ self.extraction_frequency = solver_options.extraction_frequency
299
+ self.compute_capacitance = solver_options.compute_capacitance
300
+ self.compute_dc_parameters = solver_options.compute_dc_parameters
301
+ self.compute_dc_rl = solver_options.compute_dc_rl
302
+ self.compute_dc_cg = solver_options.compute_dc_cg
303
+ self.compute_ac_rl = solver_options.compute_ac_rl
304
+ self.ground_power_nets_for_si = solver_options.ground_power_ground_nets_for_si
305
+ self.small_hole_diameter = solver_options.small_hole_diameter
306
+ self.adaptive_refinement_cg_max_passes = solver_options.cg_max_passes
307
+ self.adaptive_refinement_rl_max_passes = solver_options.rl_max_passes
308
+ self.adaptive_refinement_cg_percent_error = solver_options.cg_percent_error
309
+ self.adaptive_refinement_rl_percent_error = solver_options.rl_percent_error
310
+ self.rl_percent_refinement_per_pass = solver_options.rl_percent_refinement_per_pass
311
+ self.return_path_net_for_loop_parameters = solver_options.return_path_net_for_loop_parameters
312
+
313
+ @property
314
+ def extraction_mode(self):
315
+ """
316
+ Gets the extraction mode from the database.
317
+
318
+ Returns:
319
+ str: The extraction mode. Returns "si" if the mode is set to "1", otherwise "pi".
320
+ """
321
+ mode = self._pedb.active_cell.get_product_property(
322
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_EXTRACTION_MODE
323
+ ).value
324
+ if mode == "1":
325
+ return "si"
326
+ return "pi"
327
+
328
+ @extraction_mode.setter
329
+ def extraction_mode(self, value):
330
+ if value == "si":
331
+ self._pedb.active_cell.set_product_property(
332
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_EXTRACTION_MODE, "1"
333
+ )
334
+ else:
335
+ self._pedb.active_cell.set_product_property(
336
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_EXTRACTION_MODE, "0"
337
+ )
338
+
339
+ @property
340
+ def custom_refinement(self):
341
+ """
342
+ Gets the custom refinement setting from the database.
343
+
344
+ Returns:
345
+ bool: True if custom refinement is enabled, False otherwise.
346
+ """
347
+ refine = self._pedb.active_cell.get_product_property(
348
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CUSTOM_REFINEMENT
349
+ ).value
350
+ if refine == "1":
351
+ return True
352
+ return False
353
+
354
+ @custom_refinement.setter
355
+ def custom_refinement(self, value):
356
+ if value:
357
+ self._pedb.active_cell.set_product_property(
358
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CUSTOM_REFINEMENT, "1"
359
+ )
360
+ else:
361
+ self._pedb.active_cell.set_product_property(
362
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CUSTOM_REFINEMENT, "0"
363
+ )
364
+
365
+ @property
366
+ def extraction_frequency(self):
367
+ """
368
+ Gets the extraction frequency from the database.
369
+
370
+ Returns:
371
+ str: The extraction frequency value as a string.
372
+ """
373
+ return self._pedb.active_cell.get_product_property(
374
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_EXTRACTION_FREQUENCY
375
+ ).value
376
+
377
+ @extraction_frequency.setter
378
+ def extraction_frequency(self, value):
379
+ freq = str(GrpcValue(value))
380
+ self._pedb.active_cell.set_product_property(
381
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_EXTRACTION_FREQUENCY, freq
382
+ )
383
+
384
+ @property
385
+ def compute_capacitance(self):
386
+ """
387
+ Gets the compute capacitance setting from the database.
388
+
389
+ Returns:
390
+ bool: True if capacitance computation is enabled, False otherwise.
391
+ """
392
+ compute = self._pedb.active_cell.get_product_property(
393
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_COMPUTE_CAPACITANCE
394
+ ).value
395
+ if compute == "1":
396
+ return True
397
+ return False
398
+
399
+ @compute_capacitance.setter
400
+ def compute_capacitance(self, value):
401
+ if value:
402
+ self._pedb.active_cell.set_product_property(
403
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_COMPUTE_CAPACITANCE, "1"
404
+ )
405
+ else:
406
+ self._pedb.active_cell.set_product_property(
407
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_COMPUTE_CAPACITANCE, "0"
408
+ )
409
+
410
+ @property
411
+ def compute_dc_parameters(self):
412
+ """
413
+ Gets the compute DC parameters setting from the database.
414
+
415
+ Returns:
416
+ bool: True if DC parameters computation is enabled, False otherwise.
417
+ """
418
+ compute = self._pedb.active_cell.get_product_property(
419
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_COMPUTE_DC_PARAMS
420
+ ).value
421
+ if compute == "1":
422
+ return True
423
+ return False
424
+
425
+ @compute_dc_parameters.setter
426
+ def compute_dc_parameters(self, value):
427
+ if value:
428
+ self._pedb.active_cell.set_product_property(
429
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_COMPUTE_DC_PARAMS, "1"
430
+ )
431
+ else:
432
+ self._pedb.active_cell.get_product_property(
433
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_COMPUTE_DC_PARAMS, "0"
434
+ )
435
+
436
+ @property
437
+ def compute_dc_rl(self):
438
+ """
439
+ Gets the compute DC RL parameters setting from the database.
440
+
441
+ Returns:
442
+ bool: True if DC RL parameters computation is enabled, False otherwise.
443
+ """
444
+ _res = self._pedb.active_cell.get_product_property(
445
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_DC_PARAMS_COMPUTE_RL
446
+ ).value
447
+ if _res == "1":
448
+ return True
449
+ return False
450
+
451
+ @compute_dc_rl.setter
452
+ def compute_dc_rl(self, value):
453
+ if value:
454
+ self._pedb.active_cell.set_product_property(
455
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_DC_PARAMS_COMPUTE_RL, "1"
456
+ )
457
+ else:
458
+ self._pedb.active_cell.set_product_property(
459
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_DC_PARAMS_COMPUTE_RL, "0"
460
+ )
461
+
462
+ @property
463
+ def compute_dc_cg(self):
464
+ """
465
+ Gets the compute DC CG parameters setting from the database.
466
+
467
+ Returns:
468
+ bool: True if DC CG parameters computation is enabled, False otherwise.
469
+ """
470
+ _res = self._pedb.active_cell.get_product_property(
471
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_DC_PARAMS_COMPUTE_CG
472
+ ).value
473
+ if _res == "1":
474
+ return True
475
+ return False
476
+
477
+ @compute_dc_cg.setter
478
+ def compute_dc_cg(self, value):
479
+ if value:
480
+ self._pedb.active_cell.set_product_property(
481
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_DC_PARAMS_COMPUTE_CG, "1"
482
+ )
483
+ else:
484
+ self._pedb.active_cell.set_product_property(
485
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_DC_PARAMS_COMPUTE_CG, "0"
486
+ )
487
+
488
+ @property
489
+ def compute_ac_rl(self):
490
+ """
491
+ Gets the compute AC RL parameters setting from the database.
492
+
493
+ Returns:
494
+ bool: True if AC RL parameters computation is enabled, False otherwise.
495
+ """
496
+ _res = self._pedb.active_cell.get_product_property(
497
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_AC_PARAMS_COMPUTE_RL
498
+ ).value
499
+ if _res == "1":
500
+ return True
501
+ return False
502
+
503
+ @compute_ac_rl.setter
504
+ def compute_ac_rl(self, value):
505
+ if value:
506
+ self._pedb.active_cell.set_product_property(
507
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_AC_PARAMS_COMPUTE_RL, "1"
508
+ )
509
+ else:
510
+ self._pedb.active_cell.set_product_property(
511
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_AC_PARAMS_COMPUTE_RL, "0"
512
+ )
513
+
514
+ @property
515
+ def ground_power_nets_for_si(self):
516
+ """
517
+ Gets the ground power nets for SI analysis setting from the database.
518
+
519
+ Returns:
520
+ bool: True if grounding power nets for SI analysis is enabled, False otherwise.
521
+ """
522
+ _res = self._pedb.active_cell.get_product_property(
523
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_GROUND_PG_NETS_FOR_SI
524
+ ).value
525
+ if _res == "1":
526
+ return True
527
+ return False
528
+
529
+ @ground_power_nets_for_si.setter
530
+ def ground_power_nets_for_si(self, value):
531
+ if value:
532
+ self._pedb.active_cell.set_product_property(
533
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_GROUND_PG_NETS_FOR_SI, "1"
534
+ )
535
+ else:
536
+ self._pedb.active_cell.set_product_property(
537
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_GROUND_PG_NETS_FOR_SI, "0"
538
+ )
539
+
540
+ @property
541
+ def small_hole_diameter(self):
542
+ """
543
+ Gets the small hole diameter setting from the database.
544
+
545
+ Returns:
546
+ float|str: The small hole diameter as a float, or 'auto' if the value is set to -1.
547
+ """
548
+ _res = self._pedb.active_cell.get_product_property(
549
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_SMALL_HOLE_DIAMETER
550
+ ).value
551
+ if _res == "-1":
552
+ return "auto"
553
+ else:
554
+ return float(_res)
555
+
556
+ @small_hole_diameter.setter
557
+ def small_hole_diameter(self, value):
558
+ if value == "auto" or value == -1:
559
+ self._pedb.active_cell.set_product_property(
560
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_SMALL_HOLE_DIAMETER, "-1"
561
+ )
562
+ else:
563
+ self._pedb.active_cell.set_product_property(
564
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_SMALL_HOLE_DIAMETER, str(GrpcValue(value))
565
+ )
566
+
567
+ @property
568
+ def model_type(self):
569
+ """
570
+ Gets the model type setting from the database.
571
+
572
+ Returns:
573
+ str: The model type. Returns "rlcg" if the model type is set to "0", otherwise "esd_r".
574
+ """
575
+ return self._pedb.active_cell.get_product_property(
576
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_MODEL_TYPE
577
+ ).value
578
+
579
+ @model_type.setter
580
+ def model_type(self, value):
581
+ self._pedb.active_cell.set_product_property(
582
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_MODEL_TYPE, value.lower()
583
+ )
584
+
585
+ @property
586
+ def adaptive_refinement_cg_max_passes(self):
587
+ """
588
+ Gets the maximum number of passes for CG adaptive refinement from the database.
589
+
590
+ Returns:
591
+ int: The maximum number of passes for CG adaptive refinement.
592
+ """
593
+ return int(
594
+ self._pedb.active_cell.get_product_property(
595
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_CG_MAX_PASSES
596
+ ).value
597
+ )
598
+
599
+ @adaptive_refinement_cg_max_passes.setter
600
+ def adaptive_refinement_cg_max_passes(self, value):
601
+ self._pedb.active_cell.set_product_property(
602
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_CG_MAX_PASSES, str(int(value))
603
+ )
604
+
605
+ @property
606
+ def adaptive_refinement_cg_percent_error(self):
607
+ """
608
+ Gets the target error percentage for CG adaptive refinement from the database.
609
+
610
+ Returns:
611
+ float: The target error percentage for CG adaptive refinement.
612
+ """
613
+ return float(
614
+ self._pedb.active_cell.get_product_property(
615
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_CG_PERCENT_ERROR
616
+ ).value
617
+ )
618
+
619
+ @adaptive_refinement_cg_percent_error.setter
620
+ def adaptive_refinement_cg_percent_error(self, value):
621
+ self._pedb.active_cell.set_product_property(
622
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_CG_PERCENT_ERROR, str(float(value))
623
+ )
624
+
625
+ @property
626
+ def cg_percent_refinement_per_pass(self):
627
+ """
628
+ Gets the percentage of CG refinement per pass from the database.
629
+
630
+ Returns:
631
+ float: The percentage of CG refinement per pass.
632
+ """
633
+ return float(
634
+ self._pedb.active_cell.get_product_property(
635
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_CG_PERCENT_REFINEMENT_PER_PASS
636
+ ).value
637
+ )
638
+
639
+ @cg_percent_refinement_per_pass.setter
640
+ def cg_percent_refinement_per_pass(self, value):
641
+ self._pedb.active_cell.set_product_property(
642
+ GrpcProductIdType.SIWAVE,
643
+ SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_CG_PERCENT_REFINEMENT_PER_PASS,
644
+ str(float(value)),
645
+ )
646
+
647
+ @property
648
+ def adaptive_refinement_rl_max_passes(self):
649
+ """
650
+ Gets the maximum number of passes for RL adaptive refinement from the database.
651
+
652
+ Returns:
653
+ int: The maximum number of passes for RL adaptive refinement.
654
+ """
655
+ return int(
656
+ float(
657
+ self._pedb.active_cell.get_product_property(
658
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_RL_MAX_PASSES
659
+ ).value
660
+ )
661
+ )
662
+
663
+ @adaptive_refinement_rl_max_passes.setter
664
+ def adaptive_refinement_rl_max_passes(self, value):
665
+ self._pedb.active_cell.set_product_property(
666
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_RL_MAX_PASSES, str(float(value))
667
+ )
668
+
669
+ @property
670
+ def adaptive_refinement_rl_percent_error(self):
671
+ """
672
+ Gets the target error percentage for RL adaptive refinement from the database.
673
+
674
+ Returns:
675
+ float: The target error percentage for RL adaptive refinement.
676
+ """
677
+ return float(
678
+ self._pedb.active_cell.get_product_property(
679
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_RL_PERCENT_ERROR
680
+ ).value
681
+ )
682
+
683
+ @adaptive_refinement_rl_percent_error.setter
684
+ def adaptive_refinement_rl_percent_error(self, value):
685
+ self._pedb.active_cell.set_product_property(
686
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_RL_PERCENT_ERROR, str(float(value))
687
+ )
688
+
689
+ @property
690
+ def rl_percent_refinement_per_pass(self):
691
+ """
692
+ Gets the percentage of RL refinement per pass from the database.
693
+
694
+ Returns:
695
+ float: The percentage of RL refinement per pass.
696
+ """
697
+ return float(
698
+ self._pedb.active_cell.get_product_property(
699
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_RL_PERCENT_REFINEMENT_PER_PASS
700
+ ).value
701
+ )
702
+
703
+ @rl_percent_refinement_per_pass.setter
704
+ def rl_percent_refinement_per_pass(self, value):
705
+ self._pedb.active_cell.set_product_property(
706
+ GrpcProductIdType.SIWAVE,
707
+ SIwaveProperties.CPA_ADAPTIVE_REFINEMENT_RL_PERCENT_REFINEMENT_PER_PASS,
708
+ str(float(value)),
709
+ )
710
+
711
+ @property
712
+ def return_path_net_for_loop_parameters(self):
713
+ """
714
+ Gets the return path net setting for loop parameters from the database.
715
+
716
+ Returns:
717
+ bool: True if the return path net is enabled for loop parameters, False otherwise.
718
+ """
719
+ _res = self._pedb.active_cell.get_product_property(
720
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_RETURN_PATH_NET_FOR_LOOP_PARAMS
721
+ ).value
722
+ if _res == "1":
723
+ return True
724
+ return False
725
+
726
+ @return_path_net_for_loop_parameters.setter
727
+ def return_path_net_for_loop_parameters(self, value):
728
+ if value:
729
+ self._pedb.active_cell.set_product_property(
730
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_RETURN_PATH_NET_FOR_LOOP_PARAMS, "1"
731
+ )
732
+ else:
733
+ self._pedb.active_cell.set_product_property(
734
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_RETURN_PATH_NET_FOR_LOOP_PARAMS, "0"
735
+ )
736
+
737
+
738
+ class SIWaveCPASimulationSetup:
739
+ """
740
+ Represents the setup configuration for SIwave CPA simulations.
741
+
742
+ Attributes:
743
+ _pedb: The database object representing the active cell.
744
+ _channel_setup (ChannelSetup): The channel setup configuration.
745
+ _solver_options (SolverOptions): The solver options configuration.
746
+ """
747
+
748
+ def __init__(self, pedb, name=None, siwave_cpa_setup_class=None):
749
+ """
750
+ Initializes the SIWaveCPASimulationSetup instance.
751
+
752
+ Args:
753
+ pedb: The database object representing the active cell.
754
+ name (str, optional): The name of the simulation setup.
755
+ siwave_cpa_setup_class (SIwaveCpaSetup, optional): An optional configuration object to initialize the setup.
756
+ """
757
+ self._pedb = pedb
758
+ self._channel_setup = ChannelSetup(pedb)
759
+ self._solver_options = SolverOptions(pedb)
760
+ if isinstance(siwave_cpa_setup_class, SIwaveCpaSetup):
761
+ self._apply_cfg_object(siwave_cpa_setup_class)
762
+ else:
763
+ self.__init_values()
764
+
765
+ if (
766
+ not self._pedb.active_cell.get_product_property(
767
+ GrpcProductIdType.SIWAVE,
768
+ SIwaveProperties.CPA_SIM_NAME,
769
+ )
770
+ == name
771
+ ):
772
+ self._pedb.active_cell.set_product_property(GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_SIM_NAME, name)
773
+
774
+ def __init_values(self):
775
+ """
776
+ Initializes default values for the simulation setup attributes.
777
+ """
778
+ self.mode = "channel"
779
+ self.model_type = "rlcg"
780
+ self.use_q3d_solver = False
781
+ self.net_processing_mode = "all"
782
+
783
+ def _apply_cfg_object(self, siwave_cpa_setup_class):
784
+ """
785
+ Applies the configuration object to set up the simulation.
786
+
787
+ Args:
788
+ siwave_cpa_setup_class (SIwaveCpaSetup): The configuration object containing simulation setup data.
789
+ """
790
+ if isinstance(siwave_cpa_setup_class, SIwaveCpaSetup):
791
+ self.name = siwave_cpa_setup_class.name
792
+ self.mode = siwave_cpa_setup_class.mode
793
+ self.nets_to_process = siwave_cpa_setup_class.nets_to_process
794
+ self.model_type = siwave_cpa_setup_class.model_type
795
+ self.use_q3d_solver = siwave_cpa_setup_class.use_q3d_solver
796
+ self.net_processing_mode = siwave_cpa_setup_class.net_processing_mode
797
+ self.channel_setup = ChannelSetup(self._pedb, siwave_cpa_setup_class.channel_setup)
798
+ self.solver_options = SolverOptions(self._pedb, siwave_cpa_setup_class.solver_options)
799
+
800
+ @property
801
+ def name(self) -> str:
802
+ """
803
+ Gets the name of the simulation setup.
804
+
805
+ Returns:
806
+ str: The name of the simulation setup.
807
+ """
808
+ return self._pedb.active_cell.get_product_property(
809
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_SIM_NAME
810
+ ).value
811
+
812
+ @name.setter
813
+ def name(self, value):
814
+ self._pedb.active_cell.set_product_property(GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_SIM_NAME, value)
815
+
816
+ @property
817
+ def mode(self):
818
+ """
819
+ Gets the mode of the simulation setup.
820
+
821
+ Returns:
822
+ str: The mode of the simulation setup ("channel" or "no_channel").
823
+ """
824
+ cpa_mode = self._pedb.active_cell.get_product_property(
825
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_SETUP
826
+ ).value
827
+ if cpa_mode == "1":
828
+ return "channel"
829
+ return "no_channel"
830
+
831
+ @mode.setter
832
+ def mode(self, value):
833
+ if value == "channel":
834
+ self._pedb.active_cell.set_product_property(
835
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_SETUP, "1"
836
+ )
837
+ else:
838
+ self._pedb.active_cell.set_product_property(
839
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_CHANNEL_SETUP, "0"
840
+ )
841
+
842
+ @property
843
+ def model_type(self):
844
+ """
845
+ Gets the model type of the simulation setup.
846
+
847
+ Returns:
848
+ str: The model type ("rlcg" or "esd_r").
849
+ """
850
+ mod_type = self._pedb.active_cell.get_product_property(
851
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ESD_R_MODEL
852
+ ).value
853
+ if mod_type == "0":
854
+ return "rlcg"
855
+ else:
856
+ return "esd_r"
857
+
858
+ @model_type.setter
859
+ def model_type(self, value):
860
+ if value == "rlcg":
861
+ self._pedb.active_cell.set_product_property(GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ESD_R_MODEL, "0")
862
+ elif value == "esd_r":
863
+ self._pedb.active_cell.set_product_property(GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_ESD_R_MODEL, "1")
864
+
865
+ @property
866
+ def use_q3d_solver(self):
867
+ """
868
+ Gets the Q3D solver usage setting.
869
+
870
+ Returns:
871
+ bool: True if the Q3D solver is used, False otherwise.
872
+ """
873
+ return bool(
874
+ int(
875
+ self._pedb.active_cell.get_product_property(
876
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_USE_Q3D_SOLVER
877
+ ).value
878
+ )
879
+ )
880
+
881
+ @use_q3d_solver.setter
882
+ def use_q3d_solver(self, value):
883
+ if value:
884
+ self._pedb.active_cell.set_product_property(
885
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_USE_Q3D_SOLVER, "1"
886
+ )
887
+ else:
888
+ self._pedb.active_cell.set_product_property(
889
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_USE_Q3D_SOLVER, "0"
890
+ )
891
+
892
+ @property
893
+ def net_processing_mode(self):
894
+ """
895
+ Gets the net processing mode.
896
+
897
+ Returns:
898
+ str: The net processing mode.
899
+ """
900
+ return self._pedb.active_cell.get_product_property(
901
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_NET_PROCESSING_MODE
902
+ ).value
903
+
904
+ @net_processing_mode.setter
905
+ def net_processing_mode(self, value):
906
+ self._pedb.active_cell.set_product_property(
907
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_NET_PROCESSING_MODE, str(value)
908
+ )
909
+
910
+ @property
911
+ def channel_setup(self):
912
+ """
913
+ Gets the channel setup configuration.
914
+
915
+ Returns:
916
+ ChannelSetup: The channel setup configuration.
917
+ """
918
+ return self._channel_setup
919
+
920
+ @channel_setup.setter
921
+ def channel_setup(self, value):
922
+ if isinstance(value, ChannelSetup):
923
+ self._channel_setup = value
924
+
925
+ @property
926
+ def solver_options(self):
927
+ """
928
+ Gets the solver options configuration.
929
+
930
+ Returns:
931
+ SolverOptions: The solver options configuration.
932
+ """
933
+ return self._solver_options
934
+
935
+ @solver_options.setter
936
+ def solver_options(self, value):
937
+ if isinstance(value, SolverOptions):
938
+ self._solver_options = value
939
+
940
+ @property
941
+ def nets_to_process(self):
942
+ """
943
+ Gets the list of nets to process.
944
+
945
+ Returns:
946
+ list: A list of nets to process.
947
+ """
948
+ nets = self._pedb.active_cell.get_product_property(
949
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_NETS_TO_PROCESS
950
+ ).value
951
+ return nets.split("*")
952
+
953
+ @nets_to_process.setter
954
+ def nets_to_process(self, value):
955
+ if isinstance(value, list):
956
+ nets = "*".join(value)
957
+ self._pedb.active_cell.set_product_property(
958
+ GrpcProductIdType.SIWAVE, SIwaveProperties.CPA_NETS_TO_PROCESS, nets
959
+ )
960
+ else:
961
+ raise TypeError("nets_to_process must be a list of strings.")