|
1 | 1 | # # HFSS 3D Layout: Power Integrity Analysis
|
| 2 | + |
2 | 3 | # This example shows how to use the electronics database (EDB) for power integrity analysis. The
|
3 | 4 | # EDB will be loaded into HFSS 3D Layout for analysis and post-processing.
|
| 5 | +# |
4 | 6 | # - Set up EDB
|
| 7 | +# |
5 | 8 | # - Assign S-parameter model to components
|
6 | 9 | # - Create pin groups
|
7 | 10 | # - Create ports
|
8 | 11 | # - Create SIwave SYZ anaylsis
|
9 | 12 | # - Create cutout
|
| 13 | +# |
10 | 14 | # - Import EDB into HFSS 3D Layout
|
| 15 | +# |
11 | 16 | # - Analyze
|
12 | 17 | # - Plot $Z_{11}$
|
13 | 18 |
|
14 |
| -# ## Preparation |
15 |
| -# Import the required packages |
| 19 | +# ## Perform required imports |
| 20 | +# |
| 21 | +# Perform required imports. |
16 | 22 |
|
17 |
| -# + |
18 | 23 | import os
|
19 | 24 | import json
|
20 | 25 | import tempfile
|
21 | 26 | import time
|
22 | 27 | from pyaedt import Edb
|
23 | 28 | from pyaedt import Hfss3dLayout
|
24 | 29 | from pyaedt.downloads import download_file
|
25 |
| -# - |
26 | 30 |
|
27 |
| -# Set constant values |
| 31 | +# ## Define constants |
| 32 | +# |
| 33 | +# Define constant values used in this example |
28 | 34 |
|
29 | 35 | AEDT_VERSION = "2024.1"
|
30 | 36 | NG_MODE = True
|
31 | 37 |
|
| 38 | +# ## Create temporary directory and download files |
| 39 | +# |
| 40 | +# Create a temporary directory where we store downloaded data or |
| 41 | +# dumped data. |
| 42 | + |
| 43 | +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") |
32 | 44 |
|
33 | 45 | # Download the example PCB data.
|
34 | 46 |
|
35 |
| -temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") |
36 | 47 | aedb = download_file(
|
37 | 48 | source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name
|
38 | 49 | )
|
39 | 50 | download_file(
|
40 | 51 | source="touchstone", name="GRM32_DC0V_25degC_series.s2p", destination=temp_folder.name
|
41 | 52 | )
|
42 | 53 |
|
43 |
| -# ## Create a configuration file |
44 |
| -# In this example, we are going to use a configuration file to set up the layout for analysis. |
45 |
| -# ### Initialize a dictionary |
| 54 | +# ## Create a configuration file to set up the layout for analysis |
| 55 | +# |
46 | 56 | # Create an empty dictionary to host all configurations.
|
47 | 57 |
|
48 | 58 | cfg = dict()
|
49 | 59 |
|
50 |
| -# In this example, we are going to assign S-parameter models to capacitors. |
51 |
| -# The first step is to use the "general" key to specify where the S-parameter files can be found. |
| 60 | +# > **Note:** In the following, we are going to assign S-parameter |
| 61 | +# > models to capacitors. |
| 62 | + |
| 63 | +# ### Define the S-parameter files |
| 64 | +# |
| 65 | +# Specify the location of the S-parameter files. |
52 | 66 |
|
53 | 67 | cfg["general"] = {
|
54 | 68 | "s_parameter_library": os.path.join(temp_folder.name, "touchstone")
|
55 | 69 | }
|
56 | 70 |
|
57 |
| -# ## Assign model to capactitors. |
58 |
| -# In this example, the model "GRM32_DC0V_25degC_series.s2p" is assigned to capacitors C3 and C4, which share the same component part number. |
| 71 | +# ### Assign model to capactitors |
| 72 | +# |
| 73 | +# Assign the model "GRM32_DC0V_25degC_series.s2p" to capacitors C3 and C4, which share the same component part number. |
59 | 74 | # When "apply_to_all" is ``True``, all components having the part number "CAPC3216X180X20ML20" will be assigned the S-parameter model.
|
60 | 75 |
|
61 | 76 | cfg["s_parameters"] = [
|
|
72 | 87 | }
|
73 | 88 | ]
|
74 | 89 |
|
75 |
| -# ## Create pin groups. |
76 |
| -# In this example, the listed pins on component U2 are combined into two pin groups. |
77 |
| -# 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: |
| 90 | +# ### Define pin groups |
| 91 | +# |
| 92 | +# Combine the listed pins on component U1 into pin groups: |
| 93 | +# - the first group is defined explicitly by the pins name; |
| 94 | +# - the second group is assigned by net name using the "net" key. |
78 | 95 |
|
79 | 96 | cfg["pin_groups"] = [
|
80 | 97 | {
|
|
89 | 106 | }
|
90 | 107 | ]
|
91 | 108 |
|
92 |
| -# ## Create ports |
93 |
| -# Create a circuit port between the two pin groups just created. |
| 109 | +# ### Create ports |
| 110 | +# |
| 111 | +# Create a circuit port between the two pin groups previously created. |
94 | 112 |
|
95 | 113 | cfg["ports"] = [
|
96 | 114 | {
|
|
106 | 124 | }
|
107 | 125 | ]
|
108 | 126 |
|
109 |
| -# ## Create SIwave SYZ analysis setup |
110 |
| -# Both SIwave and HFSS can be used to run an analysis in the 3D Layout user interface. |
| 127 | +# ### Create SIwave SYZ analysis setup |
| 128 | +# |
| 129 | +# Create SIwave SYZ analysis setup. |
| 130 | +# |
| 131 | +# > **Note:** Both SIwave and HFSS can be used to run an analysis in the |
| 132 | +# > 3D Layout user interface. |
111 | 133 |
|
112 | 134 | cfg["setups"] = [
|
113 | 135 | {
|
|
131 | 153 | }
|
132 | 154 | ]
|
133 | 155 |
|
134 |
| -# ## Cutout |
135 |
| -# The following assignments will define the region of the PCB to be cut out for analysis. |
| 156 | +# ### Cutout |
| 157 | +# |
| 158 | +# Define the the region of the PCB to cutout for analysis. |
136 | 159 |
|
137 | 160 | cfg["operations"] = {
|
138 | 161 | "cutout": {
|
|
162 | 185 | }
|
163 | 186 | }
|
164 | 187 |
|
165 |
| -# ## Save the configuration |
| 188 | +# ### Save the configuration |
166 | 189 | #
|
167 |
| -# The configuration file can be saved in JSON format and applied to layout data using the EDB. |
| 190 | +# Save the configuration file in JSON format. |
168 | 191 |
|
169 | 192 | pi_json = os.path.join(temp_folder.name, "pi.json")
|
170 | 193 | with open(pi_json, "w") as f:
|
171 | 194 | json.dump(cfg, f, indent=4, ensure_ascii=False)
|
172 | 195 |
|
173 | 196 | # ## Load configuration into EDB
|
174 |
| - |
175 |
| -# Load configuration from JSON |
| 197 | +# |
| 198 | +# Load configuration from the JSON file. |
176 | 199 |
|
177 | 200 | edbapp = Edb(aedb, edbversion=AEDT_VERSION)
|
178 | 201 | edbapp.configuration.load(config_file=pi_json)
|
|
186 | 209 |
|
187 | 210 | # ## Analyze in HFSS 3D Layout
|
188 | 211 |
|
189 |
| -# ### Load edb into HFSS 3D Layout. |
| 212 | +# ### Load EDB into HFSS 3D Layout |
190 | 213 |
|
191 | 214 | h3d = Hfss3dLayout(
|
192 | 215 | aedb,
|
|
204 | 227 | solutions = h3d.post.get_solution_data(expressions='Z(port1,port1)')
|
205 | 228 | solutions.plot()
|
206 | 229 |
|
207 |
| -# ## Shut Down Electronics Desktop |
208 |
| - |
209 |
| -h3d.close_desktop() |
| 230 | +# ## Save project and close AEDT |
| 231 | +# |
| 232 | +# Save the project, release AEDT and remove both the project and temporary directory. |
210 | 233 |
|
211 |
| -# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you |
212 |
| -# can retrieve those project files. The following cell removes all temporary files, including the project folder. |
| 234 | +# > **Note:** All project files are saved in the folder ``temp_file.dir``. |
| 235 | +# > If you've run this example as a Jupyter notebook you can retrieve those project files. |
| 236 | +# > The following cell removes all temporary files, including the project folder. |
213 | 237 |
|
214 |
| -# ## Cleanup |
215 |
| -# |
216 |
| -# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you |
217 |
| -# can retrieve those project files. The following cell removes all temporary files, including the project folder. |
| 238 | +# + |
| 239 | +h3d.save_project() |
| 240 | +h3d.release_desktop() |
218 | 241 |
|
219 | 242 | time.sleep(3)
|
220 | 243 | temp_folder.cleanup()
|
0 commit comments