diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000..32344385c --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +ANSYS, Inc. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..8ba1f31cb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,2 @@ +# Contributing + diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 000000000..402d2275f --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,23 @@ +# Contributors + +## Project Lead + +* [Samuel Lopez](https://github.com/Samuelopez-ansys) + +## Individual Contributors + +* [Devin Crawford](https://github.com/dcrawforAtAnsys) +* [Massimo Capodiferro](https://github.com/maxcapodi78) +* [Giulia Malinverno](https://github.com/gmalinve) +* [Sébastien Morais](https://github.com/SMoraisAnsys) +* [Alberto Di Maria](https://github.com/Alberto-DM) +* [Simon Vandenbrouck](https://github.com/svandenb-dev) +* [Hui Zhou](https://github.com/ring630) +* [Maxime Rey](https://github.com/MaxJPRey) +* [Kathy Pippert](https://github.com/PipKat) +* [Lorenzo Vecchietti](https://github.com/lorenzovecchietti) +* [Abdun Nur](https://github.com/anur7) +* [Matthew Young](https://github.com/myoung301) +* [Josh Salant](https://github.com/jsalant22) +* [David Twyman](https://github.com/DaveTwyman) +* [Irene Woyna](https://github.com/IreneWoyna) \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..f429325ed --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 - 2024 ANSYS, Inc. and/or its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/doc/source/_static/thumbnails/lorentz_actuator.png b/doc/source/_static/thumbnails/lorentz_actuator.png new file mode 100644 index 000000000..f6be0c6a7 Binary files /dev/null and b/doc/source/_static/thumbnails/lorentz_actuator.png differ diff --git a/doc/source/_static/thumbnails/netlist.png b/doc/source/_static/thumbnails/netlist.png index f73eae65f..0f975446f 100644 Binary files a/doc/source/_static/thumbnails/netlist.png and b/doc/source/_static/thumbnails/netlist.png differ diff --git a/doc/source/conf.py b/doc/source/conf.py index d20a83a49..f155218bb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -415,35 +415,36 @@ def setup(app): # Define static thumbnails nbsphinx_thumbnails = { - "examples/02-aedt_general/configuration_files": "_static/thumbnails/configuration_file_icepak.png", - "examples/02-aedt_general/modeler/index": "_static/thumbnails/modeler.png", - "examples/02-aedt_general/modeler/coordinate_system": "_static/thumbnails/coordinate_system.png", - "examples/02-aedt_general/modeler/polyline": "_static/thumbnails/polyline.png", - "examples/02-aedt_general/modeler/netlist_to_schematic": "_static/thumbnails/netlist.png", - "examples/02-aedt_general/components/index": "_static/thumbnails/components.png", - "examples/02-aedt_general/components/component_conversion": "_static/thumbnails/e3dcomp.png", - "examples/02-aedt_general/report/index": "_static/thumbnails/touchstone.png", - "examples/02-aedt_general/report/virtual_compliance": "_static/thumbnails/virtual_compliance_eye.png", - "examples/03-high_frequency/antenna/fss_unitcell": "_static/thumbnails/unitcell.png", - "examples/03-high_frequency/antenna/large_scenarios/index": "_static/thumbnails/car_w_pedestrians.png", - "examples/03-high_frequency/antenna/interferences/index": "_static/thumbnails/emit_simple_cosite.png", - "examples/03-high_frequency/antenna/interferences/antenna": "_static/thumbnails/emit.png", - "examples/03-high_frequency/antenna/interferences/hfss_emit": "_static/thumbnails/emit_hfss.png", - "examples/03-high_frequency/antenna/interferences/interference": "_static/thumbnails/interference.png", - "examples/03-high_frequency/antenna/interferences/protection": "_static/thumbnails/protection.png", - "examples/03-high_frequency/antenna/interferences/interference_type": "_static/thumbnails/interference_type.png", - "examples/03-high_frequency/emc/subcircuit": "_static/thumbnails/subcircuit.png", - "examples/03-high_frequency/radiofrequency_mmwave/lumped_element": "_static/thumbnails/lumped_filter.png", - "examples/03-high_frequency/layout/signal_integrity/com_analysis": "_static/thumbnails/com_eye.png", - "examples/03-high_frequency/layout/signal_integrity/multizone": "_static/thumbnails/multizone.png", - "examples/03-high_frequency/multiphysics/index": "_static/thumbnails/multizone.png", - "examples/04-low_frequency/general/external_circuit": "_static/thumbnails/external_circuit.png", - "examples/04-low_frequency/general/twin_builder/index": "_static/thumbnails/rectifier.png", - "examples/04-low_frequency/general/twin_builder/static_rom": "_static/thumbnails/static_rom.png", - "examples/04-low_frequency/motor/aedt_motor/rmxpert": "_static/thumbnails/rmxpert.png", - "examples/04-low_frequency/multiphysics/maxwell_icepak": "_static/thumbnails/charging.png", - "examples/05-electrothermal/icepak_circuit_hfss_coupling": "_static/thumbnails/ring.png", - "examples/05-electrothermal/electrothermal": "_static/thumbnails/electrothermal.png", + "examples/aedt_general/configuration_files": "_static/thumbnails/configuration_file_icepak.png", + "examples/aedt_general/modeler/index": "_static/thumbnails/modeler.png", + "examples/aedt_general/modeler/coordinate_system": "_static/thumbnails/coordinate_system.png", + "examples/aedt_general/modeler/polyline": "_static/thumbnails/polyline.png", + "examples/aedt_general/modeler/netlist_to_schematic": "_static/thumbnails/netlist.png", + "examples/aedt_general/components/index": "_static/thumbnails/components.png", + "examples/aedt_general/components/component_conversion": "_static/thumbnails/e3dcomp.png", + "examples/aedt_general/report/index": "_static/thumbnails/touchstone.png", + "examples/aedt_general/report/virtual_compliance": "_static/thumbnails/virtual_compliance_eye.png", + "examples/high_frequency/antenna/fss_unitcell": "_static/thumbnails/unitcell.png", + "examples/high_frequency/antenna/large_scenarios/index": "_static/thumbnails/car_w_pedestrians.png", + "examples/high_frequency/antenna/interferences/index": "_static/thumbnails/emit_simple_cosite.png", + "examples/high_frequency/antenna/interferences/antenna": "_static/thumbnails/emit.png", + "examples/high_frequency/antenna/interferences/hfss_emit": "_static/thumbnails/emit_hfss.png", + "examples/high_frequency/antenna/interferences/interference": "_static/thumbnails/interference.png", + "examples/high_frequency/antenna/interferences/protection": "_static/thumbnails/protection.png", + "examples/high_frequency/antenna/interferences/interference_type": "_static/thumbnails/interference_type.png", + "examples/high_frequency/emc/subcircuit": "_static/thumbnails/subcircuit.png", + "examples/high_frequency/radiofrequency_mmwave/lumped_element": "_static/thumbnails/lumped_filter.png", + "examples/high_frequency/layout/signal_integrity/com_analysis": "_static/thumbnails/com_eye.png", + "examples/high_frequency/layout/signal_integrity/multizone": "_static/thumbnails/multizone.png", + "examples/high_frequency/multiphysics/index": "_static/thumbnails/multizone.png", + "examples/low_frequency/general/external_circuit": "_static/thumbnails/external_circuit.png", + "examples/low_frequency/general/twin_builder/index": "_static/thumbnails/rectifier.png", + "examples/low_frequency/general/twin_builder/static_rom": "_static/thumbnails/static_rom.png", + "examples/low_frequency/magnetic/lorentz_actuator": "_static/thumbnails/lorentz_actuator.png", + "examples/low_frequency/motor/aedt_motor/rmxpert": "_static/thumbnails/rmxpert.png", + "examples/low_frequency/multiphysics/maxwell_icepak": "_static/thumbnails/charging.png", + "examples/electrothermal/icepak_circuit_hfss_coupling": "_static/thumbnails/ring.png", + "examples/electrothermal/electrothermal": "_static/thumbnails/electrothermal.png", } diff --git a/doc/source/index.rst b/doc/source/index.rst index b22ed76da..c0afcd3da 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -3,11 +3,11 @@ Examples **Useful links**: `Installation `_ | -`Source Repository `_ | +`Source repository `_ | `Issues `_ -Embedding examples for `PyAEDT `_ are contained in this repository. -These end-to-end examples show how you can use PyAEDT. +This repository contains end-to-end embedding examples that demonstrate how to use +`PyAEDT `_. .. grid:: 2 @@ -17,78 +17,78 @@ These end-to-end examples show how you can use PyAEDT. :link: https://aedt.docs.pyansys.com/version/stable/User_guide/index.html :link-type: url - .. image:: examples/01-basic/_static/logo.png + .. image:: examples/basic/_static/logo.png :alt: PyAEDT logo :width: 250px :height: 200px :align: center - This section demonstrates basic PyAEDT capabilities + Links to brief tutorials provided in the PyAEDT documentation. .. grid-item-card:: General :padding: 2 2 2 2 - :link: examples/02-aedt_general/index + :link: examples/aedt_general/index :link-type: doc - .. image:: examples/02-aedt_general/_static/aedt_electronics.png + .. image:: examples/aedt_general/_static/aedt_electronics.png :alt: AEDT electronics :width: 250px :height: 200px :align: center - AEDT general capabilities + Provides examples of some general PyAEDT capabilities. .. grid-item-card:: High Frequency :padding: 2 2 2 2 - :link: examples/03-high_frequency/index + :link: examples/high_frequency/index :link-type: doc - .. image:: examples/03-high_frequency/_static/hf.png + .. image:: examples/high_frequency/_static/hf.png :alt: High frequency IC :width: 250px :height: 200px :align: center - PyAEDT capabilities for High Frequency applications + Provides examples of PyAEDT capabilities for high-frequency applications. .. grid-item-card:: Low Frequency :padding: 2 2 2 2 - :link: examples/04-low_frequency/index + :link: examples/low_frequency/index :link-type: doc - .. image:: examples/04-low_frequency/_static/motor_maxwell.png + .. image:: examples/low_frequency/_static/motor_maxwell.png :alt: Low frequency motor :width: 250px :height: 200px :align: center - PyAEDT capabilities for Low Frequency applications + Provides examples of PyAEDT capabilities for low-frequency applications. .. grid-item-card:: Electrothermal :padding: 2 2 2 2 - :link: examples/05-electrothermal/index + :link: examples/electrothermal/index :link-type: doc - .. image:: examples/05-electrothermal/_static/icepak_logo.png + .. image:: examples/electrothermal/_static/icepak_logo.png :alt: Icepak :width: 250px :height: 200px :align: center - PyAEDT capabilities for Electrothermal applications + Provides examples of PyAEDT capabilities for electrothermal applications. .. grid-item-card:: Examples by AEDT application :padding: 2 2 2 2 - :link: examples/06-AEDT/index + :link: examples/aedt/index :link-type: doc - .. image:: examples/06-AEDT/_static/aedt.png + .. image:: examples/aedt/_static/aedt.png :alt: AEDT :width: 250px :height: 200px :align: center - Examples divided by AEDT application + Provides examples organized by AEDT applications. .. toctree:: :hidden: diff --git a/examples/02-aedt_general/modeler/_static/circuit.png b/examples/02-aedt_general/modeler/_static/circuit.png deleted file mode 100644 index 3641f1c47..000000000 Binary files a/examples/02-aedt_general/modeler/_static/circuit.png and /dev/null differ diff --git a/examples/02-aedt_general/report/_static/virtual_compliance_configs.png b/examples/02-aedt_general/report/_static/virtual_compliance_configs.png deleted file mode 100644 index 6c7b1c2fa..000000000 Binary files a/examples/02-aedt_general/report/_static/virtual_compliance_configs.png and /dev/null differ diff --git a/examples/03-high_frequency/layout/power_integrity/index.rst b/examples/03-high_frequency/layout/power_integrity/index.rst deleted file mode 100644 index 92db57ad3..000000000 --- a/examples/03-high_frequency/layout/power_integrity/index.rst +++ /dev/null @@ -1,14 +0,0 @@ -Power integrity -~~~~~~~~~~~~~~~ - -These examples use PyAEDT to show power integrity examples - -.. nbgallery:: - - power_integrity.py - dcir.py - dcir_q3d.py - ac_q3d.py - ../../../02-aedt_general/modeler/circuit_schematic.py - ../../../02-aedt_general/modeler/netlist_to_schematic.py - ../../../02-aedt_general/report/touchstone_file.py diff --git a/examples/03-high_frequency/layout/signal_integrity/index.rst b/examples/03-high_frequency/layout/signal_integrity/index.rst deleted file mode 100644 index 830111738..000000000 --- a/examples/03-high_frequency/layout/signal_integrity/index.rst +++ /dev/null @@ -1,17 +0,0 @@ -Signal integrity -~~~~~~~~~~~~~~~~ - -These examples use PyAEDT to show signal integrity examples - -.. nbgallery:: - - com_analysis.py - pre_layout.py - pre_layout_parametrized.py - ami.py - multizone.py - circuit_transient.py - ../../../02-aedt_general/modeler/circuit_schematic.py - ../../../02-aedt_general/modeler/netlist_to_schematic.py - ../../emc/subcircuit.py - ../../../02-aedt_general/report/touchstone_file.py \ No newline at end of file diff --git a/examples/03-high_frequency/multiphysics/index.rst b/examples/03-high_frequency/multiphysics/index.rst deleted file mode 100644 index 0ca8d6355..000000000 --- a/examples/03-high_frequency/multiphysics/index.rst +++ /dev/null @@ -1,13 +0,0 @@ -Multiphysics -~~~~~~~~~~~~ - -These examples use PyAEDT to show some multiphysics examples - -.. nbgallery:: - - mri.py - hfss_mechanical.py - ../../05-electrothermal/ecad_import.py - ../../05-electrothermal/coaxial_hfss_icepak.py - ../../05-electrothermal/electrothermal.py - ../../05-electrothermal/icepak_circuit_hfss_coupling.py diff --git a/examples/06-AEDT/_static/aedt.png b/examples/06-AEDT/_static/aedt.png deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/06-AEDT/circuit/index.rst b/examples/06-AEDT/circuit/index.rst deleted file mode 100644 index 16b06fc4b..000000000 --- a/examples/06-AEDT/circuit/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -Circuit -~~~~~~~ - -These examples use PyAEDT to show Circuit capabilities - -.. nbgallery:: - - ../../02-aedt_general/modeler/circuit_schematic.py - ../../02-aedt_general/modeler/netlist_to_schematic.py - ../../02-aedt_general/report/automatic_report.py - ../../02-aedt_general/report/virtual_compliance.py - ../../03-high_frequency/emc/subcircuit.py - ../../03-high_frequency/layout/signal_integrity/ami.py - ../../03-high_frequency/layout/signal_integrity/circuit_transient.py - ../../03-high_frequency/layout/signal_integrity/multizone.py \ No newline at end of file diff --git a/examples/06-AEDT/emit/index.rst b/examples/06-AEDT/emit/index.rst deleted file mode 100644 index 9a630441e..000000000 --- a/examples/06-AEDT/emit/index.rst +++ /dev/null @@ -1,12 +0,0 @@ -EMIT -~~~~ - -These examples use PyAEDT to show EMIT capabilities - -.. nbgallery:: - - ../../03-high_frequency/antenna/interferences/antenna.py - ../../03-high_frequency/antenna/interferences/hfss_emit.py - ../../03-high_frequency/antenna/interferences/interference.py - ../../03-high_frequency/antenna/interferences/interference_type.py - ../../03-high_frequency/antenna/interferences/protection.py \ No newline at end of file diff --git a/examples/06-AEDT/hfss/index.rst b/examples/06-AEDT/hfss/index.rst deleted file mode 100644 index 828f4921b..000000000 --- a/examples/06-AEDT/hfss/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -HFSS -~~~~ - -These examples use PyAEDT to show HFSS capabilities - -.. nbgallery:: - - ../../03-high_frequency/antenna/array.py - ../../03-high_frequency/antenna/dipole.py - ../../03-high_frequency/antenna/fss_unitcell.py - ../../03-high_frequency/antenna/patch.py - ../../03-high_frequency/antenna/large_scenarios/city.py - ../../03-high_frequency/antenna/large_scenarios/doppler.py - ../../03-high_frequency/antenna/large_scenarios/reflector.py - ../../03-high_frequency/antenna/large_scenarios/time_domain.py - ../../03-high_frequency/emc/choke.py - ../../03-high_frequency/emc/eigenmode.py - ../../03-high_frequency/emc/flex_cable.py - ../../03-high_frequency/multiphysics/hfss_mechanical.py - ../../03-high_frequency/multiphysics/mri.py - ../../03-high_frequency/radiofrequency_mmwave/iris_filter.py - ../../03-high_frequency/radiofrequency_mmwave/spiral.py - ../../05-electrothermal/coaxial_hfss_icepak.py - ../../05-electrothermal/icepak_circuit_hfss_coupling.py \ No newline at end of file diff --git a/examples/06-AEDT/hfss_3d_layout/index.rst b/examples/06-AEDT/hfss_3d_layout/index.rst deleted file mode 100644 index 0fd5dc7b7..000000000 --- a/examples/06-AEDT/hfss_3d_layout/index.rst +++ /dev/null @@ -1,12 +0,0 @@ -HFSS 3D Layout -~~~~~~~~~~~~~~ - -These examples use PyAEDT to show HFSS 3D Layout capabilities - -.. nbgallery:: - - ../../03-high_frequency/layout/power_integrity/dcir.py - ../../03-high_frequency/layout/power_integrity/power_integrity.py - ../../03-high_frequency/layout/signal_integrity/pre_layout.py - ../../03-high_frequency/layout/signal_integrity/pre_layout_parametrized.py - ../../03-high_frequency/layout/gui_manipulation.py \ No newline at end of file diff --git a/examples/06-AEDT/icepak/index.rst b/examples/06-AEDT/icepak/index.rst deleted file mode 100644 index 25c4a9f78..000000000 --- a/examples/06-AEDT/icepak/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -Icepak -~~~~~~ - -These examples use PyAEDT to show Icepak capabilities - -.. nbgallery:: - - ../../05-electrothermal/coaxial_hfss_icepak.py - ../../05-electrothermal/component_3d.py - ../../05-electrothermal/component_csv.py - ../../05-electrothermal/ecad_import.py - ../../05-electrothermal/electrothermal.py - ../../05-electrothermal/graphic_card.py - ../../05-electrothermal/icepak_circuit_hfss_coupling.py - ../../05-electrothermal/sherlock.py \ No newline at end of file diff --git a/examples/06-AEDT/maxwell_2d/index.rst b/examples/06-AEDT/maxwell_2d/index.rst deleted file mode 100644 index d515e6bbf..000000000 --- a/examples/06-AEDT/maxwell_2d/index.rst +++ /dev/null @@ -1,19 +0,0 @@ -Maxwell 2D -~~~~~~~~~~ - -These examples use PyAEDT to show Maxwell 2D capabilities - -.. nbgallery:: - - ../../04-low_frequency/general/control_program.py - ../../04-low_frequency/general/eddy_current.py - ../../04-low_frequency/general/electrostatic.py - ../../04-low_frequency/general/external_circuit.py - ../../04-low_frequency/general/resistance.py - ../../04-low_frequency/magnetic/magneto_motive_contour.py - ../../04-low_frequency/magnetic/magneto_motive_line.py - ../../04-low_frequency/magnetic/transient_winding.py - ../../04-low_frequency/magnetic/lorentz_actuator.py - ../../04-low_frequency/motor/aedt_motor/pm_synchronous.py - ../../04-low_frequency/motor/aedt_motor/rmxpert.py - ../../04-low_frequency/motor/aedt_motor/transformer_inductance.py \ No newline at end of file diff --git a/examples/06-AEDT/maxwell_3d/index.rst b/examples/06-AEDT/maxwell_3d/index.rst deleted file mode 100644 index c707ff138..000000000 --- a/examples/06-AEDT/maxwell_3d/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -Maxwell 3D -~~~~~~~~~~ - -These examples use PyAEDT to show Maxwell 3D capabilities - -.. nbgallery:: - - ../../04-low_frequency/general/dc_analysis.py - ../../04-low_frequency/general/field_export.py - ../../04-low_frequency/magnetic/choke.py - ../../04-low_frequency/motor/aedt_motor/magnet_segmentation.py - ../../04-low_frequency/motor/aedt_motor/transformer.py - ../../04-low_frequency/multiphysics/maxwell_icepak.py - ../../04-low_frequency/team_problem/asymmetric_conductor.py - ../../04-low_frequency/team_problem/bath_plate.py \ No newline at end of file diff --git a/examples/06-AEDT/misc/index.rst b/examples/06-AEDT/misc/index.rst deleted file mode 100644 index 4e073cccc..000000000 --- a/examples/06-AEDT/misc/index.rst +++ /dev/null @@ -1,10 +0,0 @@ -Miscellaneous -~~~~~~~~~~~~~ - -These examples use PyAEDT to show miscellaneous capabilities - -.. nbgallery:: - - ../../02-aedt_general/report/touchstone_file.py - ../../03-high_frequency/layout/signal_integrity/com_analysis.py - ../../03-high_frequency/radiofrequency_mmwave/lumped_element.py \ No newline at end of file diff --git a/examples/06-AEDT/q3d_q2d/index.rst b/examples/06-AEDT/q3d_q2d/index.rst deleted file mode 100644 index a1f1caa08..000000000 --- a/examples/06-AEDT/q3d_q2d/index.rst +++ /dev/null @@ -1,13 +0,0 @@ -Q2D-Q3D -~~~~~~~ - -These examples use PyAEDT to show Q3D and 2D Extractor capabilities - -.. nbgallery:: - - ../../03-high_frequency/emc/armoured_cable.py - ../../03-high_frequency/emc/busbar.py - ../../03-high_frequency/layout/ac_q3d.py - ../../03-high_frequency/layout/dcir_q3d.py - ../../03-high_frequency/radiofrequency_mmwave/coplanar_waveguide.py - ../../03-high_frequency/radiofrequency_mmwave/stripline.py \ No newline at end of file diff --git a/examples/06-AEDT/twin_builder/index.rst b/examples/06-AEDT/twin_builder/index.rst deleted file mode 100644 index b7598bac9..000000000 --- a/examples/06-AEDT/twin_builder/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -Twin Builder -~~~~~~~~~~~~ - -These examples use PyAEDT to show Twin Builder capabilities - -.. nbgallery:: - - ../../04-low_frequency/general/twin_builder/dynamic_rom.py - ../../04-low_frequency/general/twin_builder/rc_circuit.py - ../../04-low_frequency/general/twin_builder/rectifier.py - ../../04-low_frequency/general/twin_builder/static_rom.py \ No newline at end of file diff --git a/examples/aedt/_static/aedt.png b/examples/aedt/_static/aedt.png new file mode 100644 index 000000000..e7213e3e4 Binary files /dev/null and b/examples/aedt/_static/aedt.png differ diff --git a/examples/aedt/circuit/index.rst b/examples/aedt/circuit/index.rst new file mode 100644 index 000000000..51a16b6e7 --- /dev/null +++ b/examples/aedt/circuit/index.rst @@ -0,0 +1,15 @@ +Circuit +~~~~~~~ + +These examples use PyAEDT to show Circuit capabilities + +.. nbgallery:: + + ../../aedt_general/modeler/circuit_schematic.py + ../../aedt_general/modeler/netlist_to_schematic.py + ../../aedt_general/report/automatic_report.py + ../../aedt_general/report/virtual_compliance.py + ../../high_frequency/emc/subcircuit.py + ../../high_frequency/layout/signal_integrity/ami.py + ../../high_frequency/layout/signal_integrity/circuit_transient.py + ../../high_frequency/layout/signal_integrity/multizone.py \ No newline at end of file diff --git a/examples/aedt/emit/index.rst b/examples/aedt/emit/index.rst new file mode 100644 index 000000000..31146fe67 --- /dev/null +++ b/examples/aedt/emit/index.rst @@ -0,0 +1,12 @@ +EMIT +~~~~ + +These examples use PyAEDT to show EMIT capabilities + +.. nbgallery:: + + ../../high_frequency/antenna/interferences/antenna.py + ../../high_frequency/antenna/interferences/hfss_emit.py + ../../high_frequency/antenna/interferences/interference.py + ../../high_frequency/antenna/interferences/interference_type.py + ../../high_frequency/antenna/interferences/protection.py \ No newline at end of file diff --git a/examples/aedt/hfss/index.rst b/examples/aedt/hfss/index.rst new file mode 100644 index 000000000..f3c4919e1 --- /dev/null +++ b/examples/aedt/hfss/index.rst @@ -0,0 +1,24 @@ +HFSS +~~~~ + +These examples use PyAEDT to show HFSS capabilities + +.. nbgallery:: + + ../../high_frequency/antenna/array.py + ../../high_frequency/antenna/dipole.py + ../../high_frequency/antenna/fss_unitcell.py + ../../high_frequency/antenna/patch.py + ../../high_frequency/antenna/large_scenarios/city.py + ../../high_frequency/antenna/large_scenarios/doppler.py + ../../high_frequency/antenna/large_scenarios/reflector.py + ../../high_frequency/antenna/large_scenarios/time_domain.py + ../../high_frequency/emc/choke.py + ../../high_frequency/emc/eigenmode.py + ../../high_frequency/emc/flex_cable.py + ../../high_frequency/multiphysics/hfss_mechanical.py + ../../high_frequency/multiphysics/mri.py + ../../high_frequency/radiofrequency_mmwave/iris_filter.py + ../../high_frequency/radiofrequency_mmwave/spiral.py + ../../electrothermal/coaxial_hfss_icepak.py + ../../electrothermal/icepak_circuit_hfss_coupling.py \ No newline at end of file diff --git a/examples/aedt/hfss_3d_layout/index.rst b/examples/aedt/hfss_3d_layout/index.rst new file mode 100644 index 000000000..5896ce0b3 --- /dev/null +++ b/examples/aedt/hfss_3d_layout/index.rst @@ -0,0 +1,12 @@ +HFSS 3D Layout +~~~~~~~~~~~~~~ + +These examples use PyAEDT to show HFSS 3D Layout capabilities + +.. nbgallery:: + + ../../high_frequency/layout/power_integrity/dcir.py + ../../high_frequency/layout/power_integrity/power_integrity.py + ../../high_frequency/layout/signal_integrity/pre_layout.py + ../../high_frequency/layout/signal_integrity/pre_layout_parametrized.py + ../../high_frequency/layout/gui_manipulation.py \ No newline at end of file diff --git a/examples/aedt/icepak/index.rst b/examples/aedt/icepak/index.rst new file mode 100644 index 000000000..3e61c6852 --- /dev/null +++ b/examples/aedt/icepak/index.rst @@ -0,0 +1,15 @@ +Icepak +~~~~~~ + +These examples use PyAEDT to show Icepak capabilities + +.. nbgallery:: + + ../../electrothermal/coaxial_hfss_icepak.py + ../../electrothermal/component_3d.py + ../../electrothermal/component_csv.py + ../../electrothermal/ecad_import.py + ../../electrothermal/electrothermal.py + ../../electrothermal/graphic_card.py + ../../electrothermal/icepak_circuit_hfss_coupling.py + ../../electrothermal/sherlock.py \ No newline at end of file diff --git a/examples/06-AEDT/index.rst b/examples/aedt/index.rst similarity index 70% rename from examples/06-AEDT/index.rst rename to examples/aedt/index.rst index 47ae4c109..ace85d39c 100644 --- a/examples/06-AEDT/index.rst +++ b/examples/aedt/index.rst @@ -1,7 +1,7 @@ Examples by AEDT application =========================== -Examples divided by AEDT application. +These examples are groped by AEDT applications. .. grid:: 2 @@ -11,67 +11,67 @@ Examples divided by AEDT application. :link: hfss/index :link-type: doc - This section shows HFSS examples + HFSS examples .. grid-item-card:: Maxwell 3D :padding: 2 2 2 2 :link: maxwell_3d/index :link-type: doc - This section shows Maxwell 3D examples + Maxwell 3D examples .. grid-item-card:: Maxwell 2D :padding: 2 2 2 2 :link: maxwell_2d/index :link-type: doc - This section shows Maxwell 2D examples + Maxwell 2D examples .. grid-item-card:: Icepak :padding: 2 2 2 2 :link: icepak/index :link-type: doc - This section shows Icepak examples + Icepak examples .. grid-item-card:: HFSS 3D Layout :padding: 2 2 2 2 :link: hfss_3d_layout/index :link-type: doc - This section shows HFSS 3D Layout examples + HFSS 3D Layout examples .. grid-item-card:: Q3D and 2D Extractor :padding: 2 2 2 2 :link: q3d_q2d/index :link-type: doc - This section shows Q3D and 2D Extractor examples + Q3D and 2D Extractor examples .. grid-item-card:: Circuit :padding: 2 2 2 2 :link: circuit/index :link-type: doc - This section shows Circuit examples + Circuit examples .. grid-item-card:: EMIT :padding: 2 2 2 2 :link: emit/index :link-type: doc - This section shows EMIT examples + EMIT examples .. grid-item-card:: Twin Builder :padding: 2 2 2 2 :link: twin_builder/index :link-type: doc - This section shows Twin Builder examples + Twin Builder examples .. grid-item-card:: Miscellaneous :padding: 2 2 2 2 :link: misc/index :link-type: doc - This section shows miscellaneous examples \ No newline at end of file + Miscellaneous examples \ No newline at end of file diff --git a/examples/aedt/maxwell_2d/index.rst b/examples/aedt/maxwell_2d/index.rst new file mode 100644 index 000000000..dab96d50b --- /dev/null +++ b/examples/aedt/maxwell_2d/index.rst @@ -0,0 +1,19 @@ +Maxwell 2D +~~~~~~~~~~ + +These examples use PyAEDT to show Maxwell 2D capabilities + +.. nbgallery:: + + ../../low_frequency/general/control_program.py + ../../low_frequency/general/eddy_current.py + ../../low_frequency/general/electrostatic.py + ../../low_frequency/general/external_circuit.py + ../../low_frequency/general/resistance.py + ../../low_frequency/magnetic/magneto_motive_contour.py + ../../low_frequency/magnetic/magneto_motive_line.py + ../../low_frequency/magnetic/transient_winding.py + ../../low_frequency/magnetic/lorentz_actuator.py + ../../low_frequency/motor/aedt_motor/pm_synchronous.py + ../../low_frequency/motor/aedt_motor/rmxpert.py + ../../low_frequency/motor/aedt_motor/transformer_inductance.py \ No newline at end of file diff --git a/examples/aedt/maxwell_3d/index.rst b/examples/aedt/maxwell_3d/index.rst new file mode 100644 index 000000000..56e6cbfa6 --- /dev/null +++ b/examples/aedt/maxwell_3d/index.rst @@ -0,0 +1,15 @@ +Maxwell 3D +~~~~~~~~~~ + +These examples use PyAEDT to show Maxwell 3D capabilities + +.. nbgallery:: + + ../../low_frequency/general/dc_analysis.py + ../../low_frequency/general/field_export.py + ../../low_frequency/magnetic/choke.py + ../../low_frequency/motor/aedt_motor/magnet_segmentation.py + ../../low_frequency/motor/aedt_motor/transformer.py + ../../low_frequency/multiphysics/maxwell_icepak.py + ../../low_frequency/team_problem/asymmetric_conductor.py + ../../low_frequency/team_problem/bath_plate.py \ No newline at end of file diff --git a/examples/aedt/misc/index.rst b/examples/aedt/misc/index.rst new file mode 100644 index 000000000..35a8ef0ba --- /dev/null +++ b/examples/aedt/misc/index.rst @@ -0,0 +1,10 @@ +Miscellaneous +~~~~~~~~~~~~~ + +These examples use PyAEDT to show miscellaneous capabilities + +.. nbgallery:: + + ../../aedt_general/report/touchstone_file.py + ../../high_frequency/layout/signal_integrity/com_analysis.py + ../../high_frequency/radiofrequency_mmwave/lumped_element.py \ No newline at end of file diff --git a/examples/aedt/q3d_q2d/index.rst b/examples/aedt/q3d_q2d/index.rst new file mode 100644 index 000000000..be65cf283 --- /dev/null +++ b/examples/aedt/q3d_q2d/index.rst @@ -0,0 +1,13 @@ +Q2D-Q3D +~~~~~~~ + +These examples use PyAEDT to show Q3D and 2D Extractor capabilities + +.. nbgallery:: + + ../../high_frequency/emc/armoured_cable.py + ../../high_frequency/emc/busbar.py + ../../high_frequency/layout/ac_q3d.py + ../../high_frequency/layout/dcir_q3d.py + ../../high_frequency/radiofrequency_mmwave/coplanar_waveguide.py + ../../high_frequency/radiofrequency_mmwave/stripline.py \ No newline at end of file diff --git a/examples/aedt/twin_builder/index.rst b/examples/aedt/twin_builder/index.rst new file mode 100644 index 000000000..999abcc1b --- /dev/null +++ b/examples/aedt/twin_builder/index.rst @@ -0,0 +1,11 @@ +Twin Builder +~~~~~~~~~~~~ + +These examples use PyAEDT to show Twin Builder capabilities + +.. nbgallery:: + + ../../low_frequency/general/twin_builder/dynamic_rom.py + ../../low_frequency/general/twin_builder/rc_circuit.py + ../../low_frequency/general/twin_builder/rectifier.py + ../../low_frequency/general/twin_builder/static_rom.py \ No newline at end of file diff --git a/examples/02-aedt_general/_static/aedt_electronics.png b/examples/aedt_general/_static/aedt_electronics.png similarity index 100% rename from examples/02-aedt_general/_static/aedt_electronics.png rename to examples/aedt_general/_static/aedt_electronics.png diff --git a/examples/02-aedt_general/components/_static/e3dcomp.png b/examples/aedt_general/components/_static/e3dcomp.png similarity index 100% rename from examples/02-aedt_general/components/_static/e3dcomp.png rename to examples/aedt_general/components/_static/e3dcomp.png diff --git a/examples/02-aedt_general/components/component_conversion.py b/examples/aedt_general/components/component_conversion.py similarity index 59% rename from examples/02-aedt_general/components/component_conversion.py rename to examples/aedt_general/components/component_conversion.py index 9fb00ac80..90ec56ff0 100644 --- a/examples/02-aedt_general/components/component_conversion.py +++ b/examples/aedt_general/components/component_conversion.py @@ -1,16 +1,17 @@ -# # Encrypted 3D Component ACIS-to-Parasolid +# # Encrypted 3D component conversion # # This example shows how to convert an encrypted -# 3D component from different AEDT releases. -# This is useful if you have models previous to 2023R1 with ACIS kernel and you need to convert it to Parasolid. +# 3D component from ACIS to Parasolid in different AEDT releases. +# If you have models previous to Ansys AEDT 2023 R1 with an ACIS kernel, +# you can convert it to Parasolid. # -# Keywords: **HFSS**, **Encrypted**, **3D Component**, **Modeler kernel**. +# Keywords: **HFSS**, **Encrypted**, **3D component**, **Modeler kernel**. # -# ## Perform required imports +# ## Perform imports and define constants # -# Perform required imports. +# Import the required packages. # import os @@ -25,13 +26,20 @@ AEDT_VERSION = "2024.2" OLD_AEDT_VERSION = "2024.1" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory +# +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# Download the example encrypted 3D component +# ## Download encrypted example +# +# Download the encrypted 3D component example. a3dcomp = download_file( directory="component_3d", @@ -39,43 +47,43 @@ destination=temp_folder.name, ) -# Enable multiple desktop support +# ## Enable multiple desktop support settings.use_multi_desktop = True # ## Prepare encrypted 3D component in ACIS # -# Launch old AEDT release +# Launch the old AEDT release. aedt_old = Desktop(new_desktop_session=True, specified_version=OLD_AEDT_VERSION) -# Insert an empty HFSS design +# Insert an empty HFSS design. hfss1 = Hfss(aedt_process_id=aedt_old.aedt_process_id, solution_type="Terminal") -# Insert the encrypted 3D component +# Insert the encrypted 3D component. cmp = hfss1.modeler.insert_3d_component(comp_file=a3dcomp, password="ansys") -# Open 3D component in a HFSS design +# Open the 3D component in an HFSS design. app_comp = cmp.edit_definition(password="ansys") -# ## Create a new encrypted 3D component in Parasolid +# ## Create an encrypted 3D component in Parasolid # -# Launch new AEDT release +# Launch the new AEDT release aedt = Desktop(new_desktop_session=True, specified_version=AEDT_VERSION) -# Insert an empty HFSS design +# Insert an empty HFSS design. hfss2 = Hfss(aedt_process_id=aedt.aedt_process_id, solution_type="Terminal") -# Copy objects from old design +# Copy objects from the old design. hfss2.copy_solid_bodies_from(design=app_comp, no_vacuum=False, no_pec=False) -# Create a new encrypted 3D component +# Create the new encrypted 3D component. hfss2.modeler.create_3dcomponent( component_file=os.path.join( @@ -94,13 +102,13 @@ aedt_old.save_project() aedt.release_desktop() aedt_old.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/02-aedt_general/components/index.rst b/examples/aedt_general/components/index.rst similarity index 50% rename from examples/02-aedt_general/components/index.rst rename to examples/aedt_general/components/index.rst index 1463525f0..50b5ef4e2 100644 --- a/examples/02-aedt_general/components/index.rst +++ b/examples/aedt_general/components/index.rst @@ -1,7 +1,7 @@ -3D Components +3D components ~~~~~~~~~~~~~ -These examples use PyAEDT to show some 3D Component capabilities +These examples use PyAEDT to show some 3D component capabilities. .. nbgallery:: diff --git a/examples/02-aedt_general/components/reuse_component.py b/examples/aedt_general/components/reuse_component.py similarity index 57% rename from examples/02-aedt_general/components/reuse_component.py rename to examples/aedt_general/components/reuse_component.py index aa706a28e..c72fc7ad3 100644 --- a/examples/02-aedt_general/components/reuse_component.py +++ b/examples/aedt_general/components/reuse_component.py @@ -1,16 +1,20 @@ -# # Create a 3D Component and reuse it +# # 3D component creation and reuse -# Summary of the workflow: -# 1. Create an antenna using PyAEDT and HFSS 3D Modeler (same can be done with EDB and +# Here is a workflow for creating a 3D component and reusing it: +# +# Step 1: Create an antenna using PyAEDT and HFSS 3D Modeler. (The antenna can also be created using EDB and # HFSS 3D Layout). -# 2. Store the object as a 3D Component on the disk. -# 3. Reuse the 3D component in another project. -# 4. Parametrize and optimize target design. # -# Keywords: **AEDT**, **General**, **3D Component**. +# Step 2. Store the object as a 3D component on the disk. +# +# Step 3. Reuse the 3D component in another project. +# +# Step 4. Parametrize and optimize the target design. +# +# Keywords: **AEDT**, **General**, **3D component**. -# ## Preparation -# Import the required packages +# ## Perform imports and define constants +# Import the required packages. import os import tempfile @@ -18,16 +22,15 @@ from ansys.aedt.core import Hfss -# ## Project setup -# -# Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -43,18 +46,19 @@ ) hfss.save_project(os.path.join(temp_folder.name, "example.aedt")) -# ## Variable definition +# ## Define variables # -# PyAEDT can create and store all variables available in AEDT (Design, Project, Post Processing). +# PyAEDT can create and store all variables available in AEDT (such as design, project, +# and postprocessing). hfss["thick"] = "0.1mm" hfss["width"] = "1mm" -# ## Modeler +# ## Create modeler objects # -# PyAEDT supports all modeler functionalities available in the Desktop. -# Objects can be created, deleted and modified using all available boolean operations. -# History is also fully accessible to PyAEDT. +# PyAEDT supports all modeler functionalities available in AEDT. +# You can create, delete, and modify objects using all available Boolean operations. +# PyAEDT can also fully access history. # + substrate = hfss.modeler.create_box( @@ -87,15 +91,19 @@ ) # - -# ## Boundaries +# ## Assign bundaries # # Most of HFSS boundaries and excitations are already available in PyAEDT. -# User can assign easily a boundary to a face or to an object by taking benefits of +# You can easily assign a boundary to a face or to an object by taking advantage of # Object-Oriented Programming (OOP) available in PyAEDT. +# ### Assign Perfect E boundary to sheets +# +# Assign a Perfect E boundary to sheets. + hfss.assign_perfecte_to_sheets(patch) -# ## Assign boundary to faces +# ### Assign boundaries to faces # # Assign boundaries to the top and bottom faces of an object. @@ -110,50 +118,50 @@ hfss.assign_perfecte_to_sheets(substrate.bottom_face_z) # - -# ## Create Wave Port +# ## Create wave port # -# Wave port can be assigned to a sheet or to a face of an object. +# You can assign a wave port to a sheet or to a face of an object. hfss.wave_port( via_outer.bottom_face_z, name="P1", ) -# ## Create 3D Component +# ## Create 3D component # -# Once the model is ready a 3D Component can be created. -# Multiple options are available to partially select objects, cs, boundaries and mesh operations. -# Furthermore, encrypted 3d comp can be created too. +# Once the model is ready, you can create a 3D component. +# Multiple options are available to partially select objects, coordinate systems, +# boundaries, and mesh operations. You can also create encrypted 3D components. component_path = os.path.join(temp_folder.name, "component_test.aedbcomp") hfss.modeler.create_3dcomponent(component_path, "patch_antenna") -# ## Multiple project management +# ## Manage multiple project # -# PyAEDT allows to control multiple projects, design and solution type at the same time. +# PyAEDT lets you control multiple projects, designs, and solution types at the same time. new_project = os.path.join(temp_folder.name, "new_project.aedt") hfss2 = Hfss(version=AEDT_VERSION, project=new_project, design="new_design") # ## Insert 3D component # -# The 3D component can be inserted without any additional info. -# All needed info will be read from the file itself. +# You can insert a 3D component without supplying additional information. +# All needed information is read from the file itself. hfss2.modeler.insert_3d_component(component_path) -# ## 3D Component Parameters +# ## Parametrize 3D components # -# All 3D Component parameters are available and can be parametrized. +# You can specify parameters for any 3D components. hfss2.modeler.user_defined_components["patch_antenna1"].parameters hfss2["p_thick"] = "1mm" hfss2.modeler.user_defined_components["patch_antenna1"].parameters["thick"] = "p_thick" -# ## Multiple 3D Components +# ## Insert multiple 3D components # -# There is no limit to the number of 3D components that can be added to the same design. -# They can be the same or linked to different files. +# There is no limit to the number of 3D components that can be inserted in a design. +# These components can be the same or linked to different files. hfss2.modeler.create_coordinate_system(origin=[20, 20, 10], name="Second_antenna") ant2 = hfss2.modeler.insert_3d_component( @@ -162,20 +170,20 @@ # ## Move 3D components # -# The 3D component can be moved by changing is position or moving the relative coordinate system. +# Move a 3D component by either changing its position or moving the relative coordinate system. hfss2.modeler.coordinate_systems[0].origin = [10, 10, 3] # ## Create air region # -# Assign a boundary to a face or an object. +# Create an air region and assign a boundary to a face or an object. hfss2.modeler.create_air_region(30, 30, 30, 30, 30, 30) hfss2.assign_radiation_boundary_to_faces(hfss2.modeler["Region"].faces) -# ## Create Setup and Optimetrics. +# ## Create setup and optimetrics analysis # -# Once project is ready to be solved, a setup and parametrics analysis can be created with PyAEDT. +# Once a project is ready to be solved, use PyAEDT to create a setup and parametrics analysis. # All setup parameters can be edited. setup1 = hfss2.create_setup() @@ -194,13 +202,13 @@ hfss2.save_project() hfss2.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/02-aedt_general/configuration_files.py b/examples/aedt_general/configuration_files.py similarity index 82% rename from examples/02-aedt_general/configuration_files.py rename to examples/aedt_general/configuration_files.py index 911746b50..f4cdb64a4 100644 --- a/examples/02-aedt_general/configuration_files.py +++ b/examples/aedt_general/configuration_files.py @@ -1,6 +1,6 @@ # # Configuration files # -# This example shows how you can use PyAEDT to export configuration files and reuse +# This example shows how to use PyAEDT to export configuration files and reuse # them to import in a new project. A configuration file is supported by these applications: # # * HFSS @@ -9,7 +9,7 @@ # * Icepak (in AEDT) # * Mechanical (in AEDT) # -# The following sections are covered: +# The following topics are covered: # # * Variables # * Mesh operations (except Icepak) @@ -18,15 +18,15 @@ # * Object properties # * Boundaries and excitations # -# When a boundary is attached to a face, the tool tries to match it with a -# ``FaceByPosition`` on the same object name on the target design. If, for -# any reason, this face position has changed or the object name in the target +# When a boundary is attached to a face, PyAEDT tries to match it with a +# ``FaceByPosition`` on the same object name on the target design. If for +# any reason this face position has changed or the object name in the target # design has changed, the boundary fails to apply. # # Keywords: **AEDT**, **general**, **configuration file**, **setup**. -# ## Preparation -# Import the required packages +# ## Perform imports and define constants +# Import the required packages. # + import os @@ -37,20 +37,22 @@ # - -# Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create the temporary directory. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download project +# +# Download the Icepack project. project_full_name = ansys.aedt.core.downloads.download_icepak( destination=temp_folder.name @@ -98,7 +100,7 @@ # ## Export project to step file # -# Export the current project to the step file. +# Export the project to the step file. filename = ipk.design_name file_path = os.path.join(ipk.working_directory, filename + ".step") @@ -113,7 +115,7 @@ # ## Export configuration files # # Export the configuration files. You can optionally disable the export and -# import sections. Supported formats are json and toml files +# import sections. Supported formats are JSON and TOML files. conf_file = ipk.configurations.export_config( os.path.join(ipk.working_directory, "config.toml") @@ -140,14 +142,12 @@ # Close the project and release AEDT. app.release_desktop() -time.sleep( - 3 -) # Allow Electronics Desktop to shut down before cleaning the temporary project folder. +time.sleep(3) # Allow AEDT to shut down before cleaning the temporary project folder. -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/02-aedt_general/index.rst b/examples/aedt_general/index.rst similarity index 67% rename from examples/02-aedt_general/index.rst rename to examples/aedt_general/index.rst index 4bdade2b2..b27522edd 100644 --- a/examples/02-aedt_general/index.rst +++ b/examples/aedt_general/index.rst @@ -1,6 +1,6 @@ General ~~~~~~~ -These examples use PyAEDT to show some general capabilities +These examples show how to use some general PyAEDT capabilities. .. nbgallery:: diff --git a/examples/aedt_general/modeler/_static/circuit.png b/examples/aedt_general/modeler/_static/circuit.png new file mode 100644 index 000000000..60919670b Binary files /dev/null and b/examples/aedt_general/modeler/_static/circuit.png differ diff --git a/examples/02-aedt_general/modeler/circuit_schematic.py b/examples/aedt_general/modeler/circuit_schematic.py similarity index 80% rename from examples/02-aedt_general/modeler/circuit_schematic.py rename to examples/aedt_general/modeler/circuit_schematic.py index b1be44a5d..ff26945ab 100644 --- a/examples/02-aedt_general/modeler/circuit_schematic.py +++ b/examples/aedt_general/modeler/circuit_schematic.py @@ -1,4 +1,4 @@ -# # Circuit Schematic Creation and Analysis +# # Circuit schematic creation and analysis # # This example shows how to build a circuit schematic # and run a transient circuit simulation. @@ -7,7 +7,7 @@ # # Keywords: **AEDT**, **Circuit**, **Schematic**. -# ## Perform required imports +# ## Import packages and define constants # # Perform required imports. @@ -20,22 +20,23 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Launch AEDT and Circuit +# ## Launch AEDT with Circuit # -# Launch AEDT and Circuit. The [pyaedt.Desktop]( +# Launch AEDT with Circuit. The [pyaedt.Desktop]( # https://aedt.docs.pyansys.com/version/stable/API/_autosummary/pyaedt.desktop.Desktop.html#pyaedt.desktop.Desktop) # class initializes AEDT and starts the specified version in the specified mode. @@ -54,12 +55,12 @@ # ## Create circuit setup # -# Create and customize an linear network analysis (LNA) setup. +# Create and customize a linear network analysis (LNA) setup. setup1 = circuit.create_setup("MyLNA") setup1.props["SweepDefinition"]["Data"] = "LINC 0GHz 4GHz 10001" -# ## Place Components +# ## Place components # # Place components such as an inductor, resistor, and capacitor. The ``location`` argument # provides the ``[x, y]`` coordinates to place the component. @@ -74,17 +75,16 @@ name="C1", value=1e-12, location=[1000, 0] ) -# ## Get all pins +# ## Get all pins # -# The component pins are instances of the class -# ``ansys.aedt.core.modeler.circuits.objct3dcircuit.CircuitPins`` and +# The component pins are instances of the +# ``ansys.aedt.core.modeler.circuits.objct3dcircuit.CircuitPins`` class and # provide access to the -# pin location, net connectivity and the method ``connect_to_component()`` which +# pin location, net connectivity, and the ``connect_to_component()`` method, which # can be used to connect components in the schematic -# as will be demonstrated in -# this example. +# as demonstrated in this example. -# ## Place a Port and Ground +# ## Place a port and ground # # Place a port and a ground in the schematic. @@ -122,7 +122,7 @@ # ## Create report # -# Display the scattering parameters. +# Create a report displaying the scattering parameters. solutions = circuit.post.get_solution_data( expressions=circuit.get_traces_for_plot(category="S"), @@ -131,7 +131,7 @@ real, imag = solutions.full_matrix_real_imag print(real) -# ## Plot data +# ## Create plot # # Create a plot based on solution data. @@ -143,12 +143,12 @@ circuit.save_project() circuit.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/02-aedt_general/modeler/coordinate_system.py b/examples/aedt_general/modeler/coordinate_system.py similarity index 88% rename from examples/02-aedt_general/modeler/coordinate_system.py rename to examples/aedt_general/modeler/coordinate_system.py index 0f4d92072..ad54a83c3 100644 --- a/examples/02-aedt_general/modeler/coordinate_system.py +++ b/examples/aedt_general/modeler/coordinate_system.py @@ -1,11 +1,11 @@ # # Coordinate system creation # -# This example shows how you can use PyAEDT to create and modify coordinate systems in the modeler. +# This example shows how to use PyAEDT to create and modify coordinate systems in the modeler. # # Keywords: **AEDT**, **modeler**, **coordinate system**. -# ## Preparation -# Import the required packages +# ## Perform imports and define constants +# Import the required packages. import os import tempfile @@ -13,15 +13,15 @@ import ansys.aedt.core -# Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open the AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -73,11 +73,11 @@ # ## Change coordinate system mode # -# Use the ``change_cs_mode`` method to change the mode. Options are +# Use the ``change_cs_mode`` method to change the mode. Options are: # # - ``0`` for axis/position # - ``1`` for Euler angle ZXZ -# - ``2`` for Euler angle ZYZ. +# - ``2`` for Euler angle ZYZ # # Here ``1`` sets Euler angle ZXZ as the mode. @@ -114,12 +114,12 @@ name="CS3", origin=[2, 2, 2], mode="zyz", phi=10, theta=20, psi=30 ) -# Create a coordinate system that is defined by standard views in the modeler. The options are +# Create a coordinate system that is defined by standard views in the modeler. The options are: # # - ``"iso"`` # - ``"XY"`` # - ``"XZ"`` -# - ``"XY"``. +# - ``"XY"`` # # Here ``"iso"`` is specified. The axes are set automatically. @@ -178,7 +178,7 @@ face=face, origin=face, axis_position=face.edges[1], rotation=10.3 ) -# Rotation can also be changed after coordinate system creation +# Rotation can also be changed after coordinate system creation. fcs4.props["ZRotationAngle"] = "3deg" @@ -196,10 +196,10 @@ fcs5.props["XOffset"] = "0.2mm" fcs5.props["YOffset"] = "0.1mm" -# ### Dependent coordinate systems +# ### Create a dependent coordinate system # # The use of dependent coordinate systems can simplify model creation. The following -# cell demonstrates how to create a coordinate system whose reference is the face coordinate system. +# cell shows how to create a coordinate system whose reference is the face coordinate system. face = box.faces[1] fcs6 = hfss.modeler.create_face_coordinate_system( @@ -209,7 +209,7 @@ name="CS_FCS", origin=[0, 0, 0], reference_cs=fcs6.name, mode="view", view="iso" ) -# ### Object coordinate systems +# ### Create object coordinate systems # # A coordinate system can also be defined relative to elements # belonging to an object. For example, the coordinate system can be @@ -235,7 +235,7 @@ ) obj_cs_1.set_as_working_cs() -# Create object coordinate system with origin specified on a point within an object. +# Create an object coordinate system with an origin specified on a point within an object. obj_cs_2 = hfss.modeler.create_object_coordinate_system( assignment=box.name, @@ -247,7 +247,7 @@ new_obj_cs_2 = hfss.modeler.duplicate_coordinate_system_to_global(obj_cs_2) obj_cs_2.delete() -# Create object coordinate system with origin on vertex. +# Create an object coordinate system with an origin on the vertex. obj_cs_3 = hfss.modeler.create_object_coordinate_system( obj=box.name, @@ -261,7 +261,7 @@ # ### Get all coordinate systems # -# All coordinate systems can easily be retrieved and subsequently manipulated. +# Easily retrieve and subsequently manipulate all coordinate systems. css = hfss.modeler.coordinate_systems names = [i.name for i in css] @@ -292,9 +292,9 @@ d.release_desktop() time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/02-aedt_general/modeler/index.rst b/examples/aedt_general/modeler/index.rst similarity index 100% rename from examples/02-aedt_general/modeler/index.rst rename to examples/aedt_general/modeler/index.rst diff --git a/examples/02-aedt_general/modeler/netlist_to_schematic.py b/examples/aedt_general/modeler/netlist_to_schematic.py similarity index 74% rename from examples/02-aedt_general/modeler/netlist_to_schematic.py rename to examples/aedt_general/modeler/netlist_to_schematic.py index 29f44b1d1..67a30617e 100644 --- a/examples/02-aedt_general/modeler/netlist_to_schematic.py +++ b/examples/aedt_general/modeler/netlist_to_schematic.py @@ -3,13 +3,13 @@ # This example shows how to create components # in the circuit schematic editor from a netlist file. # -# Note that HSPICE files are fully supported and many other formats enjoy broad coverage. +# Note that HSPICE files are fully supported and that broad coverage is provided for many other formats. # # Keywords: **Circuit**, **netlist**. -# ## Imports +# ## Perform imports and define constants # -# Perform required imports and set paths. +# Import the required packages. # + import os @@ -20,14 +20,15 @@ # - -# ## Define constants +# ## Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -46,7 +47,7 @@ new_desktop=True, ) -# ## Define a Parameter +# ## Define a parameter # # Specify the voltage as a parameter. @@ -54,8 +55,8 @@ # ## Create schematic from netlist file # -# Create a schematic from a netlist file. The ``create_schematic_from_netlist`` -# method reads the netlist file and parses it. All components are parsed +# Create a schematic from a netlist file. The ``create_schematic_from_netlist()`` +# method reads the netlist file and parses it. All components are parsed, # but only these categories are mapped: R, L, C, Q, U, J, V, and I. circuit.create_schematic_from_netlist(netlist) @@ -66,12 +67,12 @@ circuit.save_project() circuit.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/02-aedt_general/modeler/polyline.py b/examples/aedt_general/modeler/polyline.py similarity index 87% rename from examples/02-aedt_general/modeler/polyline.py rename to examples/aedt_general/modeler/polyline.py index b25c6ac52..afe0e3c70 100644 --- a/examples/02-aedt_general/modeler/polyline.py +++ b/examples/aedt_general/modeler/polyline.py @@ -1,11 +1,11 @@ # # Polyline creation # -# This example shows how you can use PyAEDT to create and manipulate polylines. +# This example shows how to use PyAEDT to create and manipulate polylines. # # Keywords: **AEDT**, **modeler**, **polyline**. -# ## Preparation -# Import the required packages +# ## Import packages and define constants +# Import the required packages. import os import tempfile @@ -16,13 +16,13 @@ # Define constants AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -64,11 +64,11 @@ ["0mm", "0mm", "0mm"], ] -# ## Polyline primitives +# ## Create polyline primitives # # The following examples are for creating polyline primitives. -# ## Create line primitive +# ### Create line primitive # # Create a line primitive. The basic polyline command takes a list of positions # (``[X, Y, Z]`` coordinates) and creates a polyline object with one or more @@ -80,9 +80,9 @@ print("Segment types : {}".format([s.type for s in line1.segment_types])) print("primitive id = {}".format(line1.id)) -# ## Create arc primitive +# ### Create arc primitive # -# Create an arc primitive. The parameter ``position_list`` must contain at +# Create an arc primitive. The ``position_list`` parameter must contain at # least three position values. The first three position values are used. line2 = modeler.create_polyline( @@ -94,11 +94,11 @@ ) ) -# ## Create spline primitive +# ### Create spline primitive # # Create a spline primitive. Defining the segment using a ``PolylineSegment`` # object allows you to provide additional input parameters for the spine, such -# as the number of points (in this case 4). The parameter ``points`` +# as the number of points (in this case 4). The ``points`` parameter # must contain at least four position values. line3 = modeler.create_polyline( @@ -107,7 +107,7 @@ name="PL03_spline_4pt", ) -# ## Create center-point arc primitive +# ### Create center-point arc primitive # # Create a center-point arc primitive. A center-point arc segment is defined # by a starting point, a center point, and an angle of rotation around the @@ -115,8 +115,8 @@ # plane of the active coordinate system. The starting point and the center point # must therefore have one coordinate value (X, Y, or Z) with the same value. # -# Here ``start-point`` and ``center-point`` have a common Z position, ``"0mm"``. -# The curve therefore lies in the XY plane at $ z = 0 $. +# In this first code example, ``start-point`` and ``center-point`` have a common +# Z position, ``"0mm"``. The curve therefore lies in the XY plane at $ z = 0 $. start_point = [100, 100, 0] center_point = [0, 0, 0] @@ -128,8 +128,8 @@ name="PL04_center_point_arc", ) -# Here ``start_point`` and ``center_point`` have the same values for the Y and -# Z coordinates, so the plane or rotation could be either XY or ZX. +# In this second code example, ``start_point`` and ``center_point`` have the same +# values for the Y and Z coordinates, so the plane or rotation could be either XY or ZX. # For these special cases when the rotation plane is ambiguous, you can specify # the plane explicitly. @@ -150,7 +150,7 @@ name="PL04_center_point_arc_rot_ZX", ) -# ## Compound polylines +# ## Create compound polylines # # You can pass a list of points to the ``create_polyline()`` method to create a multi-segment # polyline. @@ -184,7 +184,7 @@ points=test_points, cover_surface=True, name="SPL01_segmented_compound_line" ) -# ## Compound lines +# ## Insert compound lines # # The following examples are for inserting compound lines. # @@ -208,7 +208,7 @@ # ### Insert compound line with insert curve # # Insert a compound line starting a line segment at vertex 1 ``["100mm", "0mm", "0mm"]`` -# of an existing polyline and end at some new point ``["90mm", "20mm", "0mm"]``. +# of an existing polyline and ending at some new point ``["90mm", "20mm", "0mm"]``. # By numerical comparison of the starting point, it is determined automatically # that the segment is inserted after the first segment of the original polyline. @@ -226,7 +226,7 @@ ) # - -# ## Insert compound line at end of a center-point arc +# ### Insert compound line at end of a center-point arc # # Insert a compound line at the end of a center-point arc (``type="AngularArc"``). # This is a special case. @@ -281,9 +281,9 @@ name="Compound_Polyline_One_Command", ) -# ## Insert two 3-point arcs forming a circle and covered +# ## Insert two 3-point arcs forming a circle # -# Insert two 3-point arcs forming a circle and covered. +# Insert two 3-point arcs forming a circle. # Note that the last point of the second arc segment is not defined in # the position list. @@ -338,14 +338,12 @@ maxwell.save_project() maxwell.release_desktop() -time.sleep( - 3 -) # Allow Electronics Desktop to shut down before cleaning the temporary project folder. +time.sleep(3) # Allow AEDT to shut down before cleaning the temporary project folder. -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/02-aedt_general/optimetrics.py b/examples/aedt_general/optimetrics.py similarity index 75% rename from examples/02-aedt_general/optimetrics.py rename to examples/aedt_general/optimetrics.py index c74aed4b6..c138dc9ee 100644 --- a/examples/02-aedt_general/optimetrics.py +++ b/examples/aedt_general/optimetrics.py @@ -1,12 +1,12 @@ # # Optimetrics setup # -# This example shows how you can use PyAEDT to create a project in HFSS and create all optimetrics +# This example shows how to use PyAEDT to create a project in HFSS and create all optimetrics # setups. # # Keywords: **AEDT**, **General**, **optimetrics**. -# ## Preparation -# Import the required packages +# ## Perform imports and define constants +# Import the required packages. import os import tempfile @@ -14,15 +14,15 @@ import ansys.aedt.core -# Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -67,7 +67,9 @@ model.plot(os.path.join(hfss.working_directory, "Image.jpg")) # - -# ## Create two wave ports on the sheets. +# ## Create wave ports on sheets +# +# Create two wave ports on the sheets. hfss.wave_port(p1, integration_line=hfss.AxisDir.ZPos, name="1") hfss.wave_port(p2, integration_line=hfss.AxisDir.ZPos, name="2") @@ -88,9 +90,9 @@ save_fields=True, ) -# ## Optimetrics analysis +# ## Create optimetrics analyses # -# ### Parametric Analysis +# ### Create parametric analysis # # Create a simple optimetrics parametrics analysis with output calculations. @@ -99,7 +101,9 @@ sweep.add_calculation(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}) sweep.add_calculation(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"}) -# ## Create an optimetrics sensitivity analysis with output calculations. +# ### Create sensitivity analysis +# +# Create an optimetrics sensitivity analysis with output calculations. sweep2 = hfss.optimizations.add( calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="Sensitivity" @@ -107,7 +111,9 @@ sweep2.add_variation("w1", 0.1, 3, 0.5) sweep2.add_calculation(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"}) -# ## Create an optimization analysis based on goals and calculations. +# ### Create an optimization analysis +# +# Create an optimization analysis based on goals and calculations. sweep3 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}) sweep3.add_variation("w1", 0.1, 3, 0.5) @@ -119,22 +125,26 @@ condition="Maximize", ) -# ## Create a DX (DesignXplorer) optimization based on a goal and a calculation. +# ### Create a DesignXplorer optimization +# +# Create a DesignXplorer optimization based on a goal and a calculation. sweep4 = hfss.optimizations.add( calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="DesignExplorer" ) sweep4.add_goal(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"}) -# ## Create DOE based on a goal and calculation +# ### Create a Design of Experiments (DOE) # -# Create a DOE (Design of Experiments) based on a goal and a calculation. +# Create a DOE based on a goal and a calculation. sweep5 = hfss.optimizations.add( calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="DXDOE" ) -# ## Create DOE based on a goal and calculation +# ### Create another DOE +# +# Create another DOE based on a goal and a calculation. region = hfss.modeler.create_region() hfss.assign_radiation_boundary_to_objects(region) @@ -150,14 +160,12 @@ hfss.save_project() hfss.release_desktop() -time.sleep( - 3 -) # Allow Electronics Desktop to shut down before cleaning the temporary project folder. +time.sleep(3) # Allow AEDT to shut down before cleaning the temporary project folder. -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/02-aedt_general/report/_static/virtual_compliance_class.png b/examples/aedt_general/report/_static/virtual_compliance_class.png similarity index 100% rename from examples/02-aedt_general/report/_static/virtual_compliance_class.png rename to examples/aedt_general/report/_static/virtual_compliance_class.png diff --git a/examples/aedt_general/report/_static/virtual_compliance_configs.png b/examples/aedt_general/report/_static/virtual_compliance_configs.png new file mode 100644 index 000000000..85f93b218 Binary files /dev/null and b/examples/aedt_general/report/_static/virtual_compliance_configs.png differ diff --git a/examples/02-aedt_general/report/_static/virtual_compliance_eye.png b/examples/aedt_general/report/_static/virtual_compliance_eye.png similarity index 100% rename from examples/02-aedt_general/report/_static/virtual_compliance_eye.png rename to examples/aedt_general/report/_static/virtual_compliance_eye.png diff --git a/examples/02-aedt_general/report/_static/virtual_compliance_scattering1.png b/examples/aedt_general/report/_static/virtual_compliance_scattering1.png similarity index 100% rename from examples/02-aedt_general/report/_static/virtual_compliance_scattering1.png rename to examples/aedt_general/report/_static/virtual_compliance_scattering1.png diff --git a/examples/02-aedt_general/report/_static/virtual_compliance_scattering2.png b/examples/aedt_general/report/_static/virtual_compliance_scattering2.png similarity index 100% rename from examples/02-aedt_general/report/_static/virtual_compliance_scattering2.png rename to examples/aedt_general/report/_static/virtual_compliance_scattering2.png diff --git a/examples/02-aedt_general/report/_static/virtual_compliance_usage.png b/examples/aedt_general/report/_static/virtual_compliance_usage.png similarity index 100% rename from examples/02-aedt_general/report/_static/virtual_compliance_usage.png rename to examples/aedt_general/report/_static/virtual_compliance_usage.png diff --git a/examples/02-aedt_general/report/automatic_report.py b/examples/aedt_general/report/automatic_report.py similarity index 72% rename from examples/02-aedt_general/report/automatic_report.py rename to examples/aedt_general/report/automatic_report.py index 946399765..46ee62985 100644 --- a/examples/02-aedt_general/report/automatic_report.py +++ b/examples/aedt_general/report/automatic_report.py @@ -1,13 +1,13 @@ # # Automatic report creation # -# This example demonstrates how to create reports from a JSON template file. +# This example shows how to create reports from a JSON template file. # # -# Keywords: **Circuit**, **Report**. +# Keywords: **Circuit**, **report**. -# ## Perform required imports +# ## Perform imports and define constants # -# Perform required imports and set the local path to the path for PyAEDT. This example uses +# Import the required packages. This example uses # data from the [example-data repository](https://github.com/ansys/example-data/tree/master) # located in ``pyaedt\custom_reports``. @@ -19,30 +19,31 @@ import ansys.aedt.core from IPython.display import Image -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Launch AEDT with the Circuit Interface +# ## Launch AEDT with Circuit # -# ### Application keyword arguments: -# -# The application is started by instantiating an instance of +# AEDT is started by instantiating an instance of # [pyaedt.Circuit](https://aedt.docs.pyansys.com/version/stable/API/_autosummary/pyaedt.circuit.Circuit.html). # -# - The argument ``non_graphical`` specifies whether or not an interactive session will be launched or if -# AEDT runs in non-graphical mode. +# ### Application keyword arguments +# +# - The argument ``non_graphical`` specifies whether an interactive session is launched or if +# AEDT is to run in non-graphical mode. # - The Boolean parameter ``new_desktop`` specifies if a new instance -# of AEDT will be launched. If it is set to ``False`` the API will try to connect to a running session. +# of AEDT is launched. If it is set to ``False``, the API tries to connect to a running session. # # This example extracts an archived project. The full path # to the extracted project is accessible from the ``cir.project_file`` property. @@ -61,10 +62,10 @@ circuit.analyze() # Run the circuit analysis. # - -# ## Create a Spectral Report +# ## Create a spectral report # -# The JSON file is used to customize the report. In a spectral report, you can add Limit lines, and -# notes can be added to the report. The report axes, grid, and the legend can also be modified. The custom reports +# The JSON file is used to customize the report. In a spectral report, you can add limit lines. You can also +# add notes to a report and modify the axes, grid, and legend. Custom reports # can be created in AEDT in non-graphical mode using version 2023 R2 and later. report1 = circuit.post.create_report_from_configuration( @@ -74,12 +75,12 @@ project_path=circuit.working_directory, plot_name=report1.plot_name ) -# Now render the image. +# Render the image. Image(os.path.join(circuit.working_directory, report1.plot_name + ".jpg")) -# Every aspect of the report can be customized. The method ``crate_report_from_configuration`` reads the -# report configuration from a ``*.json`` file and generates the custom report. +# You can customize every aspect of the report. The method ``crate_report_from_configuration()`` reads the +# report configuration from a JSON file and generates the custom report. report1_full = circuit.post.create_report_from_configuration( os.path.join(project_path, "Spectrum_CISPR_Custom.json") @@ -89,11 +90,10 @@ ) Image(os.path.join(circuit.working_directory, report1_full.plot_name + ".jpg")) -# ## Transient Report +# ## Create a transient report # # The JSON configuration file can be read and modified from the API prior to creating the report. -# The following code modifies the trace rendering -# prior to creating the report. +# The following code modifies the trace rendering prior to creating the report. # + props = ansys.aedt.core.general_methods.read_json( @@ -108,7 +108,7 @@ # - # The ``props`` dictionary can be used to customize any aspect of an existing report or generate a new report. -# In this example the name of the curve is customized. +# In this example, the name of the curve is customized. props["expressions"] = {"V(Battery)": {}, "V(U1_VDD)": {}} props["plot_name"] = "Battery Voltage" @@ -118,9 +118,9 @@ out = circuit.post.export_report_to_jpg(circuit.working_directory, report3.plot_name) Image(os.path.join(circuit.working_directory, report3.plot_name + ".jpg")) -# ## Eye Diagram +# ## Create an eye diagram # -# Create an eye diagram. the JSON file can be used to create an eye diagram, including the eye mask as demonsrated here. +# You can use the JSON file to create an eye diagram. The following code includes the eye. report4 = circuit.post.create_report_from_configuration( os.path.join(project_path, "EyeDiagram_CISPR_Basic.json") @@ -141,7 +141,7 @@ # ## Save project and close AEDT # -# Save the project and close AEDT. The example has finished running. Project files can be retrieved +# Save the project and close AEDT. The example has finished running. You can retrieve project files # from ``temp_folder.name``. circuit.save_project() @@ -150,7 +150,7 @@ circuit.release_desktop() time.sleep(3) -# ## Cleanup +# ## Clean up # # The following cell cleans up the temporary directory and # removes all project files. diff --git a/examples/02-aedt_general/report/index.rst b/examples/aedt_general/report/index.rst similarity index 66% rename from examples/02-aedt_general/report/index.rst rename to examples/aedt_general/report/index.rst index a4283c65c..7c6dcb30a 100644 --- a/examples/02-aedt_general/report/index.rst +++ b/examples/aedt_general/report/index.rst @@ -3,7 +3,7 @@ Report ~~~~~~ -These examples use PyAEDT to show some report capabilities +These examples use PyAEDT to show some report capabilities. .. nbgallery:: diff --git a/examples/02-aedt_general/report/touchstone_file.py b/examples/aedt_general/report/touchstone_file.py similarity index 82% rename from examples/02-aedt_general/report/touchstone_file.py rename to examples/aedt_general/report/touchstone_file.py index 711712d95..b5cc5d2a2 100644 --- a/examples/02-aedt_general/report/touchstone_file.py +++ b/examples/aedt_general/report/touchstone_file.py @@ -1,6 +1,6 @@ -# # Touchstone Files +# # Touchstone files # -# This example shows how you can use objects in a Touchstone file without opening AEDT. +# This example shows how to use objects in a Touchstone file without opening AEDT. # # To provide the advanced postprocessing features needed for this example, Matplotlib and NumPy # must be installed on your machine. @@ -9,30 +9,29 @@ # # Keywords: **Touchstone**, **report**. -# ## Perform required imports -# +# ## Perform imports +# Import the required packages. from ansys.aedt.core import downloads from ansys.aedt.core.generic.touchstone_parser import read_touchstone example_path = downloads.download_touchstone() -# ## Read the Touchstone file. +# ## Read the Touchstone file data = read_touchstone(example_path) -# ## Plot Data +# ## Plot data # # Get the curve plot by category. The following code shows how to plot lists of the return losses, -# insertion losses, fext, and next based on a few inputs and port names. - +# insertion losses, next, and fext based on a few inputs and port names. data.plot_return_losses() data.plot_insertion_losses() data.plot_next_xtalk_losses("U1") data.plot_fext_xtalk_losses(tx_prefix="U1", rx_prefix="U7") -# ## Cross-talk +# ## Identify cross-talk # # Identify the worst case cross-talk. diff --git a/examples/02-aedt_general/report/virtual_compliance.py b/examples/aedt_general/report/virtual_compliance.py similarity index 91% rename from examples/02-aedt_general/report/virtual_compliance.py rename to examples/aedt_general/report/virtual_compliance.py index 3b0007bc8..9f34d9875 100644 --- a/examples/02-aedt_general/report/virtual_compliance.py +++ b/examples/aedt_general/report/virtual_compliance.py @@ -6,8 +6,8 @@ # Keywords: **Circuit**, **Automatic report**, **virtual compliance**. -# ## Perform required imports -# +# ## Perform imports and define constants +# Import the required packages. import os.path import tempfile @@ -20,17 +20,19 @@ AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# The temporary directory is used to run the example and save simulation data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. In this example, the temporary directory +# in where the example is stored and simulation data is saved. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download Example Data +# ## Download example data download_folder = ansys.aedt.core.downloads.download_file( source="pcie_compliance", destination=temp_folder.name @@ -57,7 +59,7 @@ # ## Create LNA project # -# Use the LNA setup to retrieve Touchstone files +# Use the LNA (linear network analysis) setup to retrieve Touchstone files # and generate frequency domain reports. circuit = ansys.aedt.core.Circuit(project=h3d.project_name, design="Touchstone") @@ -204,13 +206,13 @@ h3d.save_project() h3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/01-basic/_static/logo.png b/examples/basic/_static/logo.png similarity index 100% rename from examples/01-basic/_static/logo.png rename to examples/basic/_static/logo.png diff --git a/examples/05-electrothermal/_static/bdf.png b/examples/electrothermal/_static/bdf.png similarity index 100% rename from examples/05-electrothermal/_static/bdf.png rename to examples/electrothermal/_static/bdf.png diff --git a/examples/05-electrothermal/_static/icepak_logo.png b/examples/electrothermal/_static/icepak_logo.png similarity index 100% rename from examples/05-electrothermal/_static/icepak_logo.png rename to examples/electrothermal/_static/icepak_logo.png diff --git a/examples/05-electrothermal/_static/ldf.png b/examples/electrothermal/_static/ldf.png similarity index 100% rename from examples/05-electrothermal/_static/ldf.png rename to examples/electrothermal/_static/ldf.png diff --git a/examples/05-electrothermal/coaxial_hfss_icepak.py b/examples/electrothermal/coaxial_hfss_icepak.py similarity index 78% rename from examples/05-electrothermal/coaxial_hfss_icepak.py rename to examples/electrothermal/coaxial_hfss_icepak.py index 5ad1eb1da..c8e3ae6fb 100644 --- a/examples/05-electrothermal/coaxial_hfss_icepak.py +++ b/examples/electrothermal/coaxial_hfss_icepak.py @@ -1,11 +1,11 @@ # # Coaxial # -# This example shows how you can create a project from scratch in HFSS and Icepak. +# This example shows how to create a project from scratch in HFSS and Icepak. # This includes creating a setup, solving it, and creating postprocessing outputs. # # Keywords: **Multiphysics**, **HFSS**, **Icepak**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,16 +16,16 @@ import ansys.aedt.core from ansys.aedt.core.generic.pdf import AnsysReport -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -45,11 +45,12 @@ solution_type="Modal", ) -# ## Parameters +# ## Define parameters # # Parameters can be instantiated by defining them as a key used for the application -# instance as demonstrated below. The prefix ``$`` is used to define -# project-wide scope for the parameter. Otherwise the parameter scope is limited the current design. +# instance as demonstrated in the following code. The prefix ``$`` is used to define +# a project-wide scope for the parameter. Otherwise, the parameter scope is limited to +# the current design. hfss["$coax_dimension"] = "100mm" # Project-wide scope. udp = hfss.modeler.Position(0, 0, 0) @@ -58,9 +59,9 @@ # ## Create coaxial and cylinders # # Create a coaxial and three cylinders. You can apply parameters -# directly using the `ansys.aedt.core.modeler.Primitives3D.Primitives3D.create_cylinder` +# directly using the `ansys.aedt.core.modeler.Primitives3D.Primitives3D.create_cylinder()` # method. You can assign a material directly to the object creation action. -# Optionally, you can assign a material using the `assign_material` method. +# Optionally, you can assign a material using the `assign_material()` method. o1 = hfss.modeler.create_cylinder( orientation=hfss.PLANE.ZX, @@ -113,13 +114,12 @@ hfss.modeler.subtract(o3, o2, True) hfss.modeler.subtract(o2, o1, True) -# ## Assign Mesh Operations +# ## Assign mesh operations # -# Most mesh operations are accessible using the ``mesh`` property +# Most mesh operations are accessible using the ``mesh`` property, # which is an instance of the ``ansys.aedt.core.modules.MeshIcepak.IcepakMesh`` class. # -# This example demonstrates the use of several common mesh -# operations. +# This code shows how to use several common mesh operations. hfss.mesh.assign_initial_mesh_from_slider(level=6) hfss.mesh.assign_model_resolution(assignment=[o1.name, o3.name], defeature_length=None) @@ -127,12 +127,12 @@ assignment=o2.faces, inside_selection=False, maximum_length=1, maximum_elements=2000 ) -# ## Create HFSS Sources +# ## Create HFSS sources # -# The RF power dissipated in the HFSS model will act as the thermal -# source for in Icepak. The ``create_wave_port_between_objects`` method -# s used to assign the RF ports that inject RF power into the HFSS -# model. If the parameter ``add_pec_cap=True``, then the method +# The RF power dissipated in the HFSS model acts as the thermal +# source for in Icepak. The ``create_wave_port_between_objects()`` method +# is used to assign the RF ports that inject RF power into the HFSS +# model. If ``add_pec_cap=True``, then the method # creates a perfectly conducting (lossless) cap covering the port. # + @@ -158,10 +158,10 @@ hfss.modeler.fit_all() # - -# ## HFSS Simulation Setup +# ## Set up simulation # -# Create a setup. A setup is created with default values. After its creation, -# you can change values and update the setup. The ``update`` method returns a Boolean +# Create a HFSS setup with default values. After its creation, +# you can change values and update the setup. The ``update()`` method returns a Boolean # value. hfss.set_active_design(hfss.design_name) @@ -170,9 +170,9 @@ setup.props["BasisOrder"] = 2 setup.props["MaximumPasses"] = 1 -# ## HFSS Frequency Sweep +# ## Create frequency sweep # -# The frequency sweep defines the RF frequency range over which the RF power is +# The HFSS frequency sweep defines the RF frequency range over which the RF power is # injected into the structure. sweepname = hfss.create_linear_count_sweep( @@ -187,15 +187,15 @@ # ## Create Icepak model # # After an HFSS setup has been defined, the model can be lnked to an Icepak -# design and the coupled physics analysis can be run. The `FieldAnalysis3D.copy_solid_bodies_from()` -# method imports a model from HFSS into Icepak including all material definitions. +# design. The coupled physics analysis can then be run. The `FieldAnalysis3D.copy_solid_bodies_from()` +# method imports a model from HFSS into Icepak, including all material definitions. ipk = ansys.aedt.core.Icepak(design="CalcTemp", version=AEDT_VERSION) ipk.copy_solid_bodies_from(hfss) -# ## Link RF Thermal Source +# ## Link RF thermal source # -# The RF loss in HFSS will be used as the thermal source in Icepak. +# The RF loss in HFSS is used as the thermal source in Icepak. surfaceobj = ["inner", "outer"] ipk.assign_em_losses( @@ -207,30 +207,29 @@ parameters=["$coax_dimension", "inner"], ) -# ## Assign the Direction of Gravity +# ## Set direction of gravity # # Set the direction of gravity for convection in Icepak. Gravity drives a temperature gradient # due to the dependence of gas density on temperature. ipk.edit_design_settings(hfss.GRAVITY.ZNeg) -# ## Set up the Icepak Project +# ## Set up Icepak Project # # The initial solution setup applies default values that can subsequently -# be modified as shown here. +# be modified as shown in the following code. # The ``props`` property enables access to all solution settings. # -# The ``update`` function -# applies the settings to the setup. The setup creation process is identical -# for all tools. +# The ``update`` function applies the settings to the setup. The setup creation +# process is identical for all tools. setup_ipk = ipk.create_setup("SetupIPK") setup_ipk.props["Convergence Criteria - Max Iterations"] = 3 -# ### Icepak Solution Properties +# ### Access Icepak solution properties # -# The setup properties are accessible through the ``props`` property as -# an ordered dict. The ``keys()`` method can be used to retrieve all settings for +# Setup properties are accessible through the ``props`` property as +# an ordered dictionary. You can use the ``keys()`` method to retrieve all settings for # the setup. # # Find properties that contain the string ``"Convergence"`` and print the default values. @@ -240,7 +239,7 @@ for p in conv_props: print('"' + p + '" -> ' + str(setup_ipk.props[p])) -# ### Edit or Review Mesh Parameters +# ### Edit or review mesh parameters # # Edit or review the mesh parameters. After a mesh is created, you can access # a mesh operation to edit or review parameter values. @@ -250,14 +249,14 @@ airfaces = ipk.modeler.get_object_faces(airbox) ipk.assign_openings(airfaces) -# Save project and attach to Icepak instance +# Save the project and attach to the Icepak instance. hfss.save_project() ipk = ansys.aedt.core.Icepak(version=AEDT_VERSION) ipk.solution_type = ipk.SOLUTIONS.Icepak.SteadyTemperatureAndFlow ipk.modeler.fit_all() -# ## Solve the Project +# ## Solve models # # Solve the Icepak and HFSS models. @@ -266,7 +265,7 @@ hfss.modeler.fit_all() hfss.setups[0].analyze() -# ### Plot and Export Results +# ### Plot and export results # # Generate field plots in the HFSS project and export them as images. @@ -327,7 +326,7 @@ print("Total Time", end_time) # - -# ## Postprocessing +# ## Postprocess # # Create Icepak plots and export them as images using the same functions that # were used early. Only the quantity is different. @@ -364,21 +363,21 @@ project_name=hfss.project_name, design_name=hfss.design_name, version=AEDT_VERSION ) -# Create report +# Create the report. pdf_report.create() -# Add section for plots +# Add a section for plots. pdf_report.add_section() -pdf_report.add_chapter("Hfss Results") -pdf_report.add_sub_chapter("Field Plot") -pdf_report.add_text("This section contains Field plots of Hfss Coaxial.") +pdf_report.add_chapter("HFSS Results") +pdf_report.add_sub_chapter("Field plot") +pdf_report.add_text("This section contains field plots of HFSS Coaxial.") pdf_report.add_image( - os.path.join(temp_folder.name, plot1.name + ".jpg"), caption="Coaxial Cable" + os.path.join(temp_folder.name, plot1.name + ".jpg"), caption="Coaxial cable" ) -# Add a page break and a subchapter for S Parameter results +# Add a page break and a subchapter for S Parameter results. pdf_report.add_page_break() pdf_report.add_sub_chapter("S Parameters") @@ -394,14 +393,14 @@ caption="Touchstone from Matplotlib", ) -# Add a new section for Icepak results +# Add a new section for Icepak results. pdf_report.add_section() pdf_report.add_chapter("Icepak Results") pdf_report.add_sub_chapter("Temperature Plot") pdf_report.add_text("This section contains Multiphysics temperature plot.") -# Add table of content and save PDF. +# Add table of content and save the PDF. pdf_report.add_toc() pdf_report.save_pdf(file_path=temp_folder.name, file_name="AEDT_Results.pdf") @@ -412,12 +411,12 @@ ipk.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/05-electrothermal/component_3d.py b/examples/electrothermal/component_3d.py similarity index 79% rename from examples/05-electrothermal/component_3d.py rename to examples/electrothermal/component_3d.py index e9dac99b3..723ca2802 100644 --- a/examples/05-electrothermal/component_3d.py +++ b/examples/electrothermal/component_3d.py @@ -5,8 +5,9 @@ # # Keywords: **Icepak**, **3D components**, **mesh regions**, **monitor objects**. -# ## Import PyAEDT and download files -# Perform import of required classes from the ``ansys.aedt.core`` package and import the ``os`` package. +# ## Perform imports and define constants +# +# Perform required imports. import os import tempfile @@ -14,12 +15,17 @@ from ansys.aedt.core import Icepak, downloads -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# Download needed files in a temporary folder +# ## Create temporary directory and download files +# +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") package_temp_name, qfp_temp_name = downloads.download_icepak_3d_component( @@ -27,7 +33,7 @@ ) # ## Create heatsink -# Create new empty project in non-graphical mode. +# Create an empty project in non-graphical mode. ipk = Icepak( project=os.path.join(temp_folder.name, "Heatsink.aedt"), @@ -37,12 +43,12 @@ new_desktop=True, ) -# Remove air region (which is present by default) because it is not needed as the heatsink will -# be exported as a 3DComponent. +# Remove the air region, which is present by default. An air region is not needed as the heatsink +# is to be exported as a 3D component. ipk.modeler["Region"].delete() -# Define the heatsink using multiple boxes +# Define the heatsink using multiple boxes. hs_base = ipk.modeler.create_box( origin=[0, 0, 0], sizes=[37.5, 37.5, 2], name="HS_Base" @@ -55,7 +61,7 @@ ipk.plot(show=False, output_file=os.path.join(temp_folder.name, "Heatsink.jpg")) -# Definition of a mesh region around the heatsink +# Define a mesh region around the heatsink. mesh_region = ipk.mesh.assign_mesh_region( assignment=[hs_base.name, hs_fin.name] + hs_fins @@ -71,7 +77,7 @@ mesh_region.settings["UniformMeshParametersType"] = "Average" mesh_region.update() -# Assignment of monitor objects. +# Assign monitor objects. hs_middle_fin = ipk.modeler.get_object_from_name(assignment=hs_fins[n_fins // 2]) point_monitor_position = [ @@ -95,8 +101,9 @@ monitor_name="MiddleFinCenter", ) -# Export the heatsink 3D component in a ``"componentLibrary"`` folder. -# ``auxiliary_dict`` is set to true to export the monitor objects along with the .a3dcomp file. +# Export the heatsink 3D component to a ``"componentLibrary"`` folder. +# The ``auxiliary_dict`` parameter is set to ``True`` to export the monitor objects +# along with the A3DCOMP file. os.mkdir(os.path.join(temp_folder.name, "componentLibrary")) ipk.modeler.create_3dcomponent( @@ -114,7 +121,7 @@ ipk = Icepak(project=qfp_temp_name, version=AEDT_VERSION) ipk.plot(show=False, output_file=os.path.join(temp_folder.name, "QFP2.jpg")) -# Create dataset for power dissipation. +# Create a dataset for power dissipation. x_datalist = [45, 53, 60, 70] y_datalist = [0.5, 3, 6, 9] @@ -127,7 +134,7 @@ y_unit="W", ) -# Assign source power condition to the die. +# Assign a source power condition to the die. ipk.create_source_power( face_id="DieSource", @@ -154,7 +161,7 @@ surface_name="Die_Attach", monitor_quantity="Temperature", monitor_name="DieAttach" ) -# Export the QFP 3D component in the ``"componentLibrary"`` folder and close project. +# Export the QFP 3D component in the ``"componentLibrary"`` folder and close the project. # Here the auxiliary dictionary allows exporting not only the monitor objects but also the dataset # used for the power source assignment. @@ -180,10 +187,10 @@ export_path=os.path.join(temp_folder.name, "electronic_package_missing_obj.jpg"), ) -# The heatsink and the QFP are missing. They can be inserted as 3d components. -# The auxiliary files are needed since the aim is to import also monitor objects and datasets. +# The heatsink and the QFP are missing. They can be inserted as 3D components. +# The auxiliary files are needed because the goal is to also import monitor objects and datasets. -# A coordinate system is created for the heatsink so that it is placed on top of the AGP. +# Create a coordinate system for the heatsink so that it is placed on top of the AGP. # + agp = ipk.modeler.get_object_from_name(assignment="AGP_IDF") @@ -215,7 +222,7 @@ ) # - -# Create a coordinate system at the xmin, ymin, zmin of the model +# Create a coordinate system at the xmin, ymin, and zmin of the model. bounding_box = ipk.modeler.get_model_bounding_box() cs_pcb_assembly = ipk.modeler.create_coordinate_system( @@ -226,10 +233,10 @@ y_pointing=[0, 1, 0], ) -# Export of the entire assembly as a 3D component and close the project. First, the nested -# hierarchy must be flattned since nested 3d components are currently not supported. Subsequently, +# Export the entire assembly as a 3D component and close the project. First, the nested +# hierarchy must be flattned because nested 3D components are currently not supported. Subsequently, # the whole package can be exported as a 3D component. The auxiliary dictionary is needed -# to export monitor objects, datasets and native components. +# to export monitor objects, datasets, and native components. ipk.flatten_3d_components() ipk.modeler.create_3dcomponent( @@ -246,13 +253,13 @@ ipk.save_project() ipk.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-electrothermal/components_csv.py b/examples/electrothermal/components_csv.py similarity index 79% rename from examples/05-electrothermal/components_csv.py rename to examples/electrothermal/components_csv.py index 9339564e8..fb4c69848 100644 --- a/examples/05-electrothermal/components_csv.py +++ b/examples/electrothermal/components_csv.py @@ -1,11 +1,11 @@ -# # Define PCB components from CSV and export model images +# # PCB component definition from CSV file and model image exports # This example shows how to create different types of blocks and assign power -# and material to them using a *.csv input file +# and material to them using a CSV input file # -# Keywords: **Icepak**, **boundaries**, **pyVista**, **CSV**, **PCB**, **components**. +# Keywords: **Icepak**, **boundaries**, **PyVista**, **CSV**, **PCB**, **components**. -# ## Perform required imports +# ## Perform imports and define constants # + import csv @@ -24,10 +24,10 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Download and open project # @@ -51,7 +51,7 @@ material="FR-4_Ref", ) -# ## Components creation with a CSV file +# ## Create components from CSV file # # Components are represented as simple cubes with dimensions and properties specified in a CSV file. @@ -60,15 +60,16 @@ ) # The CSV file lists block properties: -# - type (solid, network, hollow) -# - name -# - starting point (xs, ys, zs) and end point (xd, yd, zd) -# - material properties (for solid blocks) -# - power assignment -# - resistances to board and to case (for network blocks) -# - whether to add a monitor point to the block (0 or 1) # -# The following table does not show the entire rows and data and only serves as a sample. +# - Type (solid, network, hollow) +# - Name +# - Dtart point (xs, ys, zs) and end point (xd, yd, zd) +# - Material properties (for solid blocks) +# - Power assignment +# - Resistances to the board and to the case (for network blocks) +# - Whether to add a monitor point to the block (0 or 1) +# +# The following table does not show entire rows and dat. It provides only a sample. # # # | block_type | name | xs | ys | zs | xd | yd | zd | matname | power | Rjb | Rjc | Monitor_point | @@ -80,9 +81,10 @@ # | network | C10 | 65.40 | -1.27 | 0.40 | 3.81 | 2.54 | 2.43 | | 0.562 | 2 | 3 | 0 | # | network | C20 | 113.03 | -0.63 | 0.40 | 2.54 | 3.81 | 2.43 | | 0.445 | 2 | 3 | 0 | # -# In this step the code will loop over each line of the csv file, creates the blocks. -# It will create solid blocks and assign BCs. -# Every row of the csv has information of a particular block. +# The following code loops over each line of the CSV file, creating solid blocks +# and assigning boundary conditions. +# +# Every row of the CSV file has information on a particular block. # + with open(filename, "r") as csv_file: @@ -106,7 +108,7 @@ else: material_name = "copper" - # creates the block with the given name, coordinates, material, and type + # Creates the block with the given name, coordinates, material, and type block = ipk.modeler.create_box( origin=origin, sizes=dimensions, name=block_name, material=material_name ) @@ -136,7 +138,7 @@ ) # Create temperature monitor points if assigned value is 1 in the last - # column of the csv file + # column of the CSV file if row["Monitor_point"] == "1": ipk.monitor.assign_point_monitor_in_object( name=row["name"], @@ -146,14 +148,13 @@ # - -# ## Calculate the power assigned to all the components +# ## Calculate the power assigned to all components power_budget, total_power = ipk.post.power_budget(units="W") -# ## Plot model -# ### Plot model using AEDT +# ## Plot model using AEDT # -# Set the colormap to use. Previously computed power budget can be used to set the minimum and maximum values. +# Set the colormap to use. You can use the previously computed power budget to set the minimum and maximum values. cmap = plt.get_cmap("plasma") norm = mpl.colors.Normalize( @@ -172,9 +173,9 @@ obj.color = [0, 0, 0] obj.transparency = 0.9 -# Export the model image by creating a list of all objects that excludes "Region". -# This list is then passed to the `export_model_picture` function. -# This approach ensures that the exported image fitted to the PCB and its components. +# Export the model image by creating a list of all objects that excludes ``Region``. +# This list is then passed to the `export_model_picture()` function. +# This approach ensures that the exported image is fitted to the PCB and its components. obj_list_noregion = list(ipk.modeler.object_names) obj_list_noregion.remove("Region") @@ -184,12 +185,12 @@ ) Image(export_file) -# ### Plot model using pyAEDT +# ### Plot model using PyAEDT # -# Initialize a pyVista plotter +# Initialize a PyVista plotter plotter = pv.Plotter(off_screen=True, window_size=[2048, 1536]) -# Export all models objects to .obj files. +# Export all models objects to OBJ files. f = ipk.post.export_model_obj( export_path=temp_folder.name, export_as_single_objects=True, air_objects=False @@ -208,7 +209,7 @@ ) plotter.add_mesh(mesh=mesh, scalars="Power", cmap="viridis", opacity=opacity) -# Add a label to the object with the maximum temperature +# Add a label to the object with the maximum temperature. max_pow_obj = "MP1" plotter.add_point_labels( @@ -219,7 +220,7 @@ text_color="red", ) -# Export file +# Export the file. export_file = os.path.join(temp_folder.name, "object_power_pyVista.png") plotter.screenshot(filename=export_file, scale=1) @@ -231,12 +232,12 @@ ipk.release_desktop() time.sleep( 3 -) # Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +) # Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-electrothermal/ecad_import.py b/examples/electrothermal/ecad_import.py similarity index 63% rename from examples/05-electrothermal/ecad_import.py rename to examples/electrothermal/ecad_import.py index aedf0efff..e4e9c9c6e 100644 --- a/examples/05-electrothermal/ecad_import.py +++ b/examples/electrothermal/ecad_import.py @@ -1,13 +1,13 @@ -# # Importing a PCB and its components via IDF and EDB +# # Import of a PCB and its components via IDF and EDB -# This example shows how to import a PCB and its components using IDF files (*.ldb/*.bdf). -# The *.emn/*.emp combination can also be used in a similar way. +# This example shows how to import a PCB and its components using IDF files (LDB and BDF). +# You can also use a combination of EMN and EMP files in a similar way. # # Keywords: **Icepak**, **PCB**, **IDF**. -# ## Perform required imports +# ## Perform imports and define constants # -# Perform required imports including the operating system, Ansys PyAEDT packages. +# Perform required imports. import os import tempfile @@ -16,10 +16,10 @@ import ansys.aedt.core from ansys.aedt.core import Hfss3dLayout, Icepak -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Open project # @@ -38,20 +38,21 @@ # ## Import the IDF files # -# Sample *.bdf and *.ldf files are presented here. +# Import the BDF and LDF files. Sample files are shown here. # # # # # -# Imports the idf files with several filtering options including caps, resistors, -# inductors, power, specific power, size... -# There are also options for the PCB creation (number o flayers, copper percentages, layer sizes). -# In this example, the default values are used for the PCB. -# The imported PCB (from IDF) here will be deleted later and replaced by a PCB that has the trace +# You can import the IDF files with several filtering options, including caps, resistors, +# inductors, power, specific power, and size. +# There are also options for PCB creation, including number of layers, copper percentages, and layer sizes. +# +# This example uses the default values for the PCB. +# The imported PCB (from the IDF files) are deleted later and replaced by a PCB that has the trace # information (from ECAD) for higher accuracy. -# Download ECAD and IDF files +# Download ECAD and IDF files. def_path = ansys.aedt.core.downloads.download_file( source="icepak/Icepak_ECAD_Import/A1_uprev.aedb", @@ -65,7 +66,7 @@ source="icepak/Icepak_ECAD_Import/", name="A1.ldf", destination=temp_folder.name ) -# Import IDF +# Import IDF file. ipk.import_idf(board_path=board_path) @@ -74,13 +75,13 @@ ipk.save_project() # ## Import ECAD -# Add an HFSS 3D Layout design with the layout information of the PCB +# Add an HFSS 3D Layout design with the layout information of the PCB. hfss3d_lo = Hfss3dLayout(project=def_path, version=AEDT_VERSION) hfss3d_lo.save_project() -# Create a PCB component in Icepak linked to the 3D Layout project. The polygon ``"poly_0"`` -# is used as the outline of the PCB and a dissipation of ``"1W"`` is applied to the PCB. +# Create a PCB component in Icepak linked to the HFSS 3D Layout project. The polygon ``"poly_0"`` +# is used as the outline of the PCB, and a dissipation of ``"1W"`` is applied to the PCB. ipk.create_pcb_from_3dlayout( component_name="PCB_pyAEDT", @@ -91,7 +92,7 @@ power_in=1, ) -# Delete the simplified PCB object coming from IDF import. +# Delete the simplified PCB object coming from the IDF import. ipk.modeler["IDF_BoardOutline"].delete() @@ -108,13 +109,13 @@ ipk.save_project() ipk.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-electrothermal/electrothermal.py b/examples/electrothermal/electrothermal.py similarity index 68% rename from examples/05-electrothermal/electrothermal.py rename to examples/electrothermal/electrothermal.py index 20a80105a..5cc8baf42 100644 --- a/examples/05-electrothermal/electrothermal.py +++ b/examples/electrothermal/electrothermal.py @@ -1,19 +1,20 @@ -# # Electrothermal Analysis +# # Electrothermal analysis # -# This example shows how to use the electronics database (EDB) for DC IR analysis and -# electrothermal analysis. The EDB will be loaded into SIwave for analysis and post-processing. +# This example shows how to use the EDB for DC IR analysis and +# electrothermal analysis. The EDB is loaded into SIwave for analysis and postprocessing. # In the end, an Icepak project is exported from SIwave. -# - Set up EDB -# - Assign package and heatsink model to components -# - Create voltage and current sources -# - Create SIwave DC analysis -# - Define cutout -# - Import EDB into SIwave -# - Analyze DC IR -# - Export Icepak project +# +# - Set up EDB: +# - Assign package and heatsink model to components. +# - Create voltage and current sources. +# - Create SIwave DC analysis. +# - Define cutout. +# - Import EDB into SIwave: +# - Analyze DC IR. +# - Export Icepak project. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -26,11 +27,11 @@ from ansys.aedt.core.downloads import download_file from pyedb import Edb, Siwave -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = True # Open Electronics UI when the application is launched. +NG_MODE = True # Open AEDT UI when it is launched. # Check if AEDT is launched in graphical mode. @@ -40,8 +41,8 @@ # ## Create temporary directory and download files # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -51,14 +52,14 @@ aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name) -# ## Create a configuration file +# ## Create configuration file # -# In this example, we are going to use a configuration file to set up layout for analysis. +# This example uses a configuration file to set up the layout for analysis. # Create an empty dictionary to host all configurations. cfg = dict() -# ## Add component thermal information and heats-ink definition +# ## Add component thermal information and heatsink definition cfg["package_definitions"] = [ { @@ -81,21 +82,22 @@ } ] -# ## Create pin groups. +# ## Create pin groups # -# 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: +# Group all pins on the "GND" net on the ``J5`` component into one group. +# Pin groups are assigned by net name using the ``net`` key. cfg["pin_groups"] = [{"name": "J5_GND", "reference_designator": "J5", "net": "GND"}] -# ## Create Current Sources +# ## Create current sources # -# In this example, two current sources are created on component J5. +# Create two current sources on the ``J5`` component. # 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. +# When the ``net`` keyword is used, all pins on the specified net are grouped into a +# new pin group that is assigned as the positive terminal. +# +# Negative terminal can be assigned by pin group name by using the ``pin_group`` keyword. +# The two current sources share the same ``J5_GND`` pin group as the negative terminal. i_src_1 = { "name": "J5_VCCR", @@ -114,9 +116,9 @@ "negative_terminal": {"pin_group": "J5_GND"}, # Defined in "pin_groups" section. } -# ## Create a Voltage Source +# ## Create a voltage source # -# Create a voltage source on component U4 between two nets using keyword "net". +# Create a voltage source on the ``U4`` componebt between two nets using the ``net`` keyword. # + v_src = { @@ -131,9 +133,9 @@ cfg["sources"] = [v_src, i_src_1, i_src_2] # - -# ## Cutout +# ## Define cutout # -# The following assignments will define the region of the PCB to be cut out for analysis. +# The following assignments define the region of the PCB to be cut out for analysis. cfg["operations"] = { "cutout": { @@ -154,7 +156,7 @@ } ] -# ## Save configuration as a JSON file +# ## Save configuration to a JSON file # # The configuration file can be saved in JSON format and applied to layout data using the EDB. @@ -167,7 +169,7 @@ # ## Load configuration into EDB # -# Load configuration from JSON +# Load the configuration from the JSON file. edbapp = Edb(aedb, edbversion=AEDT_VERSION) edbapp.configuration.load(config_file=pi_json) @@ -176,13 +178,13 @@ edbapp.close() time.sleep(3) -# The configured EDB file is saved in a temp folder. +# The configured EDB file is saved in the temporary folder. print(temp_folder.name) # ## Analyze in SIwave # -# Load edb into SIwave. +# Load EDB into SIwave. siwave = Siwave(specified_version=AEDT_VERSION) time.sleep(10) @@ -203,13 +205,13 @@ siwave.close_project() -# ## Shut Down SIwave +# ## Shut down SIwave siwave.quit_application() -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.dir``. If you've run this example as a Jupyter notbook you +# All project files are saved in the folder ``temp_folder.dir``. If you've run this example as a Jupyter notbook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. time.sleep(3) diff --git a/examples/05-electrothermal/graphic_card.py b/examples/electrothermal/graphic_card.py similarity index 77% rename from examples/05-electrothermal/graphic_card.py rename to examples/electrothermal/graphic_card.py index e80912d0e..250600a28 100644 --- a/examples/05-electrothermal/graphic_card.py +++ b/examples/electrothermal/graphic_card.py @@ -1,13 +1,13 @@ # # Graphic card thermal analysis -# This example shows how you can use pyAEDT to create a graphic card setup in -# Icepak and post-process results. +# This example shows how to use pyAEDT to create a graphic card setup in +# Icepak and postprocess the results. # The example file is an Icepak project with a model that is already created and # has materials assigned. # # Keywords: **Icepak**, **boundary conditions**, **postprocessing**, **monitors**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -19,23 +19,26 @@ import pandas as pd from IPython.display import Image -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Do not show the graphical user-interface. +NG_MODE = False # Do not show the graphical user interface. - -# ## Open project +# ## Create temporary directory and download project # -# Download the project to a temporary folder. +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") project_temp_name = ansys.aedt.core.downloads.download_icepak( destination=temp_folder.name ) - -# Open the project in without the GUI. +# ## Open project +# +# Open the project without the GUI. ipk = ansys.aedt.core.Icepak( project=project_temp_name, @@ -46,8 +49,8 @@ # ## Plot model and rotate # -# Plot the model using the pyAEDT-pyVista integration and save the result to a file. -# Rotate the model and plot again the rotated model. +# Plot the model using the pyAEDT-PyVista integration and save the result to a file. +# Rotate the model and plot the rotated model again. # + plot1 = ipk.plot( @@ -65,7 +68,7 @@ ) # - -# ## Boundary conditions +# ## Define boundary conditions # # Create source blocks on the CPU and memories. @@ -85,9 +88,9 @@ velocity=["1m_per_sec", "0m_per_sec", "0m_per_sec"], ) -# ## Mesh Settings +# ## Assign mesh settings # -# ### Mesh Region +# ### Assign mesh region # Assign a mesh region around the heat sink and CPU. mesh_region = ipk.mesh.assign_mesh_region(assignment=["HEAT_SINK", "CPU"]) @@ -96,12 +99,12 @@ mesh_region.settings -# Set the mesh region settings to manual and see new available settings +# Set the mesh region settings to manual and see newly available settings. mesh_region.manual_settings = True mesh_region.settings -# Modify settings and update +# Modify settings and update. mesh_region.settings["MaxElementSizeX"] = "2mm" mesh_region.settings["MaxElementSizeY"] = "2mm" @@ -111,7 +114,7 @@ mesh_region.settings["MinElementsInGap"] = 4 mesh_region.update() -# Modify the slack of the subregion around the objects +# Modify the slack of the subregion around the objects. subregion = mesh_region.assignment subregion.positive_x_padding = "20mm" @@ -121,14 +124,14 @@ subregion.negative_y_padding = "5mm" subregion.negative_z_padding = "10mm" -# ### Global Mesh -# Set global mesh resolution (using automatic settings) to 4. +# ### Set global mesh resolution +# Set the global mesh resolution (using automatic settings) to 4. ipk.mesh.global_mesh_region.settings["MeshRegionResolution"] = 4 ipk.mesh.global_mesh_region.update() -# ## Point monitors +# ## Assign monitors # # Assign a temperature face monitor to the CPU face in contact with the heatsink. @@ -150,7 +153,7 @@ # ## Solve project # -# Create a setup, modify solver settings and run the simulation +# Create a setup, modify solver settings, and run the simulation. setup1 = ipk.create_setup() setup1.props["Flow Regime"] = "Turbulent" @@ -160,18 +163,18 @@ ipk.save_project() ipk.analyze(setup=setup1.name, cores=NUM_CORES, tasks=NUM_CORES) -# ## PostProcess +# ## Postprocess # -# ### Quantitative post-processing +# ### Perform quantitative postprocessing -# Get the point monitor data. A dictionary is returned with 'Min', 'Max' and 'Mean' keys. +# Get the point monitor data. A dictionary is returned with ``'Min'``, ``'Max'``, and ``'Mean'`` keys. temperature_data = ipk.post.evaluate_monitor_quantity( monitor=m1, quantity="Temperature" ) temperature_data -# It is also possible to get the data as pandas dataframe for advanced post-processing. +# It is also possible to get the data as a Pandas dataframe for advanced postprocessing. speed_fs = ipk.post.create_field_summary() for m_name in speed_monitors: @@ -180,7 +183,7 @@ ) speed_data = speed_fs.get_field_summary_data(pandas_output=True) -# All the data is now in a dataframe, easy to visualize and to manipulate. +# All the data is now in a dataframe, making it easy to visualize and manipulate. speed_data.head() @@ -218,17 +221,17 @@ temperature_fs = temperature_fs.get_field_summary_data(pandas_output=True) temperature_fs.head() -# The two DataFrames can be merged using the `pd.merge()` function. With the merge, suffixes are -# added to the column names to differentiate between the columns from each original DataFrame. +# The two dataframes can be merged using the `pd.merge()` function. With the merge, suffixes are +# added to the column names to differentiate between the columns from each original dataframe. merged_df = pd.merge( temperature_fs, speed_data, on="Entity", suffixes=("_temperature", "_speed") ) merged_df.head() -# The column names are renamed based on the 'Quantity' column of the original DataFrames. -# Finally, only the 'Entity', mean temperature, and mean speed columns are selected and -# assigned to the merged DataFrame. +# The column names are renamed based on the ``Quantity`` column of the original dataframes. +# Finally, only the ``'Entity'``, ``'Mean_temperature'``, and ``'Mean_speed'`` columns are selected and +# assigned to the merged dataframe. temperature_quantity = temperature_fs["Quantity"].iloc[0] velocity_quantity = speed_data["Quantity"].iloc[0] @@ -248,7 +251,7 @@ ] merged_df.head() -# Compute the correlation coefficient between velocity and temperature from the merged DataFrame +# Compute the correlation coefficient between velocity and temperature from the merged dataframe # and plot a scatter plot to visualize their relationship. correlation = merged_df[velocity_quantity].corr(merged_df[temperature_quantity]) @@ -258,11 +261,11 @@ ax.set_title(f"Correlation between Temperature and Velocity: {correlation:.2f}") # The further away from the assembly, the faster and colder the air due to mixing. -# Despite being extremely simple, this example should demonstrate the potential of importing field -# summary data into pandas. +# Despite being extremely simple, this example demonstrates the potential of importing field +# summary data into Pandas. -# ### Qualitative Post-Processing -# Create a temperature plot on main components and export it to a png file. +# ### Perform qualitative Postprocessing +# Create a temperature plot on main components and export it to a PNG file. surflist = [i.id for i in ipk.modeler["CPU"].faces] surflist += [i.id for i in ipk.modeler["MEMORY1"].faces] @@ -277,7 +280,7 @@ ) Image(filename=path) # Display the image -# pyVista can be used to display the temperature map. +# Use PyVista to display the temperature map. plot4 = ipk.post.plot_field( quantity="Temperature", @@ -301,13 +304,13 @@ ipk.save_project() ipk.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-electrothermal/icepak_circuit_hfss_coupling.py b/examples/electrothermal/icepak_circuit_hfss_coupling.py similarity index 73% rename from examples/05-electrothermal/icepak_circuit_hfss_coupling.py rename to examples/electrothermal/icepak_circuit_hfss_coupling.py index 6f950cf45..22f1a4585 100644 --- a/examples/05-electrothermal/icepak_circuit_hfss_coupling.py +++ b/examples/electrothermal/icepak_circuit_hfss_coupling.py @@ -1,33 +1,34 @@ # # Circuit-HFSS-Icepak coupling workflow # -# This example demonstrates how to create a two-way coupling +# This example shows how to create a two-way coupling # between HFSS and Icepak. # -# Let’s consider a design where some components are simulated in +# Consider a design where some components are simulated in # HFSS with a full 3D model, while others are simulated in Circuit as lumped elements. # The electrical simulation is done by placing the HFSS design into a Circuit design as -# a subcomponent and by connecting the lumped components to its ports. +# a subcomponent and connecting the lumped components to its ports. # # The purpose of the workflow is to perform a thermal simulation # of the Circuit-HFSS design, creating a two-way coupling with Icepak # that allows running multiple iterations. The losses from both designs -# are accounted for: EM losses are evaluated by the HFSS -# solver and fed into Icepak via a direct link, while losses -# from the lumped components in the Circuit design are evaluated +# are accounted for. +# - EM losses are evaluated by the HFSS solver and fed into Icepak via a direct link. +# - Losses from the lumped components in the Circuit design are evaluated # analytically and must be manually set into the Icepak boundary. # -# On the way back of the coupling, temperature information -# is handled differently for HFSS and Circuit. For HFSS, a temperature -# map is exported from the Icepak design and used to create a -# 3D dataset; then the material properties in the HFSS design -# are updated based on this dataset. For Circuit, the average -# temperature of the lumped components is extracted from the -# Icepak design and used to update the temperature-dependent -# characteristics of the lumped components in Circuit. +# On the back of the coupling, temperature information +# is handled differently for HFSS and Circuit. # -# In this example, the Circuit design contains only a +# - For HFSS, a temperature map is exported from the Icepak design and used to create a +# 3D dataset. Then, the material properties in the HFSS design are updated based on this +# dataset. +# - For Circuit, the average temperature of the lumped components is extracted from the +# Icepak design and used to update the temperature-dependent characteristics of the +# lumped components in Circuit. +# +# The Circuit design in this example contains only a # resistor component, with temperature-dependent resistance -# described by this formula: 0.162*(1+0.004*(TempE-TempE0)), +# described by this formula: ``0.162*(1+0.004*(TempE-TempE0))``, # where TempE is the current temperature and TempE0 is the # ambient temperature. The HFSS design includes only a cylinder # with temperature-dependent material conductivity, defined by @@ -36,7 +37,7 @@ # # Keywords: **Multiphysics**, **HFSS**, **Icepak**, **Circuit**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -46,16 +47,16 @@ import ansys.aedt.core as aedt -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -81,7 +82,7 @@ non_graphical=NG_MODE, ) -# ## Variable names +# ## Set variable names # # Set the name of the resistor in Circuit. @@ -93,13 +94,13 @@ # ## Get HFSS design # -# Get the Hfss design and prepare the material for the thermal link +# Get the HFSS design and prepare the material for the thermal link. hfss = aedt.Hfss(project=circuit.project_name) -# ## Create new material +# ## Create a material # -# Create a new material that will be used to set the temperature map on it. +# Create a material to be used to set the temperature map on it. # The material is created by duplicating the material assigned to the cylinder. material_name = hfss.modeler.objects_by_name[device3D_body_name].material_name @@ -110,7 +111,7 @@ # ## Modify material properties # -# Save the conductivity value. It will be used later in the iterations. +# Save the conductivity value. It is used later in the iterations. old_conductivity = new_material.conductivity.value @@ -118,8 +119,8 @@ hfss.modeler.objects_by_name[device3D_body_name].material_name = new_material_name -# Since this material has a high conductivity, HFSS automatically deactivate "Solve Inside". -# It needs to be set back on as we need to evaluate the losses inside the cylinder. +# Because this material has a high conductivity, HFSS automatically deactivates ``solve_inside``. +# It must be turned back on to evaluate the losses inside the cylinder. hfss.modeler.objects_by_name[device3D_body_name].solve_inside = True @@ -132,7 +133,7 @@ model = icepak.plot(show=False) model.plot(os.path.join(temp_folder.name, "Image.jpg")) -# ## Set the parameters for the iterations +# ## Set parameters for iterations # # Set the initial temperature to a value closer to the final one, to speed up the convergence. @@ -147,28 +148,28 @@ temp_residual_limit = 0.02 loss_residual_limit = 0.02 -# This variable will contain the iteration statistics. +# This variable is to contain iteration statistics. stats = {} -# ## Start the iterations +# ## Start iterations # -# Each for loop is a complete two-way iteration. +# Each ``for`` loop is a complete two-way iteration. # The code is thoroughly commented. -# Please read the inline comments carefully for a full understanding. +# For a full understanding, read the inline comments carefully. for cp_iter in range(1, max_iter + 1): stats[cp_iter] = {} - # Step 1: Solve the HFSS design + # Step 1: Solve the HFSS design. # - # Solve the Hfss design. + # Solve the HFSS design. hfss.analyze(cores=NUM_CORES) - # Step 2: Refresh the dynamic link and solve the Circuit design + # Step 2: Refresh the dynamic link and solve the Circuit design. # # Find the HFSS subcomponent in Circuit. - # This information is required by refresh_dynamic_link and push_excitations methods. + # This information is required by the ``refresh_dynamic_link()`` and ``push_excitations()`` methods. hfss_component_name = "" hfss_instance_name = "" for component in circuit.modeler.components.components.values(): @@ -188,14 +189,14 @@ # Solve the Circuit design. circuit.analyze() - # Step 3: Push excitations (HFSS design results are scaled automatically) + # Step 3: Push the excitations. (HFSS design results are scaled automatically.) # - # Push excitations. + # Push the excitations. circuit.push_excitations(instance=hfss_instance_name) - # Step 4: Extract the resistor's power loss value from the Circuit design + # Step 4: Extract the resistor's power loss value from the Circuit design. # - # Evaluate power loss on resistor. + # Evaluate the power loss on the resistor. r_losses = circuit.post.get_solution_data( expressions="0.5*mag(I(I1)*V(V1))" ).data_magnitude()[0] @@ -205,7 +206,7 @@ # Step 5: Set the resistor's power loss value in the Icepak design (block thermal condition) # - # Find the Solid Block boundary in Icepak. + # Find the solid block boundary in Icepak. boundaries = icepak.boundaries boundary = None for bb in boundaries: @@ -218,17 +219,17 @@ # Set the resistor's power loss in the Block Boundary. boundary.props["Total Power"] = str(r_losses) + "W" - # Step 6: Solve the Icepak design + # Step 6: Solve the Icepak design. # - # Clear linked data, otherwise Icepak continues to run simulation with the initial losses. + # Clear linked data. Otherwise, Icepak continues to run the simulation with the initial losses. icepak.clear_linked_data() # Solve the Icepak design. icepak.analyze(cores=NUM_CORES) - # Step 7: Export the temperature map from the Icepak and create a new 3D dataset with it + # Step 7: Export the temperature map from the Icepak design and create a new 3D dataset with it. # - # Export the temperature map into a file. + # Export the temperature map to a file. fld_filename = os.path.join( icepak.working_directory, f"temperature_map_{cp_iter}.fld" ) @@ -239,7 +240,7 @@ objects_type="Vol", ) - # Convert the fld file format into a dataset tab file compatible with dataset import. + # Convert the FLD file into a dataset tab file compatible with the dataset import. # The existing header lines must be removed and replaced with a single header line # containing the value unit. with open(fld_filename, "r") as f: @@ -261,7 +262,7 @@ input_file=tab_filename, name=dataset_name, is_project_dataset=True ) - # Step 8: Update material properties in the HFSS design based on the new dataset + # Step 8: Update material properties in the HFSS design based on the new dataset. # # Set the new conductivity value. new_material.conductivity.value = ( @@ -271,19 +272,19 @@ # Switch off the thermal modifier of the material, if any. new_material.conductivity.thermalmodifier = None - # Step 9: Extract the average temperature of the resistor from the Icepak design + # Step 9: Extract the average temperature of the resistor from the Icepak design. # - # Get the mean temp value on the high resistivity object. + # Get the mean temperature value on the high-resistivity object. mean_temp = icepak.post.get_scalar_field_value( quantity="Temp", scalar_function="Mean", object_name=resistor_body_name ) - # Save the temperature in the iteration stats. + # Save the temperature in the iteration statistics. stats[cp_iter]["temp"] = mean_temp - # Step 10: Update the resistance value in the Circuit design + # Step 10: Update the resistance value in the Circuit design. # - # Set this temperature in circuit in variable TempE. + # Set this temperature in Circuit in the ``TempE`` variable. circuit["TempE"] = f"{mean_temp}cel" # Save the project @@ -292,7 +293,7 @@ # Check the convergence of the iteration # # Evaluate the relative residuals on temperature and losses. - # If the residuals are smaller than the threshold, set the convergence flag to `True`. + # If the residuals are smaller than the threshold, set the convergence flag to ``True```. # Residuals are calculated starting from the second iteration. converged = False stats[cp_iter]["converged"] = converged @@ -318,9 +319,9 @@ if converged: break -# ## Print the overall statistics +# ## Print overall statistics # -# Print the overall statistics for the multi physic loop. +# Print the overall statistics for the multiphysics loop. for i in stats: txt = "yes" if stats[i]["converged"] else "no" @@ -346,12 +347,12 @@ icepak.save_project() icepak.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/05-electrothermal/index.rst b/examples/electrothermal/index.rst similarity index 75% rename from examples/05-electrothermal/index.rst rename to examples/electrothermal/index.rst index 0a5792318..428f72095 100644 --- a/examples/05-electrothermal/index.rst +++ b/examples/electrothermal/index.rst @@ -14,5 +14,5 @@ These examples use PyAEDT to show electrothermal capabilities of AEDT sherlock.py icepak_circuit_hfss_coupling.py electrothermal.py - ../04-low_frequency/multiphysics/maxwell_icepak.py - ../02-aedt_general/report/virtual_compliance.py \ No newline at end of file + ../low_frequency/multiphysics/maxwell_icepak.py + ../aedt_general/report/virtual_compliance.py \ No newline at end of file diff --git a/examples/05-electrothermal/sherlock.py b/examples/electrothermal/sherlock.py similarity index 79% rename from examples/05-electrothermal/sherlock.py rename to examples/electrothermal/sherlock.py index aa05b409a..9deccf851 100644 --- a/examples/05-electrothermal/sherlock.py +++ b/examples/electrothermal/sherlock.py @@ -1,13 +1,13 @@ # # Setup from Sherlock inputs -# This example shows how you can create an Icepak project from Sherlock +# This example shows how to create an Icepak project from Sherlock # files (STEP and CSV) and an AEDB board. # # Keywords: **Icepak**, **Sherlock**. -# ## Perform required imports +# ## Perform imports and define constants # -# Perform required imports and set paths. +# Perform required imports. # + import os @@ -18,32 +18,32 @@ # - -# ## Define constants +# Define constants AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Define input files and variables. +# ## Set paths and define input files and variables # # Set paths. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") input_dir = ansys.aedt.core.downloads.download_sherlock(destination=temp_folder.name) -# Define input files names. +# Define input files. material_name = "MaterialExport.csv" component_properties = "TutorialBoardPartsList.csv" component_step = "TutorialBoard.stp" aedt_odb_project = "SherlockTutorial.aedt" -# Define variables that will be needed later. +# Define variables that are needed later. aedt_odb_design_name = "PCB" outline_polygon_name = "poly_14188" -# Define input files with path +# Define input files with paths. material_list = os.path.join(input_dir, material_name) component_list = os.path.join(input_dir, component_properties) @@ -69,8 +69,8 @@ ) # Create an offset coordinate system to match ODB++ with the Sherlock STEP file. -# The thickness is computed from the ``"Board"`` component (``"Board1"`` is the -# instance name of the ``"Board"`` native component) and used to offset the coordinate system. +# The thickness is computed from the ``"Board"`` component. (``"Board1"`` is the +# instance name of the ``"Board"`` native component and is used to offset the coordinate system.) bb = ipk.modeler.user_defined_components["Board1"].bounding_box stackup_thickness = bb[-1] - bb[2] @@ -78,7 +78,7 @@ origin=[0, 0, stackup_thickness / 2], mode="view", view="XY" ) -# Import the board components from a MCAD file and remove the PCB object as it is already +# Import the board components from an MCAD file and remove the PCB object as it is already # imported with the ECAD. ipk.modeler.import_3d_cad(file_path, refresh_all_ids=False) @@ -90,13 +90,13 @@ # ## Assign materials and power dissipation conditions from Sherlock # -# Use Sherlock file to assign materials. +# Use the Sherlock file to assign materials. ipk.assignmaterial_from_sherlock_files( component_file=component_list, material_file=material_list ) -# Delete objects with no materials assignments. +# Delete objects with no material assignments. no_material_objs = ipk.modeler.get_objects_by_material(material="") ipk.modeler.delete(assignment=no_material_objs) @@ -121,8 +121,7 @@ ) # ## Create simulation setup -# ### Mesh settings -# Set global mesh settings +# ### Set global mesh settings ipk.globalMeshSettings( 3, @@ -135,14 +134,14 @@ ) -# ### Add post-processing object -# Create point monitor +# ### Add postprocessing object +# Create the point monitor. point1 = ipk.monitor.assign_point_monitor( point_position=ipk.modeler["COMP_U10"].top_face_z.center, monitor_name="Point1" ) -# Create line for reporting after the simulation +# Create a line for reporting after the simulation. line = ipk.modeler.create_polyline( points=[ @@ -153,8 +152,8 @@ ) # ### Solve -# Max iterations are set to 20 for quick demonstration, please increase to at -# least 100 for better accuracy. +# To solve quickly, the maximum iterations are set to 20. For better accuracy, you +# can increase the maximum to at least 100. setup1 = ipk.create_setup() setup1.props["Solution Initialization - Y Velocity"] = "1m_per_sec" @@ -168,18 +167,19 @@ ipk.assign_priority_on_intersections() -# # Analyze the model +# ## Analyze the model # ipk.analyze(cores=4, tasks=4) # ipk.save_project() -# # ## Post-Processing -# # Get monitor point result +# ## Postprocess +# ### Get monitor point result # pt_monitor_result = ipk.monitor.all_monitors[point1].value() # print(pt_monitor_result) -# # Create a report on the previously defined line and get data from it +# ### Create report +# # Create a report on the previously defined line and get data from it. # report = ipk.post.create_report( # expressions=["Temperature", "Speed"], @@ -197,7 +197,7 @@ # ] # speed = [v for _, v in report_data.full_matrix_mag_phase[0]["Speed"].items()] -# # Plot the data +# ### Plot data # fig, ax = plt.subplots(1, 1) # sc = ax.scatter(distance, speed, c=temperature) @@ -207,7 +207,8 @@ # cbar = fig.colorbar(sc) # cbar.set_label("Temperature [cel]") -# # Plot contours. The plot can be performed within AEDT... +# ### Plot contours +# # You can create the plot within AEDT. # plot1 = ipk.post.create_fieldplot_surface( # assignment=ipk.modeler["COMP_U10"].faces, quantity="SurfTemperature" @@ -217,7 +218,7 @@ # ) # Image(filename=path) # Display the image -# # ... or using pyvista integration +# # You can create the plot outside AEDT uding the PyVista integration. # ipk.post.plot_field( # quantity="SurfPressure", @@ -230,13 +231,13 @@ ipk.save_project() ipk.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/_static/array.png b/examples/high_frequency/_static/array.png similarity index 100% rename from examples/03-high_frequency/_static/array.png rename to examples/high_frequency/_static/array.png diff --git a/examples/03-high_frequency/_static/emc.png b/examples/high_frequency/_static/emc.png similarity index 100% rename from examples/03-high_frequency/_static/emc.png rename to examples/high_frequency/_static/emc.png diff --git a/examples/03-high_frequency/_static/hf.png b/examples/high_frequency/_static/hf.png similarity index 100% rename from examples/03-high_frequency/_static/hf.png rename to examples/high_frequency/_static/hf.png diff --git a/examples/03-high_frequency/_static/layout.png b/examples/high_frequency/_static/layout.png similarity index 100% rename from examples/03-high_frequency/_static/layout.png rename to examples/high_frequency/_static/layout.png diff --git a/examples/03-high_frequency/_static/pcb_stress.png b/examples/high_frequency/_static/pcb_stress.png similarity index 100% rename from examples/03-high_frequency/_static/pcb_stress.png rename to examples/high_frequency/_static/pcb_stress.png diff --git a/examples/03-high_frequency/_static/touchstone.png b/examples/high_frequency/_static/touchstone.png similarity index 100% rename from examples/03-high_frequency/_static/touchstone.png rename to examples/high_frequency/_static/touchstone.png diff --git a/examples/03-high_frequency/_static/wgf.png b/examples/high_frequency/_static/wgf.png similarity index 100% rename from examples/03-high_frequency/_static/wgf.png rename to examples/high_frequency/_static/wgf.png diff --git a/examples/03-high_frequency/antenna/array.py b/examples/high_frequency/antenna/array.py similarity index 79% rename from examples/03-high_frequency/antenna/array.py rename to examples/high_frequency/antenna/array.py index 199029f71..806d7749f 100644 --- a/examples/03-high_frequency/antenna/array.py +++ b/examples/high_frequency/antenna/array.py @@ -1,15 +1,14 @@ # # Component antenna array -# This example shows how you can use PyAEDT to create an example using a 3D component file. It sets -# up -# the analysis, solves it, and uses postprocessing functions to create plots using Matplotlib and +# This example shows how to use PyAEDT to create an example using a 3D component file. It sets +# up the analysis, solves it, and uses postprocessing functions to create plots using Matplotlib and # PyVista without opening the HFSS user interface. This example runs only on Windows using CPython. # # Keywords: **HFSS**, **antenna array**, **3D components**, **far field**. -# ## Preparation -# Import the required packages +# ## Perform imports and define constants +# Import the required packages. import os import tempfile @@ -22,11 +21,12 @@ AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -56,23 +56,23 @@ print("Project name " + project_name) # - -# ## Read array definition from JSON file +# ## Read array definition # -# Read JSON file. +# Read array definition from the JSON file. dict_in = ansys.aedt.core.general_methods.read_json( os.path.join(example_path, "array_simple.json") ) -# ## 3D Component definition +# ## Define 3D component # -# Define 3DComponent cell. +# Define the 3D component cell. dict_in["Circ_Patch_5GHz1"] = os.path.join(example_path, "Circ_Patch_5GHz.a3dcomp") -# ## Add 3D Component Array +# ## Add 3D component array # -# Created 3D Component array from the previous dictionary. +# A 3D component array is created from the previous dictionary. # If a 3D component is not available in the design, it is loaded # into the dictionary from the path that you specify. The following # code edits the dictionary to point to the location of the A3DCOMP file. @@ -81,7 +81,7 @@ # ## Modify cells # -# Make center element passive and rotate corner elements. +# Make the center element passive and rotate the corner elements. array.cells[1][1].is_active = False array.cells[0][0].rotation = 90 @@ -89,7 +89,7 @@ array.cells[2][0].rotation = 90 array.cells[2][2].rotation = 90 -# ## Set up simulation +# ## Set up simulation and analyze # # Set up a simulation and analyze it. @@ -118,19 +118,19 @@ # ## Release AEDT # # Release AEDT. -# Far field post-processing can be performed without AEDT because the data is stored. +# You can perform far field postprocessing without AEDT because the data is stored. metadata_file = ffdata.metadata_file working_directory = hfss.working_directory hfss.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) # ## Load far field data # -# Load far field data stored. +# Load the stored far field data. ffdata = FfdSolutionData(input_file=metadata_file) @@ -174,10 +174,10 @@ show=False, ) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/antenna/dipole.py b/examples/high_frequency/antenna/dipole.py similarity index 85% rename from examples/03-high_frequency/antenna/dipole.py rename to examples/high_frequency/antenna/dipole.py index db2f827a1..eba939862 100644 --- a/examples/03-high_frequency/antenna/dipole.py +++ b/examples/high_frequency/antenna/dipole.py @@ -1,11 +1,11 @@ # # Dipole antenna # -# This example shows how you can use PyAEDT to create a dipole antenna in HFSS +# This example shows how to use PyAEDT to create a dipole antenna in HFSS # and postprocess results. # # Keywords: **HFSS**, **modal**, **antenna**, **3D components**, **far field**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,16 +15,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -38,7 +38,7 @@ # ## Launch HFSS # -# Create a new HFSS design. +# Create an HFSS design. project_name = os.path.join(temp_folder.name, "dipole.aedt") hfss = ansys.aedt.core.Hfss( @@ -102,7 +102,7 @@ hfss.analyze_setup(name="MySetup", cores=NUM_CORES) -# ### Post-processing +# ### Postprocess # # Plot s-parameters and far field. @@ -120,7 +120,7 @@ report_category="Far Fields", ) -# Create a far fields report using the ``report_by_category.far field`` method. +# Create a far fields report using the ``report_by_category.far field()`` method. new_report = hfss.post.reports_by_category.far_field( "db(RealizedGainTotal)", hfss.nominal_adaptive, "3D" @@ -129,14 +129,14 @@ new_report.primary_sweep = "Theta" new_report.create("Realized2D") -# Generate multiple plots using the object ``new_report``. This code generates +# Generate multiple plots using the ``new_report`` object. This code generates # 2D and 3D polar plots. new_report.report_type = "3D Polar Plot" new_report.secondary_sweep = "Phi" new_report.create("Realized3D") -# Get solution data using the object ``new_report``` and postprocess or plot the +# Get solution data using the ``new_report`` object and postprocess or plot the # data outside AEDT. solution_data = new_report.get_solution_data() @@ -144,7 +144,7 @@ # Generate a far field plot by creating a postprocessing variable and assigning # it to a new coordinate system. You can use the ``post`` prefix to create a -# postprocessing variable directly from a setter, or you can use the ``set_variable`` +# postprocessing variable directly from a setter, or you can use the ``set_variable()`` # method with an arbitrary name. hfss["post_x"] = 2 @@ -154,7 +154,7 @@ # ## Retrieve solution data # -# Solution data can also be processed using python libraries like Matplotlib. +# You can also process solution data using Python libraries like Matplotlib. new_report = hfss.post.reports_by_category.far_field( "GainTotal", hfss.nominal_adaptive, "3D" @@ -181,7 +181,7 @@ # ## Retrieve far-field data # # After the simulation completes, the far -# field data is generated port by port and stored in a data class, , user can use this data +# field data is generated port by port and stored in a data class. You can use this data # once AEDT is released. ffdata = hfss.get_antenna_data( @@ -192,7 +192,7 @@ # ## Generate 2D cutout plot # -# Generate 2D cutout plot. You can define the Theta scan +# Generate a 2D cutout plot. You can define the Theta scan # and Phi scan. ffdata.farfield_data.plot_cut( @@ -208,13 +208,13 @@ hfss.save_project() d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. # The following cell removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/antenna/fss_unitcell.py b/examples/high_frequency/antenna/fss_unitcell.py similarity index 76% rename from examples/03-high_frequency/antenna/fss_unitcell.py rename to examples/high_frequency/antenna/fss_unitcell.py index c51595938..e28f4953b 100644 --- a/examples/03-high_frequency/antenna/fss_unitcell.py +++ b/examples/high_frequency/antenna/fss_unitcell.py @@ -1,12 +1,11 @@ -# # FSS Unit Cell Simulation +# # FSS unit cell simulation # -# This example shows how you can use PyAEDT to model and simulation a unit cell -# for a frequency-selective surface in -# HFSS. +# This example shows how to use PyAEDT to model and simulate a unit cell +# for a frequency-selective surface in HFSS. # # Keywords: **HFSS**, **FSS**, **Floquet**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,15 +15,15 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -41,7 +40,7 @@ # ## Launch HFSS # -# Create a new HFSS design. +# Create an HFSS design. hfss = ansys.aedt.core.Hfss( version=AEDT_VERSION, project=project_name, solution_type="Modal" @@ -49,13 +48,13 @@ # ## Define variable # -# Define a variable for the 3D-component. +# Define a variable for the 3D component. hfss["patch_dim"] = "10mm" -# ## Model Setup +# ## Set up model # -# Download the 3D component from the example data and insert the 3D Component. +# Download the 3D component from the example data and insert the 3D component. unitcell_3d_component_path = ansys.aedt.core.downloads.download_FSS_3dcomponent( destination=temp_folder.name @@ -63,7 +62,7 @@ unitcell_path = os.path.join(unitcell_3d_component_path, "FSS_unitcell_23R2.a3dcomp") comp = hfss.modeler.insert_3d_component(unitcell_path) -# Assign parameter to the 3D component. +# Assign the parameter to the 3D component. component_name = hfss.modeler.user_defined_component_names comp.parameters["a"] = "patch_dim" @@ -84,11 +83,11 @@ [x_min, y_min, z_min, x_max, y_max, z_max] = region.bounding_box # - -# Assigning lattice pair boundary condition. +# Assign the lattice pair boundary condition. hfss.auto_assign_lattice_pairs(assignment=region.name) -# Defie the Floquet port. +# Define the Floquet port. id_z_pos = region.top_face_z hfss.create_floquet_port( @@ -117,9 +116,9 @@ save_fields=False, ) -# ## Post-processing +# ## Postprocess # -# Create S-parameter reports using create report. +# Create S-parameter reports. # + all_quantities = hfss.post.available_report_quantities() @@ -146,7 +145,7 @@ # ## Save and run simulation # -# Save and run the simulation. Uncomment the line following line to run the analysis. +# Save and run the simulation. Uncomment the following line to run the analysis. # hfss.analyze() hfss.save_project() @@ -154,13 +153,13 @@ # ## Release AEDT hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/03-high_frequency/antenna/index.rst b/examples/high_frequency/antenna/index.rst similarity index 55% rename from examples/03-high_frequency/antenna/index.rst rename to examples/high_frequency/antenna/index.rst index 911d33b29..4a5b8310d 100644 --- a/examples/03-high_frequency/antenna/index.rst +++ b/examples/high_frequency/antenna/index.rst @@ -1,6 +1,6 @@ Antenna ~~~~~~~ -These examples use PyAEDT to show some antenna examples +These examples use PyAEDT to show some antenna applications. .. nbgallery:: @@ -8,6 +8,6 @@ These examples use PyAEDT to show some antenna examples array.py patch.py fss_unitcell.py - ../../02-aedt_general/modeler/circuit_schematic.py + ../../aedt_general/modeler/circuit_schematic.py large_scenarios/index interferences/index diff --git a/examples/03-high_frequency/antenna/interferences/_static/coupling.png b/examples/high_frequency/antenna/interferences/_static/coupling.png similarity index 100% rename from examples/03-high_frequency/antenna/interferences/_static/coupling.png rename to examples/high_frequency/antenna/interferences/_static/coupling.png diff --git a/examples/03-high_frequency/antenna/interferences/_static/emit_hfss.png b/examples/high_frequency/antenna/interferences/_static/emit_hfss.png similarity index 100% rename from examples/03-high_frequency/antenna/interferences/_static/emit_hfss.png rename to examples/high_frequency/antenna/interferences/_static/emit_hfss.png diff --git a/examples/03-high_frequency/antenna/interferences/_static/emit_simple_cosite.png b/examples/high_frequency/antenna/interferences/_static/emit_simple_cosite.png similarity index 100% rename from examples/03-high_frequency/antenna/interferences/_static/emit_simple_cosite.png rename to examples/high_frequency/antenna/interferences/_static/emit_simple_cosite.png diff --git a/examples/03-high_frequency/antenna/interferences/antenna.py b/examples/high_frequency/antenna/interferences/antenna.py similarity index 75% rename from examples/03-high_frequency/antenna/interferences/antenna.py rename to examples/high_frequency/antenna/interferences/antenna.py index 76564972a..cfd57efc4 100644 --- a/examples/03-high_frequency/antenna/interferences/antenna.py +++ b/examples/high_frequency/antenna/interferences/antenna.py @@ -7,7 +7,7 @@ # # Keywords: **EMIT**, **Antenna**. -# ## Perform required inputs +# ## Perform imports and define constants # # Perform required imports. @@ -19,15 +19,15 @@ # from ansys.aedt.core.emit_core.emit_constants import ResultType, TxRxMode -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -54,21 +54,21 @@ if rad1 and ant1: ant1.move_and_connect_to(rad1) -# ## Place Antenna Radio Pairs +# ## Place radio/antenna pair # -# The method ``create_radio_antenna()`` places radio/antenna pair. The first -# argument is the type of radio. The 2nd argument is the name that -# will be assigned to the radio. +# Use the ``create_radio_antenna()`` method to place the radio/antenna pair. The first +# argument is the type of radio. The second argument is the name to +# assign to the radio. rad2, ant2 = aedtapp.modeler.components.create_radio_antenna("GPS Receiver") rad3, ant3 = aedtapp.modeler.components.create_radio_antenna( "Bluetooth Low Energy (LE)", "Bluetooth" ) -# ## Define the RF Environment +# ## Define the RF environment # -# The next step in this workflow is to specify the RF coupling among antennas. -# This functionality yet to be implemented in the API, but can be entered from the UI. +# Specify the RF coupling among antennas. +# This functionality is not yet implemented in the API, but it can be entered from the UI. # # @@ -79,7 +79,7 @@ # # This part of the example requires Ansys AEDT 2023 R2. -# NOTE : The following code can be uncommented. +# > **Note:** You can uncomment the following code. # # if AEDT_VERSION > "2023.1": # rev = aedtapp.results.analyze() @@ -100,12 +100,12 @@ aedtapp.save_project() aedtapp.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/antenna/interferences/hfss_emit.py b/examples/high_frequency/antenna/interferences/hfss_emit.py similarity index 84% rename from examples/03-high_frequency/antenna/interferences/hfss_emit.py rename to examples/high_frequency/antenna/interferences/hfss_emit.py index 55dd68bf0..c8b380005 100644 --- a/examples/03-high_frequency/antenna/interferences/hfss_emit.py +++ b/examples/high_frequency/antenna/interferences/hfss_emit.py @@ -1,17 +1,17 @@ # # HFSS to EMIT coupling # -# -# -# This example demonstrates how link an HFSS design +# This example shows how to link an HFSS design # to EMIT and model RF interference among various components. # +# +# # > **Note:** This example uses the ``Cell Phone RFI Desense`` # > project that is available with the AEDT installation in the -# > folder ``\Examples\EMIT\`` +# > ``\Examples\EMIT\`` directory. # # Keywords: **EMIT**, **Coupling**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -23,15 +23,15 @@ import ansys.aedt.core from ansys.aedt.core.emit_core.emit_constants import ResultType, TxRxMode -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -47,10 +47,10 @@ version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True ) -# ## Copy Example Files +# ## Copy example files # # Copy the ``Cell Phone RFT Defense`` example data from the -# installed examples folder to the temporary working +# installed ``Examples`` directory to the temporary working # directory. # # > **Note:** The HFSS design from the installed example @@ -59,8 +59,8 @@ # > the RF interference between transceivers is calculated in EMIT using # > results from the linked HFSS design. # -# The following lambda functions help create file and folder -# names when copying data from the Examples folder. +# The following lambda functions help create file and directory +# names when copying data from the ``Examples`` directory. file_name = lambda s: s + ".aedt" results_name = lambda s: s + ".aedtresults" @@ -113,7 +113,7 @@ aedtapp.couplings.update_link(link) print('linked "' + link + '".') -# ## Calculate RF Interference +# ## Calculate RF interference # # Run the EMIT simulation. This portion of the EMIT API is not yet implemented. # @@ -138,12 +138,12 @@ aedtapp.save_project() aedtapp.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/antenna/interferences/index.rst b/examples/high_frequency/antenna/interferences/index.rst similarity index 100% rename from examples/03-high_frequency/antenna/interferences/index.rst rename to examples/high_frequency/antenna/interferences/index.rst diff --git a/examples/03-high_frequency/antenna/interferences/interference.py b/examples/high_frequency/antenna/interferences/interference.py similarity index 89% rename from examples/03-high_frequency/antenna/interferences/interference.py rename to examples/high_frequency/antenna/interferences/interference.py index e68dc80c2..2d6dac9e5 100644 --- a/examples/03-high_frequency/antenna/interferences/interference.py +++ b/examples/high_frequency/antenna/interferences/interference.py @@ -1,12 +1,12 @@ -# # Classify Interference Type +# # Interference type classification # # This example shows how to load an existing AEDT EMIT # design and analyze the results to classify the # worst-case interference. # -# Keywords: **EMIT**, **Interference**. +# Keywords: **EMIT**, **interference**. -# Perform required imports +# ## Perform imports and define constants # + import sys @@ -19,23 +19,24 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# Check that EMIT version 2023.2 or greater is installed. +# Check that EMIT 2023.2 or later is installed. if AEDT_VERSION <= "2023.1": - print("Warning: this example requires AEDT 2023.2 or later.") + print("Warning: This example requires AEDT 2023.2 or later.") sys.exit() # Download project @@ -50,7 +51,7 @@ non_graphical=NG_MODE, new_desktop=True, project=project_name, version=AEDT_VERSION ) -# ## Get a List of Transmitters +# ## Get lists of transmitters and receivers # # Get lists of all transmitters and receivers in the project. @@ -69,8 +70,8 @@ # ## Classify the interference # # Iterate over all the transmitters and receivers and compute the power -# at the input to each receiver due to each of the transmitters. Computes -# which, if any, type of interference occurred. +# at the input to each receiver due to each of the transmitters. Compute +# which type of interference occurred, if any. power_matrix = [] all_colors = [] @@ -157,9 +158,9 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios): # - -# ## Generate a legend +# ## Create a legend # -# Define the interference types and colors used to display the results of +# Create a legend, defining the interference types and colors used to display the results of # the analysis. @@ -216,10 +217,10 @@ def create_legend_table(): # Create a legend for the interference types create_legend_table() -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/antenna/interferences/interference_type.py b/examples/high_frequency/antenna/interferences/interference_type.py similarity index 98% rename from examples/03-high_frequency/antenna/interferences/interference_type.py rename to examples/high_frequency/antenna/interferences/interference_type.py index a4bd9fd34..0d5453e61 100644 --- a/examples/03-high_frequency/antenna/interferences/interference_type.py +++ b/examples/high_frequency/antenna/interferences/interference_type.py @@ -1,4 +1,4 @@ -# # Classify interference type GUI +# # Interference type classification using a GUI # # This example uses a GUI to open an AEDT project with # an EMIT design and analyze the results to classify the @@ -6,9 +6,9 @@ # # > **Note:** This example requires PySide6. # -# Keywords: **EMIT**, **User interface**. +# Keywords: **EMIT**, **user interface**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -22,12 +22,12 @@ from openpyxl.styles import PatternFill from PySide6 import QtCore, QtGui, QtUiTools, QtWidgets -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# Uncomment if there are Qt plugin errors +# Uncomment the following code if there are Qt plugin errors # import PySide6 # dirname = os.path.dirname(PySide6.__file__) # plugin_path = os.path.join(dirname, 'plugins', 'platforms') @@ -37,7 +37,7 @@ desktop = ansys.aedt.core.launch_desktop(AEDT_VERSION, NG_MODE, new_desktop=True) -# ## Add emitapi to system path to import EmitApiPython +# ## Add ``EmitApiPython`` module to system path to import it emit_path = os.path.join(desktop.install_path, "Delcross") sys.path.insert(0, emit_path) @@ -47,12 +47,12 @@ # ## Define GUI # -# Start with UI extension file. +# Define the UI extension file. ui_file = ansys.aedt.core.downloads.download_file("emit", "interference_gui.ui") Ui_MainWindow, _ = QtUiTools.loadUiType(ui_file) -# Then customize the GUI +# Customize the GUI. # + class DoubleDelegate(QtWidgets.QStyledItemDelegate): @@ -316,7 +316,7 @@ def open_file_dialog(self): emit_designs.append(d) # Add warning if no EMIT design - # NOTE: This should never happen since loading a project without an EMIT design + # NOTE: This should never happen because loading a project without an EMIT design # should add a blank EMIT design self.warning_label.setHidden(True) if len(emit_designs) == 0: @@ -722,9 +722,9 @@ def closeEvent(self, event): # - -# ## Run the GUI +# ## Run GUI # -# Launch the GUI. +# Run the GUI. if __name__ == "__main__": app = QtWidgets.QApplication([]) diff --git a/examples/03-high_frequency/antenna/interferences/protection.py b/examples/high_frequency/antenna/interferences/protection.py similarity index 88% rename from examples/03-high_frequency/antenna/interferences/protection.py rename to examples/high_frequency/antenna/interferences/protection.py index d317b601f..847fe7cc6 100644 --- a/examples/03-high_frequency/antenna/interferences/protection.py +++ b/examples/high_frequency/antenna/interferences/protection.py @@ -5,9 +5,9 @@ # power at the input to each receiver exceeds the specified protection # levels. # -# Keywords: **EMIT**, **Protection levels**. +# Keywords: **EMIT**, **protection levels**. -# ## Perform required imports +# ## Perform imports and define constants # import os @@ -21,14 +21,15 @@ # from ansys.aedt.core.emit_core.emit_constants import \ # InterfererType # noqa: F401 -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -42,7 +43,7 @@ # Check that the correct version of EMIT is installed. if AEDT_VERSION <= "2023.1": - print("Warning: this example requires AEDT 2023.2 or later.") + print("Warning: This example requires AEDT 2023.2 or later.") sys.exit() project_name = os.path.join(temp_folder.name, "emit.aedt") @@ -51,14 +52,14 @@ non_graphical=NG_MODE, new_desktop=True, project=project_name, version=AEDT_VERSION ) -# ## Specify the protection levels +# ## Specify protection levels # # The protection levels are specified in dBm. # If the damage threshold is exceeded, permanent damage to the receiver front # end may occur. # Exceeding the overload threshold severely densensitizes the receiver. -# Exceeding the intermod threshold can drive the victim receiver into non- -# linear operation, where it operates as a mixer. +# Exceeding the intermod threshold can drive the victim receiver into non-linear +# operation, where it operates as a mixer. # Exceeding the desense threshold reduces the signal-to-noise ratio and can # reduce the maximum range, maximum bandwidth, and/or the overall link quality. @@ -142,9 +143,9 @@ def get_radio_node(radio_name): rev = emitapp.results.analyze() -# ## Generate a legend +# ## Create a legend # -# Define the thresholds and colors used to display the results of +# Create a legend, defining the thresholds and colors used to display the results of # the protection level analysis. @@ -242,7 +243,7 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios): # # Get lists of all transmitters and receivers in the project. -# NOTE : The following code can be uncommented. +# > **Note:** You can uncomment the following code. # # rev = emitapp.results.current_revision # rx_radios = rev.get_receiver_names() @@ -253,9 +254,9 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios): # # Iterate over all the transmitters and receivers and compute the power # at the input to each receiver due to each of the transmitters. Computes -# which, if any, protection levels are exceeded by these power levels. +# which protection levels are exceeded by these power levels, if any. -# NOTE : The following code can be uncommented but depends on the previous commented code. +# > **Note:** Your ability to uncomment the following code depends on whether you uncommented the earlier code. # # power_matrix = [] # all_colors = [] @@ -264,10 +265,10 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios): # domain, global_levels=protection_levels # ) -# # Create a scenario matrix-like view for the protection levels +# ## Create a scenario matrix-like view for the protection levels # create_scenario_view(power_matrix, all_colors, tx_radios, rx_radios) -# # Create a legend for the protection levels +# ## Create a legend for the protection levels # create_legend_table() # ## Release AEDT @@ -276,12 +277,12 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios): emitapp.save_project() emitapp.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/antenna/large_scenarios/city.py b/examples/high_frequency/antenna/large_scenarios/city.py similarity index 74% rename from examples/03-high_frequency/antenna/large_scenarios/city.py rename to examples/high_frequency/antenna/large_scenarios/city.py index 4b811feb1..0a7bdfa52 100644 --- a/examples/03-high_frequency/antenna/large_scenarios/city.py +++ b/examples/high_frequency/antenna/large_scenarios/city.py @@ -1,11 +1,11 @@ -# # Import Geometry from Maps +# # Geometry import from maps # -# This example shows how you can use PyAEDT to create an HFSS SBR+ project from an -# OpenStreeMaps. +# This example shows how to use PyAEDT to create an HFSS SBR+ project from +# OpenStreetMap. # # Keywords: **HFSS**, **SBR+**, **city**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports and set up the local path to the PyAEDT # directory path. @@ -16,14 +16,15 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -43,9 +44,9 @@ non_graphical=NG_MODE, ) -# ## Define Location to import +# ## Define location to import # -# Define latitude and longitude to import. +# Define the latitude and longitude of the location to import. ansys_home = [40.273726, -80.168269] @@ -79,12 +80,12 @@ app.save_project() app.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/antenna/large_scenarios/doppler.py b/examples/high_frequency/antenna/large_scenarios/doppler.py similarity index 88% rename from examples/03-high_frequency/antenna/large_scenarios/doppler.py rename to examples/high_frequency/antenna/large_scenarios/doppler.py index 45fde1226..3ba033c7b 100644 --- a/examples/03-high_frequency/antenna/large_scenarios/doppler.py +++ b/examples/high_frequency/antenna/large_scenarios/doppler.py @@ -1,11 +1,11 @@ # # Doppler setup # -# This example shows how you can use PyAEDT to create a multipart scenario in HFSS SBR+ +# This example shows how to use PyAEDT to create a multipart scenario in HFSS SBR+ # and set up a doppler analysis. # # Keywords: **HFSS**, **SBR+**, **doppler**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,15 +15,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -50,8 +51,8 @@ non_graphical=NG_MODE, ) -# Creation of the "actors" in the scene is comprised of many editing steps. Disabling the "autosave" option helps -# avoids delays that occur while the project is being saved. +# Creation of the "actors" in the scene is comprised of many editing steps. Disabling the autosave option helps +# avoid delays that occur while the project is being saved. app.autosave_disable() @@ -145,7 +146,7 @@ # ## Create setup # -# Create setup and validate it. The ``create_sbr_pulse_doppler_setup`` method +# Create setup and validate it. The ``create_sbr_pulse_doppler_setup()`` method # creates a setup and a parametric sweep on the time variable with a # duration of two seconds. The step is computed automatically from CPI. @@ -178,12 +179,12 @@ app.save_project() app.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/antenna/large_scenarios/index.rst b/examples/high_frequency/antenna/large_scenarios/index.rst similarity index 100% rename from examples/03-high_frequency/antenna/large_scenarios/index.rst rename to examples/high_frequency/antenna/large_scenarios/index.rst diff --git a/examples/03-high_frequency/antenna/large_scenarios/reflector.py b/examples/high_frequency/antenna/large_scenarios/reflector.py similarity index 86% rename from examples/03-high_frequency/antenna/large_scenarios/reflector.py rename to examples/high_frequency/antenna/large_scenarios/reflector.py index e82ffe08b..98d741cf2 100644 --- a/examples/03-high_frequency/antenna/large_scenarios/reflector.py +++ b/examples/high_frequency/antenna/large_scenarios/reflector.py @@ -1,11 +1,11 @@ # # Reflector # -# This example shows how you can use PyAEDT to create an HFSS SBR+ project from an +# This example shows how to use PyAEDT to create an HFSS SBR+ project from an # HFSS antenna and run a simulation. # # Keywords: **HFSS**, **SBR+**, **reflector**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports and set up the local path to the path for the PyAEDT # directory. @@ -16,15 +16,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -99,9 +100,9 @@ setup1["RangeStart"] = "10GHz" target.analyze(cores=NUM_CORES) -# ## Post-processing +# ## Postprocess # -# Plot results in Electronics Desktop. +# Plot results in AEDT. variations = target.available_variations.nominal_w_values_dict variations["Freq"] = ["10GHz"] @@ -134,12 +135,12 @@ target.save_project() target.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/antenna/large_scenarios/time_domain.py b/examples/high_frequency/antenna/large_scenarios/time_domain.py similarity index 80% rename from examples/03-high_frequency/antenna/large_scenarios/time_domain.py rename to examples/high_frequency/antenna/large_scenarios/time_domain.py index b44b83cc4..4a6b77631 100644 --- a/examples/03-high_frequency/antenna/large_scenarios/time_domain.py +++ b/examples/high_frequency/antenna/large_scenarios/time_domain.py @@ -1,11 +1,11 @@ # # HFSS to SBR+ time animation # -# This example shows how you can use PyAEDT to create an SBR+ time animation +# This example shows how to use PyAEDT to create an SBR+ time animation # and save it to a GIF file. This example works only on CPython. # # Keywords: **HFSS**, **SBR+**, **time domain**, **IFFT**. -# ## Perform required imports. +# ## Perform imports and define constants # # Perform required imports. @@ -15,16 +15,17 @@ from ansys.aedt.core import Hfss, downloads -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -48,7 +49,7 @@ # ## Get solution data # -# Get solution data. After simulation is performed, you can load solutions +# Get solution data. After the simulation is performed, you can load solutions # in the ``solution_data`` object. solution_data = hfss.post.get_solution_data( @@ -94,12 +95,12 @@ hfss.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/antenna/patch.py b/examples/high_frequency/antenna/patch.py similarity index 85% rename from examples/03-high_frequency/antenna/patch.py rename to examples/high_frequency/antenna/patch.py index f84ba2098..3a9a65d16 100644 --- a/examples/03-high_frequency/antenna/patch.py +++ b/examples/high_frequency/antenna/patch.py @@ -8,7 +8,7 @@ # # Keywords: **HFSS**, **terminal**, **antenna**., **patch**. # -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -19,16 +19,16 @@ import ansys.aedt.core from ansys.aedt.core.modeler.advanced_cad.stackup_3d import Stackup3D -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -36,7 +36,7 @@ # ## Launch HFSS # -# Launch HFSS and change length units. +# Launch HFSS and change the length units. project_name = os.path.join(temp_folder.name, "patch.aedt") hfss = ansys.aedt.core.Hfss( @@ -107,13 +107,13 @@ hfss.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/03-high_frequency/emc/armoured_cable.py b/examples/high_frequency/emc/armoured_cable.py similarity index 83% rename from examples/03-high_frequency/emc/armoured_cable.py rename to examples/high_frequency/emc/armoured_cable.py index 4faea47a4..4feec200a 100644 --- a/examples/03-high_frequency/emc/armoured_cable.py +++ b/examples/high_frequency/emc/armoured_cable.py @@ -1,20 +1,19 @@ # # Cable parameter identification -# This example shows how you can use PyAEDT to perform these tasks: +# This example shows how to use PyAEDT to perform these tasks: # -# - Create a Q2D design using modeler primitives and imported CAD. +# - Create a Q2D design using modeler primitives and an imported CAD. # - Set up the simulation. # - Link the solution to a Simplorer design. # -# For information on the cable model used in this example please see the following link: -# -# - [4 Core Armoured Power Cable] -# (https://www.luxingcable.com/low-voltage-cables/4-core-armoured-power-cable.html) +# For information on the cable model used in this example, see +# [4 Core Armoured Power Cable](https://www.luxingcable.com/low-voltage-cables/4-core-armoured-power-cable.html). # # Keywords: **Q2D**, **EMC**, **cable**. -# ## Perform required imports +# ## Perform imports and define constants # +# Perform required imports. import math import os @@ -23,18 +22,23 @@ import ansys.aedt.core -# ## Create temporary directory - -temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") - # Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. + +# ## Create temporary directory +# +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. + +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Set up for model creation # -# Initialize cable sizing - radii in mm. +# Initialize cable sizing by specifying radii in millimeters. c_strand_radius = 2.575 cable_n_cores = 4 @@ -58,8 +62,8 @@ arm_strand_rad = armour_thickness / 2.0 - 0.2 n_arm_strands = 30 -# Start an instance of the Q2D extractor, providing the version, project name, design -# name and type. +# Start an instance of Q2D Extractor, providing the version, project name, design +# name, and type. project_name = os.path.join(temp_folder.name, "Q2D_ArmouredCableExample.aedt") q2d_design_name = "2D_Extractor_Cable" @@ -74,7 +78,7 @@ ) q2d.modeler.model_units = "mm" -# Assign the variables to the Q3D design. +# Assign variables to the Q3D design. core_params = { "n_cores": str(cable_n_cores), @@ -101,8 +105,9 @@ q2d[k] = v # 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) +# included in the ``Sys`` library. +# +# Define Plastic, PE (cross-linked, wire, and cable grade): mat_pe_cable_grade = q2d.materials.add_material("plastic_pe_cable_grade") mat_pe_cable_grade.conductivity = "1.40573e-16" @@ -110,13 +115,13 @@ mat_pe_cable_grade.dielectric_loss_tangent = "0.000264575" mat_pe_cable_grade.update() -# Plastic, PP (10% carbon fiber) +# Define Plastic, PP (10% carbon fiber): mat_pp = q2d.materials.add_material("plastic_pp_carbon_fiber") mat_pp.conductivity = "0.0003161" mat_pp.update() -# ## Model Creation +# ## Create model # # Create the geometry for core strands, fill, and XLPE insulation. @@ -191,7 +196,7 @@ ) arm_fill_id.color = (255, 255, 255) -# Create geometry for the outer sheath. +# Create the geometry for the outer sheath. outer_sheath_id = q2d.modeler.create_circle( origin=["0mm", "0mm", "0mm"], @@ -201,7 +206,7 @@ ) outer_sheath_id.color = (0, 0, 0) -# Create the geometry for armature steel strands. +# Create the geometry for the armature steel strands. arm_strand_1_id = q2d.modeler.create_circle( origin=["0mm", "armour_centre_pos", "0mm"], @@ -240,23 +245,25 @@ model = q2d.plot(show=False) model.plot(os.path.join(temp_folder.name, "Image.jpg")) -# Specify the design settings +# Specify the design settings. lumped_length = "100m" q2d.design_settings["LumpedLength"] = lumped_length -# ## Solve the model +# ## Solve model # -# Insert setup and frequency sweep +# Insert the setup and frequency sweep. q2d_setup = q2d.create_setup(name=setup_name) q2d_sweep = q2d_setup.add_sweep(name=sweep_name) # The cable model is generated by running two solution types: +# # 1. Capacitance and conductance per unit length (CG). # For this model, the CG solution runs in a few seconds. +# # 2. Series resistance and inductance (RL). -# For this model the solution time can range from 15-20 minutes, +# For this model, the solution time can range from 15-20 minutes, # depending on the available hardware. # # Uncomment the following line to run the analysis. @@ -267,7 +274,7 @@ # ## Evaluate results # -# Add a Simplorer/Twin Builder design and the Q3D dynamic component +# Add a Simplorer/Twin Builder design and the Q3D dynamic component. tb = ansys.aedt.core.TwinBuilder(design=tb_design_name, version=AEDT_VERSION) @@ -286,13 +293,13 @@ tb.save_project() tb.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/emc/busbar.py b/examples/high_frequency/emc/busbar.py similarity index 88% rename from examples/03-high_frequency/emc/busbar.py rename to examples/high_frequency/emc/busbar.py index 5c0be70a1..e05302d52 100644 --- a/examples/03-high_frequency/emc/busbar.py +++ b/examples/high_frequency/emc/busbar.py @@ -1,11 +1,11 @@ # # Busbar analysis -# This example shows how you can use PyAEDT to create a busbar design in +# This example shows how to use PyAEDT to create a busbar design in # Q3D Extractor and run a simulation. # # Keywords: **Q3D**, **EMC*, **busbar**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,7 +15,7 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 @@ -23,7 +23,8 @@ # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -125,9 +126,9 @@ sweep.props["RangeStep"] = "5MHz" sweep.update() -# ### Setup for postprocessing +# ### Set up for postprocessing # -# Specify the traces that will be displayed after solving the model. +# Specify the traces to display after solving the model. data_plot_self = q3d.matrices[0].get_sources_for_plot( get_self_terms=True, get_mutual_terms=False @@ -136,7 +137,7 @@ get_self_terms=False, get_mutual_terms=True, category="C" ) -# Define a plot and a data table in Electronics Desktop for visualizing results. +# Define a plot and a data table in AEDT for visualizing results. q3d.post.create_report(expressions=data_plot_self) q3d.post.create_report( @@ -160,13 +161,13 @@ q3d.save_project() q3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/emc/choke.py b/examples/high_frequency/emc/choke.py similarity index 83% rename from examples/03-high_frequency/emc/choke.py rename to examples/high_frequency/emc/choke.py index c9d0c1799..8a543fce5 100644 --- a/examples/03-high_frequency/emc/choke.py +++ b/examples/high_frequency/emc/choke.py @@ -1,10 +1,10 @@ # # Choke # -# This example shows how you can use PyAEDT to create a choke setup in HFSS. +# This example shows how to use PyAEDT to create a choke setup in HFSS. # # Keywords: **HFSS**, **EMC**, **choke**, . -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,15 +15,15 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -40,7 +40,7 @@ solution_type="Terminal", ) -# ## Rules and information of use +# ## Define parameters # # The dictionary values contain the different parameter values of the core and # the windings that compose the choke. You must not change the main structure of @@ -58,23 +58,23 @@ # correct one by default. For the dictionaries from ``"Core"`` through ``"Inner Winding"``, # values must be strings, floats, or integers. # -# Descriptions follow for primary keys: +# Descriptions follow for the primary keys: # -# - ``"Number of Windings"``: Number of windings around the core -# - ``"Layer"``: Number of layers of all windings +# - ``"Number of Windings"``: Number of windings around the core. +# - ``"Layer"``: Number of layers of all windings. # - ``"Layer Type"``: Whether layers of a winding are linked to each other # - ``"Similar Layer"``: Whether layers of a winding have the same number of turns and -# same spacing between turns -# - ``"Mode"``: When there are only two windows, whether they are in common or differential mode -# - ``"Wire Section"``: Type of wire section and number of segments -# - ``"Core"``: Design of the core +# same spacing between turns. +# - ``"Mode"``: When there are only two windows, whether they are in common or differential mode. +# - ``"Wire Section"``: Type of wire section and number of segments. +# - ``"Core"``: Design of the core. # - ``"Outer Winding"``: Design of the first layer or outer layer of a winding and the common -# parameters for all layers -# - ``"Mid Winding"``: Turns and turns spacing ("Coil Pit") for the second or -# mid layer if it is necessary -# - ``"Inner Winding"``: Turns and turns spacing ("Coil Pit") for the third or inner -# layer if it is necessary -# - ``"Occupation(%)"``: An informative parameter that is useless to modify +# parameters for all layers. +# - ``"Mid Winding"``: Turns and turns spacing (``Coil Pit``) for the second or +# mid layer if it is necessary. +# - ``"Inner Winding"``: Turns and turns spacing (``Coil Pit``) for the third or inner +# layer if it is necessary. +# - ``"Occupation(%)"``: An informative parameter that is useless to modify. # # The following parameter values work. You can modify them if you want. @@ -110,7 +110,7 @@ # ## Convert dictionary to JSON file # -# Convert a dictionary to a JSON file. You must supply the path of the +# Convert the dictionary to a JSON file. You must supply the path of the # JSON file as an argument. json_path = os.path.join(hfss.working_directory, "choke_example.json") @@ -119,11 +119,11 @@ # ## Verify parameters of JSON file # -# Verify parameters of the JSON file. The ``check_choke_values`` method takes +# Verify parameters of the JSON file. The ``check_choke_values()`` method takes # the JSON file path as an argument and does the following: # -# - Checks if the JSON file is correctly written (as explained in the rules) -# - Checks in equations on windings parameters to avoid having unintended intersections +# - Checks if the JSON file is correctly written (as explained earlier). +# - Checks equations on windings parameters to avoid having unintended intersections. dictionary_values = hfss.modeler.check_choke_values( json_path, create_another_file=False @@ -142,8 +142,6 @@ second_winding_list = list_object[3] # ## Create ground -# -# Create a ground. ground_radius = 1.2 * dictionary_values[1]["Outer Winding"]["Outer Radius"] ground_position = [0, 0, first_winding_list[1][0][2] - 2] @@ -154,8 +152,6 @@ ground.transparency = 0.9 # ## Create lumped ports -# -# Create lumped ports. port_position_list = [ [ @@ -192,8 +188,6 @@ ) # ## Create mesh -# -# Create the mesh. # + cylinder_height = 2.5 * dictionary_values[1]["Outer Winding"]["Height"] @@ -256,13 +250,13 @@ hfss.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/emc/eigenmode.py b/examples/high_frequency/emc/eigenmode.py similarity index 76% rename from examples/03-high_frequency/emc/eigenmode.py rename to examples/high_frequency/emc/eigenmode.py index 78c482560..17d32ee17 100644 --- a/examples/03-high_frequency/emc/eigenmode.py +++ b/examples/high_frequency/emc/eigenmode.py @@ -1,19 +1,20 @@ # # Eigenmode filter # -# This example shows how you can use PyAEDT to automate the eigenmode solver in HFSS. -# Eigenmode analysis can be applied to open, radiating structures +# This example shows how to use PyAEDT to automate the Eigenmode solver in HFSS. +# Eigenmode analysis can be applied to open radiating structures # using an absorbing boundary condition. This type of analysis is useful for -# determining the resonant frequency of a geometry or an antenna and can be used to refine +# determining the resonant frequency of a geometry or an antenna, and it can be used to refine # the mesh at the resonance, even when the resonant frequency of the antenna is not known. # # The challenge posed by this method is to identify and filter the non-physical modes # resulting from reflection from boundaries of the main domain. # Because the Eigenmode solver sorts by frequency and does not filter on the -# quality factor, these virtual modes are present when the eigenmode approach is +# quality factor, these virtual modes are present when the Eigenmode approach is # applied to nominally open structures. +# # When looking for resonant modes over a wide frequency range for nominally # enclosed structures, several iterations may be required because the minimum frequency -# is determined manually and simulations re-run until the complete frequency range is covered +# is determined manually. Simulations re-run until the complete frequency range is covered # and all important physical modes are calculated. # # The following script finds the physical modes of a model in a wide frequency @@ -26,7 +27,7 @@ # # Keywords: **HFSS**, **Eigenmode**, **resonance**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -36,16 +37,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -68,20 +69,20 @@ # ## Launch HFSS # -# Create a new HFSS design. +# Create an HFSS design. hfss = ansys.aedt.core.Hfss( version=AEDT_VERSION, project=project_path, non_graphical=NG_MODE ) -# ## Input parameters for eigenmode solver +# ## Input parameters for Eigenmode solver # # The geometry and material should be already set. The analyses are generated by the code. -# Number of modes during each analysis, max allowed number is 20. -# Entering a number higher than 10 might need long simulation time as the -# eigenmode solver needs to converge on modes. ``fmin`` is the lowest frequency -# of interest. ``fmax`` is the highest frequency of interest. -# ``limit`` is the parameter limit that determines which modes are ignored. +# The ``num_modes`` parameter is the number of modes during each analysis. The maximum +# allowed number is 20. Entering a number higher than 10 might result in a long simulation +# time as the Eigenmode solver must converge on modes. The ``fmin`` parameter is the lowest +# frequency of interest. The ``fmax`` parameter is the highest frequency of interest. +# The ``limit`` parameter determines which modes are ignored. num_modes = 6 fmin = 1 @@ -91,9 +92,9 @@ limit = 10 resonance = {} -# ## Find the modes +# ## Find modes # -# The following cell defines a function that can be used to create and solve an eigenmode setup. +# The following cell defines a function that can be used to create and solve an Eigenmode setup. # After solving the model, information about each mode is saved for subsequent processing. @@ -109,10 +110,10 @@ def find_resonance(): setup.props["MinimumPasses"] = 3 setup.props["MaxDeltaFreq"] = 5 - # Analyzing the eigenmode setup + # Analyze the Eigenmode setup hfss.analyze_setup(setup_name, cores=NUM_CORES, use_auto_settings=True) - # Getting the Q and real frequency of each mode + # Get the Q and real frequency of each mode eigen_q_quantities = hfss.post.available_report_quantities( quantities_category="Eigen Q" ) @@ -135,11 +136,11 @@ def find_resonance(): return data -# ## Automate eigenmode solution +# ## Automate Eigenmode solution # # Running the next cell calls the resonance function and saves # only those modes with a Q higher than the defined -# limit. The ``find_resonance`` function is called until the complete +# limit. The ``find_resonance()`` function is called until the complete # frequency range is covered. # When the automation ends, the physical modes in the whole frequency # range are reported. @@ -160,7 +161,7 @@ def find_resonance(): print(str(resonance_frequencies)) # - -# Plot the model +# Plot the model. hfss.modeler.fit_all() hfss.plot( @@ -173,13 +174,13 @@ def find_resonance(): hfss.save_project() d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/03-high_frequency/emc/flex_cable.py b/examples/high_frequency/emc/flex_cable.py similarity index 90% rename from examples/03-high_frequency/emc/flex_cable.py rename to examples/high_frequency/emc/flex_cable.py index ef8ea4eaa..a79c7fb0e 100644 --- a/examples/03-high_frequency/emc/flex_cable.py +++ b/examples/high_frequency/emc/flex_cable.py @@ -1,11 +1,11 @@ # # Flex cable CPWG # -# This example shows how you can use PyAEDT to create a flex cable CPWG +# This example shows how to use PyAEDT to create a flex cable CPWG # (coplanar waveguide with ground). # # Keywords: **HFSS**, **flex cable**, **CPWG**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,7 +16,7 @@ import ansys.aedt.core from ansys.aedt.core.generic.general_methods import generate_unique_name -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" @@ -27,10 +27,10 @@ non_graphical = False -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -50,7 +50,7 @@ os.path.join(temp_folder.name, generate_unique_name("example") + ".aedt") ) -# ## Design settings +# ## Modify design settings # # Modify some design settings. @@ -79,7 +79,7 @@ # ## Create bend # -# The ``create_bending`` method creates a list of points for +# The ``create_bending()`` method creates a list of points for # the bend based on the curvature radius and extension. @@ -208,7 +208,7 @@ def create_bending(radius, extension=0): # ## Create ports # -# Creates ports. +# Create ports. for s, port_name in zip(port_faces, ["1", "2"]): reference = [i.name for i in gnd_objs + boundary + [bot]] + ["b1", "b2"] @@ -249,6 +249,11 @@ def create_bending(radius, extension=0): hfss.release_desktop() -# ## Clean temporary directory +# ## Clean up +# +# All project files are saved in the folder ``temp_folder.name``. +# If you've run this example as a Jupyter notebook, you +# can retrieve those project files. +# The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/emc/index.rst b/examples/high_frequency/emc/index.rst similarity index 59% rename from examples/03-high_frequency/emc/index.rst rename to examples/high_frequency/emc/index.rst index fd141309c..76d18e98e 100644 --- a/examples/03-high_frequency/emc/index.rst +++ b/examples/high_frequency/emc/index.rst @@ -1,7 +1,7 @@ EMC ~~~ -These examples use PyAEDT to show some EMC examples +These examples use PyAEDT to show some EMC applications. .. nbgallery:: @@ -11,5 +11,5 @@ These examples use PyAEDT to show some EMC examples armoured_cable.py busbar.py subcircuit.py - ../../02-aedt_general/modeler/circuit_schematic.py + ../../aedt_general/modeler/circuit_schematic.py ../antenna/interferences/index diff --git a/examples/03-high_frequency/emc/subcircuit.py b/examples/high_frequency/emc/subcircuit.py similarity index 80% rename from examples/03-high_frequency/emc/subcircuit.py rename to examples/high_frequency/emc/subcircuit.py index 4378482e2..b263b664d 100644 --- a/examples/03-high_frequency/emc/subcircuit.py +++ b/examples/high_frequency/emc/subcircuit.py @@ -1,14 +1,14 @@ # # Schematic subcircuit management # # This example shows how to add a subcircuit to a circuit design. -# In this example, the focus is changed within the hierarchy between +# It changes the focus within the hierarchy between # the child subcircuit and the parent design. # # Keywords: **Circuit**, **EMC**, **schematic**. -# ## Imports +# ## Perform imports and define constants # -# Perform the required import. +# Perform required imports. import os import tempfile @@ -16,14 +16,15 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -42,7 +43,7 @@ ) circuit.modeler.schematic_units = "mil" -# ## Add Subcircuit +# ## Add subcircuit # # Add a new subcircuit to the previously created circuit design, creating a # child circuit. Push this child circuit down into the child subcircuit. @@ -51,12 +52,12 @@ subcircuit_name = subcircuit.composed_name circuit.push_down(subcircuit) -# ## Parametrization +# ## Parametrize subcircuit # # Parametrize the subcircuit and add a resistor, inductor, and a capacitor with -# the parameter values. Components are connected in series +# parameter values. Components are connected in series, # and the focus is changed to the parent schematic using -# the ``pop_up`` method. +# the ``pop_up()`` method. circuit.variable_manager.set_variable(variable_name="R_val", expression="35ohm") circuit.variable_manager.set_variable(variable_name="L_val", expression="1e-7H") @@ -77,12 +78,12 @@ circuit.save_project() circuit.release_desktop() -# Wait 5 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 5 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(5) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/index.rst b/examples/high_frequency/index.rst similarity index 80% rename from examples/03-high_frequency/index.rst rename to examples/high_frequency/index.rst index 218e0dfde..4f9819421 100644 --- a/examples/03-high_frequency/index.rst +++ b/examples/high_frequency/index.rst @@ -1,7 +1,7 @@ -High Frequency +High frequency ============== -These end-to-end examples show how you can use PyAEDT for high frequency applications. +These end-to-end examples show how to use PyAEDT for high-frequency applications. .. grid:: 2 @@ -17,7 +17,7 @@ These end-to-end examples show how you can use PyAEDT for high frequency applica :height: 200px :align: center - This section shows some Antenna workflows + Antenna examples .. grid-item-card:: IC-Package-PCB :padding: 2 2 2 2 @@ -30,7 +30,7 @@ These end-to-end examples show how you can use PyAEDT for high frequency applica :height: 200px :align: center - This section shows some layout automation examples + Layout automation examples .. grid-item-card:: Radio frequency and millimeter wave :padding: 2 2 2 2 @@ -43,7 +43,7 @@ These end-to-end examples show how you can use PyAEDT for high frequency applica :height: 200px :align: center - This section shows some RF and millimeter wave workflows + Radio frequency and millimeter wave examples .. grid-item-card:: EMC :padding: 2 2 2 2 @@ -56,7 +56,7 @@ These end-to-end examples show how you can use PyAEDT for high frequency applica :height: 200px :align: center - This section shows some EMC examples + EMC examples .. grid-item-card:: Multiphysics :padding: 2 2 2 2 @@ -69,7 +69,7 @@ These end-to-end examples show how you can use PyAEDT for high frequency applica :height: 200px :align: center - This section shows some multiphysics examples + Multiphysics examples .. grid-item-card:: Report :padding: 2 2 2 2 @@ -82,7 +82,7 @@ These end-to-end examples show how you can use PyAEDT for high frequency applica :height: 200px :align: center - This section shows report examples + Report examples .. toctree:: :hidden: diff --git a/examples/03-high_frequency/layout/_static/power_integrity.png b/examples/high_frequency/layout/_static/power_integrity.png similarity index 100% rename from examples/03-high_frequency/layout/_static/power_integrity.png rename to examples/high_frequency/layout/_static/power_integrity.png diff --git a/examples/03-high_frequency/layout/_static/pyedb.png b/examples/high_frequency/layout/_static/pyedb.png similarity index 100% rename from examples/03-high_frequency/layout/_static/pyedb.png rename to examples/high_frequency/layout/_static/pyedb.png diff --git a/examples/03-high_frequency/layout/_static/pyedb2.png b/examples/high_frequency/layout/_static/pyedb2.png similarity index 100% rename from examples/03-high_frequency/layout/_static/pyedb2.png rename to examples/high_frequency/layout/_static/pyedb2.png diff --git a/examples/03-high_frequency/layout/_static/signal_integrity.png b/examples/high_frequency/layout/_static/signal_integrity.png similarity index 100% rename from examples/03-high_frequency/layout/_static/signal_integrity.png rename to examples/high_frequency/layout/_static/signal_integrity.png diff --git a/examples/03-high_frequency/layout/_static/user_interface.png b/examples/high_frequency/layout/_static/user_interface.png similarity index 100% rename from examples/03-high_frequency/layout/_static/user_interface.png rename to examples/high_frequency/layout/_static/user_interface.png diff --git a/examples/03-high_frequency/layout/gui_manipulation.py b/examples/high_frequency/layout/gui_manipulation.py similarity index 73% rename from examples/03-high_frequency/layout/gui_manipulation.py rename to examples/high_frequency/layout/gui_manipulation.py index 188ba6cdd..9b1c3934d 100644 --- a/examples/03-high_frequency/layout/gui_manipulation.py +++ b/examples/high_frequency/layout/gui_manipulation.py @@ -1,12 +1,12 @@ -# # User interface modification +# # HFSS Layout UI modification # -# This example shows how to modify the 3D Layout user interface. +# This example shows how to modify the HFSS 3D Layout UI. # # -# Keywords: **HFSS 3D Layout**, **User interface**. +# Keywords: **HFSS 3D Layout**, **UI**, **user interface**. -# # Preparation -# Import required packages +# ## Perform imports and define constants +# Perform required imports. # + @@ -19,16 +19,16 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = True # Open Electronics UI when the application is launched. +NG_MODE = True # Open AEDT UI when it is launched. # Check if AEDT is launched in graphical mode. if not NG_MODE: - print("Warning: this example requires graphical mode enabled.") + print("Warning: This example requires graphical mode enabled.") sys.exit() # Download example board. @@ -66,7 +66,7 @@ # ## Disable component visibility -# Disable component visibility for ``"1_Top"`` and ``"16_Bottom"`` layers. +# Disable component visibility for the ``"1_Top"`` and ``"16_Bottom"`` layers. top = h3d.modeler.layers.layers[h3d.modeler.layers.layer_id("1_Top")] top.is_visible_component = False @@ -74,7 +74,7 @@ bot = h3d.modeler.layers.layers[h3d.modeler.layers.layer_id("16_Bottom")] bot.is_visible_component = False -# ## Display the Layout +# ## Display the layout # # Fit all so that you can visualize all. @@ -84,13 +84,13 @@ h3d.save_project() h3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/layout/index.rst b/examples/high_frequency/layout/index.rst similarity index 70% rename from examples/03-high_frequency/layout/index.rst rename to examples/high_frequency/layout/index.rst index 75c3bea60..a4781deea 100644 --- a/examples/03-high_frequency/layout/index.rst +++ b/examples/high_frequency/layout/index.rst @@ -1,12 +1,12 @@ IC-Package-PCB ============== -These examples use PyAEDT to show some layout examples +These examples use PyAEDT to show some layout applications. .. grid:: 3 - .. grid-item-card:: Layout pre-processing + .. grid-item-card:: Layout preprocessing :padding: 2 2 2 2 :link: https://edb.docs.pyansys.com/version/stable/examples/legacy_standalone/index.html :link-type: url @@ -17,7 +17,7 @@ These examples use PyAEDT to show some layout examples :height: 150px :align: center - End-to-end examples show how you can use PyEDB. + Links to examples in the AEDT documentation that show how to use the legacy PyEDB API as a standalone package. .. grid-item-card:: Power integrity :padding: 2 2 2 2 @@ -30,7 +30,7 @@ These examples use PyAEDT to show some layout examples :height: 150px :align: center - Power integrity examples. + Provides power integrity examples. .. grid-item-card:: Signal integrity :padding: 2 2 2 2 @@ -43,9 +43,9 @@ These examples use PyAEDT to show some layout examples :height: 150px :align: center - Signal integrity examples. + Provides signal integrity examples - .. grid-item-card:: Layout user interface + .. grid-item-card:: HFSS 3D Layout GUI modificatation :padding: 2 2 2 2 :link: gui_manipulation :link-type: doc @@ -56,9 +56,9 @@ These examples use PyAEDT to show some layout examples :height: 150px :align: center - HFSS 3D Layout Gui manipulation. + Provides HFSS 3D Layout GUI modification examples. - .. grid-item-card:: Configuration files + .. grid-item-card:: PyEDB configuration files :padding: 2 2 2 2 :link: https://edb.docs.pyansys.com/version/stable/examples/use_configuration/index.html :link-type: url @@ -69,4 +69,4 @@ These examples use PyAEDT to show some layout examples :height: 150px :align: center - PyEDB configuration file examples. \ No newline at end of file + Links to examples in the PyAEDT documentation that show how to use PyEDB configuration files. \ No newline at end of file diff --git a/examples/03-high_frequency/layout/power_integrity/ac_q3d.py b/examples/high_frequency/layout/power_integrity/ac_q3d.py similarity index 79% rename from examples/03-high_frequency/layout/power_integrity/ac_q3d.py rename to examples/high_frequency/layout/power_integrity/ac_q3d.py index c5cdff014..0512dc186 100644 --- a/examples/03-high_frequency/layout/power_integrity/ac_q3d.py +++ b/examples/high_frequency/layout/power_integrity/ac_q3d.py @@ -1,11 +1,11 @@ # # PCB AC analysis -# This example shows how you can use PyAEDT to create a design in -# Q3D Extractor and run a simulation starting from an EDB Project. +# This example shows how to use PyAEDT to create a design in +# Q3D Extractor and run a simulation starting from an EDB project. # # Keywords: **Q3D**, **PCB**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,23 +16,24 @@ import ansys.aedt.core import pyedb -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Setup project files and path +# ## Set up project files and path # -# Download of needed project file and setup of temporary project directory. +# Download needed project file and set up temporary project directory. # + project_dir = os.path.join(temp_folder.name, "edb") @@ -45,9 +46,9 @@ output_q3d = os.path.join(project_dir, project_name + "_q3d.aedt") # - -# ## Open EDB +# ## Open EDB and create cutout # -# Open the edb project and created a cutout on the selected nets +# Open the EDB project and create a cutout on the selected nets # before exporting to Q3D. edb = pyedb.Edb(aedb_project, edbversion=AEDT_VERSION) @@ -59,10 +60,10 @@ ) -# ## Identify the position of pins +# ## Identify locations of pins # # Identify $(x,y)$ pin locations on the components to define where to assign sources -# and sinks for Q3D and append Z elevation. +# and sinks for Q3D. pin_u13_scl = [ i for i in edb.components["U13"].pins.values() if i.net_name == "CLOCK_I2C_SCL" @@ -77,9 +78,9 @@ i for i in edb.components["U1"].pins.values() if i.net_name == "CLOCK_I2C_SDA" ] -# ## Append Z Positions +# ## Append Z elevation positions # -# Note: The factor 1000 converts from "meters" to "mm" +# > **Note:** The factor 1000 converts from meters to millimeters. # + location_u13_scl = [i * 1000 for i in pin_u13_scl[0].position] @@ -95,9 +96,9 @@ location_u1_sda.append(edb.components["U1"].upper_elevation * 1000) # - -# ## Save and close the EDB +# ## Save and close EDB # -# Save, close Edb and open it in Hfss 3D Layout to generate the 3D model. +# Save and close EDB. Then, open the EDB project in HFSS 3D Layout to generate the 3D model. # + edb.save_edb() @@ -111,7 +112,7 @@ # ## Set up the Q3D Project # # Use HFSS 3D Layout to export the model to Q3D Extractor. The named parameter -# ``keep_net_name=True`` ensures that net names are retained when the model is exported from Hfss 3D Layout. +# ``keep_net_name=True`` ensures that net names are retained when the model is exported from HFSS 3D Layout. setup = h3d.create_setup() setup.export_to_q3d(output_q3d, keep_net_name=True) @@ -128,7 +129,7 @@ plot_air_objects=False, ) -# Use previously calculated position to identify faces and +# Use the previously calculated positions to identify faces and # assign sources and sinks on nets. f1 = q3d.modeler.get_faceid_from_position(location_u13_scl, assignment="CLOCK_I2C_SCL") @@ -151,14 +152,14 @@ ) setup.analyze(num_cores=NUM_CORES) -# ### Solve +# ## Solve # # Compute AC inductance and resistance. traces_acl = q3d.post.available_report_quantities(quantities_category="ACL Matrix") solution = q3d.post.get_solution_data(traces_acl) -# ## Post-Processing +# ## Postprocess # # Plot AC inductance and resistance. @@ -171,13 +172,13 @@ q3d.save_project() q3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/layout/power_integrity/dcir.py b/examples/high_frequency/layout/power_integrity/dcir.py similarity index 71% rename from examples/03-high_frequency/layout/power_integrity/dcir.py rename to examples/high_frequency/layout/power_integrity/dcir.py index 56ead2037..26bb49f45 100644 --- a/examples/03-high_frequency/layout/power_integrity/dcir.py +++ b/examples/high_frequency/layout/power_integrity/dcir.py @@ -1,25 +1,25 @@ -# # DC IR Analysis -# This example shows how to configure EDB for DC IR analysis, and load EDB into the 3D Layout UI for analysis and -# post-processing. +# # DC IR analysis +# This example shows how to configure EDB for DC IR analysis and load EDB into the HFSS 3D Layout UI for analysis and +# postprocessing. # -# - Set up EDB +# - Set up EDB: # -# - Edit via padstack -# - Assign SPICE model to components -# - Create pin groups -# - Create voltage and current sources -# - Create SIwave DC analysis -# - Create cutout +# - Edit via padstack. +# - Assign SPICE model to components. +# - Create pin groups. +# - Create voltage and current sources. +# - Create SIwave DC analysis. +# - Create cutout. # -# - Import EDB into HFSS 3D Layout +# - Import EDB into HFSS 3D Layout: # -# - Analyze -# - Get DC IR analysis results +# - Analyze. +# - Get DC IR analysis results. # -# Keywords: **HFSS 3D Layout**, **DCIR**. +# Keywords: **HFSS 3D Layout**, **DC IR**. -# # Preparation -# Import required packages +# ## Perform imports and define constants +# Perform required imports. import json import os @@ -30,11 +30,11 @@ from ansys.aedt.core.downloads import download_file from pyedb import Edb -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # Download example board. @@ -44,9 +44,9 @@ source="spice", name="ferrite_bead_BLM15BX750SZ1.mod", destination=temp_folder.name ) -# # Create a configuration file -# In this example, we are going to use a configure file to set up layout for analysis. -# ## Initialize a dictionary +# ## Create configuration file +# This example uses a configuration file to set up the layout for analysis. +# Initialize and create an empty dictionary to host all configurations. cfg = dict() @@ -57,7 +57,7 @@ "spice_model_library": os.path.join(temp_folder.name, "spice"), } -# ## Change via hole size and plating thickness +# ### Change via hole size and plating thickness cfg["padstacks"] = { "definitions": [ @@ -65,7 +65,7 @@ ], } -# ## Assign SPICE models +# ### Assign SPICE models cfg["spice_models"] = [ { @@ -79,8 +79,8 @@ } ] -# ## Create a Voltage Source -# Create a voltage source from net. +# ### Create voltage source +# Create a voltage source from a net. cfg["sources"] = [ { @@ -93,8 +93,8 @@ } ] -# ## Create Current Sources -# Create current sources between net and pin group. +# ### Create current sources +# Create current sources between the net and pin group. cfg["pin_groups"] = [{"name": "J5_GND", "reference_designator": "J5", "net": "GND"}] @@ -123,11 +123,11 @@ } ) -# ## Create SIwave DC analysis +# ### Create SIwave DC analysis cfg["setups"] = [{"name": "siwave_dc", "type": "siwave_dc", "dc_slider_position": 0}] -# ## Do cutout +# ### Define cutout cfg["operations"] = { "cutout": { @@ -157,15 +157,15 @@ } } -# ## Save configuration as a JSON file +# ### Save configuration as a JSON file pi_json = os.path.join(temp_folder.name, "pi.json") with open(pi_json, "w") as f: json.dump(cfg, f, indent=4, ensure_ascii=False) -# # Load configuration into EDB +# ## Load configuration into EDB -# Load configuration from JSON +# Load the configuration from the JSON file into EDB. edbapp = Edb(aedb, edbversion=AEDT_VERSION) edbapp.configuration.load(config_file=pi_json) @@ -174,31 +174,31 @@ # # Load configuration into EDB edbapp.nets.plot(None, None, color_by_net=True) -# # Save and close EDB +# ## Save and close EDB edbapp.save() edbapp.close() -# The configured EDB file is saved in a temp folder. +# The configured EDB file is saved in the temporary folder. print(temp_folder.name) -# # Analyze DCIR with SIwave +# ## Analyze DCIR with SIwave # -# The 3D Layout interface to SIwave is used to open the EDB and run the DCIR analysis +# The HFSS 3D Layout interface to SIwave is used to open the EDB and run the DCIR analysis # using SIwave -# ## Load edb into 3D Layout. +# ### Load EDB into HFSS 3D Layout. siw = ansys.aedt.core.Hfss3dLayout( aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True ) -# ## Analyze +# ### Analyze siw.analyze(cores=NUM_CORES) -# ## Get DC IR results +# ### Get DC IR results siw.get_dcir_element_data_current_source("siwave_dc") @@ -206,13 +206,13 @@ siw.save_project() siw.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/layout/power_integrity/dcir_q3d.py b/examples/high_frequency/layout/power_integrity/dcir_q3d.py similarity index 88% rename from examples/03-high_frequency/layout/power_integrity/dcir_q3d.py rename to examples/high_frequency/layout/power_integrity/dcir_q3d.py index 4b866cad2..25d99a86b 100644 --- a/examples/03-high_frequency/layout/power_integrity/dcir_q3d.py +++ b/examples/high_frequency/layout/power_integrity/dcir_q3d.py @@ -1,11 +1,11 @@ # # PCB DCIR analysis # -# This example shows how you can use PyAEDT to create a design in -# Q3D Extractor and run a DC IR Drop simulation starting from an EDB Project. +# This example shows how to use PyAEDT to create a design in +# Q3D Extractor and run a DC IR drop simulation starting from an EDB project. # # Keywords: **Q3D**, **layout**, **DCIR**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,7 +16,7 @@ import ansys.aedt.core import pyedb -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 @@ -24,7 +24,8 @@ # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -48,7 +49,7 @@ output_edb = os.path.join(temp_folder.name, project_name + ".aedb") output_q3d = os.path.join(temp_folder.name, project_name + "_q3d.aedt") -# ## Open EDB +# ## Open EDB project # # Open the EDB project and create a cutout on the selected nets # before exporting to Q3D. @@ -78,8 +79,8 @@ # ## Append Z Positions # -# Compute Q3D 3D position. The units in EDB are meters so the -# factor 1000 converts from "meters" to "mm". +# Compute the Q3D 3D position. The units in EDB are meters so the +# factor 1000 converts from meters to millimeters. # + location_u11_scl = [i * 1000 for i in pin_u11_scl[0].position] @@ -135,7 +136,7 @@ # ## Open Q3D # -# Launch the newly created q3d project. +# Launch the newly created Q3D project. q3d = ansys.aedt.core.Q3d(output_q3d, version=AEDT_VERSION) q3d.modeler.delete("GND") @@ -144,7 +145,7 @@ # ## Insert inductors # -# Create new coordinate systems and place 3D component inductors. +# Create coordinate systems and place 3D component inductors. # + q3d.modeler.create_coordinate_system(location_l2_1, name="L2") @@ -172,7 +173,7 @@ # ## Delete dielectrics # -# Delete all dielectric objects since not needed in DC analysis. +# Delete all dielectric objects since they are not needed in DC analysis. # + q3d.modeler.delete(q3d.modeler.get_objects_by_material("Megtron4")) @@ -193,7 +194,7 @@ # ## Assign source and sink # -# Use previously calculated positions to identify faces, select the net "1_Top" and +# Use previously calculated positions to identify faces. Select the net ``1_Top`` and # assign sources and sinks on nets. # + @@ -227,7 +228,7 @@ # ## Create setup # # Create a setup and a frequency sweep from DC to 2GHz. -# Analyze project. +# Then, analyze the project. setup = q3d.create_setup() setup.dc_enabled = True @@ -242,9 +243,9 @@ q3d.save_project() q3d.analyze_setup(setup.name, cores=NUM_CORES) -# ## Field Calculator +# ## Create a named expression # -# We will create a named expression using field calculator. +# Use the field calculator to create a named expression. drop_name = "Vdrop3_3" fields = q3d.ofieldsreporter @@ -254,7 +255,7 @@ q3d.ofieldsreporter.CalcOp("+") q3d.ofieldsreporter.AddNamedExpression(drop_name, "DC R/L Fields") -# ## Phi plot +# ## Create Phi plot # # Compute ACL solutions and plot them. @@ -278,10 +279,10 @@ # - -# ## Computing Voltage on Source Circles +# ## Compute voltage on source circles # -# Using Field Calculator we can compute the voltage on source circles and get the value -# using get_solution_data method. +# Use the field calculator to compute the voltage on source circles and get the value +# using the ``get_solution_data()`` method. # + curves = [] @@ -313,13 +314,13 @@ q3d.save_project() q3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/high_frequency/layout/power_integrity/index.rst b/examples/high_frequency/layout/power_integrity/index.rst new file mode 100644 index 000000000..438dcb645 --- /dev/null +++ b/examples/high_frequency/layout/power_integrity/index.rst @@ -0,0 +1,14 @@ +Power integrity +~~~~~~~~~~~~~~~ + +These examples use PyAEDT to show power integrity examples. + +.. nbgallery:: + + power_integrity.py + dcir.py + dcir_q3d.py + ac_q3d.py + ../../../aedt_general/modeler/circuit_schematic.py + ../../../aedt_general/modeler/netlist_to_schematic.py + ../../../aedt_general/report/touchstone_file.py diff --git a/examples/03-high_frequency/layout/power_integrity/power_integrity.py b/examples/high_frequency/layout/power_integrity/power_integrity.py similarity index 69% rename from examples/03-high_frequency/layout/power_integrity/power_integrity.py rename to examples/high_frequency/layout/power_integrity/power_integrity.py index 5b3fad059..bc997fe29 100644 --- a/examples/03-high_frequency/layout/power_integrity/power_integrity.py +++ b/examples/high_frequency/layout/power_integrity/power_integrity.py @@ -1,23 +1,23 @@ -# # Power Integrity Analysis -# This example shows how to use the electronics database (EDB) for power integrity analysis. The -# EDB will be loaded into HFSS 3D Layout for analysis and post-processing. +# # Power integrity analysis +# This example shows how to use the Ansys Electronics Database (EDB) for power integrity analysis. The +# EDB is loaded into HFSS 3D Layout for analysis and postprocessing. # -# - Set up EDB +# - Set up EDB consists of these steps: # -# - Assign S-parameter model to components -# - Create pin groups -# - Create ports -# - Create SIwave SYZ analysis -# - Create cutout +# - Assign S-parameter model to components. +# - Create pin groups. +# - Create ports. +# - Create SIwave SYZ analysis. +# - Create cutout. # -# - Import EDB into HFSS 3D Layout +# - Import EDB into HFSS 3D Layout: # -# - Analyze -# - Plot $Z_{11}$ +# - Analyze. +# - Plot ``$Z_{11}$``. # -# Keywords: **HFSS 3D Layout**, **Power Integrity**. +# Keywords: **HFSS 3D Layout**, **power integrity**. -# ## Preparation +# ## Perform imports and define constants # Import the required packages import json @@ -28,15 +28,16 @@ import ansys.aedt.core from ansys.aedt.core.downloads import download_file -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -51,21 +52,20 @@ destination=temp_folder.name, ) -# ## Create a configuration file -# In this example, we are going to use a configuration file to set up the layout for analysis. -# ### Initialize a dictionary -# Create an empty dictionary to host all configurations. +# ## Create configuration file +# This example uses a configuration file to set up the layout for analysis. +# Initialize and create an empty dictionary to host all configurations. cfg = dict() -# In this example, we are going to assign S-parameter models to capacitors. +# Assigns S-parameter models to capacitors. # The first step is to use the "general" key to specify where the S-parameter files can be found. cfg["general"] = {"s_parameter_library": os.path.join(temp_folder.name, "touchstone")} -# ## Assign model to capactitors. -# In this example, the model "GRM32_DC0V_25degC_series.s2p" is assigned to capacitors C3 and C4, which share the same component part number. -# When "apply_to_all" is ``True``, all components having the part number "CAPC3216X180X20ML20" will be assigned the S-parameter model. +# ## Assign model to capactitors +# The model ``GRM32_DC0V_25degC_series.s2p`` is assigned to capacitors C3 and C4, which share the same component part number. +# When "apply_to_all" is ``True``, all components having the part number "CAPC3216X180X20ML20" are assigned the S-parameter model. cfg["s_parameters"] = [ { @@ -79,9 +79,10 @@ } ] -# ## Create pin groups. -# In this example, the listed pins on component U2 are combined into two pin groups. -# Pins can be grouped explicitly by the pin name or pin groups can be assigned by net name using the "net" key as shown here: +# ## Create pin groups +# Pins can be grouped explicitly by the pin name, or pin groups can be assigned by net name using the ''net'' key. +# The following code combine the listed pins on component U2 into two pin groups using the ``net`` key. + cfg["pin_groups"] = [ { @@ -130,8 +131,8 @@ } ] -# ## Cutout -# The following assignments will define the region of the PCB to be cut out for analysis. +# ## Define cutout +# Define the region of the PCB to be cut out for analysis. cfg["operations"] = { "cutout": { @@ -161,9 +162,9 @@ } } -# ## Save the configuration +# ## Save configuration # -# The configuration file can be saved in JSON format and applied to layout data using the EDB. +# Save the configuration file to a JSON file and apply it to layout data using the EDB. pi_json = os.path.join(temp_folder.name, "pi.json") with open(pi_json, "w") as f: @@ -171,7 +172,7 @@ # ## Load configuration into EDB -# Load configuration from JSON +# Load the configuration into EDB from the JSON file. edbapp = ansys.aedt.core.Edb(aedb, edbversion=AEDT_VERSION) edbapp.configuration.load(config_file=pi_json) @@ -179,13 +180,13 @@ edbapp.save() edbapp.close() -# The configured EDB file is saved in a temp folder. +# The configured EDB file is saved in the temporary folder. print(temp_folder.name) # ## Analyze in HFSS 3D Layout -# ### Load edb into HFSS 3D Layout. +# ### Load EDB into HFSS 3D Layout h3d = ansys.aedt.core.Hfss3dLayout( aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True @@ -204,13 +205,13 @@ h3d.save_project() h3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/layout/signal_integrity/_static/com_eye.png b/examples/high_frequency/layout/signal_integrity/_static/com_eye.png similarity index 100% rename from examples/03-high_frequency/layout/signal_integrity/_static/com_eye.png rename to examples/high_frequency/layout/signal_integrity/_static/com_eye.png diff --git a/examples/03-high_frequency/layout/signal_integrity/_static/com_report.png b/examples/high_frequency/layout/signal_integrity/_static/com_report.png similarity index 100% rename from examples/03-high_frequency/layout/signal_integrity/_static/com_report.png rename to examples/high_frequency/layout/signal_integrity/_static/com_report.png diff --git a/examples/03-high_frequency/layout/signal_integrity/_static/pre_layout_parameterized_pcb.png b/examples/high_frequency/layout/signal_integrity/_static/pre_layout_parameterized_pcb.png similarity index 100% rename from examples/03-high_frequency/layout/signal_integrity/_static/pre_layout_parameterized_pcb.png rename to examples/high_frequency/layout/signal_integrity/_static/pre_layout_parameterized_pcb.png diff --git a/examples/03-high_frequency/layout/signal_integrity/_static/pre_layout_sma_connector_on_pcb.png b/examples/high_frequency/layout/signal_integrity/_static/pre_layout_sma_connector_on_pcb.png similarity index 100% rename from examples/03-high_frequency/layout/signal_integrity/_static/pre_layout_sma_connector_on_pcb.png rename to examples/high_frequency/layout/signal_integrity/_static/pre_layout_sma_connector_on_pcb.png diff --git a/examples/03-high_frequency/layout/signal_integrity/_static/spectrum_plot.png b/examples/high_frequency/layout/signal_integrity/_static/spectrum_plot.png similarity index 100% rename from examples/03-high_frequency/layout/signal_integrity/_static/spectrum_plot.png rename to examples/high_frequency/layout/signal_integrity/_static/spectrum_plot.png diff --git a/examples/03-high_frequency/layout/signal_integrity/ami.py b/examples/high_frequency/layout/signal_integrity/ami.py similarity index 88% rename from examples/03-high_frequency/layout/signal_integrity/ami.py rename to examples/high_frequency/layout/signal_integrity/ami.py index 138a5a196..88ccc3e89 100644 --- a/examples/03-high_frequency/layout/signal_integrity/ami.py +++ b/examples/high_frequency/layout/signal_integrity/ami.py @@ -1,4 +1,4 @@ -# # AMI PostProcessing +# # AMI Postprocessing # # This example demonstrates advanced postprocessing of AMI simulations. @@ -6,10 +6,12 @@ # # Keywords: **Circuit**, **AMI**. -# ## Perform required imports +# ## Perform imports and define constants # -# Perform required imports. Note that [Numpy](https://numpy.org/) -# and [Matplotlib](https://matplotlib.org/) are required to run this example. +# Perform required imports. +# +# > **Note:** [Numpy](https://numpy.org/) +# > and [Matplotlib](https://matplotlib.org/) are required to run this example. # + import os @@ -22,20 +24,21 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory +# ## Create temporary directory and download example files # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download Example Data +# ## Download example data # # The ``download_file()`` method retrieves example # data from the PyAnsys @@ -55,7 +58,7 @@ # ## Launch AEDT with Circuit and enable Pandas as the output format # -# All outputs obtained with the `get_solution_data` method will have the +# All outputs obtained with the `get_solution_data()` method are in the # [Pandas](https://pandas.pydata.org/docs/user_guide/index.html) format. # Launch AEDT with Circuit. The `ansys.aedt.core.Desktop` class initializes AEDT # and starts the specified version in the specified mode. @@ -76,7 +79,7 @@ # ## Get AMI report # -# Get AMI report data +# Get AMI report data. plot_name = "WaveAfterProbe" circuit.solution_type = "NexximAMI" @@ -96,9 +99,9 @@ fig = original_data.plot() -# ## Extract Wave Form +# ## Extract wave form # -# Use the _WaveAfterProbe_ plot type to extract the +# Use the ``WaveAfterProbe`` plot type to extract the # waveform using an AMI receiver clock probe. # The signal is extracted at a specific clock # flank with additional half unit interval. @@ -121,7 +124,7 @@ # ## Plot waveform and samples # -# Create the plot from a start time to stop time in seconds +# Create the plot from a start time to stop time in seconds. # + tstop = 55e-9 @@ -184,9 +187,9 @@ plt.show() # - -# ## Plot Slicer Scatter +# ## Plot slicer scatter # -# Create the plot from a start time to stop time in seconds +# Create the plot from a start time to stop time in seconds. fig, ax2 = plt.subplots() ax2.plot(sample_waveform[0].index, sample_waveform[0].values, "r*") @@ -195,7 +198,7 @@ ax2.set_ylabel("V") plt.show() -# ## Plot Scatter Histogram +# ## Plot scatter histogram # # Create the plot from a start time to stop time in seconds. @@ -206,9 +209,7 @@ ax4.grid() plt.show() -# ## Transient Report -# -# Get Transient report data +# ## Get transient report data plot_name = "V(b_input_43.int_ami_rx.eye_probe.out)" circuit.solution_type = "NexximTransient" @@ -219,9 +220,9 @@ variations=circuit.available_variations.nominal, ) -# ## Sample Waveform +# ## Extract sample waveform # -# Extract waveform at specific clock time plus half unit interval. +# Extract a waveform at a specific clock time plus a half unit interval. # + original_data.enable_pandas_output = False @@ -242,7 +243,7 @@ ) # - -# ## Plot Waveform +# ## Plot waveform # # Create the plot from a start time to stop time in seconds. @@ -304,7 +305,7 @@ plt.show() # - -# ## Plot Slicer Scatter +# ## Plot slicer scatter # # Create the plot from a start time to stop time in seconds. @@ -322,12 +323,12 @@ circuit.save_project() circuit.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/layout/signal_integrity/circuit_transient.py b/examples/high_frequency/layout/signal_integrity/circuit_transient.py similarity index 84% rename from examples/03-high_frequency/layout/signal_integrity/circuit_transient.py rename to examples/high_frequency/layout/signal_integrity/circuit_transient.py index d3d6d2176..63a00f72b 100644 --- a/examples/03-high_frequency/layout/signal_integrity/circuit_transient.py +++ b/examples/high_frequency/layout/signal_integrity/circuit_transient.py @@ -1,11 +1,11 @@ -# # Circuit Transient Analysis and Eye Diagram +# # Circuit transient analysis and eye diagram # -# This example demonstrates how to create a circuit design, +# This example shows how to create a circuit design, # run a Nexxim time-domain simulation, and create an eye diagram. # -# Keywords: **Circuit**, **Transient**, **Eye diagram**. +# Keywords: **Circuit**, **transient**, **eye diagram**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -20,15 +20,15 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -46,7 +46,7 @@ non_graphical=NG_MODE, ) -# ## IBIS Buffer +# ## Place IBIS buffer # # Read an IBIS file and place a buffer in the schematic editor. @@ -55,7 +55,7 @@ ) ibs = ibis.buffers["DQ_u26a_800"].insert(0, 0) -# ## Ideal Transmission Line +# ## Place ideal transmission line # # Place an ideal transmission line in the schematic and parametrize it. @@ -64,14 +64,14 @@ ) tr1.parameters["P"] = "50mm" -# ## Component Placement +# ## Place components # # Create a resistor and ground in the schematic. res = circuit.modeler.components.create_resistor(name="R1", value="1Meg") gnd1 = circuit.modeler.components.create_gnd() -# ## Connect Componennts +# ## Connect componennts # # Connect the components in the schematic. @@ -79,9 +79,9 @@ tr1.pins[1].connect_to_component(res.pins[0]) res.pins[1].connect_to_component(gnd1.pins[0]) -# ## Voltage Probe +# ## Place a probe # -# Place a probe and rename it to ``Vout``. +# Place a voltage probe and rename it to ``Vout``. pr1 = circuit.modeler.components.components_catalog["Probes:VPROBE"].place("vout") pr1.parameters["Name"] = "Vout" @@ -98,10 +98,10 @@ trans_setup.props["TransientData"] = ["0.01ns", "200ns"] circuit.analyze_setup("TransientRun") -# ## Results +# ## Create report # # Create a report using the ``get_solution_data()`` method. This -# method allows you to view and post-process results using Python packages. +# method allows you to view and postprocess results using Python packages. # The ``solutions.plot()`` method uses # [Matplotlib](https://matplotlib.org/). @@ -111,7 +111,7 @@ solutions = circuit.post.get_solution_data(domain="Time") solutions.plot("V(Vout)") -# ## Visualize Results +# ## Visualize results # # Create a report inside AEDT using the ``new_report`` object. This object is # fully customizable and usable with most of the reports available in AEDT. @@ -147,7 +147,7 @@ sol = new_report.get_solution_data() sol.plot() -# ## Eye Diagram in AEDT +# ## Create eye diagram in AEDT # # Create an eye diagram inside AEDT using the ``new_eye`` object. @@ -156,7 +156,7 @@ new_eye.time_stop = "100ns" new_eye.create() -# ## Eye Diagram in Matplotlib +# ## Create eye diagram in Matplotlib # # Create the same eye diagram outside AEDT using Matplotlib and the # ``get_solution_data()`` method. @@ -203,12 +203,12 @@ circuit.save_project() circuit.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/layout/signal_integrity/com_analysis.py b/examples/high_frequency/layout/signal_integrity/com_analysis.py similarity index 68% rename from examples/03-high_frequency/layout/signal_integrity/com_analysis.py rename to examples/high_frequency/layout/signal_integrity/com_analysis.py index f44cd0374..5bb986681 100644 --- a/examples/03-high_frequency/layout/signal_integrity/com_analysis.py +++ b/examples/high_frequency/layout/signal_integrity/com_analysis.py @@ -1,6 +1,6 @@ # # Channel Operating Margin (COM) -# This example shows how you can use PyAEDT for COM analysis. -# Supported standards are as below: +# This example shows how to use PyAEDT for COM analysis. +# These standards are supported: # # - 50GAUI_1_C2C # - 100GAUI_2_C2C @@ -11,11 +11,11 @@ # -# ## What is COM +# ## What is COM? # # - COM was developed as part of IEEE 802.3bj, 100GBASE Ethernet. -# - COM is a figure of merit for an S-parameter representing a high speed SerDes channel. -# - COM is the ratio between eye height and noise +# - COM is a figure of merit for an S-parameter representing a high-speed SerDes channel. +# - COM is the ratio between eye height and noise. # ```math # COM = 20 * log10 (A_signal / A_noise) @@ -23,8 +23,8 @@ # # Keywords: **COM**, **signal integrity**, **virtual compliance**. -# ## Preparation -# Import required packages +# ## Perform imports +# Perform required imports. import os import tempfile @@ -33,7 +33,12 @@ from ansys.aedt.core.misc.spisim_com_configuration_files import com_parameters from pyedb.misc.downloads import download_file -# Download example files into temporary folder +# ## Create temporary directory and download example files +# +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. # + temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") @@ -61,14 +66,15 @@ # - # ## Run COM analysis -# PyAEDT calls SPISim for COM analysis. Please check PyAEDT documentation for supported standards. -# Set port_order="EvenOdd" when S-parameter has below port order. +# PyAEDT calls SPISim for COM analysis. For supported standardes, see the PyAEDT documentation. + +# Set ``port_order="EvenOdd"`` when the S-parameter has this port order: # # 1 - 2 # # 3 - 4 # -# Set port_order="Incremental" when S-parameter has below port order. +# Set ``port_order="Incremental"`` when the S-parameter has this port order: # # 1 - 3 # @@ -83,15 +89,15 @@ ) # ## Print COM values -# There are two COM values reported by the definition of the standard. +# There are two COM values reported by the definition of the standard: # -# - Case 0. COM value in dB when big package is used. -# - Case 1. COM value in dB when small package is used. +# - Case 0: COM value in dB when big package is used. +# - Case 1: COM value in dB when small package is used. print(*com_results) -# ## COM report -# A complete COM report is generate in temporary folder in html format. +# ## View COM report +# A complete COM report is generated in the temporary folder in HTML format. print(temp_folder.name) @@ -99,7 +105,7 @@ # ## Run COM analysis on custom configuration file -# ### Export template configuration file in JSON format. +# ### Export template configuration file in JSON format custom_json = os.path.join(temp_folder.name, "custom.json") spi_sim.export_com_configure_file(custom_json, standard=1) @@ -118,7 +124,7 @@ print(*com_results) # ## Export SPISim supported configuration file -# The exported configuration file can be used in SPISim GUI. +# You can use the exported configuration file in the SPISim GUI. # + @@ -128,7 +134,7 @@ com_param.export_spisim_cfg(custom_cfg) # - -# PyAEDT support SPISim cfg file as well. +# PyAEDT also supports the SPISim configuration file. com_results = spi_sim.compute_com( standard=0, config_file=custom_cfg, port_order="EvenOdd" diff --git a/examples/high_frequency/layout/signal_integrity/index.rst b/examples/high_frequency/layout/signal_integrity/index.rst new file mode 100644 index 000000000..55d956e2d --- /dev/null +++ b/examples/high_frequency/layout/signal_integrity/index.rst @@ -0,0 +1,17 @@ +Signal integrity +~~~~~~~~~~~~~~~~ + +These examples use PyAEDT to show signal integrity examples. + +.. nbgallery:: + + com_analysis.py + pre_layout.py + pre_layout_parametrized.py + ami.py + multizone.py + circuit_transient.py + ../../../aedt_general/modeler/circuit_schematic.py + ../../../aedt_general/modeler/netlist_to_schematic.py + ../../emc/subcircuit.py + ../../../aedt_general/report/touchstone_file.py \ No newline at end of file diff --git a/examples/03-high_frequency/layout/signal_integrity/multizone.py b/examples/high_frequency/layout/signal_integrity/multizone.py similarity index 66% rename from examples/03-high_frequency/layout/signal_integrity/multizone.py rename to examples/high_frequency/layout/signal_integrity/multizone.py index 58fa89559..ca61ba38b 100644 --- a/examples/03-high_frequency/layout/signal_integrity/multizone.py +++ b/examples/high_frequency/layout/signal_integrity/multizone.py @@ -1,10 +1,10 @@ -# # Simulate multi-zone layout with SIwave +# # Multi-zone simulation with SIwave # -# This example demonstrates simulation of multiple zones with SIwave. +# This example shows how to simulate multiple zones with SIwave. # # Keywords: **Circuit**, **multi-zone**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports, which includes importing a section. @@ -18,21 +18,20 @@ # - -# ## Define constants +# Define constants. EDB_VERSION = "2024.2" # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download file -# -# Download the EDB folder. +# ## Download EDB folder edb_file = ansys.aedt.core.downloads.download_file( directory="edb/siwave_multi_zones.aedb", destination=temp_folder.name @@ -43,45 +42,44 @@ print(edb_file) -# ## AEDT version -# -# Sets the AEDT version. +# ## Set AEDT version + edb_version = EDB_VERSION -# ## Ground net +# ## Define ground net # -# Common reference net used across all sub-designs, Mandatory for this work flow. +# Define the common reference net used across all subdesigns, which is mandatory for this workflow. common_reference_net = "GND" -# ## Load the Project +# ## Load project # -# Load initial Edb file, checking if aedt file exists and remove to allow Edb loading. +# Check if the AEDT file exists and remove it to allow EDB loading. Then, load the initial EDB file. if os.path.isfile(aedt_file): os.remove(aedt_file) edb = Edb(edbversion=edb_version, edbpath=edb_file) -# ## Project zones +# ## Copy project zones # -# Copy project zone into sub project. +# Copy project zone into the subproject. edb_zones = edb.copy_zones(working_directory=work_folder) # ## Split zones # -# Clip sub-designs along with corresponding zone definition -# and create port of clipped signal traces. +# Clip subdesigns along with corresponding zone definitions +# and create a port of clipped signal traces. defined_ports, project_connexions = edb.cutout_multizone_layout( edb_zones, common_reference_net ) -# ## Circuit +# ## Create circuit # -# Create circuit design, import all sub-project as EM model and connect -# all corresponding pins in circuit. +# Create circuit design, import all subprojects as EM models, and connect +# all corresponding pins in the circuit. circuit = Circuit(version=edb_version, project=circuit_project_file) circuit.connect_circuit_models_from_multi_zone_cutout( @@ -91,15 +89,15 @@ model_inc=70, ) -# ## Setup +# ## Set up simulation # # Add Nexxim LNA simulation setup. circuit_setup = circuit.create_setup("Pyedt_LNA") -# ## Frequency sweep +# ## Add frequency sweep # -# Add frequency sweep from 0GHt to 20GHz with 10NHz frequency step. +# Add a frequency sweep from 0 GHt to 20 GHz with a 10 NHz frequency step. circuit_setup.props["SweepDefinition"]["Data"] = "LIN {} {} {}".format( "0GHz", "20GHz", "10MHz" @@ -107,7 +105,7 @@ # ## Start simulation # -# Analyze all siwave projects and solves the circuit. +# Analyze all SIwave projects and solve the circuit. circuit.analyze() @@ -124,7 +122,7 @@ reference="U1.via_33.B2B_SIGN", ) -# Plot results +# Plot results. circuit.post.create_report( expressions=["dB(S(U0,U0))", "dB(S(U1,U0))"], context="Differential Pairs" @@ -136,12 +134,12 @@ circuit.save_project() circuit.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/layout/signal_integrity/pre_layout.py b/examples/high_frequency/layout/signal_integrity/pre_layout.py similarity index 81% rename from examples/03-high_frequency/layout/signal_integrity/pre_layout.py rename to examples/high_frequency/layout/signal_integrity/pre_layout.py index 318e10bc1..ec36924a9 100644 --- a/examples/03-high_frequency/layout/signal_integrity/pre_layout.py +++ b/examples/high_frequency/layout/signal_integrity/pre_layout.py @@ -1,32 +1,32 @@ -# # Pre-layout Signal Integrity -# This example shows how to create a parameterized layout design, -# and load the layout into HFSS 3D Layout for analysis and post-processing. +# # Pre-layout signal integrity +# This example shows how to create a parameterized layout design +# and load the layout into HFSS 3D Layout for analysis and postprocessing. # -# - Create EDB +# - Create EDB: # -# - Add material -# - Create stackup -# - Create a parameterized via padstack definition -# - Create ground planes -# - Create a component -# - Create signal vias and traces -# - Create ground stitching vias -# - Create HFSS analysis setup and frequency sweep +# - Add material. +# - Create stackup. +# - Create a parameterized via padstack definition. +# - Create ground planes. +# - Create a component. +# - Create signal vias and traces. +# - Create ground stitching vias. +# - Create HFSS analysis setup and frequency sweep. # -# - Import EDB into HFSS 3D Layout +# - Import EDB into HFSS 3D Layout: # -# - Place SMA connector -# - Analysis -# - Plot return loss +# - Place SMA connector. +# - Analyze. +# - Plot return loss. # Here is an image of the model that is created in this example. # # # -# Keywords: **HFSS 3D Layout**, **Signal Integrity**. +# Keywords: **HFSS 3D Layout**, **signal integrity**. -# ## Preparation -# Import the required packages +# ## Perform imports and define constants +# Perform required packages. # + import os @@ -39,14 +39,19 @@ # - -# Set constant values +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# Download example board. +# ## Create temporary directory and download example files +# +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") sma_rf_connector = download_file( @@ -56,7 +61,7 @@ ) -# # Create a layout design +# # Create layout design # ## Import example design @@ -90,14 +95,14 @@ # ## Create parameterized padstack definition -# Create signal via padstack definition +# Create signal via padstack definition. edbapp["$antipad"] = "0.7mm" edbapp.padstacks.create( padstackname="svia", holediam="0.3mm", antipaddiam="$antipad", paddiam="0.5mm" ) -# Create component pin padstack definition +# Create component pin padstack definition. edbapp.padstacks.create( padstackname="comp_pin", @@ -192,13 +197,13 @@ # ## Place vias -# Place a signal via +# Place a signal via. edbapp.padstacks.place( position=[0, 0], definition_name="svia", net_name="SIG", is_pin=False ) -# Place ground stitching vias +# Place ground stitching vias. edbapp.padstacks.place( position=["-1mm", 0], definition_name="svia", net_name="GND", is_pin=False @@ -218,7 +223,7 @@ edbapp["width"] = "0.15mm" edbapp["gap"] = "0.1mm" -# Signal fanout +# Create signal fanout. sig_trace = edbapp.modeler.create_trace( path_list=[[0, 0]], @@ -236,7 +241,7 @@ sig_trace.add_point(x=0, y="1mm", incremental=True) sig_path = sig_trace.get_center_line() -# Coplanar waveguide with ground with ground stitching vias +# Create coplanar waveguide with ground with ground stitching vias. sig2_trace = edbapp.modeler.create_trace( path_list=[sig_path[-1]], @@ -251,7 +256,7 @@ sig2_trace.create_via_fence(distance="0.5mm", gap="1mm", padstack_name="svia") sig2_trace.add_point(x=0, y="1mm", incremental=True) -# Create trace-to-ground clearance +# Create trace-to-ground clearance. sig2_path = sig2_trace.get_center_line() path_list = [sig_path, sig2_path] @@ -266,13 +271,13 @@ ) edbapp.modeler.add_void(shape=gnd_bottom, void_shape=void) -# Review +# Generate plot to review. edbapp.nets.plot() # ## Create ports -# Create a Wave port +# Create a wave port. sig2_trace.create_edge_port( name="p1_wave_port", @@ -290,7 +295,7 @@ setup.set_solution_single_frequency("5GHz", max_num_passes=1, max_delta_s="0.02") setup.hfss_solver_settings.order_basis = "first" -# Add a frequency sweep to setup. +# Add a frequency sweep to the setup. # # When the simulation results are to # be used for transient SPICE analysis, you should @@ -298,7 +303,7 @@ # # - DC point # - Logarithmic sweep from 1 kHz to 100 MHz -# - Linear scale for higher frequencies. +# - Linear scale for higher frequencies setup.add_frequency_sweep( "Sweep1", @@ -315,7 +320,7 @@ # # Analyze in HFSS 3D Layout -# ## Load edb into HFSS 3D Layout. +# ## Load EDB into HFSS 3D Layout. h3d = Hfss3dLayout(aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True) @@ -348,13 +353,13 @@ h3d.save_project() h3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_dir.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/layout/signal_integrity/pre_layout_parametrized.py b/examples/high_frequency/layout/signal_integrity/pre_layout_parametrized.py similarity index 99% rename from examples/03-high_frequency/layout/signal_integrity/pre_layout_parametrized.py rename to examples/high_frequency/layout/signal_integrity/pre_layout_parametrized.py index 3a41abcde..3b1b9852b 100644 --- a/examples/03-high_frequency/layout/signal_integrity/pre_layout_parametrized.py +++ b/examples/high_frequency/layout/signal_integrity/pre_layout_parametrized.py @@ -27,7 +27,7 @@ AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Launch EDB diff --git a/examples/03-high_frequency/multiphysics/hfss_mechanical.py b/examples/high_frequency/multiphysics/hfss_mechanical.py similarity index 87% rename from examples/03-high_frequency/multiphysics/hfss_mechanical.py rename to examples/high_frequency/multiphysics/hfss_mechanical.py index 0963034cb..c75542340 100644 --- a/examples/03-high_frequency/multiphysics/hfss_mechanical.py +++ b/examples/high_frequency/multiphysics/hfss_mechanical.py @@ -1,11 +1,11 @@ # # HFSS-Mechanical multiphysics analysis # -# This example shows how you can use PyAEDT to create a multiphysics workflow that +# This example shows how to use PyAEDT to create a multiphysics workflow that # includes Circuit, HFSS, and Mechanical. # # Keywords: **Multiphysics**, **HFSS**, **Mechanical AEDT**, **Circuit**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -18,15 +18,18 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") @@ -59,7 +62,7 @@ # ## Set up dynamic link options # -# Set up dynamic link options. The argument for ``set_sim_option_on_hfss_subcircuit`` +# Set up dynamic link options. The argument for the ``set_sim_option_on_hfss_subcircuit()`` # method can be the component name, component ID, or component object. circuit.modeler.schematic.refresh_dynamic_link(name=hfss_comp.composed_name) @@ -99,8 +102,6 @@ # - # ## Create setup -# -# Create a setup. setup_name = "MySetup" LNA_setup = circuit.create_setup(name=setup_name) @@ -124,8 +125,6 @@ mech.change_material_override(True) # ## Get losses from HFSS and assign convection to Mechanical -# -# Get losses from HFSS and assign the convection to Mechanical. mech.assign_em_losses( design=hfss.design_name, @@ -142,8 +141,6 @@ ) # ## Plot model -# -# Plot the model. mech.plot( show=False, @@ -152,8 +149,6 @@ ) # ## Solve and plot thermal results -# -# Solve and plot the thermal results. mech.create_setup() mech.save_project() @@ -169,12 +164,12 @@ mech.save_project() mech.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/high_frequency/multiphysics/index.rst b/examples/high_frequency/multiphysics/index.rst new file mode 100644 index 000000000..6f54d0966 --- /dev/null +++ b/examples/high_frequency/multiphysics/index.rst @@ -0,0 +1,13 @@ +Multiphysics +~~~~~~~~~~~~ + +These examples use PyAEDT to show some multiphysics applications. + +.. nbgallery:: + + mri.py + hfss_mechanical.py + ../../electrothermal/ecad_import.py + ../../electrothermal/coaxial_hfss_icepak.py + ../../electrothermal/electrothermal.py + ../../electrothermal/icepak_circuit_hfss_coupling.py diff --git a/examples/03-high_frequency/multiphysics/mri.py b/examples/high_frequency/multiphysics/mri.py similarity index 66% rename from examples/03-high_frequency/multiphysics/mri.py rename to examples/high_frequency/multiphysics/mri.py index cc9de8fe4..4e55b1aa4 100644 --- a/examples/03-high_frequency/multiphysics/mri.py +++ b/examples/high_frequency/multiphysics/mri.py @@ -1,20 +1,24 @@ # # HFSS-Mechanical MRI analysis # -# The goal of this example is to use a coil tuned to 63.8 MHz to determine the temperature +# This example uses a coil tuned to 63.8 MHz to determine the temperature # rise in a gel phantom near an implant given a background SAR of 1 W/kg. # -# Steps to follow -# Step 1: Simulate coil loaded by empty phantom: -# Scale input to coil ports to produce desired background SAR of 1 W/kg at location -# that will later contain the implant. -# Step 2: Simulate coil loaded by phantom containing implant in proper location: -# View SAR in tissue surrounding implant. +# Here is the workflow: + +# Step 1: Simulate the coil loaded by the empty phantom: +# Scale input to coil ports to produce desired background SAR of 1 W/kg at the location +# that is to contain the implant. + +# Step 2: Simulate the coil loaded by the phantom containing the implant in the proper location: +# View SAR in the tissue surrounding implant. + # Step 3: Thermal simulation: -# Link HFSS to transient thermal solver to find temperature rise in tissue near implant vs. time. +# Link HFSS to the transient thermal solver to find the temperature rise in the tissue near the implant +# versus the time. # -# Keywords: **Multiphysics**, **HFSS**, **Mechanical AEDT**, **Circuit**. +# Keywords: **multiphysics**, **HFSS**, **Mechanical AEDT**, **Circuit**. -# ## Perform required imports +# ## Perform imports and define constants # Perform required imports. # + @@ -26,30 +30,29 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Project load +# ## Load project +# +# Open AEDT and the ``background_SAR.aedt`` project. This project +# contains the phantom and airbox. The phantom consists of two objects: ``phantom`` and ``implant_box``. # -# Open ANSYS Electronics Desktop -# Open project background_SAR.aedt -# Project contains phantom and airbox -# Phantom consists of two objects: phantom and implant_box -# Separate objects are used to selectively assign mesh operations +# Separate objects are used to selectively assign mesh operations. # Material properties defined in this project already contain electrical and thermal properties. project_path = downloads.download_file(source="mri", destination=temp_folder.name) @@ -63,22 +66,23 @@ # ## Insert 3D component # -# The MRI Coil is saved as a separate 3D Component -# ‒ 3D Components store geometry (including parameters), +# The MRI coil is saved as a separate 3D component. + +# ‒ 3D components store geometry (including parameters), # material properties, boundary conditions, mesh assignments, -# and excitations -# ‒ 3D Components make it easy to reuse and share parts of a simulation +# and excitations. +# ‒ 3D components make it easy to reuse and share parts of a simulation. component_file = os.path.join(project_path, "coil.a3dcomp") hfss.modeler.insert_3d_component(input_file=component_file) -# ## Expression Cache +# ## Define convergence criteria # -# On the expression cache tab, define additional convergence criteria for self -# impedance of the four coil -# ports -# ‒ Set each of these convergence criteria to 2.5 ohm -# For this demo number of passes is limited to 2 to reduce simulation time. +# On the **Expression Cache** tab, define additional convergence criteria for self +# impedance of the four coil ports. + +# Set each of these convergence criteria to 2.5 ohm. +# This example limits the number of passes to two to reduce simulation time. # + im_traces = hfss.get_traces_for_plot( @@ -96,28 +100,28 @@ hfss.setups[0].props["MaximumPasses"] = 1 # - -# ## Edit Sources +# ## Edit sources # -# The 3D Component of the MRI Coil contains all the ports, +# The 3D component of the MRI coil contains all the ports, # but the sources for these ports are not yet defined. -# Browse to and select sources.csv. -# These sources were determined by tuning this coil at 63.8 MHz. -# Notice the “*input_scale” multiplier to allow quick adjustment of the coil excitation power. +# Browse to and select the ``sources.csv`` file. +# The sources in this file were determined by tuning the coil at 63.8 MHz. +# Notice that ``input_scale`` is a multiplier that lets you quickly adjust the coil excitation power. hfss.edit_sources_from_file(os.path.join(project_path, "sources.csv")) -# ## Run Simulation +# ## Run simulation # # Save and analyze the project. hfss.save_project(project_file=os.path.join(project_path, "solved.aedt")) hfss.analyze(cores=NUM_CORES) -# ## Plot SAR on Cut Plane in Phantom +# ## Plot SAR on cut plane in phantom # -# Ensure that the SAR averaging method is set to Gridless -# Plot averagedSAR on GlobalYZ plane -# Draw Point1 at origin of the implant coordinate system +# Ensure that the SAR averaging method is set to ``Gridless``. +# Plot ``Average_SAR`` on the global YZ plane. +# Draw ``Point1`` at the origin of the implant coordinate system. # + hfss.sar_setup( @@ -144,12 +148,13 @@ ) # - -# ## Adjust Input Power to MRI Coil +# ## Adjust input Power to MRI coil # -# The goal is to adjust the MRI coil’s input power, so that the averageSAR at Point1 is 1 W/kg -# Note that SAR and input power are linearly related -# To determine required input, calculate -# input_scale = 1/AverageSAR at Point1 +# Adjust the MRI coil’s input power so that the average SAR at ``Point1`` is 1 W/kg. +# Note that the SAR and input power are linearly related. +# +# To determine therequired input, calculate +# ``input_scale = 1/AverageSAR`` at ``Point1``. # + sol_data = hfss.post.get_solution_data( @@ -163,10 +168,10 @@ hfss["input_scale"] = 1 / sol_data.data_real()[0] # - -# ## Phantom with Implant +# ## Analyze phantom with implant # -# Import implant geometry. -# Subtract rod from implant_box. +# Import the implant geometry. +# Subtract the rod from the implant box. # Assign titanium to the imported object rod. # Analyze the project. @@ -179,16 +184,16 @@ hfss.save_project() # - -# ## Thermal Simulation +# ## Run a thermal simulation # -# Initialize a new Mechanical Transient Thermal analysis. -# Mechanical Transient Thermal is available in AEDT from 2023 R2 as a Beta feature. +# Initialize a new Mechanical transient thermal analysis. +# This type of analysis is available in AEDT in 2023 R2 and later as a beta feature. mech = Mechanical(solution_type="Transient Thermal", version=AEDT_VERSION) # ## Copy geometries # -# Copy bodies from the HFSS project. 3D Component will not be copied. +# Copy bodies from the HFSS project. The 3D component is not copied. mech.copy_solid_bodies_from(hfss) @@ -208,9 +213,9 @@ assignment=mech.modeler["Region"].faces, convection_value=1 ) -# ## Create Setup +# ## Create setup # -# Create a new setup and edit properties. +# Create a setup and edit properties. # + setup = mech.create_setup() @@ -226,16 +231,16 @@ setup.props["N Steps"] = "2" # - -# ## Analyze Mechanical +# ## Analyze project # -# Analyze the project. +# Analyze the Mechanical project. mech.analyze(cores=NUM_CORES) -# ## Plot Fields +# ## Plot fields # -# Plot Temperature on cut plane. -# Plot Temperature on point. +# Plot the temperature on cut plane. +# Plot the temperature on the point. # + mech.post.create_fieldplot_cutplane( @@ -265,16 +270,16 @@ ) # - -# ## Thermal Simulation +# ## Run a new thermal simulation # -# Initialize a new Icepak Transient Thermal analysis. +# Initialize a new Icepak transient thermal analysis. ipk = Icepak(solution_type="Transient", version=AEDT_VERSION) ipk.design_solutions.problem_type = "TemperatureOnly" # ## Copy geometries # -# Copy bodies from the HFSS project. 3D Component will not be copied. +# Copy bodies from the HFSS project. The 3D component is not copied. ipk.modeler.delete("Region") ipk.copy_solid_bodies_from(hfss) @@ -292,10 +297,10 @@ surface_objects=ipk.get_all_conductors_names(), ) -# ## Create Setup +# ## Create setup # -# Create a new setup and edit properties. -# Simulation will be for 30 seconds. +# Create a setup and edit properties. +# Simulation takes 30 seconds. # + setup = ipk.create_setup() @@ -306,9 +311,9 @@ setup.props["Convergence Criteria - Energy"] = 1e-12 # - -# ## Mesh Region +# ## Create mesh region # -# Create a new mesh region and change accuracy level to 4. +# Create a mesh region and change the accuracy level to 4. bound = ipk.modeler["implant_box"].bounding_box mesh_box = ipk.modeler.create_box( @@ -321,9 +326,9 @@ mesh_region.Level = 4 mesh_region.update() -# ## n Point Monitor +# ## Create point monitor # -# Create a new point monitor. +# Create a point monitor. ipk.modeler.set_working_coordinate_system("implant") ipk.monitor.assign_point_monitor(point_position=[0, 0, 0], monitor_name="Point1") @@ -332,8 +337,8 @@ # ## Analyze and plot fields # # Analyze the project. -# Plot Temperature on cut plane. -# Plot Temperature on monitor point. +# Plot the temperature on the cut plane. +# Plot the temperature on the monitor point. # + ipk.analyze(cores=NUM_CORES, tasks=4) @@ -359,12 +364,12 @@ hfss.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/03-high_frequency/radiofrequency_mmwave/_static/wgf.png b/examples/high_frequency/radiofrequency_mmwave/_static/wgf.png similarity index 100% rename from examples/03-high_frequency/radiofrequency_mmwave/_static/wgf.png rename to examples/high_frequency/radiofrequency_mmwave/_static/wgf.png diff --git a/examples/03-high_frequency/radiofrequency_mmwave/coplanar_waveguide.py b/examples/high_frequency/radiofrequency_mmwave/coplanar_waveguide.py similarity index 93% rename from examples/03-high_frequency/radiofrequency_mmwave/coplanar_waveguide.py rename to examples/high_frequency/radiofrequency_mmwave/coplanar_waveguide.py index e1a1ebe2c..0e88d3f08 100644 --- a/examples/03-high_frequency/radiofrequency_mmwave/coplanar_waveguide.py +++ b/examples/high_frequency/radiofrequency_mmwave/coplanar_waveguide.py @@ -1,11 +1,11 @@ # # CPWG analysis -# This example shows how you can use PyAEDT to create a CPWG (coplanar waveguide with ground) design +# This example shows how to use PyAEDT to create a CPWG (coplanar waveguide with ground) design # in 2D Extractor and run a simulation. # # Keywords: **Q2D**, **CPWG**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,7 +15,7 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 @@ -24,7 +24,8 @@ # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -43,7 +44,7 @@ design="coplanar_waveguide", ) -# ## Create the model +# ## Create model # # Define variables. @@ -234,13 +235,13 @@ q2d.save_project() q2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-high_frequency/radiofrequency_mmwave/index.rst b/examples/high_frequency/radiofrequency_mmwave/index.rst similarity index 71% rename from examples/03-high_frequency/radiofrequency_mmwave/index.rst rename to examples/high_frequency/radiofrequency_mmwave/index.rst index f6391e503..72c95e371 100644 --- a/examples/03-high_frequency/radiofrequency_mmwave/index.rst +++ b/examples/high_frequency/radiofrequency_mmwave/index.rst @@ -1,7 +1,7 @@ Radio frequency and millimeter wave ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -These examples use PyAEDT to show some general capabilities of AEDT for radio frequency and millimeter wave applications +These examples use PyAEDT to show some radio frequency and millimeter wave applications. .. nbgallery:: diff --git a/examples/03-high_frequency/radiofrequency_mmwave/iris_filter.py b/examples/high_frequency/radiofrequency_mmwave/iris_filter.py similarity index 82% rename from examples/03-high_frequency/radiofrequency_mmwave/iris_filter.py rename to examples/high_frequency/radiofrequency_mmwave/iris_filter.py index 5e0b65de7..845ded302 100644 --- a/examples/03-high_frequency/radiofrequency_mmwave/iris_filter.py +++ b/examples/high_frequency/radiofrequency_mmwave/iris_filter.py @@ -1,13 +1,13 @@ # # Inductive iris waveguide filter # -# This example shows how to build and analyze a 4-pole +# This example shows how to build and analyze a four-pole # X-Band waveguide filter using inductive irises. # # Keywords: **HFSS**, **modal**, **waveguide filter**. # -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. # @@ -18,23 +18,29 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Launch Ansys Electronics Desktop (AEDT) +# ## Launch AEDT # ### Define parameters and values for waveguide iris filter # +# Define these parameters: + # l: Length of the cavity from the mid-point of one iris -# to the midpoint of the next iris. -# w: Width of the iris opening. +# to the midpoint of the next iris +# +# w: Width of the iris opening +# # a: Long dimension of the waveguide cross-section (X-Band) -# b: Short dimension of the waveguide cross-section. -# t: Metal thickness of the iris insert. +# +# b: Short dimension of the waveguide cross-section +# +# t: Metal thickness of the iris insert # + wgparams = { @@ -47,16 +53,16 @@ } # - -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ### Create the HFSS design +# ### Create HFSS design project_name = os.path.join(temp_folder.name, "waveguide.aedt") hfss = ansys.aedt.core.Hfss( @@ -70,7 +76,7 @@ ) -# ### Initialize design parameters in HFSS. +# ### Initialize design parameters # + hfss.modeler.model_units = "in" # Set to inches @@ -78,7 +84,7 @@ for key in wgparams: if type(wgparams[key]) in [int, float]: hfss[key] = str(wgparams[key]) + wgparams["units"] - var_mapping[key] = wgparams[key] # Used for expression parsing + var_mapping[key] = wgparams[key] # Used for expression parsing. elif type(wgparams[key]) == list: count = 1 for v in wgparams[key]: @@ -140,10 +146,10 @@ def place_iris(z_pos, dz, param_count): # ### Draw full waveguide with ports # -# Use ``hfss.variable_manager`` which acts like a dict() to return an instance of +# Use ``hfss.variable_manager``, which acts like a dictionary, to return an instance of # the ``ansys.aedt.core.application.variables.VariableManager`` class for any variable. # The ``VariableManager`` instance takes the HFSS variable name as a key. -# ``VariableManager`` properties enable access to update, modify and +# ``VariableManager`` properties enable access to update, modify, and # evaluate variables. var_mapping["port_extension"] = 1.5 * wgparams["l"][0] @@ -161,11 +167,11 @@ def place_iris(z_pos, dz, param_count): material="vacuum", ) -# ### Draw the whole waveguide. +# ### Draw the entire waveguide # -# wg_z is the total length of the waveguide, including port extension. +# The variable ``# wg_z`` is the total length of the waveguide, including the port extension. # Note that the ``.evaluated_value`` provides access to the numerical value of -# ``wg_z_start`` which is an expression in HFSS. +# ``wg_z_start``, which is an expression in HFSS. wg_z = [ wg_z_start.evaluated_value, @@ -192,11 +198,12 @@ def place_iris(z_pos, dz, param_count): ) ) -# ### Insert the mesh adaptation setup using refinement at two frequencies. +# ### Insert mesh adaptation setup # -# This approach is useful for resonant structures as the coarse initial -# mesh impacts the resonant frequency and hence, the field propagation through the -# filter. Adaptation at multiple frequencies helps to ensure that energy propagates +# Insert a mesh adaptation setup using refinement at two frequencies. +# This approach is useful for resonant structures because the coarse initial +# mesh impacts the resonant frequency and, hence, the field propagation through the +# filter. Adaptation at multiple frequencies helps to ensure that energy propagates # through the resonant structure while the mesh is refined. # + @@ -222,11 +229,12 @@ def place_iris(z_pos, dz, param_count): setup.analyze(num_tasks=2, num_cores=NUM_CORES) -# ### Post-processing +# ### Postprocess # # The following commands fetch solution data from HFSS for plotting directly # from the Python interpreter. -# Caution: The syntax for expressions must be identical to that used +# +# **Caution:** The syntax for expressions must be identical to that used # in HFSS. # + @@ -252,17 +260,17 @@ def place_iris(z_pos, dz, param_count): # ## Release AEDT # -# The following command saves the project to a file and closes the desktop. +# The following command saves the project to a file and closes AEDT. hfss.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/03-high_frequency/radiofrequency_mmwave/lumped_element.py b/examples/high_frequency/radiofrequency_mmwave/lumped_element.py similarity index 80% rename from examples/03-high_frequency/radiofrequency_mmwave/lumped_element.py rename to examples/high_frequency/radiofrequency_mmwave/lumped_element.py index e8764d67d..b7baa243e 100644 --- a/examples/03-high_frequency/radiofrequency_mmwave/lumped_element.py +++ b/examples/high_frequency/radiofrequency_mmwave/lumped_element.py @@ -1,25 +1,21 @@ -# # Design a lumped element filter +# # Lumped element filter design # # This example shows how to use PyAEDT to use the ``FilterSolutions`` module to design and # visualize the frequency response of a band-pass Butterworth filter. # # Keywords: **filter solutions** -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. import ansys.aedt.core import matplotlib.pyplot as plt from ansys.aedt.core.filtersolutions_core.attributes import ( - FilterClass, - FilterImplementation, - FilterType, -) -from ansys.aedt.core.filtersolutions_core.ideal_response import FrequencyResponseColumn + FilterClass, FilterImplementation, FilterType) +from ansys.aedt.core.filtersolutions_core.ideal_response import \ + FrequencyResponseColumn -# ## Define constants -# # Define constants. AEDT_VERSION = "2025.1" @@ -38,7 +34,7 @@ def format_plot(): plt.grid() -# ## Create the lumped design +# ## Create lumped filter design # # Create a lumped element filter design and assign the class, type, frequency, and order. @@ -51,7 +47,7 @@ def format_plot(): design.attributes.pass_band_width_frequency = "500M" design.attributes.filter_order = 5 -# ## Plot the frequency response of the filter +# ## Plot frequency response of filter # # Plot the frequency response of the filter without any transmission zeros. @@ -62,9 +58,9 @@ def format_plot(): format_plot() plt.show() -# ## Add a transmission zero to the filter design +# ## Add a transmission zero to filter design # -# Add a transmission zeros that yields nulls separated by 2 times the pass band width (1 GHz). +# Add a transmission zero that yields nulls separated by two times the pass band width (1 GHz). # Plot the frequency response of the filter with the transmission zero. design.transmission_zeros_ratio.append_row("2.0") @@ -76,9 +72,10 @@ def format_plot(): format_plot() plt.show() -# ## Generate the netlist for the designed filter +# ## Generate netlist for designed filter # -# Generate and print the netlist for the designed filter with the added transmission zero to filter. +# Generate and print the netlist for the designed filter with the added transmission zero to +# the filter. netlist = design.topology.circuit_response() print("Netlist: \n", netlist) diff --git a/examples/03-high_frequency/radiofrequency_mmwave/spiral.py b/examples/high_frequency/radiofrequency_mmwave/spiral.py similarity index 83% rename from examples/03-high_frequency/radiofrequency_mmwave/spiral.py rename to examples/high_frequency/radiofrequency_mmwave/spiral.py index 8dfd3b407..f1e4dc923 100644 --- a/examples/03-high_frequency/radiofrequency_mmwave/spiral.py +++ b/examples/high_frequency/radiofrequency_mmwave/spiral.py @@ -1,10 +1,10 @@ # # Spiral inductor # -# This example shows how you can use PyAEDT to create a spiral inductor, solve it, and plot results. +# This example shows how to use PyAEDT to create a spiral inductor, solve it, and plot results. # # Keywords: **HFSS**, **spiral**, **inductance**, **output variable**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -14,16 +14,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -31,7 +31,7 @@ # ## Launch HFSS # -# Create a new HFSS design and change the units to microns. +# Create an HFSS design and change the units to microns. project_name = os.path.join(temp_folder.name, "spiral.aedt") hfss = ansys.aedt.core.Hfss( @@ -60,8 +60,8 @@ # ## Standardize polyline # -# Define a function that creates a polyline using the ``create_line`` method. This -# function creates a polyline having fixed width, thickness, and material. +# Define a function that creates a polyline using the ``create_line()`` method. This +# function creates a polyline having a fixed width, thickness, and material. def create_line(pts): @@ -141,7 +141,7 @@ def create_line(pts): ) # - -# ## Model Setup +# ## Set up model # # Create the air box and radiation boundary condition. @@ -162,7 +162,7 @@ def create_line(pts): hfss.assign_radiation_boundary_to_objects("airbox") # - -# Assign a material override which allows object intersections, +# Assign a material override that allows object intersections, # assigning conductors higher priority than insulators. hfss.change_material_override() @@ -177,7 +177,7 @@ def create_line(pts): # ## Generate the solution # -# Create the setup including a frequency sweep, then solve the project. +# Create the setup, including a frequency sweep. Then, solve the project. setup1 = hfss.create_setup(name="setup1") setup1.props["Frequency"] = "10GHz" @@ -192,7 +192,7 @@ def create_line(pts): hfss.save_project() hfss.analyze(cores=NUM_CORES) -# ## Post-processing +# ## Postprocess # # Get report data and use the following formulas to calculate # the inductance and quality factor. @@ -200,7 +200,7 @@ def create_line(pts): L_formula = "1e9*im(1/Y(1,1))/(2*pi*freq)" Q_formula = "im(Y(1,1))/re(Y(1,1))" -# Define the inductance as a post-processing variable. +# Define the inductance as a postprocessing variable. hfss.create_output_variable("L", L_formula, solution="setup1 : LastAdaptive") @@ -211,7 +211,7 @@ def create_line(pts): curves=[L_formula, Q_formula], formula="re", x_label="Freq", y_label="L and Q" ) -# Export results to csv file +# Export results to a CSV file data.export_data_to_csv(os.path.join(hfss.toolkit_directory, "output.csv")) @@ -221,13 +221,13 @@ def create_line(pts): hfss.save_project() hfss.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/03-high_frequency/radiofrequency_mmwave/stripline.py b/examples/high_frequency/radiofrequency_mmwave/stripline.py similarity index 92% rename from examples/03-high_frequency/radiofrequency_mmwave/stripline.py rename to examples/high_frequency/radiofrequency_mmwave/stripline.py index 5d5fa61f4..3412f13b0 100644 --- a/examples/03-high_frequency/radiofrequency_mmwave/stripline.py +++ b/examples/high_frequency/radiofrequency_mmwave/stripline.py @@ -1,11 +1,11 @@ # # Stripline analysis -# This example shows how you can use PyAEDT to create a differential stripline design in +# This example shows how to use PyAEDT to create a differential stripline design in # 2D Extractor and run a simulation. # # Keywords: **Q2D**, **Stripline**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -18,7 +18,7 @@ # - -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 @@ -26,7 +26,8 @@ # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -241,7 +242,7 @@ q2d.analyze(cores=NUM_CORES) plot_sources = matrix.get_sources_for_plot(category="Z0") -# Get simulation results as a ``SolutionData`` object and plot as a jpg +# Get simulation results as a ``SolutionData`` object and plot to a JPG file. data = q2d.post.get_solution_data(expressions=plot_sources, context=matrix.name) data.plot(snapshot_path=os.path.join(temp_folder.name, "plot.jpg")) @@ -252,13 +253,13 @@ q2d.save_project() q2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/index.rst b/examples/index.rst index 329b6ae83..b6042aec4 100644 --- a/examples/index.rst +++ b/examples/index.rst @@ -4,16 +4,16 @@ :hidden: :maxdepth: 2 - 02-aedt_general/index - 03-high_frequency/index - 04-low_frequency/index - 05-electrothermal/index - 06-AEDT/index + aedt_general/index + high_frequency/index + low_frequency/index + electrothermal/index + aedt/index Examples ======== -End-to-end examples show how you can use PyAEDT. If PyAEDT is installed +End-to-end examples show how to use PyAEDT. If PyAEDT is installed on your machine, you can download these examples and use them as Python files or Jupyter notebooks and run them locally. diff --git a/examples/04-low_frequency/_static/CFD_coil.png b/examples/low_frequency/_static/CFD_coil.png similarity index 100% rename from examples/04-low_frequency/_static/CFD_coil.png rename to examples/low_frequency/_static/CFD_coil.png diff --git a/examples/04-low_frequency/_static/TEAM.png b/examples/low_frequency/_static/TEAM.png similarity index 100% rename from examples/04-low_frequency/_static/TEAM.png rename to examples/low_frequency/_static/TEAM.png diff --git a/examples/04-low_frequency/_static/general.png b/examples/low_frequency/_static/general.png similarity index 100% rename from examples/04-low_frequency/_static/general.png rename to examples/low_frequency/_static/general.png diff --git a/examples/04-low_frequency/_static/magnetic.png b/examples/low_frequency/_static/magnetic.png similarity index 100% rename from examples/04-low_frequency/_static/magnetic.png rename to examples/low_frequency/_static/magnetic.png diff --git a/examples/04-low_frequency/_static/motor_maxwell.png b/examples/low_frequency/_static/motor_maxwell.png similarity index 100% rename from examples/04-low_frequency/_static/motor_maxwell.png rename to examples/low_frequency/_static/motor_maxwell.png diff --git a/examples/04-low_frequency/_static/pcb_stress.png b/examples/low_frequency/_static/pcb_stress.png similarity index 100% rename from examples/04-low_frequency/_static/pcb_stress.png rename to examples/low_frequency/_static/pcb_stress.png diff --git a/examples/04-low_frequency/_static/touchstone.png b/examples/low_frequency/_static/touchstone.png similarity index 100% rename from examples/04-low_frequency/_static/touchstone.png rename to examples/low_frequency/_static/touchstone.png diff --git a/examples/04-low_frequency/general/control_program.py b/examples/low_frequency/general/control_program.py similarity index 64% rename from examples/04-low_frequency/general/control_program.py rename to examples/low_frequency/general/control_program.py index 52431db1a..6340792dd 100644 --- a/examples/04-low_frequency/general/control_program.py +++ b/examples/low_frequency/general/control_program.py @@ -1,13 +1,13 @@ -# # Enabling Control Program +# # Control program enablement -# This example shows how you can use PyAEDT to enable control program in a Maxwell 2D project. -# It shows how to create the geometry, load material properties from an Excel file and -# set up the mesh settings. Moreover, it focuses on post-processing operations, in particular how to -# plot field line traces, relevant for an electrostatic analysis. +# This example shows how to use PyAEDT to enable a control program in a Maxwell 2D project. +# It shows how to create the geometry, load material properties from an Excel file, and +# set up the mesh settings. Moreover, it focuses on postprocessing operations, in particular how to +# plot field line traces, which are relevant for an electrostatic analysis. # # Keywords: **Maxwell 2D**, **control program**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,23 +16,24 @@ from ansys.aedt.core import Maxwell2d, downloads -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# The temporary directory is used to run the example and save simulation data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download the project file +# ## Download project file # -# The files required to run this example will be downloaded to the temporary working folder. +# Download the files required to run this example to the temporary working folder. aedt_file = downloads.download_file( source="maxwell_ctrl_prg", @@ -55,20 +56,18 @@ ) # ## Set active design -# -# Set the active design. m2d.set_active_design("1 time step control") -# ## Retrieve the setup +# ## Get setup # -# Get the simulation setup for this design so that the "control program" can be enabled. +# Get the simulation setup for this design so that the control program can be enabled. setup = m2d.setups[0] # ## Enable control program # -# Enable control program by giving the path to the file. +# Enable the control program by giving the path to the file. setup.enable_control_program(control_program_path=ctrl_prg_file) @@ -94,13 +93,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/general/dc_analysis.py b/examples/low_frequency/general/dc_analysis.py similarity index 82% rename from examples/04-low_frequency/general/dc_analysis.py rename to examples/low_frequency/general/dc_analysis.py index 5b67ed2ea..f69a62615 100644 --- a/examples/04-low_frequency/general/dc_analysis.py +++ b/examples/low_frequency/general/dc_analysis.py @@ -1,11 +1,11 @@ # # Electro DC analysis -# This example shows how you can use PyAEDT to create a Maxwell DC analysis, +# This example shows how to use PyAEDT to create a Maxwell DC analysis, # compute mass center, and move coordinate systems. # # Keywords: **Maxwell 3D**, **DC**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,16 +15,17 @@ from ansys.aedt.core import Maxwell3d -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# The temporary directory is used to run the example and save simulation data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -33,7 +34,7 @@ # ## Launch AEDT # # Create an instance of the ``Maxwell3d`` class named ``m3d`` by providing -# the project name, the version and the graphical mode. +# the project name, the version, and the graphical mode. project_name = os.path.join(temp_folder.name, "conductor_example.aedt") m3d = Maxwell3d( @@ -51,22 +52,18 @@ # ## Create conductor # -# Create a conductor using "copper" which is pre-defined in the Maxwell material library. +# Create a conductor using copper, a predefined material in the Maxwell material library. conductor = m3d.modeler.create_box( origin=[7, 4, 22], sizes=[10, 5, 30], name="Conductor", material="copper" ) # ## Create setup and assign voltage -# -# Create the setup and assign a voltage. m3d.assign_voltage(assignment=conductor.faces, amplitude=0) m3d.create_setup() # ## Plot model -# -# Plot the model. m3d.plot( show=False, @@ -75,8 +72,6 @@ ) # ## Solve setup -# -# Solve the setup. m3d.analyze(cores=NUM_CORES) @@ -128,13 +123,13 @@ m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/general/eddy_current.py b/examples/low_frequency/general/eddy_current.py similarity index 79% rename from examples/04-low_frequency/general/eddy_current.py rename to examples/low_frequency/general/eddy_current.py index 0c11b18b5..5042b86a1 100644 --- a/examples/04-low_frequency/general/eddy_current.py +++ b/examples/low_frequency/general/eddy_current.py @@ -1,11 +1,11 @@ -# # Eddy Current analysis and reduced matrix +# # Eddy current analysis and reduced matrix -# This example shows how to leverage PyAEDT to assign matrix +# This example shows how to leverage PyAEDT to assign a matrix # and perform series or parallel connections in a Maxwell 2D design. # # Keywords: **Maxwell 2D**, **eddy current**, *matrix**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,24 +15,24 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download .aedt file +# ## Download AEDT file # -# Set local temporary folder to export the .aedt file to. +# Set the local temporary folder to export the AEDT file to. project_path = ansys.aedt.core.downloads.download_file( source="maxwell_ec_reduced_matrix", @@ -42,7 +42,7 @@ # ## Launch AEDT and Maxwell 2D # -# Launch AEDT and Maxwell 2D providing the version, path to the project and the graphical mode. +# Launch AEDT and Maxwell 2D, providing the version, path to the project, and the graphical mode. m2d = ansys.aedt.core.Maxwell2d( project=project_path, @@ -62,8 +62,8 @@ # ## Assign reduced matrices # # Assign reduced matrices to the parent matrix previously created. -# For 2D/3D Eddy Current Solvers, two or more excitations can be joined -# either in series or parallel connection. The result is known as reduced matrix. +# For 2D/3D Eddy current solvers, two or more excitations can be joined +# either in series or parallel connection. The result is known as a reduced matrix. series = matrix.join_series(sources=["pri", "sec"], matrix_name="ReducedMatrix1") parallel = matrix.join_parallel(sources=["sec", "terz"], matrix_name="ReducedMatrix2") @@ -125,13 +125,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/general/electrostatic.py b/examples/low_frequency/general/electrostatic.py similarity index 73% rename from examples/04-low_frequency/general/electrostatic.py rename to examples/low_frequency/general/electrostatic.py index b77e9addd..7bcb0adaf 100644 --- a/examples/04-low_frequency/general/electrostatic.py +++ b/examples/low_frequency/general/electrostatic.py @@ -1,13 +1,13 @@ # # Electrostatic analysis -# This example shows how you can use PyAEDT to create a Maxwell 2D electrostatic analysis. -# It shows how to create the geometry, load material properties from an Excel file and -# set up the mesh settings. Moreover, it focuses on post-processing operations, in particular how to -# plot field line traces, relevant for an electrostatic analysis. +# This example shows how to use PyAEDT to create a Maxwell 2D electrostatic analysis. +# It shows how to create the geometry, load material properties from a Microsoft Excel file, and +# set up the mesh settings. Moreover, it focuses on postprocessing operations, in particular how to +# plot field line traces, which are relevant for an electrostatic analysis. # # Keywords: **Maxwell 2D**, **electrostatic**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -17,24 +17,24 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 NG_MODE = False -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, -# the temporary folder name is given by ``temp_folder.name``. +# the temporary folder name is given by ``temp_folder.name``.. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download .xlsx file +# ## Download Excel file # -# Set local temporary folder to export the .xlsx file to. +# Set the local temporary folder to export the Excel (XLSX) file to. file_name_xlsx = ansys.aedt.core.downloads.download_file( source="field_line_traces", name="my_copper.xlsx", destination=temp_folder.name @@ -42,7 +42,7 @@ # ## Initialize dictionaries # -# Initialize dictionaries that contain all the definitions for the design variables. +# Initialize the dictionaries that contain all the definitions for the design variables. # + geom_params_circle = { @@ -94,15 +94,15 @@ for k, v in geom_params_rectangle.items(): m2d[k] = v -# ## Read materials from .xslx file +# ## Read materials from Excel file # -# Read materials from .xslx file into and set into design. +# Read materials from the Excel file into the design. mats = m2d.materials.import_materials_from_excel(file_name_xlsx) # ## Create design geometries # -# Create a rectangle and a circle and assign the material read from the .xlsx file. +# Create a rectangle and a circle. Assign the material read from the Excel file. # Create two new polylines and a region. # + @@ -143,7 +143,7 @@ # ## Define excitations # -# Assign voltage excitations to rectangle and circle. +# Assign voltage excitations to the rectangle and circle. m2d.assign_voltage(assignment=rect.id, amplitude=0, name="Ground") m2d.assign_voltage(assignment=circle.id, amplitude=50e6, name="50kV") @@ -154,9 +154,7 @@ m2d.mesh.assign_surface_mesh_manual(assignment=["Ground"], surface_deviation=0.001) -# ## Create, validate and analyze the setup -# -# Create, update, validate and analyze the setup. +# ## Create, validate, and analyze setup setup_name = "MySetupAuto" setup = m2d.create_setup(name=setup_name) @@ -168,7 +166,7 @@ # ## Evaluate the E Field tangential component # # Evaluate the E Field tangential component along the given polylines. -# Add these operations to the Named Expression list in Field Calculator. +# Add these operations to the **Named Expression** list in the field calculator. e_line = m2d.post.fields_calculator.add_expression( calculation="e_line", assignment=None @@ -180,10 +178,10 @@ calculation="e_line", assignment="Poly12", names=[e_line] ) -# ## Create Field Line Traces Plot +# ## Create field line traces plot # -# Create Field Line Traces Plot specifying as seeding faces -# the ground, the electrode and the region +# Create a field line traces plot specifying as seeding faces +# the ground, the electrode, and the region # and as ``In surface objects`` only the region. plot = m2d.post.create_fieldplot_line_traces( @@ -192,10 +190,10 @@ plot_name="LineTracesTest", ) -# ## Update Field Line Traces Plot +# ## Update field line traces plot # -# Update field line traces plot. -# Update seeding points number, line style and line width. +# Update the field line traces plot. +# Update the seeding points number, line style, and line width. plot.SeedingPointsNumber = 20 plot.LineStyle = "Cylinder" @@ -204,16 +202,16 @@ # ## Export field line traces plot # -# Export field line traces plot. -# For field lint traces plot, the export file format is ``.fldplt``. +# Export the field line traces plot. +# For the field lint traces plot, the export file format is ``.fldplt``. m2d.post.export_field_plot( plot_name="LineTracesTest", output_dir=temp_folder.name, file_format="fldplt" ) -# ## Export the mesh field plot +# ## Export mesh field plot # -# Export the mesh in ``aedtplt`` format. +# Export the mesh to an AEDTPLT file. m2d.post.export_mesh_obj(setup=m2d.nominal_adaptive) @@ -221,13 +219,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/general/external_circuit.py b/examples/low_frequency/general/external_circuit.py similarity index 83% rename from examples/04-low_frequency/general/external_circuit.py rename to examples/low_frequency/general/external_circuit.py index d9f3c137b..c1a626708 100644 --- a/examples/04-low_frequency/general/external_circuit.py +++ b/examples/low_frequency/general/external_circuit.py @@ -1,9 +1,9 @@ -# # External circuit +# # External delta circuit # # This example shows how to create an external delta circuit and connect it with a Maxwell 2D design. -# Keywords: **Maxwell2d**, **Circuit**, **netlist** +# Keywords: **Maxwell 2D**, **Circuit**, **netlist** -# ## Perform required imports +# ## Perform imports and define constants import os import tempfile @@ -11,16 +11,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -28,7 +28,7 @@ # ## Launch AEDT and Maxwell 2D # -# Launch AEDT and Maxwell 2D providing the version, path to the project and the graphical mode. +# Launch AEDT and Maxwell 2D providing the version, path to the project, and the graphical mode. project_name = os.path.join(temp_folder.name, "Maxwell_circuit_example.aedt") design_name = "1 Maxwell" @@ -45,7 +45,7 @@ # ## Initialize dictionaries and define variables # -# Initialize dictionaries that contain all design variables definitions. +# Initialize dictionaries that contain all design variable definitions. voltage = "230V" frequency = "50Hz" @@ -69,7 +69,7 @@ # ## Create geometry # -# Create copper coils and vacuum region, assign mesh operations, and assign balloon boundary to the region edges. +# Create copper coils and a vacuum region. Assign mesh operations, and then assign a balloon boundary to the region edges. coil1_id = m2d.modeler.create_circle( orientation="Z", origin=[0, 0, 0], radius=10, name="coil1", material="copper" @@ -117,7 +117,7 @@ # ## Create simulation setup # -# Create simulation setup defining stop time and time step +# Create the simulation setup, defining the stop time and time step. setup = m2d.create_setup() setup["StopTime"] = "stop_time" @@ -125,7 +125,7 @@ # ## Create external circuit # -# Create circuit design including all the windings of type ``External`` in the Maxwell design. +# Create the circuit design, including all windings of type ``External`` in the Maxwell design. circuit = m2d.create_external_circuit(circuit_design=circuit_name) @@ -144,7 +144,7 @@ # ## Finalize external circuit # -# Draw other components: Resistances, voltage sources, and grounds +# Draw these other components: resistors, voltage sources, and grounds circuit.modeler.schematic_units = "mil" @@ -173,9 +173,9 @@ g = circuit.modeler.schematic.create_gnd([2300, i * 1000], angle=90) ground.append(g) -# ## Connect the components +# ## Connect components # -# Connect components by drawing wires +# Connect the components by drawing wires. windings[2].pins[1].connect_to_component(resistors[2].pins[0], use_wire=True) windings[1].pins[1].connect_to_component(resistors[1].pins[0], use_wire=True) @@ -213,9 +213,9 @@ ] ) -# ## Export and import the netlist +# ## Export and import netlist # -# Export the netlist file, and import it to Maxwell +# Export the netlist file and then import it to Maxwell 2D. netlist_file = os.path.join(temp_folder.name, "_netlist.sph") circuit.export_netlist_from_schematic(netlist_file) @@ -224,9 +224,8 @@ netlist_file_path=netlist_file, schematic_design_name=circuit_name ) -# ## Analyze the setup +# ## Analyze setup # -# Analyze the setup setup.analyze(cores=NUM_CORES) @@ -245,13 +244,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_dir.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/general/field_export.py b/examples/low_frequency/general/field_export.py similarity index 75% rename from examples/04-low_frequency/general/field_export.py rename to examples/low_frequency/general/field_export.py index c228d6175..52eb4bf18 100644 --- a/examples/04-low_frequency/general/field_export.py +++ b/examples/low_frequency/general/field_export.py @@ -1,13 +1,13 @@ -# # Fields export in transient +# # Fields export in transient analysis # -# This example shows how to leverage PyAEDT to set up a Maxwell 3D transient analysis, +# This example shows how to leverage PyAEDT to set up a Maxwell 3D transient analysis and then # compute the average value of the current density field over a specific coil surface # and the magnitude of the current density field over all coil surfaces at each time step # of the transient analysis. # # Keywords: **Maxwell 3D**, **transient**, **fields calculator**, **field export**. -# ## Perform required imports +# ## Perform imports and define constant # # Perform required imports. @@ -17,24 +17,24 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, -# the temporary folder name is given by ``temp_folder.name``. +# the temporary folder name is given by ``temp_folder.name`` temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Import project # -# The files required to run this example will be downloaded into the temporary working folder. +# The files required to run this example are downloaded into the temporary working folder. project_path = ansys.aedt.core.downloads.download_file( source="maxwell_transient_fields", @@ -52,8 +52,8 @@ # ## Create setup and validate # -# Create the setup specifying general settings such as ``StopTime`` and ``TimeStep`` -# and the save fields type. +# Create the setup specifying general settings such as ``StopTime``, ``TimeStep``, +# and ``SaveFieldsType``. setup = m3d.create_setup(name="Setup1") setup.props["StopTime"] = "0.02s" @@ -71,8 +71,8 @@ # ## Create field expressions # -# Create a field expression to evaluate J normal to a surface using the advanced fields calculator. -# The expression is created as a dictionary and then provided as an argument to ``add_expression``. +# Create a field expression to evaluate the J field normal to a surface using the advanced fields calculator. +# The expression is created as a dictionary and then provided as an argument to the ``add_expression()`` method. my_expression = { "name": "Jn", @@ -91,7 +91,7 @@ } m3d.post.fields_calculator.add_expression(my_expression, None) -# Calculate the average value of J normal using the advanced fields calculator. +# Calculate the average value of the J field normal using the advanced fields calculator. my_expression = { "name": "Jn_avg", @@ -111,24 +111,24 @@ } m3d.post.fields_calculator.add_expression(my_expression, None) -# ## Analyze setup specifying setup name. +# ## Analyze setup specifying setup name m3d.analyze_setup(name=setup.name, cores=NUM_CORES) -# ## Get the available report quantities +# ## Get available report quantities # -# Get available report quantities given a specific report category. -# In this case ``Calculator Expressions`` is the category. +# Get the available report quantities given a specific report category. +# In this case, ``Calculator Expressions`` is the category. report_types = m3d.post.available_report_types quantity = m3d.post.available_report_quantities( report_category="Fields", quantities_category="Calculator Expressions" ) -# ## Compute the time steps of the analysis +# ## Compute time steps of the analysis # # Create a fields report object given the nominal sweep. -# Get the report solution data in order to compute the time steps of the transient analysis. +# Get the report solution data to compute the time steps of the transient analysis. sol = m3d.post.reports_by_category.fields(setup=m3d.nominal_sweep) data = sol.get_solution_data() @@ -136,12 +136,13 @@ # ## Create field plots over the coil surfaces and export field data # -# Convert each time step into ``ms``. +# Convert each time step into millimeters. # Create field plots over the surface of each coil by specifying the coil object, -# the quantity to plot and the time step. -# The average value of J normal is plotted on Coil_A2 surface for every time-step. +# the quantity to plot, and the time step. +# +# The average value of the J field normal is plotted on the ``Coil_A2`` surface for every time step. # The J field is plotted on the surface of each coil for every time-step. -# Export fields data in temporary directory as an ``.aedtplt``. +# Fields data is exported to the temporary folder as an AEDTPLT file. for time_step in time_steps: t = ansys.aedt.core.generic.constants.unit_converter( @@ -180,13 +181,13 @@ m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/general/index.rst b/examples/low_frequency/general/index.rst similarity index 76% rename from examples/04-low_frequency/general/index.rst rename to examples/low_frequency/general/index.rst index 16bf3d043..7e572c736 100644 --- a/examples/04-low_frequency/general/index.rst +++ b/examples/low_frequency/general/index.rst @@ -1,7 +1,7 @@ General ~~~~~~~ -These examples use PyAEDT to show some general examples +These examples use PyAEDT to show some general applications. .. nbgallery:: diff --git a/examples/04-low_frequency/general/resistance.py b/examples/low_frequency/general/resistance.py similarity index 77% rename from examples/04-low_frequency/general/resistance.py rename to examples/low_frequency/general/resistance.py index 0bf1f6136..7e952c441 100644 --- a/examples/04-low_frequency/general/resistance.py +++ b/examples/low_frequency/general/resistance.py @@ -5,7 +5,7 @@ # # Keywords: **Maxwell 2D**, **DXF import**, **material sweep**, **expression cache**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,7 +16,7 @@ import ansys.aedt.core from ansys.aedt.core.generic.pdf import AnsysReport -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NG_MODE = False @@ -24,7 +24,8 @@ # ## Create temporary directory # -# The temporary directory is used to run the example and save simulation data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -49,7 +50,7 @@ # ## Import geometry as a DXF file # -# You can test importing a DXF or a Parasolid file by commenting/uncommenting +# You can test importing a DXF or a Parasolid file by commenting and uncommenting # the following lines. # Importing DXF files only works in graphical mode. @@ -66,8 +67,8 @@ # ## Define variables # -# Define conductor thickness in z-direction, material array with 4 materials, -# and MaterialIndex referring to the material array. +# Define the conductor thickness in the z-direction, the material array with four materials, +# and the material index referring to the material array. m2d["MaterialThickness"] = "5mm" m2d["ConductorMaterial"] = '["Copper", "Aluminum", "silver", "gold"]' @@ -77,28 +78,26 @@ # ## Assign materials # -# Voltage ports will be defined as gold, conductor +# Voltage ports are defined as gold. The conductor # gets the material defined by the 0th entry of the material array. m2d.assign_material(obj=["ANSYS_LOGO_2D_1", "ANSYS_LOGO_2D_2"], mat="gold") m2d.modeler["ANSYS_LOGO_2D_3"].material_name = "ConductorMaterial[MaterialIndex]" # ## Assign voltages -# -# 1V and 0V. m2d.assign_voltage(assignment=["ANSYS_LOGO_2D_1"], amplitude=1, name="1V") m2d.assign_voltage(assignment=["ANSYS_LOGO_2D_2"], amplitude=0, name="0V") -# ## Setup conductance calculation +# ## Set up conductance calculation # -# 1V is the source, 0V ground. +# ``1V`` is the source. ``0V`` is the ground. m2d.assign_matrix(assignment=["1V"], group_sources=["0V"], matrix_name="Matrix1") # ## Assign mesh operation # -# 3mm on the . +# Assign three millimeters as the maximum length. m2d.mesh.assign_length_mesh( assignment=["ANSYS_LOGO_2D_3"], @@ -109,8 +108,8 @@ # ## Create simulation setup and enable expression cache # -# Create simulation setup with minimum 4 adaptive passes to ensure convergence. -# Enable expression cache to observe the convergence. +# Create the simulation setup with a minimum of four adaptive passes to ensure convergence. +# Enable the expression cache to observe the convergence. setup = m2d.create_setup(setupname="Setup1", MinimumPasses=4) setup.enable_expression_cache( @@ -130,8 +129,8 @@ # ## Create parametric sweep # -# Create parametric sweep to sweep all the entries in the material array. -# Save fields and mesh and use the mesh for all the materials. +# Create a parametric sweep to sweep all the entries in the material array. +# Save fields and mesh. Use the mesh for all the materials. sweep = m2d.parametrics.add( sweep_var="MaterialIndex", @@ -146,9 +145,9 @@ sweep["SolveWithCopiedMeshOnly"] = True sweep.analyze(cores=NUM_CORES) -# ## Create resistance report +# ## Create report # -# Create R. vs. material report. +# Create a material resistance versus material index report. # + variations = {"MaterialIndex": ["All"], "MaterialThickness": ["Nominal"]} @@ -163,7 +162,7 @@ # ## Get solution data # -# Get solution data using the object ``report``` to get resistance values +# Get solution data using the ``report``` object to get resistance values # and plot data outside AEDT. data = report.get_solution_data() @@ -172,10 +171,10 @@ data.primary_sweep = "MaterialIndex" data.plot(snapshot_path=os.path.join(temp_folder.name, "M2D_DCConduction.jpg")) -# ## Create material index vs resistance table +# ## Create material index versus resistance table # -# Create material index vs resistance table to use in PDF report generator. -# Create ``colors`` table to customize each row of the material index vs resistance table. +# Create material index versus resistance table to use in the PDF report generator. +# Create ``colors`` table to customize each row of the material index versus resistance table. material_index_vs_resistance = [["Material", "Resistance"]] colors = [[(255, 255, 255), (0, 255, 0)]] @@ -186,9 +185,9 @@ colors.append([None, None]) # - -# ## Field overlay +# ## Overlay fields # -# Plot electric field and current density on the conductor surface. +# Plot the electric field and current density on the conductor surface. conductor_surface = m2d.modeler["ANSYS_LOGO_2D_3"].faces plot1 = m2d.post.create_fieldplot_surface( @@ -198,9 +197,9 @@ assignment=conductor_surface, quantity="Mag_J", plot_name="Current Density" ) -# ## Field overlay +# ## Overlay fields using PyVista # -# Plot electric field using pyvista and saving to an image. +# Plot electric field using PyVista and save to an image file. py_vista_plot = m2d.post.plot_field( quantity="Mag_E", assignment=conductor_surface, plot_cad_objs=False, show=False @@ -213,9 +212,9 @@ py_vista_plot.azimuth_angle = 0 py_vista_plot.plot(os.path.join(temp_folder.name, "mag_E.jpg")) -# ## Field animation +# ## Plot field animation # -# Plot current density vs the Material index. +# Plot current density verus the material index. animated_plot = m2d.post.plot_animated_field( quantity="Mag_J", @@ -236,39 +235,37 @@ animated_plot.animate() # ## Export model picture -# -# Export model picture. model_picture = m2d.post.export_model_picture() # ## Generate PDF report # -# Generate a PDF report with output of simulation. +# Generate a PDF report with the output of the simulation. pdf_report = AnsysReport( project_name=m2d.project_name, design_name=m2d.design_name, version=AEDT_VERSION ) -# Customize text font. +# Customize the text font. pdf_report.report_specs.font = "times" pdf_report.report_specs.text_font_size = 10 -# Create report +# Create the report pdf_report.create() -# Add project's design info to report. +# Add project's design information to the report. pdf_report.add_project_info(m2d) -# Add model picture in a new chapter and add text. +# Add the model picture in a new chapter. Then, add text. pdf_report.add_chapter("Model Picture") -pdf_report.add_text("This section contains the model picture") +pdf_report.add_text("This section contains the model picture.") pdf_report.add_image(path=model_picture, caption="Model Picture", width=80, height=60) -# Add in a new chapter field overlay plots. +# Add field overlay plots in a new chapter. pdf_report.add_chapter("Field overlay") pdf_report.add_sub_chapter("Plots") @@ -283,14 +280,14 @@ pdf_report.add_section() pdf_report.add_chapter("Results") pdf_report.add_sub_chapter("Resistance vs. Material") -pdf_report.add_text("This section contains resistance vs material data.") +pdf_report.add_text("This section contains resistance versus material data.") # Aspect ratio is automatically calculated if only width is provided pdf_report.add_image(os.path.join(temp_folder.name, "M2D_DCConduction.jpg"), width=130) -# Add a new subchapter to display resistance data from previously created table. +# Add a new subchapter to display resistance data from the previously created table. pdf_report.add_sub_chapter("Resistance data table") -pdf_report.add_text("This section contains Resistance data.") +pdf_report.add_text("This section contains resistance data.") pdf_report.add_table( title="Resistance Data", content=material_index_vs_resistance, @@ -298,7 +295,7 @@ col_widths=[75, 100], ) -# Add table of content and save PDF. +# Add a table of contents and save the PDF. pdf_report.add_toc() pdf_report.save_pdf(temp_folder.name, "AEDT_Results.pdf") @@ -307,13 +304,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/general/twin_builder/_static/rectifier.png b/examples/low_frequency/general/twin_builder/_static/rectifier.png similarity index 100% rename from examples/04-low_frequency/general/twin_builder/_static/rectifier.png rename to examples/low_frequency/general/twin_builder/_static/rectifier.png diff --git a/examples/04-low_frequency/general/twin_builder/dynamic_rom.py b/examples/low_frequency/general/twin_builder/dynamic_rom.py similarity index 76% rename from examples/04-low_frequency/general/twin_builder/dynamic_rom.py rename to examples/low_frequency/general/twin_builder/dynamic_rom.py index 0c8d476ab..2f8ffc901 100644 --- a/examples/04-low_frequency/general/twin_builder/dynamic_rom.py +++ b/examples/low_frequency/general/twin_builder/dynamic_rom.py @@ -1,14 +1,14 @@ # # Dynamic ROM # -# This example shows how you can use PyAEDT to create a dynamic ROM in Twin Builder -# and run a Twin Builder time-domain simulation. +# This example shows how to use PyAEDT to create a dynamic reduced order model (ROM) +# in Twin Builder and run a Twin Builder time-domain simulation. # # > **Note:** This example uses functionality only available in Twin # > Builder 2023 R2 and later. # # Keywords: **Twin Builder**, **Dynamic ROM**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -20,15 +20,16 @@ import ansys.aedt.core import matplotlib.pyplot as plt -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -36,12 +37,12 @@ # ## Set up input data # -# Define needed file name +# Define the file name. source_snapshot_data_zipfilename = "Ex1_Mechanical_DynamicRom.zip" source_build_conf_file = "dynarom_build.conf" -# Download data from example_data repository +# Download data from the ``example_data`` repository. _ = ansys.aedt.core.downloads.download_twin_builder_data( file_name=source_snapshot_data_zipfilename, @@ -52,7 +53,7 @@ source_build_conf_file, True, temp_folder.name ) -# Toggle these for local testing +# Toggle these for local testing. data_folder = os.path.join(source_data_folder, "Ex03") @@ -69,7 +70,7 @@ # ## Launch Twin Builder and build ROM component # # Launch Twin Builder using an implicit declaration and add a new design with -# a default setup for building the dynamic ROM component. +# the default setup for building the dynamic ROM component. project_name = os.path.join(temp_folder.name, "dynamic_rom.aedt") tb = ansys.aedt.core.TwinBuilder( @@ -79,32 +80,31 @@ new_desktop=True, ) -# ## Desktop Configuration +# ## Configure AEDT # -# > **Note:** Only run following cell if AEDT is not configured to run _"Twin Builder"_. +# > **Note:** Only run the following cell if AEDT is not configured to run Twin Builder. # > -# > The following cell configures Electronics Desktop (AEDT) and the schematic editor -# > to use the _"Twin Builder"_ configuration. +# > The following cell configures AEDT and the schematic editor +# > to use the ``Twin Builder`` configuration. # > The dynamic ROM feature is only available with a Twin Builder license. # > A cell at the end of this example restores the AEDT configuration. If your -# > environment is set up -# > to use the _"Twin Builder"_ configuration, you do not need to run these sections. -# > +# > environment is set up to use the ``Twin Builder`` configuration, you do not +# > need to run these code blocks. current_desktop_config = tb._odesktop.GetDesktopConfiguration() current_schematic_environment = tb._odesktop.GetSchematicEnvironment() tb._odesktop.SetDesktopConfiguration("Twin Builder") tb._odesktop.SetSchematicEnvironment(1) -# Get the dynamic ROM builder object +# Get the dynamic ROM builder object. rom_manager = tb._odesign.GetROMManager() dynamic_rom_builder = rom_manager.GetDynamicROMBuilder() -# Build the dynamic ROM with specified configuration file +# Build the dynamic ROM with the specified configuration file. conf_file_path = os.path.join(data_folder, source_build_conf_file) dynamic_rom_builder.Build(conf_file_path.replace("\\", "/")) -# Test if ROM was created successfully +# Test if the ROM was created successfully dynamic_rom_path = os.path.join(data_folder, "DynamicRom.dyn") if os.path.exists(dynamic_rom_path): tb._odesign.AddMessage( @@ -115,7 +115,7 @@ "Info", "path does not exist: {}".format(dynamic_rom_path), "" ) -# Create the ROM component definition in Twin Builder +# Create the ROM component definition in Twin Builder. rom_manager.CreateROMComponent(dynamic_rom_path.replace("\\", "/"), "dynarom") @@ -123,15 +123,15 @@ # # Place components to create a schematic. -# Define the grid distance for ease in calculations +# Define the grid distance for ease in calculations. G = 0.00254 -# Place a dynamic ROM component +# Place a dynamic ROM component. rom1 = tb.modeler.schematic.create_component("ROM1", "", "dynarom", [36 * G, 28 * G]) -# Place two excitation sources +# Place two excitation sources. source1 = tb.modeler.schematic.create_periodic_waveform_source( None, "PULSE", 190, 0.002, "300deg", 210, 0, [20 * G, 29 * G] @@ -140,14 +140,14 @@ None, "PULSE", 190, 0.002, "300deg", 210, 0, [20 * G, 25 * G] ) -# Connect components with wires +# Connect components with wires. tb.modeler.schematic.create_wire([[22 * G, 29 * G], [33 * G, 29 * G]]) tb.modeler.schematic.create_wire( [[22 * G, 25 * G], [30 * G, 25 * G], [30 * G, 28 * G], [33 * G, 28 * G]] ) -# Zoom to fit the schematic +# Zoom to fit the schematic. tb.modeler.zoom_to_fit() # ## Parametrize transient setup @@ -159,8 +159,6 @@ tb.set_hmax("1s") # ## Solve transient setup -# -# Solve the transient setup. tb.analyze_setup("TR", cores=NUM_CORES) @@ -190,10 +188,10 @@ # After the simulation is completed, you can close Twin Builder or release it. # All methods provide for saving the project before closing. -# Clean up the downloaded data +# Clean up the downloaded data. shutil.rmtree(source_data_folder) -# Restore earlier desktop configuration and schematic environment +# Restore the earlier AEDT configuration and schematic environment. tb._odesktop.SetDesktopConfiguration(current_desktop_config) tb._odesktop.SetSchematicEnvironment(current_schematic_environment) @@ -203,12 +201,12 @@ tb.save_project() tb.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/04-low_frequency/general/twin_builder/index.rst b/examples/low_frequency/general/twin_builder/index.rst similarity index 63% rename from examples/04-low_frequency/general/twin_builder/index.rst rename to examples/low_frequency/general/twin_builder/index.rst index affc9179b..2a4e222a3 100644 --- a/examples/04-low_frequency/general/twin_builder/index.rst +++ b/examples/low_frequency/general/twin_builder/index.rst @@ -1,7 +1,7 @@ Twin Builder ~~~~~~~~~~~~ -These examples use PyAEDT to show some Twin Builder examples +These examples use PyAEDT to show some Twin Builder applications. .. nbgallery:: diff --git a/examples/04-low_frequency/general/twin_builder/rc_circuit.py b/examples/low_frequency/general/twin_builder/rc_circuit.py similarity index 85% rename from examples/04-low_frequency/general/twin_builder/rc_circuit.py rename to examples/low_frequency/general/twin_builder/rc_circuit.py index 1fcc15208..a369e0a1e 100644 --- a/examples/04-low_frequency/general/twin_builder/rc_circuit.py +++ b/examples/low_frequency/general/twin_builder/rc_circuit.py @@ -1,11 +1,11 @@ # # RC circuit design analysis # -# This example shows how you can use PyAEDT to create a Twin Builder design +# This example shows how to use PyAEDT to create a Twin Builder design # and run a Twin Builder time-domain simulation. # # Keywords: **Twin Builder**, **RC**. -# ## Perform required imports +# ## Perform imports and define constantss # # Perform required imports. @@ -15,15 +15,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -74,8 +75,6 @@ tb.set_end_time("300ms") # ## Solve transient setup -# -# Solve the transient setup. tb.analyze_setup("TR") @@ -98,12 +97,12 @@ tb.save_project() tb.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/04-low_frequency/general/twin_builder/rectifier.py b/examples/low_frequency/general/twin_builder/rectifier.py similarity index 84% rename from examples/04-low_frequency/general/twin_builder/rectifier.py rename to examples/low_frequency/general/twin_builder/rectifier.py index dadbc15b2..508a1792e 100644 --- a/examples/04-low_frequency/general/twin_builder/rectifier.py +++ b/examples/low_frequency/general/twin_builder/rectifier.py @@ -1,13 +1,13 @@ -# # Wiring a rectifier with a capacitor filter +# # Wiring of a rectifier with a capacitor filter # -# This example shows how you can use PyAEDT to create a Twin Builder design +# This example shows how to use PyAEDT to create a Twin Builder design # and run a Twin Builder time-domain simulation. # # # # Keywords: **Twin Builder**, **rectifier**, **filter**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -18,15 +18,16 @@ import ansys.aedt.core import matplotlib.pyplot as plt -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -35,7 +36,7 @@ # ## Launch Twin Builder # # Launch Twin Builder using an implicit declaration and add a new design with -# a default setup. +# the default setup. project_name = os.path.join(temp_folder.name, "TB_Rectifier_Demo.aedt") tb = ansys.aedt.core.TwinBuilder( @@ -45,13 +46,13 @@ new_desktop=True, ) -# ## Create components for bridge rectifier +# ## Create components # # Place components for a bridge rectifier and a capacitor filter in the schematic editor. # # Specify the grid spacing to use for placement # of components in the schematic editor. Components are placed using the named -# argument ``location`` as a list of ``[x, y]`` values in mm. +# argument ``location`` as a list of ``[x, y]`` values in millimeters. G = 0.00254 @@ -95,9 +96,7 @@ # ## Connect components # -# Connect components with wires. - -# Connect the diode pins to create the bridge. +# Connect components with wires, and connect the diode pins to create the bridge. tb.modeler.schematic.create_wire( points=[diode1.pins[0].location, diode3.pins[0].location] @@ -139,13 +138,13 @@ # Zoom to fit the schematic tb.modeler.zoom_to_fit() -# The circuit schematic will now be visible in the Twin Builder -# schematic editor and should look like +# The circuit schematic should now be visible in the Twin Builder +# schematic editor and look like # the image shown at the beginning of the example. # -# ## Run the Simulation +# ## Run the simulation # -# Update the total time to be simulated and run the analysis +# Update the total time to be simulated and run the analysis. tb.set_end_time("100ms") tb.analyze_setup("TR") @@ -178,12 +177,12 @@ tb.save_project() tb.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/04-low_frequency/general/twin_builder/static_rom.py b/examples/low_frequency/general/twin_builder/static_rom.py similarity index 75% rename from examples/04-low_frequency/general/twin_builder/static_rom.py rename to examples/low_frequency/general/twin_builder/static_rom.py index 650d1c4b4..4dec1fcec 100644 --- a/examples/04-low_frequency/general/twin_builder/static_rom.py +++ b/examples/low_frequency/general/twin_builder/static_rom.py @@ -3,11 +3,11 @@ # This example shows how to create a static reduced order model (ROM) # in Twin Builder and run a transient simulation. # -# > **Note:** _This example uses functionality only available in Twin Builder 2024 R2 and later._ +# > **Note:** This example uses functionality only available in Twin Builder 2024 R2 and later. # # Keywords: **Twin Builder**, **Static ROM**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -18,15 +18,16 @@ from ansys.aedt.core import TwinBuilder, downloads -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -34,17 +35,17 @@ # ## Set up input data # -# The following files will be downloaded along with the +# The following files are downloaded along with the # other project data used to run this example. source_snapshot_data_zipfilename = "Ex1_Fluent_StaticRom.zip" source_build_conf_file = "SROMbuild.conf" source_props_conf_file = "SROM_props.conf" -# ## Download Example Data +# ## Download example data # # The following cell downloads the required files needed to run this example and -# extracts them in a local folder ``"Ex04"`` +# extracts them in a local folder named ``"Ex04"``. # + _ = downloads.download_twin_builder_data( @@ -78,7 +79,7 @@ # ## Launch Twin Builder and build ROM component # # Launch Twin Builder using an implicit declaration and add a new design with -# a default setup for building the static ROM component. +# the default setup for building the static ROM component. project_name = os.path.join(temp_folder.name, "static_rom.aedt") tb = TwinBuilder( @@ -88,16 +89,16 @@ new_desktop=True, ) -# ## Desktop Configuration +# ## Configure AEDT # -# > **Note:** Only run following cell if AEDT is not configured to run "Twin Builder". +# > **Note:** Only run the following cell if AEDT is not configured to run Twin Builder. # > -# > The following cell configures Electronics Desktop (AEDT) and the schematic editor -# > to use the _"Twin Builder"_ configuration. +# > The following cell configures AEDT and the schematic editor +# > to use the ``Twin Builder`` configuration. # > The Static ROM feature is only available with a Twin Builder license. # > A cell at the end of this example restores the AEDT configuration. If your -# > environment is set up_ -# > to use the "Twin Builder" configuration, you do not need to run these sections. +# > environment is set up to use the ``Twin Builder`` configuration, you do not +# > need to run these sections. current_desktop_config = tb._odesktop.GetDesktopConfiguration() current_schematic_environment = tb._odesktop.GetSchematicEnvironment() @@ -105,37 +106,37 @@ tb._odesktop.SetSchematicEnvironment(1) # + -# Get the static ROM builder object +# Get the static ROM builder object. rom_manager = tb._odesign.GetROMManager() static_rom_builder = rom_manager.GetStaticROMBuilder() -# Build the static ROM with specified configuration file +# Build the static ROM with the specified configuration file confpath = os.path.join(data_folder, source_build_conf_file) static_rom_builder.Build(confpath.replace("\\", "/")) -# Test if ROM was created successfully +# Test if the ROM was created successfully. static_rom_path = os.path.join(data_folder, "StaticRom.rom") if os.path.exists(static_rom_path): tb.logger.info("Built intermediate rom file successfully at: %s", static_rom_path) else: tb.logger.error("Intermediate rom file not found at: %s", static_rom_path) -# Create the ROM component definition in Twin Builder +# Create the ROM component definition in Twin Builder. rom_manager.CreateROMComponent(static_rom_path.replace("\\", "/"), "staticrom") # - # ## Create schematic # -# Place components to create a schematic. +# Place components to create the schematic. # + -# Define the grid distance for ease in calculations +# Define the grid distance for ease in calculations. G = 0.00254 -# Place a dynamic ROM component +# Place a dynamic ROM component. rom1 = tb.modeler.schematic.create_component("ROM1", "", "staticrom", [40 * G, 25 * G]) -# Place two excitation sources +# Place two excitation sources. source1 = tb.modeler.schematic.create_periodic_waveform_source( None, "SINE", 2.5, 0.01, 0, 7.5, 0, [20 * G, 29 * G] ) @@ -144,14 +145,14 @@ ) # - -# Connect components with wires +# Connect components with wires. tb.modeler.schematic.create_wire([[22 * G, 29 * G], [33 * G, 29 * G]]) tb.modeler.schematic.create_wire( [[22 * G, 25 * G], [30 * G, 25 * G], [30 * G, 28 * G], [33 * G, 28 * G]] ) -# Enable storage of views +# Enable storage of views. rom1.set_property("store_snapshots", 1) rom1.set_property("view1_storage_period", "10s") @@ -170,9 +171,9 @@ # ## Solve transient setup # -# Solve the transient setup. Skipping in case of documentation build. +# Solve the transient setup. Skipping this step in case the documentation is being built. -# NOTE : The following code can be uncommented. +# > **Note:** The following code can be uncommented. # # tb.analyze_setup("TR") @@ -182,7 +183,7 @@ # the values for the voltage on the pulse voltage source and the values for the # output of the dynamic ROM. -# NOTE : The following code can be uncommented but depends on the previous commented code. +# > **Note:** The following code can be uncommented, but it depends on the previous commented code. # # e_value = "ROM1.outfield_mode_1" # x = tb.post.get_solution_data(e_value, "TR", "Time") @@ -200,13 +201,13 @@ # ## Close Twin Builder # -# After the simulation is completed, you can close Twin Builder or release it. +# After the simulation is completed, either close Twin Builder or release it. # All methods provide for saving the project before closing. -# Clean up the downloaded data +# Clean up the downloaded data. shutil.rmtree(source_data_folder) -# Restore earlier desktop configuration and schematic environment +# Restore earlier desktop configuration and schematic environment. tb._odesktop.SetDesktopConfiguration(current_desktop_config) tb._odesktop.SetSchematicEnvironment(current_schematic_environment) @@ -216,12 +217,12 @@ tb.save_project() tb.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # -# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_folder.cleanup() diff --git a/examples/04-low_frequency/index.rst b/examples/low_frequency/index.rst similarity index 78% rename from examples/04-low_frequency/index.rst rename to examples/low_frequency/index.rst index aaa941da0..328289bed 100644 --- a/examples/04-low_frequency/index.rst +++ b/examples/low_frequency/index.rst @@ -1,7 +1,7 @@ -Low Frequency +Low frequency ============= -These end-to-end examples show how you can use PyAEDT for low frequency applications. +These end-to-end examples show how to use PyAEDT for low-frequency applications. .. grid:: 2 @@ -17,7 +17,7 @@ These end-to-end examples show how you can use PyAEDT for low frequency applicat :height: 200px :align: center - This section shows some general workflows + General examples .. grid-item-card:: Motor :padding: 2 2 2 2 @@ -30,7 +30,7 @@ These end-to-end examples show how you can use PyAEDT for low frequency applicat :height: 200px :align: center - This section shows some motor examples + Motor examples .. grid-item-card:: Magnetics :padding: 2 2 2 2 @@ -43,9 +43,9 @@ These end-to-end examples show how you can use PyAEDT for low frequency applicat :height: 200px :align: center - This section shows some Magnetics application examples + Magnetics examples - .. grid-item-card:: TEAM problems + .. grid-item-card:: T.E.A.M :padding: 2 2 2 2 :link: team_problem/index :link-type: doc @@ -56,7 +56,7 @@ These end-to-end examples show how you can use PyAEDT for low frequency applicat :height: 200px :align: center - This section show the TEAM problems set by COMPUMAG + T.E.A.M. problems set by COMPUMAG .. grid-item-card:: Multiphysics :padding: 2 2 2 2 @@ -69,7 +69,7 @@ These end-to-end examples show how you can use PyAEDT for low frequency applicat :height: 200px :align: center - This section shows some multiphysics examples + Multiphysics examples .. grid-item-card:: Report :padding: 2 2 2 2 @@ -82,7 +82,7 @@ These end-to-end examples show how you can use PyAEDT for low frequency applicat :height: 200px :align: center - This section shows report examples + Report examples .. toctree:: :hidden: diff --git a/examples/04-low_frequency/magnetic/choke.py b/examples/low_frequency/magnetic/choke.py similarity index 80% rename from examples/04-low_frequency/magnetic/choke.py rename to examples/low_frequency/magnetic/choke.py index 202b2cbee..7640f72ec 100644 --- a/examples/04-low_frequency/magnetic/choke.py +++ b/examples/low_frequency/magnetic/choke.py @@ -1,10 +1,10 @@ # # Choke setup # -# This example shows how you can use PyAEDT to create a choke setup in Maxwell 3D. +# This example shows how to use PyAEDT to create a choke setup in Maxwell 3D. # # Keywords: **Maxwell 3D**, **choke**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,17 +15,18 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, -# the temporary folder name is given by ``temp_folder.name``. +# the temporary folder name is given by ``temp_folder.name`` temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") @@ -42,9 +43,9 @@ new_desktop=True, ) -# ## Rules and information of use +# ## Define parameters # -# The dictionary values containing the different parameters of the core and +# The dictionary values contain the different parameter values of the core and # the windings that compose the choke. You must not change the main structure of # the dictionary. The dictionary has many primary keys, including # ``"Number of Windings"``, ``"Layer"``, and ``"Layer Type"``, that have @@ -55,28 +56,28 @@ # You must not modify the primary or secondary keys. You can modify only their values. # You must not change the data types for these keys. For the dictionaries from # ``"Number of Windings"`` through ``"Wire Section"``, values must be Boolean. Only -# one value per dictionary can be ``"True"``. If all values are ``True``, only the first one +# one value per dictionary can be ``True``. If all values are ``True``, only the first one # remains set to ``True``. If all values are ``False``, the first value is chosen as the # correct one by default. For the dictionaries from ``"Core"`` through ``"Inner Winding"``, # values must be strings, floats, or integers. # -# Descriptions follow for primary keys: +# Descriptions follow for the primary keys: # -# - ``"Number of Windings"``: Number of windings around the core -# - ``"Layer"``: Number of layers of all windings +# - ``"Number of Windings"``: Number of windings around the core. +# - ``"Layer"``: Number of layers of all windings. # - ``"Layer Type"``: Whether layers of a winding are linked to each other # - ``"Similar Layer"``: Whether layers of a winding have the same number of turns and -# same spacing between turns -# - ``"Mode"``: When there are only two windows, whether they are in common or differential mode -# - ``"Wire Section"``: Type of wire section and number of segments -# - ``"Core"``: Design of the core +# same spacing between turns. +# - ``"Mode"``: When there are only two windows, whether they are in common or differential mode. +# - ``"Wire Section"``: Type of wire section and number of segments. +# - ``"Core"``: Design of the core. # - ``"Outer Winding"``: Design of the first layer or outer layer of a winding and the common -# parameters for all layers -# - ``"Mid Winding"``: Turns and turns spacing ("Coil Pit") for the second or mid layer if -# it is necessary -# - ``"Inner Winding"``: Turns and turns spacing ("Coil Pit") for the third or inner layer -# if it is necessary -# - ``"Occupation(%)"``: An informative parameter that is useless to modify +# parameters for all layers. +# - ``"Mid Winding"``: Turns and turns spacing (``Coil Pit``) for the second or +# mid layer if it is necessary. +# - ``"Inner Winding"``: Turns and turns spacing (``Coil Pit``) for the third or inner +# layer if it is necessary. +# - ``"Occupation(%)"``: An informative parameter that is useless to modify. # # The following parameter values work. You can modify them if you want. @@ -112,7 +113,7 @@ # ## Convert dictionary to JSON file # -# Convert a dictionary to a JSON file. PyAEDT methods ask for the path of the +# Convert the dictionary to a JSON file. PyAEDT methods ask for the path of the # JSON file as an argument. You can convert a dictionary to a JSON file. # + @@ -124,11 +125,11 @@ # ## Verify parameters of JSON file # -# Verify parameters of the JSON file. The ``check_choke_values`` method takes +# Verify parameters of the JSON file. The ``check_choke_values()`` method takes # the JSON file path as an argument and does the following: # -# - Checks if the JSON file is correctly written (as explained in the rules) -# - Checks inequations on windings parameters to avoid having unintended intersections +# - Checks if the JSON file is correctly written (as explained earlier) +# - Checks equations on windings parameters to avoid having unintended intersections dictionary_values = m3d.modeler.check_choke_values( input_dir=json_path, create_another_file=False @@ -137,7 +138,7 @@ # ## Create choke # -# Create the choke. The ``create_choke`` method takes the JSON file path as an +# Create the choke. The ``create_choke()`` method takes the JSON file path as an # argument. list_object = m3d.modeler.create_choke(input_file=json_path) @@ -148,8 +149,6 @@ third_winding_list = list_object[4] # ## Assign excitations -# -# Assign excitations. first_winding_faces = m3d.modeler.get_object_faces( assignment=first_winding_list[0].name @@ -204,16 +203,12 @@ ) # ## Assign matrix -# -# Assign the matrix. m3d.assign_matrix( assignment=["phase_1_in", "phase_2_in", "phase_3_in"], matrix_name="current_matrix" ) # ## Create mesh operation -# -# Create the mesh operation. mesh = m3d.mesh mesh.assign_skin_depth( @@ -253,8 +248,6 @@ ) # ## Save project -# -# Save the project. m3d.save_project() m3d.modeler.fit_all() @@ -268,13 +261,13 @@ m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/magnetic/index.rst b/examples/low_frequency/magnetic/index.rst similarity index 71% rename from examples/04-low_frequency/magnetic/index.rst rename to examples/low_frequency/magnetic/index.rst index 0053f7a90..b7d2098aa 100644 --- a/examples/04-low_frequency/magnetic/index.rst +++ b/examples/low_frequency/magnetic/index.rst @@ -1,7 +1,7 @@ Magnetics ~~~~~~~~~ -These examples use PyAEDT to show some magnetics examples +These examples use PyAEDT to show some magnetics applications. .. nbgallery:: diff --git a/examples/04-low_frequency/magnetic/lorentz_actuator.py b/examples/low_frequency/magnetic/lorentz_actuator.py similarity index 86% rename from examples/04-low_frequency/magnetic/lorentz_actuator.py rename to examples/low_frequency/magnetic/lorentz_actuator.py index 905cec326..28d7a1a5a 100644 --- a/examples/04-low_frequency/magnetic/lorentz_actuator.py +++ b/examples/low_frequency/magnetic/lorentz_actuator.py @@ -3,9 +3,9 @@ # This example uses PyAEDT to set up a Lorentz actuator # and solve it using the Maxwell 2D transient solver. # -# Keywords: **Maxwell2D**, **Transient**, **translational motion**, **mechanical transient** +# Keywords: **Maxwell2D**, **transient**, **translational motion**, **mechanical transient** -# ## Perform required imports +# ## Perform imports and define constantss # # Perform required imports. @@ -15,15 +15,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -31,9 +32,11 @@ # ## Initialize dictionaries # -# Initialize electric and geometric parameters for the actuator. -# Initialize simulation specification. -# Initialize materials for the actuator component. +# Initialize the following: +# +# - Electric and geometric parameters for the actuator +# - Simulation specifications +# - Materials for the actuator component dimensions = { "Core_outer_x": "100mm", @@ -73,7 +76,7 @@ # Launch AEDT and Maxwell 2D after first setting up the project name. # The following code also creates an instance of the # ``Maxwell2d`` class named ``m2d`` by providing -# the project name, the design name, the solver, the version and the graphical mode. +# the project name, the design name, the solver, the version, and the graphical mode. project_name = os.path.join(temp_folder.name, "Lorentz_actuator.aedt") m2d = ansys.aedt.core.Maxwell2d( @@ -100,7 +103,7 @@ for k, v in simulation_specifications.items(): m2d[k] = v -# Materials. +# Definem materials. m2d.variable_manager.set_variable(name="Material data") m2d.logger.clear_messages() @@ -119,7 +122,7 @@ # ## Create geometry # -# Create magnetic core, coils, and magnets. Assign materials and create a new coordinate system to +# Create magnetic core, coils, and magnets. Assign materials and create a coordinate system to # define the magnet orientation. core_id = m2d.modeler.create_rectangle( @@ -203,8 +206,8 @@ # ## Assign motion # -# Create band objects: all the objects within the band move. Inner band ensures that the mesh is good, -# and additionally it is required when there more than 1 moving objects. +# Create band objects. All the objects within the band move. The inner band ensures that the mesh is good, +# and additionally it is required when there is more than one moving object. # Assign linear motion with mechanical transient. band_id = m2d.modeler.create_rectangle( @@ -245,14 +248,14 @@ # ## Create simulation domain # -# Create region and assign zero vector potential on the region edges. +# Create a region and assign zero vector potential on the region edges. region_id = m2d.modeler.create_region(pad_percent=2) m2d.assign_vector_potential(assignment=region_id.edges, boundary="VectorPotential1") # ## Assign mesh operations # -# Transient solver does not have adaptive mesh refinement, so the mesh operations have to be assigned. +# The transient solver does not have adaptive mesh refinement, so the mesh operations must be assigned. m2d.mesh.assign_length_mesh( assignment=[band_id, inner_band_id], @@ -269,19 +272,17 @@ # ## Turn on eddy effects # -# Assign eddy effects to magnets. +# Assign eddy effects to the magnets. m2d.eddy_effects_on(assignment=["magnet_n", "magnet_s"]) # ## Turn on core loss # -# Enable core loss for core. +# Enable core loss for the core. m2d.set_core_losses(assignment="Core") -# ## Create setup -# -# Create the simulation setup. +# ## Create simulation setup setup = m2d.create_setup(name="Setup1") setup.props["StopTime"] = "Stop_time" @@ -293,7 +294,8 @@ # ## Create report # -# Create a XY-report with force on coil and the position of the coil on Y-axis, time on X-axis. +# Create an XY-report with force on the coil, the position of the coil on the Y axis, +# and time on the X axis. m2d.post.create_report( expressions=["Moving1.Force_x", "Moving1.Position"], @@ -302,8 +304,6 @@ ) # ## Analyze project -# -# Analyze the project. setup.analyze(cores=NUM_CORES, use_auto_settings=False) @@ -311,13 +311,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_dir.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/magnetic/magneto_motive_contour.py b/examples/low_frequency/magnetic/magneto_motive_contour.py similarity index 75% rename from examples/04-low_frequency/magnetic/magneto_motive_contour.py rename to examples/low_frequency/magnetic/magneto_motive_contour.py index 72d449176..d46ae8155 100644 --- a/examples/04-low_frequency/magnetic/magneto_motive_contour.py +++ b/examples/low_frequency/magnetic/magneto_motive_contour.py @@ -2,14 +2,13 @@ # # This example shows how to use PyAEDT to calculate # the magnetomotive force along several lines. -# It shows how to leverage PyAEDT advanced fields calculator -# to insert a custom formula, in this case the integral +# It shows how to leverage the PyAEDT advanced fields calculator +# to insert a custom formula, which in this case is the integral # of the H field along a line. # # Keywords: **Maxwell 2D**, **magnetomotive force**. - -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -19,16 +18,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -36,7 +35,7 @@ # ## Import project # -# The files required to run this example will be downloaded into the temporary working folder. +# Download the files required to run this example to the temporary working folder. project_path = ansys.aedt.core.downloads.download_file( source="maxwell_magnetic_force", @@ -57,11 +56,11 @@ # ## Create a polyline # -# Create a polyline specifying its points. +# Create a polyline, specifying its points. poly = m2d.modeler.create_polyline(points=[[10, -10, 0], [10, 10, 0]], name="polyline") -# Duplicate polyline along a vector +# Duplicate the polyline along a vector. polys = [poly.name] polys.extend(poly.duplicate_along_line(vector=[-0.5, 0, 0], clones=10)) @@ -73,15 +72,15 @@ # ## Analyze setup # -# Analyze setup specifying setup name +# Analyze the setup, specifying the setup name. m2d.analyze_setup(name=m2d.setups[0].name, cores=NUM_CORES, use_auto_settings=False) # ## Compute magnetomotive force along each line # -# Create and add a new formula to add in PyAEDT advanced fields calculator. -# Create fields report object and get field data. -# Create a Data Table report for H field along each line and export it in a .csv file. +# Create and add a new formula to add in the PyAEDT advanced fields calculator. +# Create the fields report object and get field data. +# Create a data table report for the H field along each line and export it to a .csv file. for p in polys: quantity = "H_field_{}".format(p) @@ -126,13 +125,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/magnetic/magneto_motive_line.py b/examples/low_frequency/magnetic/magneto_motive_line.py similarity index 74% rename from examples/04-low_frequency/magnetic/magneto_motive_line.py rename to examples/low_frequency/magnetic/magneto_motive_line.py index b18eca1cf..093020798 100644 --- a/examples/04-low_frequency/magnetic/magneto_motive_line.py +++ b/examples/low_frequency/magnetic/magneto_motive_line.py @@ -2,14 +2,14 @@ # # This example shows how to use PyAEDT to calculate # the magnetomotive force along a line that changes position. -# It shows how to leverage PyAEDT advanced fields calculator -# to insert a custom formula, in this case the integral -# of the H field along a line -# and compute the field for each position with a parametric sweep. +# It shows how to leverage the PyAEDT advanced fields calculator +# to insert a custom formula, which in this case is the integral +# of the H field along a line. It computes the field for each position +# with a parametric sweep. # # Keywords: **Maxwell 2D**, **magnetomotive force**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -19,16 +19,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -36,7 +36,7 @@ # ## Import project # -# The files required to run this example will be downloaded into the temporary working folder. +# Download the files required to run this example to the temporary working folder. project_path = ansys.aedt.core.downloads.download_file( source="maxwell_magnetic_force", @@ -55,15 +55,15 @@ design="Maxwell2DDesign1", ) -# ## Create a new design variable +# ## Create a design variable # -# Parametrize polyline x position. +# Parametrize the polyline x position. m2d["xl"] = "10mm" -# ## Create a polyline +# ## Create polyline # -# Create a polyline specifying its points. +# Create a polyline, specifying its points. poly = m2d.modeler.create_polyline( points=[["xl", -10, 0], ["xl", 10, 0]], name="polyline" @@ -74,7 +74,7 @@ model = m2d.plot(show=False) model.plot(os.path.join(temp_folder.name, "Image.jpg")) -# ## Add a parametric sweep +# ## Add parametric sweep # # Add a parametric sweep where the parameter to sweep is ``xl``. # Create a linear step sweep from ``10mm`` to ``15mm`` every ``1mm`` step. @@ -89,7 +89,7 @@ # ## Compute magnetomotive force along the line # -# Create and add a new formula to add in PyAEDT advanced fields calculator. +# Create and add a new formula to add in the PyAEDT advanced fields calculator. quantity = "H_field_{}".format(poly.name) my_expression = { @@ -120,10 +120,10 @@ param_sweep.analyze(cores=NUM_CORES) -# ## Create a data table report +# ## Create data table report # # Create a data table report to display H for each polyline position. -# Afterward export results in a .csv file. +# Afterwards, export results to a CSV file. report = m2d.post.create_report( expressions=quantity, @@ -141,13 +141,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/magnetic/transient_winding.py b/examples/low_frequency/magnetic/transient_winding.py similarity index 81% rename from examples/04-low_frequency/magnetic/transient_winding.py rename to examples/low_frequency/magnetic/transient_winding.py index f93e82336..767c2f8b5 100644 --- a/examples/04-low_frequency/magnetic/transient_winding.py +++ b/examples/low_frequency/magnetic/transient_winding.py @@ -1,6 +1,6 @@ # # Transient winding analysis # -# This example shows how you can use PyAEDT to create a project in Maxwell 2D +# This example shows how to use PyAEDT to create a project in Maxwell 2D # and run a transient simulation. It runs only on Windows using CPython. # # The following libraries are required for the advanced postprocessing features @@ -10,7 +10,7 @@ # - [Numpy](https://pypi.org/project/numpy/) # - [PyVista](https://pypi.org/project/pyvista/) # -# Install these libraries with: +# Install these libraries with this command: # # ```console # pip install numpy pyvista matplotlib @@ -18,7 +18,7 @@ # # Keywords: **Maxwell 2D**, **transient**, **winding**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -28,25 +28,23 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Insert Maxwell 2D design -# -# Insert a Maxwell 2D design. project_name = os.path.join(temp_folder.name, "Transient.aedt") m2d = ansys.aedt.core.Maxwell2d( @@ -58,8 +56,6 @@ ) # ## Create rectangle and duplicate it -# -# Create a rectangle and duplicate it. rect1 = m2d.modeler.create_rectangle( origin=[0, 0, 0], sizes=[10, 20], name="winding", material="copper" @@ -81,8 +77,6 @@ m2d.assign_balloon(assignment=region.edges) # ## Plot model -# -# Plot the model. m2d.plot( show=False, @@ -90,9 +84,7 @@ plot_air_objects=True, ) -# ## Create setup -# -# Create the transient setup. +# ## Create transient setup setup = m2d.create_setup() setup.props["StopTime"] = "0.02s" @@ -103,8 +95,6 @@ setup.props["Steps To"] = "0.002s" # ## Create rectangular plot -# -# Create a rectangular plot. m2d.post.create_report( expressions="InputCurrent(PHA)", @@ -114,14 +104,10 @@ ) # ## Solve model -# -# Solve the model. m2d.analyze(cores=NUM_CORES, use_auto_settings=False) # ## Create output and plot using PyVista -# -# Create the output and plot it using PyVista. # + cutlist = ["Global:XY"] @@ -165,13 +151,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/motor/_static/motor.png b/examples/low_frequency/motor/_static/motor.png similarity index 100% rename from examples/04-low_frequency/motor/_static/motor.png rename to examples/low_frequency/motor/_static/motor.png diff --git a/examples/04-low_frequency/motor/_static/motorcad.png b/examples/low_frequency/motor/_static/motorcad.png similarity index 100% rename from examples/04-low_frequency/motor/_static/motorcad.png rename to examples/low_frequency/motor/_static/motorcad.png diff --git a/examples/04-low_frequency/motor/aedt_motor/index.rst b/examples/low_frequency/motor/aedt_motor/index.rst similarity index 69% rename from examples/04-low_frequency/motor/aedt_motor/index.rst rename to examples/low_frequency/motor/aedt_motor/index.rst index 1b3ae8b58..9ba2dd72f 100644 --- a/examples/04-low_frequency/motor/aedt_motor/index.rst +++ b/examples/low_frequency/motor/aedt_motor/index.rst @@ -1,7 +1,7 @@ AEDT Motor ~~~~~~~~~~ -These examples use PyAEDT to show some motor examples in AEDT +These examples use PyAEDT to show some motor applications in AEDT. .. nbgallery:: diff --git a/examples/04-low_frequency/motor/aedt_motor/magnet_segmentation.py b/examples/low_frequency/motor/aedt_motor/magnet_segmentation.py similarity index 51% rename from examples/04-low_frequency/motor/aedt_motor/magnet_segmentation.py rename to examples/low_frequency/motor/aedt_motor/magnet_segmentation.py index 47c81f616..372f345bf 100644 --- a/examples/04-low_frequency/motor/aedt_motor/magnet_segmentation.py +++ b/examples/low_frequency/motor/aedt_motor/magnet_segmentation.py @@ -1,11 +1,11 @@ # # Magnet segmentation -# This example shows how you can use PyAEDT to segment magnets of an electric motor. -# The method is valid and usable for any object the user would like to segment. +# This example shows how to use PyAEDT to segment magnets of an electric motor. +# The method is valid and usable for any object you would like to segment. # # Keywords: **Maxwell 3D**, **Magnet segmentation**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -15,22 +15,23 @@ from ansys.aedt.core import Maxwell3d, downloads -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download .aedt file example +# ## Download AEDT file example # -# Set local temporary folder to export the .aedt file to. +# Set the local temporary folder to export the AEDT file to. aedt_file = downloads.download_file( source="object_segmentation", @@ -40,7 +41,7 @@ # ## Launch Maxwell 3D # -# Launch Maxwell 3D, providing the version, path to the project and the graphical mode. +# Launch Maxwell 3D, providing the version, rgw path to the project, and the graphical mode. m3d = Maxwell3d( project=aedt_file, @@ -49,14 +50,14 @@ non_graphical=NG_MODE, ) -# ## Segment first magnet by specifying the number of segments +# ## Segment first magnet by specifying number of segments # -# Select first magnet to segment by specifying the number of segments. -# The method accepts in input either the list of magnets names to segment or -# magnets ids or the magnet object :class:`ansys.aedt.core.modeler.cad.object3d.Object3d`. -# ``apply_mesh_sheets`` is enabled which means that the mesh sheets will -# be applied in the geometry too. -# In this specific case we give as input the name of the magnet. +# Select the first magnet to segment by specifying the number of segments. +# The method accepts as input the list of magnets names to segment, +# magnet IDs, or the magnet :class:`ansys.aedt.core.modeler.cad.object3d.Object3d` object. +# When ``apply_mesh_sheets`` is enabled, the mesh sheets are also +# applied in the geometry. +# In the following code, the name of the magnet is also given as an input. segments_number = 2 object_name = "PM_I1" @@ -67,10 +68,10 @@ mesh_sheets=3, ) -# ## Segment second magnet by specifying the number of segments +# ## Segment second magnet by specifying number of segments # -# Select second magnet to segment by specifying the number of segments. -# In this specific case we give as input the id of the magnet. +# Select the second magnet to segment by specifying the number of segments. +# The following code gives the ID of the magnet as an input. segments_number = 2 object_name = "PM_I1_1" @@ -79,11 +80,11 @@ magnet_id, segments=segments_number, apply_mesh_sheets=True ) -# ## Segment third magnet by specifying the segmentation thickness +# ## Segment third magnet by specifying segmentation thickness # -# Select third magnet to segment by specifying the segmentation thickness. -# In this specific case we give as input the magnet object -# of type `ansys.aedt.core.modeler.cad.object3d.Object3d`. +# Select the third magnet to segment by specifying the segmentation thickness. +# The following code gives the magnet object type `ansys.aedt.core.modeler.cad.object3d.Object3d` +# as an input. segmentation_thickness = 1 object_name = "PM_O1" @@ -92,10 +93,10 @@ magnet, segmentation_thickness=segmentation_thickness, apply_mesh_sheets=True ) -# ## Segment fourth magnet by specifying the number of segments +# ## Segment fourth magnet by specifying number of segments # -# Select fourth magnet to segment by specifying the number of segments. -# In this specific case we give as input the name of the magnet and we disable the mesh sheets. +# Select the fourth magnet to segment by specifying the number of segments. +# The following code gives the name of the magnet as input and disables the mesh sheets. object_name = "PM_O1_1" segments_number = 2 @@ -110,13 +111,13 @@ m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/motor/aedt_motor/pm_synchronous.py b/examples/low_frequency/motor/aedt_motor/pm_synchronous.py similarity index 93% rename from examples/04-low_frequency/motor/aedt_motor/pm_synchronous.py rename to examples/low_frequency/motor/aedt_motor/pm_synchronous.py index 7fcdf8776..680a73018 100644 --- a/examples/04-low_frequency/motor/aedt_motor/pm_synchronous.py +++ b/examples/low_frequency/motor/aedt_motor/pm_synchronous.py @@ -1,11 +1,11 @@ # # PM synchronous motor transient analysis # -# This example shows how you can use PyAEDT to create a Maxwell 2D transient analysis for -# an interior permanent magnet electric motor. +# This example shows how to use PyAEDT to create a Maxwell 2D transient analysis for +# an interior permanent magnet (PM) electric motor. # # Keywords: **Maxwell 2D**, **transient**, **motor**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -17,16 +17,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory and download files # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -36,7 +36,7 @@ # # Dictionaries contain all the definitions for the design variables and output variables. -# ## Initialize definitions for stator, rotor, and shaft +# ## Initialize definitions for th stator, rotor, and shaft # # Initialize geometry parameter definitions for the stator, rotor, and shaft. # The naming refers to RMxprt primitives. @@ -123,8 +123,6 @@ ) # ## Define modeler units -# -# Define modeler units. m2d.modeler.model_units = "mm" @@ -162,9 +160,9 @@ # ## Create second material # # Create the material ``"Arnold_Magnetics_N30UH_80C"``. -# The BH curve is read from a tabbed CSV file, and a list (``BH_List_PM``) +# The BH curve is read from a tabbed CSV file. A list named ``BH_List_PM`` # is created. This list is passed to the ``mat_PM.permeability.value`` -# method. +# variable. mat_PM = m2d.materials.add_material(name="Arnold_Magnetics_N30UH_80C_new") mat_PM.update() @@ -206,7 +204,7 @@ # ## Create geometry for stator # # Create the geometry for the stator. It is created via -# the RMxprt user-defined primitive. A list of lists is +# the RMxprt user-defined primitive (UDP). A list of lists is # created with the proper UDP parameters. # + @@ -252,7 +250,7 @@ # ## Assign properties to stator # # Assign properties to the stator. The following code assigns -# the material, name, color, and ``solve_inside`` properties. +# the ``material``, ``name``, ``color``, and ``solve_inside`` properties. m2d.assign_material(assignment=stator_id, material="30DH_20C_smooth") stator_id.name = "Stator" @@ -344,8 +342,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): id_PMs = m2d.modeler.get_objects_w_string(string_name="PM", case_sensitive=True) # ## Create coils -# -# Create the coils. coil_id = m2d.modeler.create_rectangle( origin=["DiaRotorLam/2+Airgap+Coil_SetBack", "-Coil_Edge_Short/2", 0], @@ -361,8 +357,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): id_coils = m2d.modeler.get_objects_w_string(string_name="Coil", case_sensitive=True) # ## Create shaft and region -# -# Create the shaft and region. region_id = m2d.modeler.create_circle( origin=[0, 0, 0], @@ -582,8 +576,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): ph_c_current = "IPeak * cos(2*pi * ElectricFrequency*time - 240deg+Theta_i)" # ## Define windings in phase A -# -# Define windings in phase A. m2d.assign_coil( assignment=["Coil"], @@ -610,8 +602,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): ) # ## Define windings in phase B -# -# Define windings in phase B. m2d.assign_coil( assignment="Coil_3", @@ -638,8 +628,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): ) # ## Define windings in phase C -# -# Define windings in phase C. m2d.assign_coil( assignment="Coil_1", @@ -674,8 +662,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): m2d.assign_current(assignment=item, amplitude=0, solid=True, name=item + "_I0") # ## Create mesh operations -# -# Create the mesh operations. m2d.mesh.assign_length_mesh( assignment=id_coils, @@ -699,43 +685,26 @@ def create_cs_magnets(pm_id, cs_name, point_direction): name="rotor", ) -# ## Turn on eddy effects -# -# Turn on eddy effects. - -# m2d.eddy_effects_on(eddy_effects_list,activate_eddy_effects=True, -# activate_displacement_current=False) - # ## Turn on core loss -# -# Turn on core loss. core_loss_list = ["Rotor", "Stator"] m2d.set_core_losses(core_loss_list, core_loss_on_field=True) # ## Compute transient inductance -# -# Compute the transient inductance. m2d.change_inductance_computation( compute_transient_inductance=True, incremental_matrix=False ) # ## Set model depth -# -# Set the model depth. m2d.model_depth = "Magnetic_Axial_Length" # ## Set symmetry factor -# -# Set the symmetry factor. m2d.change_symmetry_multiplier("SymmetryFactor") # ## Create setup and validate -# -# Create the setup and validate it. # + setup_name = "MySetupAuto" @@ -756,7 +725,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # ## Initialize definitions for output variables # # Initialize the definitions for the output variables. -# These will be used later to generate reports. +# These are used later to generate reports. output_vars = { "Current_A": "InputCurrent(Phase_A)", @@ -800,21 +769,15 @@ def create_cs_magnets(pm_id, cs_name, point_direction): } # ## Create output variables for postprocessing -# -# Create output variables for postprocessing. for k, v in output_vars.items(): m2d.create_output_variable(k, v) # ## Initialize definition for postprocessing plots -# -# Initialize the definition for postprocessing plots. post_params = {"Moving1.Torque": "TorquePlots"} # ## Initialize definition for postprocessing multiplots -# -# Initialize the definition for postprocessing multiplots. post_params_multiplot = { # reports ("U_A", "U_B", "U_C", "Ui_A", "Ui_B", "Ui_C"): "PhaseVoltages", @@ -863,9 +826,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): ): "SolidLoss", } -# ## Create report -# -# Create a report. +# ## Create report. for k, v in post_params.items(): m2d.post.create_report( @@ -884,8 +845,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): ) # ## Create multiplot report -# -# Create a multiplot report. # + # for k, v in post_params_multiplot.items(): @@ -898,8 +857,6 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # - # ## Analyze and save project -# -# Analyze and save the project. m2d.save_project() m2d.analyze_setup(setup_name, use_auto_settings=False, cores=NUM_CORES) @@ -926,7 +883,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # ## Get solution data # # Get a simulation result from a solved setup and cast it in a ``SolutionData`` object. -# Plot the desired expression by using Matplotlib plot(). +# Plot the desired expression by using the Matplotlib ``plot()`` function. solutions = m2d.post.get_solution_data( expressions="Moving1.Torque", primary_sweep_variable="Time" @@ -942,7 +899,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # ## Export a report to a file # -# Export a 2D Plot data to a .csv file. +# Export 2D plot data to a CSV file. m2d.post.export_report_to_file( output_dir=temp_folder.name, plot_name="TorquePlots", extension=".csv" @@ -952,13 +909,13 @@ def create_cs_magnets(pm_id, cs_name, point_direction): m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/motor/aedt_motor/rmxpert.py b/examples/low_frequency/motor/aedt_motor/rmxpert.py similarity index 77% rename from examples/04-low_frequency/motor/aedt_motor/rmxpert.py rename to examples/low_frequency/motor/aedt_motor/rmxpert.py index 602ae629f..83ef3e273 100644 --- a/examples/04-low_frequency/motor/aedt_motor/rmxpert.py +++ b/examples/low_frequency/motor/aedt_motor/rmxpert.py @@ -1,14 +1,14 @@ -# # Create and export motor +# # Motor creation and export # -# This example uses PyAEDT to create a RMxprt project and export to Maxwell 2D. +# This example uses PyAEDT to create a RMxprt project and export it to Maxwell 2D. # It shows how to create an ASSM (Adjust-Speed Synchronous Machine) in RMxprt # and how to access rotor and stator settings. -# The model is then exported in a Maxwell 2d design -# and the RMxprt settings are exported in a json file to be reused. +# It then exports the model to a Maxwell 2D design +# and the RMxprt settings to a JSON file to be reused. # -# Keywords: **RMxprt**, **Maxwell2D** +# Keywords: **RMxprt**, **Maxwell 2D** -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -18,27 +18,25 @@ import ansys.aedt.core -# ## Define constants -# # Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Launch AEDT and Rmxprt +# ## Launch AEDT and RMxprt # -# Launch AEDT and Rmxprt after first setting up the project name. -# As a solution type the example uses an ASSM (Adjust-Speed Synchronous Machine). +# Launch AEDT and RMxprt after first setting up the project name. +# This example uses ASSM (Adjust-Speed Synchronous Machine) as the solution type. project_name = os.path.join(temp_folder.name, "ASSM.aedt") rmxprt = ansys.aedt.core.Rmxprt( @@ -50,9 +48,7 @@ non_graphical=NG_MODE, ) -# ## Define Machine settings -# -# Define global machine settings. +# ## Define global machine settings rmxprt.general["Number of Poles"] = 4 rmxprt.general["Rotor Position"] = "Inner Rotor" @@ -63,16 +59,14 @@ rmxprt.general["Circuit Type"] = "Y3" # ## Define circuit settings -# -# Define circuit settings. rmxprt.circuit["Trigger Pulse Width"] = "120deg" rmxprt.circuit["Transistor Drop"] = "2V" rmxprt.circuit["Diode Drop"] = "2V" -# ## Stator +# ## Define stator # -# Define stator, slot and windings settings. +# Define stator and slot and winding settings. rmxprt.stator["Outer Diameter"] = "122mm" rmxprt.stator["Inner Diameter"] = "75mm" @@ -96,7 +90,7 @@ rmxprt.stator.properties.children["Winding"].props["Coil Pitch"] = 5 rmxprt.stator.properties.children["Winding"].props["Number of Strands"] = 1 -# ## Rotor +# ## Define rotor # # Define rotor and pole settings. @@ -115,9 +109,9 @@ ] rmxprt.rotor.properties.children["Pole"].props["Magnet Thickness"] = "3.5mm" -# ## Setup +# ## Create setup # -# Create a setup and define main settings. +# Create a setup and define the main settings. setup = rmxprt.create_setup() setup.props["RatedVoltage"] = "220V" @@ -125,15 +119,13 @@ setup.props["RatedSpeed"] = "1500rpm" setup.props["OperatingTemperature"] = "75cel" -# ## Analyze setup -# -# Analyze setup. +# ## Analyze setup. setup.analyze(cores=NUM_CORES) # ## Export to Maxwell # -# After the project is solved, it can be exported either to Maxwell 2D or Maxwell 3D. +# After the project is solved, you can export it to either Maxwell 2D or Maxwell 3D. m2d = rmxprt.create_maxwell_design(setup_name=setup.name, maxwell_2d=True) m2d.plot( @@ -142,10 +134,10 @@ plot_air_objects=True, ) -# ## RMxprt settings export +# ## Export RMxprt settings # -# All RMxprt settings can be exported in a json file and reused for another -# project with import function. +# Export all RMxprt settings to a JSON file to reuse it for another +# project with the the import function. config = rmxprt.export_configuration(os.path.join(temp_folder.name, "assm.json")) rmxprt2 = ansys.aedt.core.Rmxprt( diff --git a/examples/04-low_frequency/motor/aedt_motor/transformer.py b/examples/low_frequency/motor/aedt_motor/transformer.py similarity index 78% rename from examples/04-low_frequency/motor/aedt_motor/transformer.py rename to examples/low_frequency/motor/aedt_motor/transformer.py index 18c61b899..6a5c66145 100644 --- a/examples/04-low_frequency/motor/aedt_motor/transformer.py +++ b/examples/low_frequency/motor/aedt_motor/transformer.py @@ -1,11 +1,11 @@ # # Transformer -# This example shows how you can use PyAEDT to set core loss given a set -# of Power-Volume [kw/m^3] curves at different frequencies. +# This example shows how to use PyAEDT to set core loss given a set +# of power-volume [kw/m^3] curves at different frequencies. # # Keywords: **Maxwell 3D**, **Transformer**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -17,24 +17,23 @@ from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.general_methods import read_csv_pandas -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NG_MODE = False # ## Create temporary directory # -# The temporary directory is used to run the example and save simulation data. If you run -# this example as a Jupyter Notebook you can recover the project data and results by copying -# the contents of the temporary folder to a local drive prior to executing the final cell of this -# notebook. -# The temporary folder name is given by ``temp_folder.name``. +# Create a temporary directory where downloaded data or +# dumped data can be stored. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Download .aedt file example +# ## Download AEDT file example # -# The files required to run this example will be downloaded to the temporary working folder. +# Download the files required to run this example to the temporary working folder. # + aedt_file = downloads.download_file( @@ -78,7 +77,7 @@ # ## Launch AEDT and Maxwell 3D # # Create an instance of the ``Maxwell3d`` class named ``m3d`` by providing -# the project and design names, the version and the graphical mode. +# the project and design names, the version, and the graphical mode. m3d = Maxwell3d( project=aedt_file, @@ -90,9 +89,9 @@ # ## Set core loss at frequencies # -# Create a new material, create a dictionary of Power-Volume [kw/m^3] points -# for a set of frequencies -# retrieved from datasheet provided by supplier and finally set Power-Ferrite core loss model. +# Create a new material, create a dictionary of power-volume [kw/m^3] points +# for a set of frequencies retrieved from datasheet provided by a supplier, +# and finally set the Power-Ferrite core loss model. mat = m3d.materials.add_material("newmat") freq_25kHz = unit_converter( @@ -136,13 +135,13 @@ m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/motor/aedt_motor/transformer_inductance.py b/examples/low_frequency/motor/aedt_motor/transformer_inductance.py similarity index 86% rename from examples/04-low_frequency/motor/aedt_motor/transformer_inductance.py rename to examples/low_frequency/motor/aedt_motor/transformer_inductance.py index b80f51b25..b91d56c9a 100644 --- a/examples/04-low_frequency/motor/aedt_motor/transformer_inductance.py +++ b/examples/low_frequency/motor/aedt_motor/transformer_inductance.py @@ -1,14 +1,14 @@ # # Transformer leakage inductance calculation # -# This example shows how you can use PyAEDT to create a Maxwell 2D +# This example shows how to use PyAEDT to create a Maxwell 2D # magnetostatic analysis to calculate transformer leakage # inductance and reactance. -# The analysis based on this document form page 8 on: -# https://www.ee.iitb.ac.in/~fclab/FEM/FEM1.pdf +# The analysis based on this document is from page 8 in Professor S. V. +# Kulkami's paper, [Basis of Finite Element Method](https://www.ee.iitb.ac.in/~fclab/FEM/FEM1.pdf). # # Keywords: **Maxwell 2D**, **transformer**, **motor**. -# ## Perform required imports +# ## Perform imports and define constants import os import tempfile @@ -16,17 +16,17 @@ from ansys.aedt.core import Maxwell2d -# ## Define constants +# Define constants, AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -34,8 +34,8 @@ # ## Initialize and launch Maxwell 2D # -# Initialize and launch Maxwell 2D, providing the version, path to the project, the design -# name and type. +# Initialize and launch Maxwell 2D, providing the version, the path to the project, the design +# name, and the type. # + @@ -113,7 +113,7 @@ # ## Create design geometries # -# Create transformer core, HV and LV windings, and the region. +# Create the transformer core, the HV and LV windings, and the region. # + core = m2d.modeler.create_rectangle( @@ -173,14 +173,14 @@ # ## Define excitations # -# Assign the same current in amp-turns but in opposite directions to HV and LV windings. +# Assign the same current in amp-turns but in opposite directions to the HV and LV windings. m2d.assign_current(assignment=lv, amplitude="Amp_turns", name="LV") m2d.assign_current(assignment=hv, amplitude="Amp_turns", name="HV", swap_direction=True) -# ## Create and analyze the setup +# ## Create and analyze setup # -# Create and analyze the setup. Setu no. of minimum passes to 3 to ensure accuracy. +# Create and analyze the setup. Set the number of minimum passes to 3 to ensure accuracy. m2d.create_setup(name="Setup1", MinimumPasses=3) m2d.analyze_setup(use_auto_settings=False, cores=NUM_CORES) @@ -239,7 +239,7 @@ ) # - -# ## Print leakage inductance and reactance values in the Message Manager +# ## Print leakage inductance and reactance values in AEDT Message Manager m2d.logger.clear_messages() m2d.logger.info( @@ -267,13 +267,13 @@ m2d.save_project() m2d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/motor/index.rst b/examples/low_frequency/motor/index.rst similarity index 84% rename from examples/04-low_frequency/motor/index.rst rename to examples/low_frequency/motor/index.rst index 3663603e6..09e00c53f 100644 --- a/examples/04-low_frequency/motor/index.rst +++ b/examples/low_frequency/motor/index.rst @@ -1,7 +1,7 @@ Motor ===== -These examples use PyAEDT to show some motor examples +These examples use PyAEDT to show some motor applications. .. grid:: 2 @@ -17,7 +17,7 @@ These examples use PyAEDT to show some motor examples :height: 150px :align: center - End-to-end examples show how you can use PyMotorCAD. + Links to examples in PyMotorCAD documentation. .. grid-item-card:: Motor :padding: 2 2 2 2 diff --git a/examples/04-low_frequency/multiphysics/index.rst b/examples/low_frequency/multiphysics/index.rst similarity index 50% rename from examples/04-low_frequency/multiphysics/index.rst rename to examples/low_frequency/multiphysics/index.rst index 369e056df..46c8ca88d 100644 --- a/examples/04-low_frequency/multiphysics/index.rst +++ b/examples/low_frequency/multiphysics/index.rst @@ -1,7 +1,7 @@ Multiphysics ~~~~~~~~~~~~ -These examples use PyAEDT to show some multiphysics examples +These examples use PyAEDT to show some multiphysics applications. .. nbgallery:: diff --git a/examples/04-low_frequency/multiphysics/maxwell_icepak.py b/examples/low_frequency/multiphysics/maxwell_icepak.py similarity index 77% rename from examples/04-low_frequency/multiphysics/maxwell_icepak.py rename to examples/low_frequency/multiphysics/maxwell_icepak.py index 3902e47d0..2c847c6a5 100644 --- a/examples/04-low_frequency/multiphysics/maxwell_icepak.py +++ b/examples/low_frequency/multiphysics/maxwell_icepak.py @@ -1,4 +1,4 @@ -# # Maxwell 3D - Icepak electrothermal analysis +# # Maxwell 3D-Icepak electrothermal analysis # # This example uses PyAEDT to set up a simple Maxwell design consisting of a coil and a ferrite core. # Coil current is set to 100A, and coil resistance and ohmic loss are analyzed. @@ -8,7 +8,7 @@ # # Keywords: **Multiphysics**, **Maxwell**, **Icepak**, **Wireless Charging**. # -# ## Set up project +# ## Perform imports and define constants # # Perform required imports. @@ -19,26 +19,25 @@ import ansys.aedt.core from ansys.aedt.core.generic.constants import AXIS -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. -# ## Create temporary directory and download files +# ## Create temporary directory # -# Create a temporary directory where we store downloaded data or -# dumped data. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -# ## Launch Application +# ## Launch application # # The syntax for different applications in AEDT differ -# only in the name of the class. In this template we use -# ``Hfss()``. Modify -# this text as needed for your example. +# only in the name of the class. This template uses +# the ``Hfss()`` class. Modify this text as needed. # + project_name = os.path.join(temp_folder.name, "Maxwell-Icepak-2way-Coupling") @@ -54,7 +53,7 @@ ) # - -# ## Model setup +# ## Set up model # # Create the coil, coil terminal, core, and region. @@ -78,11 +77,11 @@ region = m3d.modeler.create_region(pad_percent=[20, 20, 20, 20, 500, 100]) # - -# ### Create a material +# ### Create and assign material # -# Copper AWG40 Litz wire, strand diameter = 0.08mm, -# 24 parallel strands. Assign materials: Assign Coil to AWG40 copper, -# core to ferrite, and region to vacuum. +# Create a new cooper material: Copper AWG40 Litz wire, strand diameter = 0.08mm, +# 24 parallel strands. Then assign materials: Assign the coil to AWG40 copper, +# the core to ferrite, and the region to vacuum. # + no_strands = 24 @@ -99,8 +98,8 @@ m3d.assign_material(core.name, "ferrite") # - -# Assign coil current, coil consists of 20 turns, total current 10A. -# Note that each coil turn consists of 24 parallel Litz strands, see above. +# Assign coil current. The coil consists of 20 turns. The total current is 10A. +# Note that each coil turn consists of 24 parallel Litz strands as indicated earlier. # + no_turns = 20 @@ -113,7 +112,8 @@ # ## Assign mesh operations # -# Mesh operations are not necessary in eddy current solver because of auto-adaptive meshing. However, with appropriate mesh operations, less adaptive passes are needed +# Mesh operations are not necessary in the eddy current solver because of auto-adaptive meshing. +# However, with appropriate mesh operations, less adaptive passes are needed m3d.mesh.assign_length_mesh( ["Core"], maximum_length=15, maximum_elements=None, name="Inside_Core" @@ -131,30 +131,30 @@ # ## Set object temperature and enable feedback # -# Set the temperature of the objects to default temperature (22deg C) +# Set the temperature of the objects to the default temperature (22 degrees C) # and enable temperature feedback for two-way coupling. m3d.modeler.set_objects_temperature(["Coil"], ambient_temperature=22) # ## Assign matrix # -# Resistance and inductance calculation. +# Assign matrix for resistance and inductance calculation. m3d.assign_matrix(["Winding1"], matrix_name="Matrix1") # ## Create and analyze simulation setup # -# Simulation frequency 150kHz. +# The simulation frequency is 150 kHz. setup = m3d.create_setup(name="Setup1") setup.props["Frequency"] = "150kHz" m3d.analyze_setup("Setup1") -# ## Postprocessing +# ## Postprocess # # Calculate analytical DC resistance and compare it with the simulated coil -# resistance, print them in the message manager, as well as ohmic loss in -# coil before temperature feedback. +# resistance. Print them in AEDT Message Manager, along with the ohmic loss in +# coil before the temperature feedback. # + report = m3d.post.create_report(expressions="Matrix1.R(Winding1,Winding1)") @@ -167,7 +167,7 @@ # Analytical calculation of the DC resistance of the coil cu_cond = float(cu_litz.conductivity.value) -# average radius of a coil turn = 0.125m +# Average radius of a coil turn = 0.125m l_conductor = no_turns * 2 * 0.125 * 3.1415 # R = resistivity * length / area / no_strand r_analytical_DC = ( @@ -177,7 +177,7 @@ / no_strands ) -# Print results in the Message Manager +# Print results in AEDT Message Manager m3d.logger.info( "*******Coil analytical DC resistance = {:.2f}Ohm".format(r_analytical_DC) ) @@ -193,9 +193,9 @@ ) # - -# ## Icepak design +# ## Insert Icepak design # -# Insert Icepak design, copy solid objects from Maxwell, and modify region dimensions. +# Insert Icepak design, copy solid objects from Maxwell 3D, and modify region dimensions. # + ipk = ansys.aedt.core.Icepak(design=icepak_design_name, version=AEDT_VERSION) @@ -212,7 +212,7 @@ # ## Map coil losses # -# Map ohmic losses from Maxwell to the Icepak design. +# Map ohmic losses from Maxwell 3D to the Icepak design. ipk.assign_em_losses( design="1 Maxwell", @@ -221,9 +221,9 @@ assignment=["Coil"], ) -# ### Boundary conditions +# ### Define boundary conditions # -# Assign opening. +# Assign the opening. faces = ipk.modeler["Region"].faces face_names = [face.id for face in faces] @@ -231,12 +231,11 @@ # ### Assign monitor # -# Temperature monitor on -# the coil surface. +# Assign the temperature monitor on the coil surface. temp_monitor = ipk.assign_point_monitor([70, 0, 0], monitor_name="PointMonitor1") -# Icepak solution setup +# Set up Icepak solution solution_setup = ipk.create_setup() solution_setup.props["Convergence Criteria - Max Iterations"] = 50 @@ -249,16 +248,16 @@ solution_setup.props["Convergence Criteria - Flow"] = 0.0005 solution_setup.props["Flow Iteration Per Radiation Iteration"] = "5" -# ## Add 2-way coupling and solve the project +# ## Add two-way coupling and solve the project # -# Enable mapping temperature distribution back to Maxwell. Default number -# Maxwell <–> Icepak iterations is 2, but for increased accuracy -# it can be increased (number_of_iterations). +# Enable mapping temperature distribution back to Maxwell 3D. The default number +# for Maxwell <–> Icepak iterations is 2. However, for increased accuracy, +# you can increate the value for the ``number_of_iterations`` parameter. ipk.assign_2way_coupling() ipk.analyze_setup(name=solution_setup.name) -# ## Postprocessing +# ## Postprocess # # Plot temperature on the object surfaces. @@ -286,9 +285,9 @@ m3d.logger.info("*******Coil temperature = {:.2f}deg C".format(temp)) # - -# ### Get new resistance from Maxwell +# ### Get new resistance from Maxwell 3D # -# Temperature of the coil increases, and consequently also coil resistance increases. +# The temperature of the coil increases, and consequently the coil resistance increases. # + report_new = m3d.post.create_report(expressions="Matrix1.R(Winding1,Winding1)") @@ -319,14 +318,12 @@ ipk.save_project() ipk.release_desktop() -time.sleep( - 3 -) # Allow Electronics Desktop to shut down before cleaning the temporary project folder. +time.sleep(3) # Allow AEDT to shut down before cleaning the temporary project folder. -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. diff --git a/examples/04-low_frequency/team_problem/asymmetric_conductor.py b/examples/low_frequency/team_problem/asymmetric_conductor.py similarity index 92% rename from examples/04-low_frequency/team_problem/asymmetric_conductor.py rename to examples/low_frequency/team_problem/asymmetric_conductor.py index 62c10a672..a50ef1e1b 100644 --- a/examples/04-low_frequency/team_problem/asymmetric_conductor.py +++ b/examples/low_frequency/team_problem/asymmetric_conductor.py @@ -1,12 +1,13 @@ # # Asymmetric conductor analysis # # This example uses PyAEDT to set up the TEAM 7 problem for an asymmetric -# conductor with a hole and solve it using the Maxwell 3D Eddy Current solver. -# https://www.compumag.org/wp/wp-content/uploads/2018/06/problem7.pdf +# conductor with a hole and solve it using the Maxwell 3D eddy current solver. +# For more information on this problem, see this +# [paper](https://www.compumag.org/wp/wp-content/uploads/2018/06/problem7.pdf). # # Keywords: **Maxwell 3D**, **Asymmetric conductor**. -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -18,15 +19,16 @@ from ansys.aedt.core import Maxwell3d from ansys.aedt.core.generic.general_methods import write_csv -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -54,7 +56,7 @@ # # Add a Maxwell 3D setup with frequency points at DC, 50 Hz, and 200Hz. # Otherwise, the default PyAEDT setup values are used. To approximate a DC field in the -# Eddy Current solver, use a low frequency value. Second-order shape functions improve +# eddy current solver, use a low frequency value. Second-order shape functions improve # the smoothness of the induced currents in the plate. # + @@ -102,8 +104,6 @@ P4 = [dim2, dim1, 0] # ## Create coordinate system for positioning coil -# -# Create a coordinate system for positioning the coil. m3d.modeler.create_coordinate_system( origin=coil_centre, mode="view", view="XY", name="Coil_CS" @@ -119,8 +119,6 @@ test.set_crosssection_properties(type="Rectangle", width=coil_thk, height=coil_height) # ## Duplicate and unite polyline to create full coil -# -# Duplicate and unit the polyline to create a full coil. m3d.modeler.duplicate_around_axis( assignment="Coil", @@ -159,7 +157,7 @@ m3d.assign_current(assignment="Coil_Section1", amplitude="Coil_Excitation", solid=False) m3d.modeler.set_working_coordinate_system("Global") -# ## Add a material +# ## Add material # # Add a material named ``team3_aluminium``. @@ -177,7 +175,7 @@ hole = m3d.modeler.create_box(origin=[18, 18, 0], sizes=[108, 108, 19], name="Hole") m3d.modeler.subtract(blank_list="Plate", tool_list=["Hole"], keep_originals=False) -# ## Draw a background region +# ## Draw background region # # Draw a background region that uses the default properties for an air region. @@ -188,7 +186,7 @@ # ## Adjust eddy effects for plate and coil # # Adjust the eddy effects for the plate and coil by turning off displacement currents -# for all parts. The setting for eddy effect is ignored for the stranded conductor type +# for all parts. The setting for the eddy effect is ignored for the stranded conductor type # used in the coil. m3d.eddy_effects_on(assignment="Plate") @@ -233,8 +231,6 @@ # - # ## Plot model -# -# Plot the model. m3d.plot( show=False, @@ -242,7 +238,7 @@ plot_air_objects=False, ) -# Published measurement results are included with this script via the list below. +# Published measurement results are included with this script via the following list. # Test results are used to create text files for import into a rectangular plot # and to overlay simulation results. @@ -455,7 +451,7 @@ ] # - -# ## Write dataset values in a CSV file +# ## Write dataset values to a CSV file # # Dataset details are used to encode test parameters in the text files. # For example, ``Bz A1_B1 050 0`` is the Z component of flux density ``B`` @@ -473,8 +469,8 @@ # ## Create rectangular plots and import test data into report # # Create rectangular plots, using text file encoding to control their formatting. -# Import test data into correct plot and overlay with simulation results. -# Variations for a DC plot must have different frequency and phase than the other plots. +# Import test data into the correct plot and overlay with the simulation results. +# Variations for a DC plot must have a different frequency and phase than the other plots. for item in range(len(dataset)): if item % 2 == 0: @@ -536,13 +532,13 @@ m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/team_problem/bath_plate.py b/examples/low_frequency/team_problem/bath_plate.py similarity index 91% rename from examples/04-low_frequency/team_problem/bath_plate.py rename to examples/low_frequency/team_problem/bath_plate.py index fb7052235..1c172edb8 100644 --- a/examples/04-low_frequency/team_problem/bath_plate.py +++ b/examples/low_frequency/team_problem/bath_plate.py @@ -1,12 +1,13 @@ # # Bath plate analysis # # This example uses PyAEDT to set up the TEAM 3 bath plate problem and -# solve it using the Maxwell 3D Eddy Current solver. -# https://www.compumag.org/wp/wp-content/uploads/2018/06/problem3.pdf +# solve it using the Maxwell 3D eddy current solver. +# # For more information on this problem, see this +# [paper](https://www.compumag.org/wp/wp-content/uploads/2018/06/problem3.pdf). # # Keywords: **Maxwell 3D**, **TEAM 3 bath plate** -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -16,15 +17,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = True # Open Electronics UI when the application is launched. +NG_MODE = True # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -49,7 +51,7 @@ # ## Add variable # -# Add a design variable named ``Coil_Position`` that you use later to adjust the +# Add a design variable named ``Coil_Position`` to use later to adjust the # position of the coil. Coil_Position = -20 @@ -89,8 +91,8 @@ ) # ## Add mesh refinement to ladder plate -# -# Add a mesh refinement to the ladder plate. + +# > **Note:** You can uncomment the following code. # m3d.mesh.assign_length_mesh( # assignment="LadderPlate", @@ -249,8 +251,6 @@ # - # ## Set up sweep value and plot solution -# -# Set up a sweep value and plot the solution. solutions.active_variation["Coil_Position"] = -0.02 solutions.plot() @@ -280,13 +280,13 @@ m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-low_frequency/team_problem/index.rst b/examples/low_frequency/team_problem/index.rst similarity index 56% rename from examples/04-low_frequency/team_problem/index.rst rename to examples/low_frequency/team_problem/index.rst index ceb826b3c..b274fad38 100644 --- a/examples/04-low_frequency/team_problem/index.rst +++ b/examples/low_frequency/team_problem/index.rst @@ -1,7 +1,7 @@ T.E.A.M. ~~~~~~~~ -These examples use PyAEDT to show some T.E.A.M. examples +These examples use PyAEDT to show some T.E.A.M. applications. .. nbgallery:: diff --git a/examples/template.py b/examples/template.py index 43c3eb363..7cbf473be 100644 --- a/examples/template.py +++ b/examples/template.py @@ -9,7 +9,7 @@ # # Keywords: **Template**, **Jupyter** -# ## Perform required imports +# ## Perform imports and define constants # # Perform required imports. @@ -19,15 +19,16 @@ import ansys.aedt.core -# ## Define constants +# Define constants. AEDT_VERSION = "2024.2" NUM_CORES = 4 -NG_MODE = False # Open Electronics UI when the application is launched. +NG_MODE = False # Open AEDT UI when it is launched. # ## Create temporary directory # -# Create temporary directory. +# Create a temporary directory where downloaded data or +# dumped data can be stored. # If you'd like to retrieve the project data for subsequent use, # the temporary folder name is given by ``temp_folder.name``. @@ -35,8 +36,8 @@ # ## Launch AEDT and application # -# Create an instance of the application (i.e. ``Maxwell3d``,``Hfss`` etc.) -# class named (``m3d``,``hfss`` etc.) by providing +# Create an instance of the application (such as ``Maxwell3d`` or``Hfss``) +# with a class (such as ``m3d`` or``hfss``) by providing # the project and design names, the solver, and the version. project_name = os.path.join(temp_folder.name, "my_project.aedt") @@ -50,29 +51,29 @@ ) m3d.modeler.model_units = "mm" -# ## Pre-Processing +# ## Preprocess # -# Description of pre-processing task. -# Add as many sections as needed for pre-processing tasks. +# Description of preprocessing task. +# Add as many sections as needed for preprocessing tasks. -# ## Post-Processing +# ## Postprocess # -# Description of post-processing task. -# Add as many sections as needed for post-processing tasks. +# Description of postprocessing task. +# Add as many sections as needed for postprocessing tasks. # ## Release AEDT m3d.save_project() m3d.release_desktop() -# Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory. time.sleep(3) -# ## Cleanup +# ## Clean up # # All project files are saved in the folder ``temp_folder.name``. -# If you've run this example as a Jupyter notebook you +# If you've run this example as a Jupyter notebook, you # can retrieve those project files. The following cell # removes all temporary files, including the project folder.