|
7 | 7 | # ## Import PyAEDT and download files
|
8 | 8 | # Perform import of required classes from the ``pyaedt`` package and import the ``os`` package.
|
9 | 9 |
|
10 |
| -# + |
11 | 10 | import os
|
12 | 11 | import tempfile
|
13 | 12 |
|
14 | 13 | from pyaedt import Icepak, downloads
|
15 |
| -# - |
16 | 14 |
|
17 | 15 | # Set constant values
|
18 | 16 |
|
19 | 17 | AEDT_VERSION = "2024.1"
|
| 18 | +NG_MODE = False # Open Electronics UI when the application is launched. |
20 | 19 |
|
21 | 20 | # Download needed files in a temporary folder
|
22 | 21 |
|
|
26 | 25 | )
|
27 | 26 |
|
28 | 27 |
|
29 |
| -# ## Set non-graphical mode |
30 |
| -# Set non-graphical mode. |
31 |
| -# You can set ``non_graphical`` either to ``True`` or ``False``. |
32 |
| - |
33 |
| -non_graphical = False |
34 |
| - |
35 | 28 | # ## Create heatsink
|
36 | 29 | # Create new empty project in non-graphical mode.
|
37 | 30 |
|
38 | 31 | ipk = Icepak(
|
39 | 32 | project=os.path.join(temp_folder.name, "Heatsink.aedt"),
|
40 | 33 | version=AEDT_VERSION,
|
41 |
| - non_graphical=non_graphical, |
| 34 | + non_graphical=NG_MODE, |
42 | 35 | close_on_exit=True,
|
43 | 36 | new_desktop=True,
|
44 | 37 | )
|
|
50 | 43 |
|
51 | 44 | # Define the heatsink using multiple boxes
|
52 | 45 |
|
53 |
| -hs_base = ipk.modeler.create_box(origin=[0, 0, 0], sizes=[37.5, 37.5, 2], name="HS_Base") |
| 46 | +hs_base = ipk.modeler.create_box( |
| 47 | + origin=[0, 0, 0], sizes=[37.5, 37.5, 2], name="HS_Base" |
| 48 | +) |
54 | 49 | hs_base.material_name = "Al-Extruded"
|
55 | 50 | hs_fin = ipk.modeler.create_box(origin=[0, 0, 2], sizes=[37.5, 1, 18], name="HS_Fin1")
|
56 | 51 | hs_fin.material_name = "Al-Extruded"
|
57 | 52 | n_fins = 11
|
58 | 53 | hs_fins = hs_fin.duplicate_along_line(vector=[0, 3.65, 0], clones=n_fins)
|
59 | 54 |
|
60 |
| -ipk.plot(show=False, export_path=os.path.join(temp_folder.name, "Heatsink.jpg")) |
| 55 | +ipk.plot(show=False, output_file=os.path.join(temp_folder.name, "Heatsink.jpg")) |
61 | 56 |
|
62 | 57 | # Definition of a mesh region around the heatsink
|
63 | 58 |
|
64 |
| -mesh_region = ipk.mesh.assign_mesh_region(assignment=[hs_base.name, hs_fin.name] + hs_fins) |
| 59 | +mesh_region = ipk.mesh.assign_mesh_region( |
| 60 | + assignment=[hs_base.name, hs_fin.name] + hs_fins |
| 61 | +) |
65 | 62 | mesh_region.manual_settings = True
|
66 | 63 | mesh_region.settings["MaxElementSizeX"] = "5mm"
|
67 | 64 | mesh_region.settings["MaxElementSizeY"] = "5mm"
|
|
87 | 84 | monitor_name="TopPoint",
|
88 | 85 | )
|
89 | 86 | ipk.monitor.assign_face_monitor(
|
90 |
| - face_id=hs_base.bottom_face_z.id, monitor_quantity="Temperature", monitor_name="Bottom" |
| 87 | + face_id=hs_base.bottom_face_z.id, |
| 88 | + monitor_quantity="Temperature", |
| 89 | + monitor_name="Bottom", |
91 | 90 | )
|
92 | 91 | ipk.monitor.assign_point_monitor_in_object(
|
93 |
| - name=hs_middle_fin.name, monitor_quantity="Temperature", monitor_name="MiddleFinCenter" |
| 92 | + name=hs_middle_fin.name, |
| 93 | + monitor_quantity="Temperature", |
| 94 | + monitor_name="MiddleFinCenter", |
94 | 95 | )
|
95 | 96 |
|
96 | 97 | # Export the heatsink 3D component in a ``"componentLibrary"`` folder.
|
97 | 98 | # ``auxiliary_dict`` is set to true to export the monitor objects along with the .a3dcomp file.
|
98 | 99 |
|
99 | 100 | os.mkdir(os.path.join(temp_folder.name, "componentLibrary"))
|
100 | 101 | ipk.modeler.create_3dcomponent(
|
101 |
| - component_file=os.path.join(temp_folder.name, "componentLibrary", "Heatsink.a3dcomp"), |
| 102 | + component_file=os.path.join( |
| 103 | + temp_folder.name, "componentLibrary", "Heatsink.a3dcomp" |
| 104 | + ), |
102 | 105 | component_name="Heatsink",
|
103 | 106 | auxiliary_dict=True,
|
104 | 107 | )
|
105 |
| -ipk.close_project(save_project=False) |
| 108 | +ipk.close_project(save=False) |
106 | 109 |
|
107 | 110 | # ## Create QFP
|
108 | 111 | # Open the previously downloaded project containing a QPF.
|
109 | 112 |
|
110 | 113 | ipk = Icepak(project=qfp_temp_name)
|
111 |
| -ipk.plot(show=False, export_path=os.path.join(temp_folder.name, "QFP2.jpg")) |
| 114 | +ipk.plot(show=False, output_file=os.path.join(temp_folder.name, "QFP2.jpg")) |
112 | 115 |
|
113 | 116 | # Create dataset for power dissipation.
|
114 | 117 |
|
115 | 118 | x_datalist = [45, 53, 60, 70]
|
116 | 119 | y_datalist = [0.5, 3, 6, 9]
|
117 | 120 | ipk.create_dataset(
|
118 |
| - dsname="PowerDissipationDataset", |
119 |
| - xlist=x_datalist, |
120 |
| - ylist=y_datalist, |
| 121 | + name="PowerDissipationDataset", |
| 122 | + x=x_datalist, |
| 123 | + y=y_datalist, |
121 | 124 | is_project_dataset=False,
|
122 |
| - xunit="cel", |
123 |
| - yunit="W", |
| 125 | + x_unit="cel", |
| 126 | + y_unit="W", |
124 | 127 | )
|
125 | 128 |
|
126 | 129 | # Assign source power condition to the die.
|
|
166 | 169 | # Download and open a project containing the electronic package.
|
167 | 170 |
|
168 | 171 | ipk = Icepak(
|
169 |
| - project=package_temp_name, version=AEDT_VERSION, non_graphical=non_graphical |
| 172 | + project=package_temp_name, |
| 173 | + version=AEDT_VERSION, |
| 174 | + non_graphical=NG_MODE, |
170 | 175 | )
|
171 | 176 | ipk.plot(
|
172 | 177 | objects=[o for o in ipk.modeler.object_names if not o.startswith("DomainBox")],
|
|
201 | 206 | )
|
202 | 207 |
|
203 | 208 | ipk.plot(
|
204 |
| - objects=[o for o in ipk.modeler.object_names if not o.startswith("DomainBox")], |
| 209 | + assignment=[o for o in ipk.modeler.object_names if not o.startswith("DomainBox")], |
205 | 210 | show=False,
|
206 | 211 | plot_air_objects=False,
|
207 |
| - export_path=os.path.join(temp_folder.name, "electronic_package.jpg"), |
| 212 | + output_file=os.path.join(temp_folder.name, "electronic_package.jpg"), |
208 | 213 | force_opacity_value=0.5,
|
209 | 214 | )
|
210 | 215 | # -
|
|
220 | 225 | y_pointing=[0, 1, 0],
|
221 | 226 | )
|
222 | 227 |
|
223 |
| -# Export of the whole assembly as 3d component and close project. First, a flattening |
224 |
| -# is needed because nested 3d components are not natively supported. Then it is possible |
225 |
| -# to export the whole package as 3d component. Here the auxiliary dictionary is needed |
| 228 | +# Export of the entire assembly as a 3D component and close the project. First, the nested |
| 229 | +# hierarchy must be flattned since nested 3d components are currently not supported. Subsequently, |
| 230 | +# the whole package can be exported as a 3D component. The auxiliary dictionary is needed |
226 | 231 | # to export monitor objects, datasets and native components.
|
227 | 232 |
|
228 | 233 | ipk.flatten_3d_components()
|
229 | 234 | ipk.modeler.create_3dcomponent(
|
230 |
| - component_file=os.path.join(temp_folder.name, "componentLibrary", "PCBAssembly.a3dcomp"), |
| 235 | + component_file=os.path.join( |
| 236 | + temp_folder.name, "componentLibrary", "PCBAssembly.a3dcomp" |
| 237 | + ), |
231 | 238 | component_name="PCBAssembly",
|
232 | 239 | auxiliary_dict=True,
|
233 | 240 | included_cs=["Global", "HeatsinkCS", "PCB_Assembly"],
|
234 | 241 | reference_cs="PCB_Assembly",
|
235 | 242 | )
|
236 | 243 |
|
237 | 244 | # ## Release AEDT
|
238 |
| -# |
239 |
| -# Release AEDT and remove the temporary folder. |
240 | 245 |
|
241 | 246 | ipk.release_desktop(close_projects=True, close_desktop=True)
|
| 247 | + |
| 248 | +# ## Cleanup |
| 249 | +# |
| 250 | +# All project files are saved in the folder ``temp_dir.name``. |
| 251 | +# If you've run this example as a Jupyter notebook you |
| 252 | +# can retrieve those project files. The following cell |
| 253 | +# removes all temporary files, including the project folder. |
| 254 | + |
242 | 255 | temp_folder.cleanup()
|
0 commit comments