.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\05-Q3D\Q2D_Armoured_Cable.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_05-Q3D_Q2D_Armoured_Cable.py: Q2D: Cable parameter identification --------------------------------------------------- This example shows how you can use PyAEDT to perform these tasks: - Create a Q2D design using the Modeler primitives and importing part of the geometry. - Set up the entire simulation. - Link the solution to a Simplorer design. For cable information, see `4 Core Armoured Power Cable `_ .. GENERATED FROM PYTHON SOURCE LINES 14-16 Perform required imports ~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 16-20 .. code-block:: Python import pyaedt import math .. GENERATED FROM PYTHON SOURCE LINES 21-24 Set AEDT version ~~~~~~~~~~~~~~~~ Set AEDT version. .. GENERATED FROM PYTHON SOURCE LINES 24-27 .. code-block:: Python aedt_version = "2024.1" .. GENERATED FROM PYTHON SOURCE LINES 28-31 Initialize core strand dimensions and positions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Initialize cable sizing - radii in mm. .. GENERATED FROM PYTHON SOURCE LINES 31-38 .. code-block:: Python c_strand_radius = 2.575 cable_n_cores = 4 core_n_strands = 6 core_xlpe_ins_thickness = 0.5 core_xy_coord = math.ceil(3 * c_strand_radius + 2 * core_xlpe_ins_thickness) .. GENERATED FROM PYTHON SOURCE LINES 39-42 Initialize filling and sheath dimensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Initialize radii of further structures incrementally adding thicknesses. .. GENERATED FROM PYTHON SOURCE LINES 42-49 .. code-block:: Python filling_radius = 1.4142 * (core_xy_coord + 3 * c_strand_radius + core_xlpe_ins_thickness + 0.5) inner_sheath_radius = filling_radius + 0.75 armour_thickness = 3 armour_radius = inner_sheath_radius + armour_thickness outer_sheath_radius = armour_radius + 2 .. GENERATED FROM PYTHON SOURCE LINES 50-53 Initialize armature strand dimensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Initialize radii. .. GENERATED FROM PYTHON SOURCE LINES 53-58 .. code-block:: Python armour_centre_pos = inner_sheath_radius + armour_thickness / 2.0 arm_strand_rad = armour_thickness / 2.0 - 0.2 n_arm_strands = 30 .. GENERATED FROM PYTHON SOURCE LINES 59-63 Initialize dictionaries ~~~~~~~~~~~~~~~~~~~~~~~ Initialize dictionaries that contain all the definitions for the design variables and output variables. .. GENERATED FROM PYTHON SOURCE LINES 63-82 .. code-block:: Python core_params = { "n_cores": str(cable_n_cores), "n_strands_core": str(core_n_strands), "c_strand_radius": str(c_strand_radius) + 'mm', "c_strand_xy_coord": str(core_xy_coord) + 'mm' } outer_params = { "filling_radius": str(filling_radius) + 'mm', "inner_sheath_radius": str(inner_sheath_radius) + 'mm', "armour_radius": str(armour_radius) + 'mm', "outer_sheath_radius": str(outer_sheath_radius) + 'mm' } armour_params = { "armour_centre_pos": str(armour_centre_pos) + 'mm', "arm_strand_rad": str(arm_strand_rad) + 'mm', "n_arm_strands": str(n_arm_strands) } .. GENERATED FROM PYTHON SOURCE LINES 83-87 Initialize Q2D ~~~~~~~~~~~~~~ Initialize Q2D, providing the version, path to the project, and the design name and type. .. GENERATED FROM PYTHON SOURCE LINES 87-95 .. code-block:: Python project_name = 'Q2D_ArmouredCableExample' q2d_design_name = '2D_Extractor_Cable' setup_name = "MySetupAuto" sweep_name = "sweep1" tb_design_name = 'CableSystem' q2d = pyaedt.Q2d(projectname=project_name, designname=q2d_design_name, specified_version=aedt_version) .. rst-class:: sphx-glr-script-out .. code-block:: none C:\actions-runner\_work\_tool\Python\3.10.9\x64\lib\subprocess.py:1072: ResourceWarning: subprocess 9912 is still running _warn("subprocess %s is still running" % self.pid, C:\actions-runner\_work\pyaedt\pyaedt\.venv\lib\site-packages\pyaedt\generic\settings.py:383: ResourceWarning: unclosed file <_io.TextIOWrapper name='D:\\Temp\\pyaedt_ansys.log' mode='a' encoding='cp1252'> self._logger = val .. GENERATED FROM PYTHON SOURCE LINES 96-99 Define variables from dictionaries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Define design variables from the created dictionaries. .. GENERATED FROM PYTHON SOURCE LINES 99-107 .. code-block:: Python for k, v in core_params.items(): q2d[k] = v for k, v in outer_params.items(): q2d[k] = v for k, v in armour_params.items(): q2d[k] = v .. GENERATED FROM PYTHON SOURCE LINES 108-111 Create object to access 2D modeler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Create the ``mod2D`` object to access the 2D modeler easily. .. GENERATED FROM PYTHON SOURCE LINES 111-116 .. code-block:: Python mod2D = q2d.modeler mod2D.delete() mod2D.model_units = "mm" .. GENERATED FROM PYTHON SOURCE LINES 117-121 Initialize required material properties ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Cable insulators require the definition of specific materials since they are not included in the Sys Library. Plastic, PE (cross-linked, wire, and cable grade) .. GENERATED FROM PYTHON SOURCE LINES 121-132 .. code-block:: Python mat_pe_cable_grade = q2d.materials.add_material("plastic_pe_cable_grade") mat_pe_cable_grade.conductivity = "1.40573e-16" mat_pe_cable_grade.permittivity = "2.09762" mat_pe_cable_grade.dielectric_loss_tangent = "0.000264575" mat_pe_cable_grade.update() # Plastic, PP (10% carbon fiber) mat_pp = q2d.materials.add_material("plastic_pp_carbon_fiber") mat_pp.conductivity = "0.0003161" mat_pp.update() .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 133-135 Create geometry for core strands, filling, and XLPE insulation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 135-156 .. code-block:: Python mod2D.create_coordinate_system(['c_strand_xy_coord', 'c_strand_xy_coord', '0mm'], name='CS_c_strand_1') mod2D.set_working_coordinate_system('CS_c_strand_1') c1_id = mod2D.create_circle(['0mm', '0mm', '0mm'], 'c_strand_radius', name='c_strand_1', material='copper') c2_id = c1_id.duplicate_along_line(vector=['0mm', '2.0*c_strand_radius', '0mm'], nclones=2) mod2D.duplicate_around_axis(c2_id, axis="Z", angle=360 / core_n_strands, clones=6) c_unite_name = mod2D.unite(q2d.get_all_conductors_names()) fill_id = mod2D.create_circle(['0mm', '0mm', '0mm'], '3*c_strand_radius', name='c_strand_fill', material='plastic_pp_carbon_fiber') fill_id.color = (255, 255, 0) xlpe_id = mod2D.create_circle(['0mm', '0mm', '0mm'], '3*c_strand_radius+' + str(core_xlpe_ins_thickness) + 'mm', name='c_strand_xlpe', material='plastic_pe_cable_grade') xlpe_id.color = (0, 128, 128) mod2D.set_working_coordinate_system('Global') all_obj_names = q2d.get_all_conductors_names() + q2d.get_all_dielectrics_names() mod2D.duplicate_around_axis(all_obj_names, axis="Z", angle=360 / cable_n_cores, clones=4) cond_names = q2d.get_all_conductors_names() .. GENERATED FROM PYTHON SOURCE LINES 157-159 Create geometry for filling object ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 159-164 .. code-block:: Python filling_id = mod2D.create_circle(['0mm', '0mm', '0mm'], 'filling_radius', name='Filling', material='plastic_pp_carbon_fiber') filling_id.color = (255, 255, 180) .. GENERATED FROM PYTHON SOURCE LINES 165-167 Create geometry for inner sheath object ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 167-172 .. code-block:: Python inner_sheath_id = mod2D.create_circle(['0mm', '0mm', '0mm'], 'inner_sheath_radius', name='InnerSheath', material='PVC plastic') inner_sheath_id.color = (0, 0, 0) .. GENERATED FROM PYTHON SOURCE LINES 173-175 Create geometry for armature fill ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 175-180 .. code-block:: Python arm_fill_id = mod2D.create_circle(['0mm', '0mm', '0mm'], 'armour_radius', name='ArmourFilling', material='plastic_pp_carbon_fiber') arm_fill_id.color = (255, 255, 255) .. GENERATED FROM PYTHON SOURCE LINES 181-183 Create geometry for outer sheath ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 183-188 .. code-block:: Python outer_sheath_id = mod2D.create_circle(['0mm', '0mm', '0mm'], 'outer_sheath_radius', name='OuterSheath', material='PVC plastic') outer_sheath_id.color = (0, 0, 0) .. GENERATED FROM PYTHON SOURCE LINES 189-191 Create geometry for armature steel strands ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 191-198 .. code-block:: Python arm_strand_1_id = mod2D.create_circle(['0mm', 'armour_centre_pos', '0mm'], '1.1mm', name='arm_strand_1', material='steel_stainless') arm_strand_1_id.color = (128, 128, 64) arm_strand_1_id.duplicate_around_axis('Z', '360deg/n_arm_strands', clones='n_arm_strands') arm_strand_names = mod2D.get_objects_w_string('arm_strand') .. GENERATED FROM PYTHON SOURCE LINES 199-201 Create region ~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 201-205 .. code-block:: Python region = q2d.modeler.create_region([500, 500, 500, 500]) region.material_name = "vacuum" .. GENERATED FROM PYTHON SOURCE LINES 206-208 Assign conductors and reference ground ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 208-216 .. code-block:: Python obj = [q2d.modeler.get_object_from_name(i) for i in cond_names] [q2d.assign_single_conductor(assignment=i, name='C1' + str(obj.index(i) + 1), conductor_type='SignalLine') for i in obj] obj = [q2d.modeler.get_object_from_name(i) for i in arm_strand_names] q2d.assign_single_conductor(assignment=obj, name="gnd", conductor_type="ReferenceGround") mod2D.fit_all() .. GENERATED FROM PYTHON SOURCE LINES 217-219 Assign design settings ~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 219-224 .. code-block:: Python lumped_length = "100m" q2d_des_settings = q2d.design_settings q2d_des_settings['LumpedLength'] = lumped_length .. GENERATED FROM PYTHON SOURCE LINES 225-227 Insert setup and frequency sweep ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 227-231 .. code-block:: Python q2d_setup = q2d.create_setup(name=setup_name) q2d_sweep = q2d_setup.add_sweep(name=sweep_name) .. GENERATED FROM PYTHON SOURCE LINES 232-234 Analyze setup ~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 234-237 .. code-block:: Python # q2d.analyze(setup_name=setup_name) .. GENERATED FROM PYTHON SOURCE LINES 238-240 Add a Simplorer/Twin Builder design and the Q3D dynamic component ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 240-243 .. code-block:: Python tb = pyaedt.TwinBuilder(designname=tb_design_name) .. GENERATED FROM PYTHON SOURCE LINES 244-246 Add a Q3D dynamic component ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 246-250 .. code-block:: Python tb.add_q3d_dynamic_component(project_name, q2d_design_name, setup_name, sweep_name, coupling_matrix_name="Original", model_depth=lumped_length) .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 251-253 Save project and release desktop ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 253-256 .. code-block:: Python tb.save_project() tb.release_desktop(True, True) .. rst-class:: sphx-glr-script-out .. code-block:: none True .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 5.755 seconds) .. _sphx_glr_download_examples_05-Q3D_Q2D_Armoured_Cable.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Q2D_Armoured_Cable.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Q2D_Armoured_Cable.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_