|
1 | 1 | # # HFSS 3D Layout: Electrothermal Analysis
|
2 |
| -# This example shows how to use the electronics database (EDB) for DC IR analysis and |
| 2 | +# This example shows how to use the electronics database (EDB) for DC IR analysis and |
3 | 3 | # electrotermal analysis. The EDB will be loaded into SIwave for analysis and post-processing.
|
4 | 4 | # In the end, an Icepak project is exported from SIwave.
|
5 | 5 | # - Set up EDB
|
|
15 | 15 | # ## Preparation
|
16 | 16 | # Import required packages
|
17 | 17 |
|
| 18 | +import json |
| 19 | + |
18 | 20 | # +
|
19 | 21 | import os
|
20 |
| -import json |
21 | 22 | import tempfile
|
22 | 23 | import time
|
23 |
| -from pyedb import Edb |
24 |
| -from pyedb import Siwave |
25 |
| -from pyaedt.downloads import download_file |
| 24 | + |
26 | 25 | from ansys.pyaedt.examples.constants import AEDT_VERSION
|
| 26 | +from pyaedt.downloads import download_file |
| 27 | +from pyedb import Edb, Siwave |
27 | 28 |
|
28 | 29 | NG_MODE = False
|
29 | 30 |
|
|
32 | 33 | # Download the example PCB data.
|
33 | 34 |
|
34 | 35 | temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
|
35 |
| -aedb = download_file( |
36 |
| - source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name |
37 |
| -) |
| 36 | +aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name) |
38 | 37 |
|
39 | 38 | # ## Create a configuration file
|
40 | 39 | # In this example, we are going to use a configure file to set up layout for analysis.
|
|
59 | 58 | "fin_height": "4mm",
|
60 | 59 | "fin_orientation": "x_oriented",
|
61 | 60 | "fin_spacing": "1mm",
|
62 |
| - "fin_thickness": "1mm" |
| 61 | + "fin_thickness": "1mm", |
63 | 62 | },
|
64 | 63 | "apply_to_all": False,
|
65 |
| - "components": ["J5"] |
| 64 | + "components": ["J5"], |
66 | 65 | }
|
67 | 66 | ]
|
68 | 67 |
|
69 | 68 | # ## Create pin groups.
|
70 | 69 | # In this example, all pins on net "GND" on component J5 are grouped into one group. Pin groups can be assigned by net name using the "net" key as shown here:
|
71 | 70 |
|
72 |
| -cfg["pin_groups"] = [ |
73 |
| - { |
74 |
| - "name": "J5_GND", |
75 |
| - "reference_designator": "J5", |
76 |
| - "net": "GND" |
77 |
| - } |
78 |
| -] |
| 71 | +cfg["pin_groups"] = [{"name": "J5_GND", "reference_designator": "J5", "net": "GND"}] |
79 | 72 |
|
80 | 73 | # ### Create Current Sources
|
81 |
| -# In this example, two current sources are created on component J5. A current source is placed between postive and negative terminals. When keyword "net" is used, all pins on the specified net are grouped into a new pin group which is assigned as the positive terminal. Negative terminal can be assigned by pin group name by using the keyword "pin_group". The two current sources share the same pin group "J5_GND" as the negative terminal. |
| 74 | +# In this example, two current sources are created on component J5. A current source is placed between positive and negative terminals. When keyword "net" is used, all pins on the specified net are grouped into a new pin group which is assigned as the positive terminal. Negative terminal can be assigned by pin group name by using the keyword "pin_group". The two current sources share the same pin group "J5_GND" as the negative terminal. |
82 | 75 |
|
83 | 76 | i_src_1 = {
|
84 | 77 | "name": "J5_VCCR",
|
85 | 78 | "reference_designator": "J5",
|
86 | 79 | "type": "current",
|
87 | 80 | "magnitude": 0.5,
|
88 |
| - "positive_terminal": { |
89 |
| - "net": "SFPA_VCCR" |
90 |
| - }, |
91 |
| - "negative_terminal": { |
92 |
| - "pin_group": "J5_GND" # Defined in "pin_groups" section. |
93 |
| - } |
| 81 | + "positive_terminal": {"net": "SFPA_VCCR"}, |
| 82 | + "negative_terminal": {"pin_group": "J5_GND"}, # Defined in "pin_groups" section. |
94 | 83 | }
|
95 | 84 | i_src_2 = {
|
96 | 85 | "name": "J5_VCCT",
|
97 | 86 | "reference_designator": "J5",
|
98 | 87 | "type": "current",
|
99 | 88 | "magnitude": 0.5,
|
100 |
| - "positive_terminal": { |
101 |
| - "net": "SFPA_VCCT" |
102 |
| - }, |
103 |
| - "negative_terminal": { |
104 |
| - "pin_group": "J5_GND" # Defined in "pin_groups" section. |
105 |
| - } |
| 89 | + "positive_terminal": {"net": "SFPA_VCCT"}, |
| 90 | + "negative_terminal": {"pin_group": "J5_GND"}, # Defined in "pin_groups" section. |
106 | 91 | }
|
107 | 92 |
|
108 | 93 | # ### Create a Voltage Source
|
109 | 94 | # Create a voltage source on component U4 between two nets using keyword "net".
|
110 | 95 |
|
111 | 96 | # +
|
112 | 97 | v_src = {
|
113 |
| - "name": "VSOURCE_5V", |
114 |
| - "reference_designator": "U4", |
115 |
| - "type": "voltage", |
116 |
| - "magnitude": 5, |
117 |
| - "positive_terminal": { |
118 |
| - "net": "5V" |
119 |
| - }, |
120 |
| - "negative_terminal": { |
121 |
| - "net": "GND" |
122 |
| - } |
123 |
| - } |
| 98 | + "name": "VSOURCE_5V", |
| 99 | + "reference_designator": "U4", |
| 100 | + "type": "voltage", |
| 101 | + "magnitude": 5, |
| 102 | + "positive_terminal": {"net": "5V"}, |
| 103 | + "negative_terminal": {"net": "GND"}, |
| 104 | +} |
124 | 105 |
|
125 | 106 | cfg["sources"] = [v_src, i_src_1, i_src_2]
|
126 | 107 | # -
|
|
143 | 124 | "name": "siwave_dc",
|
144 | 125 | "type": "siwave_dc",
|
145 | 126 | "dc_slider_position": 0,
|
146 |
| - "dc_ir_settings": { |
147 |
| - "export_dc_thermal_data": True |
148 |
| - } |
| 127 | + "dc_ir_settings": {"export_dc_thermal_data": True}, |
149 | 128 | }
|
150 | 129 | ]
|
151 | 130 |
|
|
177 | 156 |
|
178 | 157 | # ### Load edb into HFSS 3D Layout.
|
179 | 158 |
|
180 |
| -# siwave = Siwave(specified_version=AEDT_VERSION) |
181 |
| -# siwave.open_project(proj_path=aedb) |
182 |
| -# siwave.save_project(projectpath=temp_folder.name, projectName="ansys") |
| 159 | +siwave = Siwave(specified_version=AEDT_VERSION) |
| 160 | +time.sleep(10) |
| 161 | +siwave.close_project() |
| 162 | +siwave.open_project(proj_path=aedb) |
| 163 | +siwave.save_project(projectpath=temp_folder.name, projectName="ansys") |
183 | 164 |
|
184 | 165 | # ### Analyze
|
185 | 166 |
|
186 |
| -# siwave.run_dc_simulation() |
| 167 | +siwave.run_dc_simulation() |
187 | 168 |
|
188 | 169 | # ### Export Icepak project
|
189 | 170 |
|
190 |
| -# siwave.export_icepak_project(os.path.join(temp_folder.name, "from_siwave.aedt"), "siwave_dc") |
| 171 | +siwave.export_icepak_project(os.path.join(temp_folder.name, "from_siwave.aedt"), "siwave_dc") |
191 | 172 |
|
192 | 173 | # ### Close SIwave project
|
193 | 174 |
|
194 |
| -# siwave.close_project() |
| 175 | +siwave.close_project() |
195 | 176 |
|
196 | 177 | # ## Shut Down SIwave
|
197 | 178 |
|
198 |
| -# siwave.quit_application() |
| 179 | +siwave.quit_application() |
199 | 180 |
|
200 | 181 | # ## Cleanup
|
201 | 182 | #
|
202 |
| -# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you |
| 183 | +# All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notbook you |
203 | 184 | # can retrieve those project files. The following cell removes all temporary files, including the project folder.
|
204 | 185 | time.sleep(3)
|
205 | 186 | temp_folder.cleanup()
|
0 commit comments