Busbar Analysis

This example shows how you can use PyAEDT to create a busbar design in in Q3D and run a simulation.

# sphinx_gallery_thumbnail_path = 'Resources/busbar.png'

import os

from pyaedt import Q3d

Launch AEDT in Non-Graphical Mode

You can change the Boolean parameter NonGraphical to False to launch AEDT in graphical mode.

NonGraphical = True

Launch AEDT and Q3D

This example launches AEDT 2021.2 in graphical mode.

# This example use SI units.


q = Q3d(specified_version="2021.2", non_graphical=NonGraphical, new_desktop_session=True)

Out:

Launching PyAEDT outside Electronics Desktop with CPython and Pythonnet
Launching AEDT installation C:\Program Files\AnsysEM\AnsysEM21.2\Win64
===================================================================================
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info: Ansoft.ElectronicsDesktop.2021.2 Started with process ID 5208.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20220120_154711.log
pyaedt info: pyaedt v0.5.dev1
pyaedt info: Python version 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
pyaedt info: Project Project2597 has been created.
pyaedt info: No design is present. Inserting a new design.
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded

Create Primitives

Create polylines for three busbars and a box for the substrate.

b1 = q.modeler.primitives.create_polyline(
    [[0, 0, 0], [-100, 0, 0]],
    name="Bar1",
    matname="copper",
    xsection_type="Rectangle",
    xsection_width="5mm",
    xsection_height="1mm",
)
q.modeler["Bar1"].color = (255, 0, 0)

q.modeler.primitives.create_polyline(
    [[0, -15, 0], [-150, -15, 0]],
    name="Bar2",
    matname="aluminum",
    xsection_type="Rectangle",
    xsection_width="5mm",
    xsection_height="1mm",
)
q.modeler["Bar2"].color = (0, 255, 0)

q.modeler.primitives.create_polyline(
    [[0, -30, 0], [-175, -30, 0], [-175, -10, 0]],
    name="Bar3",
    matname="copper",
    xsection_type="Rectangle",
    xsection_width="5mm",
    xsection_height="1mm",
)
q.modeler["Bar3"].color = (0, 0, 255)

q.modeler.primitives.create_box([50, 30, -0.5], [-250, -100, -3], name="substrate", matname="FR4_epoxy")
q.modeler["substrate"].color = (128, 128, 128)
q.modeler["substrate"].transparency = 0.8

q.plot(show=False, export_path=os.path.join(q.working_directory, "Q3D.jpg"), plot_air_objects=False)
Q3D Example

Out:

<pyaedt.modules.AdvancedPostProcessing.ModelPlotter object at 0x000001D06414FB20>

Set Up Boundaries

Identify nets and assign sources and sinks to all nets. There is a source and sink for each busbar.

q.auto_identify_nets()

q.assign_source_to_objectface("Bar1", axisdir=q.AxisDir.XPos, source_name="Source1")

q.assign_sink_to_objectface("Bar1", axisdir=q.AxisDir.XNeg, sink_name="Sink1")

q.assign_source_to_objectface("Bar2", axisdir=q.AxisDir.XPos, source_name="Source2")
q.assign_sink_to_objectface("Bar2", axisdir=q.AxisDir.XNeg, sink_name="Sink2")
q.assign_source_to_objectface("Bar3", axisdir=q.AxisDir.XPos, source_name="Source3")
q.assign_sink_to_objectface("Bar3", axisdir=q.AxisDir.YPos, sink_name="Sink3")

Out:

<pyaedt.modules.Boundary.BoundaryObject object at 0x000001D051E01C10>

Add a Q3D Setup

This command adds a setup to the project and defines the adaptive frequency value.

q.create_setup(props={"AdaptiveFreq": "100MHz"})

Out:

SetupName MySetupAuto with 0 Sweeps

Create a Rectangular Plot

This command creates a rectangular plot and a Data Table.

q.post.create_rectangular_plot(expression="C(Bar1,Bar1)", context="Original")

q.post.create_rectangular_plot(expression="C(Bar1,Bar1)", context="Original", plot_type="Data Table")

Out:

pyaedt info: Report Plot_W118WM correctly created.
pyaedt info: Report Plot_PWQR2F correctly created.

True

Solve the Setup

This command solves the setup.

q.analyze_nominal()

Out:

pyaedt info: Solving design setup MySetupAuto
pyaedt info: Design setup MySetupAuto solved correctly

True

Get Report Data

This command get the report data into a Data Structure that allows to manipulate them.

a = q.post.get_report_data(expression="C(Bar1,Bar1)", domain=["Context:=", "Original"])
a.sweeps["Freq"]
a.data_magnitude()

Out:

pyaedt info: Solution Data Correctly Loaded.

[3.136177074084028]

Close AEDT

After the simulaton is completed, you can close AEDT or release it using the release_desktop method. All methods provide for saving projects before exiting.

if os.name != "posix":
    q.release_desktop(close_projects=True, close_on_exit=True)

Out:

pyaedt error: Method release_desktop Failed:  Type Error. Please Check again
Method release_desktop Failed:  Type Error. Please Check again
pyaedt error: release_desktop() got an unexpected keyword argument 'close_on_exit'
release_desktop() got an unexpected keyword argument 'close_on_exit'
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     close_projects = True
    close_projects = True
pyaedt error:     close_desktop = None
    close_desktop = None
pyaedt error:     close_on_exit = True
    close_on_exit = True
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=release_desktop
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=release_desktop

Total running time of the script: ( 1 minutes 20.566 seconds)

Gallery generated by Sphinx-Gallery