Skip to content

Commit 61eb0b4

Browse files
Release desktop
1 parent 49f1a85 commit 61eb0b4

File tree

4 files changed

+115
-150
lines changed

4 files changed

+115
-150
lines changed

examples/01-HFSS3DLayout/01_power_integrity.py

+26-50
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# # HFSS 3D Layout: Power Integrity Analysis
2-
# This example shows how to use the electronics database (EDB) for power integrity analysis. The
2+
# This example shows how to use the electronics database (EDB) for power integrity analysis. The
33
# EDB will be loaded into HFSS 3D Layout for analysis and post-processing.
44
# - Set up EDB
55
# - Assign S-parameter model to components
66
# - Create pin groups
77
# - Create ports
8-
# - Create SIwave SYZ anaylsis
8+
# - Create SIwave SYZ analysis
99
# - Create cutout
1010
# - Import EDB into HFSS 3D Layout
1111
# - Analyze
@@ -14,14 +14,16 @@
1414
# ## Preparation
1515
# Import the required packages
1616

17+
import json
18+
1719
# +
1820
import os
19-
import json
2021
import tempfile
2122
import time
22-
from pyaedt import Edb
23-
from pyaedt import Hfss3dLayout
23+
24+
from pyaedt import Edb, Hfss3dLayout
2425
from pyaedt.downloads import download_file
26+
2527
try:
2628
from ansys.pyaedt.examples.constants import AEDT_VERSION
2729
except:
@@ -34,9 +36,7 @@
3436
# Download the example PCB data.
3537

3638
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
37-
aedb = download_file(
38-
source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name
39-
)
39+
aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name)
4040
download_file(
4141
source="touchstone", name="GRM32_DC0V_25degC_series.s2p", destination=temp_folder.name
4242
)
@@ -48,16 +48,14 @@
4848

4949
cfg = dict()
5050

51-
# In this example, we are going to assign S-parameter models to capacitors.
51+
# In this example, we are going to assign S-parameter models to capacitors.
5252
# The first step is to use the "general" key to specify where the S-parameter files can be found.
5353

54-
cfg["general"] = {
55-
"s_parameter_library": os.path.join(temp_folder.name, "touchstone")
56-
}
54+
cfg["general"] = {"s_parameter_library": os.path.join(temp_folder.name, "touchstone")}
5755

58-
# ## Assign model to capactitors.
56+
# ## Assign model to capactitors.
5957
# In this example, the model "GRM32_DC0V_25degC_series.s2p" is assigned to capacitors C3 and C4, which share the same component part number.
60-
# When "apply_to_all" is ``True``, all components having the part number "CAPC3216X180X20ML20" will be assigned the S-parameter model.
58+
# When "apply_to_all" is ``True``, all components having the part number "CAPC3216X180X20ML20" will be assigned the S-parameter model.
6159

6260
cfg["s_parameters"] = [
6361
{
@@ -67,27 +65,17 @@
6765
"apply_to_all": False,
6866
"components": ["C110", "C206"],
6967
"reference_net": "GND",
70-
"reference_net_per_component": {
71-
"C110": "GND"
72-
}
68+
"reference_net_per_component": {"C110": "GND"},
7369
}
7470
]
7571

7672
# ## Create pin groups.
77-
# In this example, the listed pins on component U2 are combined into two pin groups.
73+
# In this example, the listed pins on component U2 are combined into two pin groups.
7874
# Pins can be grouped explicitly by the pin name or pin groups can be assigned by net name using the "net" key as shown here:
7975

8076
cfg["pin_groups"] = [
81-
{
82-
"name": "PIN_GROUP_1",
83-
"reference_designator": "U1",
84-
"pins": ["AD14", "AD15", "AD16", "AD17"]
85-
},
86-
{
87-
"name": "PIN_GROUP_2",
88-
"reference_designator": "U1",
89-
"net": "GND"
90-
}
77+
{"name": "PIN_GROUP_1", "reference_designator": "U1", "pins": ["AD14", "AD15", "AD16", "AD17"]},
78+
{"name": "PIN_GROUP_2", "reference_designator": "U1", "net": "GND"},
9179
]
9280

9381
# ## Create ports
@@ -98,12 +86,8 @@
9886
"name": "port1",
9987
"reference_designator": "U1",
10088
"type": "circuit",
101-
"positive_terminal": {
102-
"pin_group": "PIN_GROUP_1"
103-
},
104-
"negative_terminal": {
105-
"pin_group": "PIN_GROUP_2"
106-
}
89+
"positive_terminal": {"pin_group": "PIN_GROUP_1"},
90+
"negative_terminal": {"pin_group": "PIN_GROUP_2"},
10791
}
10892
]
10993

@@ -120,15 +104,10 @@
120104
"name": "Sweep1",
121105
"type": "Interpolation",
122106
"frequencies": [
123-
{
124-
"distribution": "log scale",
125-
"start": 1e6,
126-
"stop": 1e9,
127-
"samples": 20
128-
}
129-
]
107+
{"distribution": "log scale", "start": 1e6, "stop": 1e9, "samples": 20}
108+
],
130109
}
131-
]
110+
],
132111
}
133112
]
134113

@@ -159,7 +138,7 @@
159138
"maximum_iterations": 10,
160139
"preserve_components_with_model": False,
161140
"simple_pad_check": True,
162-
"keep_lines_as_path": False
141+
"keep_lines_as_path": False,
163142
}
164143
}
165144

@@ -190,10 +169,7 @@
190169
# ### Load edb into HFSS 3D Layout.
191170

192171
h3d = Hfss3dLayout(
193-
aedb,
194-
specified_version=AEDT_VERSION,
195-
non_graphical=NG_MODE,
196-
new_desktop_session=True
172+
aedb, specified_version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop_session=True
197173
)
198174

199175
# ### Analyze
@@ -202,19 +178,19 @@
202178

203179
# ### Plot impedance
204180

205-
solutions = h3d.post.get_solution_data(expressions='Z(port1,port1)')
181+
solutions = h3d.post.get_solution_data(expressions="Z(port1,port1)")
206182
solutions.plot()
207183

208184
# ## Shut Down Electronics Desktop
209185

210186
h3d.release_desktop()
211187

212-
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
188+
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
213189
# can retrieve those project files. The following cell removes all temporary files, including the project folder.
214190

215191
# ## Cleanup
216192
#
217-
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
193+
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
218194
# can retrieve those project files. The following cell removes all temporary files, including the project folder.
219195

220196
time.sleep(3)

examples/01-HFSS3DLayout/02_dc_ir_analysis.py

+22-54
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# - Assign SPICE model to components
77
# - Create pin groups
88
# - Create voltage and current sources
9-
# - Create SIwave DC anaylsis
9+
# - Create SIwave DC analysis
1010
# - Create cutout
1111
# - Import EDB into HFSS 3D Layout
1212
# - Analyze
@@ -16,14 +16,17 @@
1616
# # Preparation
1717
# Import required packages
1818

19+
import json
20+
1921
# +
2022
import os
21-
import json
2223
import tempfile
2324
import time
24-
from pyedb import Edb
25+
2526
from pyaedt import Hfss3dLayout
2627
from pyaedt.downloads import download_file
28+
from pyedb import Edb
29+
2730
try:
2831
from ansys.pyaedt.examples.constants import AEDT_VERSION
2932
except:
@@ -36,12 +39,8 @@
3639

3740
# Download example board.
3841

39-
aedb = download_file(
40-
source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name
41-
)
42-
download_file(
43-
source="spice", name="ferrite_bead_BLM15BX750SZ1.mod", destination=temp_folder.name
44-
)
42+
aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name)
43+
download_file(source="spice", name="ferrite_bead_BLM15BX750SZ1.mod", destination=temp_folder.name)
4544

4645
# # Create a configuration file
4746
# In this example, we are going to use a configure file to set up layout for analysis.
@@ -53,18 +52,14 @@
5352

5453
cfg["general"] = {
5554
"s_parameter_library": os.path.join(temp_folder.name, "touchstone"),
56-
"spice_model_library": os.path.join(temp_folder.name, "spice")
55+
"spice_model_library": os.path.join(temp_folder.name, "spice"),
5756
}
5857

5958
# ## Change via hole size and plating thickness
6059

6160
cfg["padstacks"] = {
6261
"definitions": [
63-
{
64-
"name": "v40h15-3",
65-
"hole_diameter": "0.2mm",
66-
"hole_plating_thickness": "25um"
67-
}
62+
{"name": "v40h15-3", "hole_diameter": "0.2mm", "hole_plating_thickness": "25um"}
6863
],
6964
}
7065

@@ -78,7 +73,7 @@
7873
"sub_circuit_name": "BLM15BX750SZ1",
7974
"apply_to_all": True, # If True, SPICE model is to be assigned to all components share the same part name.
8075
# If False, only assign SPICE model to components in "components".
81-
"components": []
76+
"components": [],
8277
}
8378
]
8479

@@ -91,38 +86,24 @@
9186
"reference_designator": "U4",
9287
"type": "voltage",
9388
"magnitude": 5,
94-
"positive_terminal": {
95-
"net": "5V"
96-
},
97-
"negative_terminal": {
98-
"net": "GND"
99-
}
89+
"positive_terminal": {"net": "5V"},
90+
"negative_terminal": {"net": "GND"},
10091
}
10192
]
10293

10394
# ## Create Current Sources
10495
# Create current sources between net and pin group.
10596

106-
cfg["pin_groups"] = [
107-
{
108-
"name": "J5_GND",
109-
"reference_designator": "J5",
110-
"net": "GND"
111-
}
112-
]
97+
cfg["pin_groups"] = [{"name": "J5_GND", "reference_designator": "J5", "net": "GND"}]
11398

11499
cfg["sources"].append(
115100
{
116101
"name": "J5_VCCR",
117102
"reference_designator": "J5",
118103
"type": "current",
119104
"magnitude": 0.5,
120-
"positive_terminal": {
121-
"net": "SFPA_VCCR"
122-
},
123-
"negative_terminal": {
124-
"pin_group": "J5_GND" # Defined in "pin_groups" section.
125-
}
105+
"positive_terminal": {"net": "SFPA_VCCR"},
106+
"negative_terminal": {"pin_group": "J5_GND"}, # Defined in "pin_groups" section.
126107
}
127108
)
128109
cfg["sources"].append(
@@ -131,24 +112,14 @@
131112
"reference_designator": "J5",
132113
"type": "current",
133114
"magnitude": 0.5,
134-
"positive_terminal": {
135-
"net": "SFPA_VCCT"
136-
},
137-
"negative_terminal": {
138-
"pin_group": "J5_GND" # Defined in "pin_groups" section.
139-
}
115+
"positive_terminal": {"net": "SFPA_VCCT"},
116+
"negative_terminal": {"pin_group": "J5_GND"}, # Defined in "pin_groups" section.
140117
}
141118
)
142119

143120
# ## Create SIwave DC analysis
144121

145-
cfg["setups"] = [
146-
{
147-
"name": "siwave_dc",
148-
"type": "siwave_dc",
149-
"dc_slider_position": 0
150-
}
151-
]
122+
cfg["setups"] = [{"name": "siwave_dc", "type": "siwave_dc", "dc_slider_position": 0}]
152123

153124
# ## Do cutout
154125

@@ -176,7 +147,7 @@
176147
"maximum_iterations": 10,
177148
"preserve_components_with_model": False,
178149
"simple_pad_check": True,
179-
"keep_lines_as_path": False
150+
"keep_lines_as_path": False,
180151
}
181152
}
182153

@@ -208,10 +179,7 @@
208179
# ## Load edb into 3D Layout.
209180

210181
siw = Hfss3dLayout(
211-
aedb,
212-
specified_version=AEDT_VERSION,
213-
non_graphical=NG_MODE,
214-
new_desktop_session=True
182+
aedb, specified_version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop_session=True
215183
)
216184

217185
# ## Analyze
@@ -228,7 +196,7 @@
228196

229197
# ## Cleanup
230198
#
231-
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
199+
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
232200
# can retrieve those project files. The following cell removes all temporary files, including the project folder.
233201

234202
time.sleep(3)

examples/01-HFSS3DLayout/03_gui_manipulation.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
# # Preparation
66
# Import required packages
77

8+
import tempfile
9+
810
# +
911
import time
10-
import tempfile
12+
1113
from pyaedt import Hfss3dLayout
1214
from pyaedt.downloads import download_file
15+
1316
try:
1417
from ansys.pyaedt.examples.constants import AEDT_VERSION
1518
except:
@@ -24,9 +27,7 @@
2427

2528
# Download example board.
2629

27-
aedb = download_file(
28-
source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name
29-
)
30+
aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name)
3031

3132
# ## Launch HFSS 3D Layout
3233
#
@@ -77,7 +78,7 @@
7778

7879
# ## Cleanup
7980
#
80-
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
81+
# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you
8182
# can retrieve those project files. The following cell removes all temporary files, including the project folder.
8283

8384
time.sleep(3)

0 commit comments

Comments
 (0)