|
2 | 2 |
|
3 | 3 | # This example shows how to use PyAEDT to perform these tasks:
|
4 | 4 | #
|
5 |
| -# - Create a Q2D design using modeler primitives and imported CAD. |
| 5 | +# - Create a Q2D design using modeler primitives and an imported CAD. |
6 | 6 | # - Set up the simulation.
|
7 | 7 | # - Link the solution to a Simplorer design.
|
8 | 8 | #
|
9 |
| -# For information on the cable model used in this example please see the following link: |
10 |
| -# |
11 |
| -# - [4 Core Armoured Power Cable] |
12 |
| -# (https://www.luxingcable.com/low-voltage-cables/4-core-armoured-power-cable.html) |
| 9 | +# For information on the cable model used in this example, see |
| 10 | +# [4 Core Armoured Power Cable](https://www.luxingcable.com/low-voltage-cables/4-core-armoured-power-cable.html). |
13 | 11 | #
|
14 | 12 | # Keywords: **Q2D**, **EMC**, **cable**.
|
15 | 13 |
|
16 |
| -# ## Perform required imports |
| 14 | +# ## Perform imports and define constants |
17 | 15 | #
|
| 16 | +# Perform required imports. |
18 | 17 |
|
19 | 18 | import math
|
20 | 19 | import os
|
|
23 | 22 |
|
24 | 23 | import ansys.aedt.core
|
25 | 24 |
|
26 |
| -# ## Create temporary directory |
27 |
| - |
28 |
| -temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") |
29 |
| - |
30 | 25 | # Define constants.
|
31 | 26 |
|
32 | 27 | AEDT_VERSION = "2024.2"
|
33 | 28 | NG_MODE = False # Open AEDT UI when it is launched.
|
34 | 29 |
|
| 30 | +# ## Create temporary directory |
| 31 | +# |
| 32 | +# Create a temporary directory where downloaded data or |
| 33 | +# dumped data can be stored. |
| 34 | +# If you'd like to retrieve the project data for subsequent use, |
| 35 | +# the temporary folder name is given by ``temp_folder.name``. |
| 36 | + |
| 37 | +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") |
| 38 | + |
35 | 39 | # ## Set up for model creation
|
36 | 40 | #
|
37 |
| -# Initialize cable sizing - radii in mm. |
| 41 | +# Initialize cable sizing by specifying radii in millimeters. |
38 | 42 |
|
39 | 43 | c_strand_radius = 2.575
|
40 | 44 | cable_n_cores = 4
|
|
58 | 62 | arm_strand_rad = armour_thickness / 2.0 - 0.2
|
59 | 63 | n_arm_strands = 30
|
60 | 64 |
|
61 |
| -# Start an instance of the Q2D extractor, providing the version, project name, design |
62 |
| -# name and type. |
| 65 | +# Start an instance of Q2D Extractor, providing the version, project name, design |
| 66 | +# name, and type. |
63 | 67 |
|
64 | 68 | project_name = os.path.join(temp_folder.name, "Q2D_ArmouredCableExample.aedt")
|
65 | 69 | q2d_design_name = "2D_Extractor_Cable"
|
|
74 | 78 | )
|
75 | 79 | q2d.modeler.model_units = "mm"
|
76 | 80 |
|
77 |
| -# Assign the variables to the Q3D design. |
| 81 | +# Assign variables to the Q3D design. |
78 | 82 |
|
79 | 83 | core_params = {
|
80 | 84 | "n_cores": str(cable_n_cores),
|
|
101 | 105 | q2d[k] = v
|
102 | 106 |
|
103 | 107 | # Cable insulators require the definition of specific materials since they are not
|
104 |
| -# included in the Sys Library. |
105 |
| -# Plastic, PE (cross-linked, wire, and cable grade) |
| 108 | +# included in the ``Sys`` library. |
| 109 | +# |
| 110 | +# Define Plastic, PE (cross-linked, wire, and cable grade): |
106 | 111 |
|
107 | 112 | mat_pe_cable_grade = q2d.materials.add_material("plastic_pe_cable_grade")
|
108 | 113 | mat_pe_cable_grade.conductivity = "1.40573e-16"
|
109 | 114 | mat_pe_cable_grade.permittivity = "2.09762"
|
110 | 115 | mat_pe_cable_grade.dielectric_loss_tangent = "0.000264575"
|
111 | 116 | mat_pe_cable_grade.update()
|
112 | 117 |
|
113 |
| -# Plastic, PP (10% carbon fiber) |
| 118 | +# Define Plastic, PP (10% carbon fiber): |
114 | 119 |
|
115 | 120 | mat_pp = q2d.materials.add_material("plastic_pp_carbon_fiber")
|
116 | 121 | mat_pp.conductivity = "0.0003161"
|
117 | 122 | mat_pp.update()
|
118 | 123 |
|
119 |
| -# ## Model Creation |
| 124 | +# ## Create model |
120 | 125 | #
|
121 | 126 | # Create the geometry for core strands, fill, and XLPE insulation.
|
122 | 127 |
|
|
191 | 196 | )
|
192 | 197 | arm_fill_id.color = (255, 255, 255)
|
193 | 198 |
|
194 |
| -# Create geometry for the outer sheath. |
| 199 | +# Create the geometry for the outer sheath. |
195 | 200 |
|
196 | 201 | outer_sheath_id = q2d.modeler.create_circle(
|
197 | 202 | origin=["0mm", "0mm", "0mm"],
|
|
201 | 206 | )
|
202 | 207 | outer_sheath_id.color = (0, 0, 0)
|
203 | 208 |
|
204 |
| -# Create the geometry for armature steel strands. |
| 209 | +# Create the geometry for the armature steel strands. |
205 | 210 |
|
206 | 211 | arm_strand_1_id = q2d.modeler.create_circle(
|
207 | 212 | origin=["0mm", "armour_centre_pos", "0mm"],
|
|
240 | 245 | model = q2d.plot(show=False)
|
241 | 246 | model.plot(os.path.join(temp_folder.name, "Image.jpg"))
|
242 | 247 |
|
243 |
| -# Specify the design settings |
| 248 | +# Specify the design settings. |
244 | 249 |
|
245 | 250 | lumped_length = "100m"
|
246 | 251 | q2d.design_settings["LumpedLength"] = lumped_length
|
247 | 252 |
|
248 |
| -# ## Solve the model |
| 253 | +# ## Solve model |
249 | 254 | #
|
250 |
| -# Insert setup and frequency sweep |
| 255 | +# Insert the setup and frequency sweep. |
251 | 256 |
|
252 | 257 | q2d_setup = q2d.create_setup(name=setup_name)
|
253 | 258 | q2d_sweep = q2d_setup.add_sweep(name=sweep_name)
|
254 | 259 |
|
255 | 260 | # The cable model is generated by running two solution types:
|
| 261 | +# |
256 | 262 | # 1. Capacitance and conductance per unit length (CG).
|
257 | 263 | # For this model, the CG solution runs in a few seconds.
|
| 264 | +# |
258 | 265 | # 2. Series resistance and inductance (RL).
|
259 |
| -# For this model the solution time can range from 15-20 minutes, |
| 266 | +# For this model, the solution time can range from 15-20 minutes, |
260 | 267 | # depending on the available hardware.
|
261 | 268 | #
|
262 | 269 | # Uncomment the following line to run the analysis.
|
|
267 | 274 |
|
268 | 275 | # ## Evaluate results
|
269 | 276 | #
|
270 |
| -# Add a Simplorer/Twin Builder design and the Q3D dynamic component |
| 277 | +# Add a Simplorer/Twin Builder design and the Q3D dynamic component. |
271 | 278 |
|
272 | 279 | tb = ansys.aedt.core.TwinBuilder(design=tb_design_name, version=AEDT_VERSION)
|
273 | 280 |
|
|
0 commit comments