Skip to content

Commit 24b130a

Browse files
Sleep 10 seconds
1 parent 9dc2e38 commit 24b130a

File tree

1 file changed

+33
-52
lines changed

1 file changed

+33
-52
lines changed

examples/01-HFSS3DLayout/05_electrothermal_analysis.py

+33-52
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# # 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
33
# electrotermal analysis. The EDB will be loaded into SIwave for analysis and post-processing.
44
# In the end, an Icepak project is exported from SIwave.
55
# - Set up EDB
@@ -15,15 +15,16 @@
1515
# ## Preparation
1616
# Import required packages
1717

18+
import json
19+
1820
# +
1921
import os
20-
import json
2122
import tempfile
2223
import time
23-
from pyedb import Edb
24-
from pyedb import Siwave
25-
from pyaedt.downloads import download_file
24+
2625
from ansys.pyaedt.examples.constants import AEDT_VERSION
26+
from pyaedt.downloads import download_file
27+
from pyedb import Edb, Siwave
2728

2829
NG_MODE = False
2930

@@ -32,9 +33,7 @@
3233
# Download the example PCB data.
3334

3435
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)
3837

3938
# ## Create a configuration file
4039
# In this example, we are going to use a configure file to set up layout for analysis.
@@ -59,68 +58,50 @@
5958
"fin_height": "4mm",
6059
"fin_orientation": "x_oriented",
6160
"fin_spacing": "1mm",
62-
"fin_thickness": "1mm"
61+
"fin_thickness": "1mm",
6362
},
6463
"apply_to_all": False,
65-
"components": ["J5"]
64+
"components": ["J5"],
6665
}
6766
]
6867

6968
# ## Create pin groups.
7069
# 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:
7170

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"}]
7972

8073
# ### 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.
8275

8376
i_src_1 = {
8477
"name": "J5_VCCR",
8578
"reference_designator": "J5",
8679
"type": "current",
8780
"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.
9483
}
9584
i_src_2 = {
9685
"name": "J5_VCCT",
9786
"reference_designator": "J5",
9887
"type": "current",
9988
"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.
10691
}
10792

10893
# ### Create a Voltage Source
10994
# Create a voltage source on component U4 between two nets using keyword "net".
11095

11196
# +
11297
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+
}
124105

125106
cfg["sources"] = [v_src, i_src_1, i_src_2]
126107
# -
@@ -143,9 +124,7 @@
143124
"name": "siwave_dc",
144125
"type": "siwave_dc",
145126
"dc_slider_position": 0,
146-
"dc_ir_settings": {
147-
"export_dc_thermal_data": True
148-
}
127+
"dc_ir_settings": {"export_dc_thermal_data": True},
149128
}
150129
]
151130

@@ -177,29 +156,31 @@
177156

178157
# ### Load edb into HFSS 3D Layout.
179158

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")
183164

184165
# ### Analyze
185166

186-
# siwave.run_dc_simulation()
167+
siwave.run_dc_simulation()
187168

188169
# ### Export Icepak project
189170

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")
191172

192173
# ### Close SIwave project
193174

194-
# siwave.close_project()
175+
siwave.close_project()
195176

196177
# ## Shut Down SIwave
197178

198-
# siwave.quit_application()
179+
siwave.quit_application()
199180

200181
# ## Cleanup
201182
#
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
203184
# can retrieve those project files. The following cell removes all temporary files, including the project folder.
204185
time.sleep(3)
205186
temp_folder.cleanup()

0 commit comments

Comments
 (0)