Download this example
Download this example as a Jupyter Notebook or as a Python script.
Choke setup#
This example shows how to use PyAEDT to create a choke setup in Maxwell 3D.
Keywords: Maxwell 3D, choke.
Perform imports and define constants#
Perform required imports.
[1]:
import json
import os
import tempfile
import time
[2]:
import ansys.aedt.core
Define constants.
[3]:
AEDT_VERSION = "2024.2"
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
[4]:
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
Launch Maxwell3D#
Launch Maxwell 3D 2024 R2 in graphical mode.
[5]:
project_name = os.path.join(temp_folder.name, "choke.aedt")
m3d = ansys.aedt.core.Maxwell3d(
project=project_name,
solution_type="EddyCurrent",
version=AEDT_VERSION,
non_graphical=NG_MODE,
new_desktop=True,
)
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.12.dev0.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_d2b35fc6-db39-4c40-bcee-834b53606296.log is enabled.
PyAEDT INFO: Log on AEDT is enabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: New AEDT session is starting on gRPC port 52920
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
PyAEDT INFO: Ansoft.ElectronicsDesktop.2024.2 version started with process ID 8064.
PyAEDT INFO: Project choke has been created.
PyAEDT INFO: No design is present. Inserting a new design.
PyAEDT INFO: Added design 'Maxwell 3D_JYB' of type Maxwell 3D.
PyAEDT INFO: Aedt Objects correctly read
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 the dictionary. The dictionary has many primary keys, including "Number of Windings"
, "Layer"
, and "Layer Type"
, that have dictionaries as values. The keys of these dictionaries are secondary keys of the dictionary values, such as "1"
, "2"
, "3"
, "4"
, and "Simple"
.
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 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 the primary keys:
"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."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.
The following parameter values work. You can modify them if you want.
[6]:
values = {
"Number of Windings": {"1": False, "2": False, "3": True, "4": False},
"Layer": {"Simple": False, "Double": False, "Triple": True},
"Layer Type": {"Separate": False, "Linked": True},
"Similar Layer": {"Similar": False, "Different": True},
"Mode": {"Differential": True, "Common": False},
"Wire Section": {"None": False, "Hexagon": False, "Octagon": True, "Circle": False},
"Core": {
"Name": "Core",
"Material": "ferrite",
"Inner Radius": 100,
"Outer Radius": 143,
"Height": 25,
"Chamfer": 0.8,
},
"Outer Winding": {
"Name": "Winding",
"Material": "copper",
"Inner Radius": 100,
"Outer Radius": 143,
"Height": 25,
"Wire Diameter": 5,
"Turns": 2,
"Coil Pit(deg)": 4,
"Occupation(%)": 0,
},
"Mid Winding": {"Turns": 7, "Coil Pit(deg)": 4, "Occupation(%)": 0},
"Inner Winding": {"Turns": 10, "Coil Pit(deg)": 4, "Occupation(%)": 0},
}
Convert dictionary to JSON file#
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.
[7]:
json_path = os.path.join(temp_folder.name, "choke_example.json")
with open(json_path, "w") as outfile:
json.dump(values, outfile)
Verify parameters of JSON file#
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 earlier)
Checks equations on windings parameters to avoid having unintended intersections
[8]:
dictionary_values = m3d.modeler.check_choke_values(
input_dir=json_path, create_another_file=False
)
print(dictionary_values)
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 1sec
PyAEDT INFO: Materials class has been initialized! Elapsed time: 0m 0sec
PyAEDT WARNING: Inner Radius of the winding is too high. The maximum value has been set instead.
PyAEDT WARNING: Outer Radius of the winding is too low. The minimum value has been set instead.
PyAEDT WARNING: Height of the winding is too low. The minimum value has been set instead.
[True, {'Number of Windings': {'1': False, '2': False, '3': True, '4': False}, 'Layer': {'Simple': False, 'Double': False, 'Triple': True}, 'Layer Type': {'Separate': False, 'Linked': True}, 'Similar Layer': {'Similar': False, 'Different': True}, 'Mode': {'Differential': True, 'Common': False}, 'Wire Section': {'None': False, 'Hexagon': False, 'Octagon': True, 'Circle': False}, 'Core': {'Name': 'Core', 'Material': 'ferrite', 'Inner Radius': 100, 'Outer Radius': 143, 'Height': 25, 'Chamfer': 0.8}, 'Outer Winding': {'Name': 'Winding', 'Material': 'copper', 'Inner Radius': 86.25, 'Outer Radius': 156.75, 'Height': 52.5, 'Wire Diameter': 5, 'Turns': 2, 'Coil Pit(deg)': 4, 'Occupation(%)': 13.333333333333334}, 'Mid Winding': {'Turns': 7, 'Coil Pit(deg)': 4.0, 'Occupation(%)': 46.666666666666664}, 'Inner Winding': {'Turns': 10, 'Coil Pit(deg)': 4.0, 'Occupation(%)': 66.66666666666667}}]
Create choke#
Create the choke. The create_choke()
method takes the JSON file path as an argument.
[9]:
list_object = m3d.modeler.create_choke(input_file=json_path)
print(list_object)
core = list_object[1]
first_winding_list = list_object[2]
second_winding_list = list_object[3]
third_winding_list = list_object[4]
PyAEDT INFO: CHOKE INFO: {'Number of Windings': {'1': False, '2': False, '3': True, '4': False}, 'Layer': {'Simple': False, 'Double': False, 'Triple': True}, 'Layer Type': {'Separate': False, 'Linked': True}, 'Similar Layer': {'Similar': False, 'Different': True}...
PyAEDT INFO: Parsing design objects. This operation can take time
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmp9cj28kmd.ansys/choke.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmp9cj28kmd.ansys/choke.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.01562190055847168
PyAEDT INFO: 3D Modeler objects parsed. Elapsed time: 0m 0sec
PyAEDT INFO: Deleted 3 Objects: Winding,Winding_1,Winding_2.
PyAEDT INFO: Deleted 7 Objects: Winding,Winding_1,Winding_2,Winding_3,Winding_4,Winding_5,Winding_6.
PyAEDT INFO: Deleted 10 Objects: Winding,Winding_1,Winding_2,Winding_3,Winding_4,Winding_5,Winding_6,Winding_7,Winding_8,Winding_9.
PyAEDT INFO: Deleted 3 Objects: Winding_2,Winding_1,Winding.
PyAEDT INFO: Creating triple linked winding
PyAEDT INFO: Choke created correctly
[<ansys.aedt.core.modeler.cad.object_3d.Object3d object at 0x0000029A95BC6920>, <ansys.aedt.core.modeler.cad.object_3d.Object3d object at 0x0000029A95BC6140>, [<ansys.aedt.core.modeler.cad.polylines.Polyline object at 0x0000029A95BC6110>, [[-74.497822093321, 62.511095042016, -52.5], [-74.497822093321, 62.511095042016, 12.839087296526], [-76.344688372662, 64.060799855845, 15.25], [-115.963757581084, 84.252601589961, 15.25], [-117.914226930149, 85.669700521628, 12.839087296526], [-117.914226930149, 85.669700521628, -12.839087296526], [-115.963757581084, 84.252601589961, -15.25], [-84.517247279393, 52.812237532635, -15.25], [-82.472677351212, 51.534648446679, -12.839087296526], [-82.472677351212, 51.534648446679, 12.839087296526], [-84.517247279393, 52.812237532635, 15.25], [-126.560902091063, 67.293625321403, 15.25], [-128.689611659189, 68.425480276044, 12.839087296526], [-128.689611659189, 68.425480276044, -12.839087296526], [-126.560902091063, 67.293625321403, -15.25], [-91.044774104774, 40.535745078881, -15.25], [-88.842295755743, 39.555138539122, -12.839087296526], [-88.842295755743, 39.555138539122, 12.839087296526], [-91.044774104774, 40.535745078881, 15.25], [-134.694682602733, 49.024855181328, 15.25], [-136.960199479546, 49.849435889716, 12.839087296526], [-136.960199479546, 49.849435889716, -12.839087296526], [-134.694682602733, 49.024855181328, -15.25], [-95.800217964102, 27.470270455894, -15.25], [-93.482699930001, 26.805732853203, -12.839087296526], [-93.482699930001, 26.805732853203, 12.839087296526], [-95.800217964102, 27.470270455894, 15.25], [-140.20678433047, 29.801872000095, 15.25], [-142.565012806952, 30.303128936688, 12.839087296526], [-142.565012806952, 30.303128936688, -12.839087296526], [-140.20678433047, 29.801872000095, -15.25], [-98.691019551891, 13.870118265453, -15.25], [-96.303569685118, 13.534584068366, -12.839087296526], [-96.303569685118, 13.534584068366, 12.839087296526], [-98.691019551891, 13.870118265453, 15.25], [-142.989920484069, 9.998829279507, 15.25], [-145.394960325369, 10.167006048206, 12.839087296526], [-145.394960325369, 10.167006048206, -12.839087296526], [-142.989920484069, 9.998829279507, -15.25], [-99.660912703474, 0.0, -15.25], [-97.25, 0.0, -12.839087296526], [-97.25, 0.0, 12.839087296526], [-99.660912703474, 0.0, 15.25], [-142.989920484069, -9.998829279507, 15.25], [-145.394960325369, -10.167006048206, 12.839087296526], [-145.394960325369, -10.167006048206, -12.839087296526], [-142.989920484069, -9.998829279507, -15.25], [-98.691019551891, -13.870118265453, -15.25], [-96.303569685118, -13.534584068366, -12.839087296526], [-96.303569685118, -13.534584068366, 12.839087296526], [-98.691019551891, -13.870118265453, 15.25], [-140.20678433047, -29.801872000095, 15.25], [-142.565012806952, -30.303128936688, 12.839087296526], [-142.565012806952, -30.303128936688, -12.839087296526], [-140.20678433047, -29.801872000095, -15.25], [-95.800217964102, -27.470270455894, -15.25], [-93.482699930001, -26.805732853203, -12.839087296526], [-93.482699930001, -26.805732853203, 12.839087296526], [-95.800217964102, -27.470270455894, 15.25], [-134.694682602733, -49.024855181328, 15.25], [-136.960199479546, -49.849435889716, 12.839087296526], [-136.960199479546, -49.849435889716, -12.839087296526], [-134.694682602733, -49.024855181328, -15.25], [-91.044774104774, -40.535745078881, -15.25], [-88.842295755743, -39.555138539122, -12.839087296526], [-88.842295755743, -39.555138539122, 12.839087296526], [-91.044774104774, -40.535745078881, 15.25], [-126.560902091063, -67.293625321403, 15.25], [-128.689611659189, -68.425480276044, 12.839087296526], [-128.689611659189, -68.425480276044, -12.839087296526], [-126.560902091063, -67.293625321403, -15.25], [-84.517247279393, -52.812237532635, -15.25], [-82.472677351212, -51.534648446679, -12.839087296526], [-82.472677351212, -51.534648446679, 12.839087296526], [-84.517247279393, -52.812237532635, 15.25], [-115.963757581084, -84.252601589961, 15.25], [-117.914226930149, -85.669700521628, 12.839087296526], [-117.914226930149, -85.669700521628, -12.839087296526], [-115.963757581084, -84.252601589961, -15.25], [-76.344688372662, -64.060799855845, -15.25], [-74.497822093321, -62.511095042016, -12.839087296526], [-74.497822093321, -62.511095042016, 15.117261889578], [-76.344688372662, -64.060799855845, 20.75], [-117.806839543016, -85.591679017905, 20.75], [-122.363820399211, -88.902519409237, 15.117261889578], [-122.363820399211, -88.902519409237, -15.117261889578], [-117.806839543016, -85.591679017905, -20.75], [-82.585245653043, -51.60498892849, -20.75], [-77.808412822352, -48.620092493397, -15.117261889578], [-77.808412822352, -48.620092493397, 15.117261889578], [-82.585245653043, -51.60498892849, 20.75], [-128.572410864111, -68.363163507903, 20.75], [-133.545823419913, -71.007573871366, 15.117261889578], [-133.545823419913, -71.007573871366, -15.117261889578], [-128.572410864111, -68.363163507903, -20.75], [-88.963558053575, -39.609127992563, -20.75], [-83.817795738709, -37.318087002205, -15.117261889578], [-83.817795738709, -37.318087002205, 15.117261889578], [-88.963558053575, -39.609127992563, 20.75], [-136.835466456686, -49.804036782165, 20.75], [-142.128508893869, -51.730546678007, 15.117261889578], [-142.128508893869, -51.730546678007, -15.117261889578], [-136.835466456686, -49.804036782165, -20.75], [-93.610295991141, -26.842320434976, -20.75], [-88.195760602341, -25.28972739621, -15.117261889578], [-88.195760602341, -25.28972739621, 15.117261889578], [-93.610295991141, -26.842320434976, 20.75], [-142.435175342717, -30.275531131715, 20.75], [-147.944824610988, -31.446643236186, 15.117261889578], [-147.944824610988, -31.446643236186, -15.117261889578], [-142.435175342717, -30.275531131715, -20.75], [-96.435015997374, -13.553057642809, -20.75], [-90.857095307039, -12.769132013086, -15.117261889578], [-90.857095307039, -12.769132013086, 15.117261889578], [-96.435015997374, -13.553057642809, 20.75], [-145.262545558313, -10.157746705692, 20.75], [-150.881562601798, -10.550666653799, 15.117261889578], [-150.881562601798, -10.550666653799, -15.117261889578], [-145.262545558313, -10.157746705692, -20.75], [-97.382738110422, 0.0, -20.75], [-91.75, 0.0, -15.117261889578], [-91.75, 0.0, 15.117261889578], [-97.382738110422, 0.0, 20.75], [-145.262545558313, 10.157746705692, 20.75], [-150.881562601798, 10.550666653799, 15.117261889578], [-150.881562601798, 10.550666653799, -15.117261889578], [-145.262545558313, 10.157746705692, -20.75], [-96.435015997374, 13.553057642809, -20.75], [-90.857095307039, 12.769132013086, -15.117261889578], [-90.857095307039, 12.769132013086, 15.117261889578], [-96.435015997374, 13.553057642809, 20.75], [-142.435175342717, 30.275531131715, 20.75], [-147.944824610988, 31.446643236186, 15.117261889578], [-147.944824610988, 31.446643236186, -15.117261889578], [-147.944824610988, 31.446643236186, -17.39543648263], [-142.435175342717, 30.275531131715, -26.25], [-94.179012442856, 13.235997020166, -26.25], [-85.41062092896, 12.003679957806, -17.39543648263], [-85.41062092896, 12.003679957806, 17.39543648263], [-94.179012442856, 13.235997020166, 26.25], [-147.535170632557, 10.316664131877, 26.25], [-156.368164878227, 10.934327259392, 17.39543648263], [-156.368164878227, 10.934327259392, -17.39543648263], [-147.535170632557, 10.316664131877, -26.25], [-95.10456351737, 0.0, -26.25], [-86.25, 0.0, -17.39543648263], [-86.25, 0.0, 17.39543648263], [-95.10456351737, 0.0, 26.25], [-147.535170632557, -10.316664131877, 26.25], [-156.368164878227, -10.934327259392, 17.39543648263], [-156.368164878227, -10.934327259392, -17.39543648263], [-156.368164878227, -10.934327259392, -52.5]]], [<ansys.aedt.core.modeler.cad.polylines.Polyline object at 0x0000029A925B7430>, [[-16.887285278109, -95.772553980438, -52.5], [-16.887285278109, -95.772553980438, 12.839087296526], [-17.305935875581, -98.146839502654, 15.25], [-14.983014521293, -142.553860778499, 15.25], [-15.23502352126, -144.951566249926, 12.839087296526], [-15.23502352126, -144.951566249926, -12.839087296526], [-14.983014521293, -142.553860778499, -15.25], [-3.478115694263, -99.600201968203, -15.25], [-3.393976054318, -97.190757927607, -12.839087296526], [-3.393976054318, -97.190757927607, 12.839087296526], [-3.478115694263, -99.600201968203, 15.25], [5.002462004445, -143.251768997437, 15.25], [5.086601644389, -145.661213038034, 12.839087296526], [5.086601644389, -145.661213038034, -12.839087296526], [5.002462004445, -143.251768997437, -15.25], [10.417402052746, -99.11495979599, -15.25], [10.165393052779, -96.717254324565, -12.839087296526], [10.165393052779, -96.717254324565, 12.839087296526], [10.417402052746, -99.11495979599, 15.25], [24.890571297483, -141.161444479313, 15.25], [25.309221894955, -143.535730001529, 12.839087296526], [25.309221894955, -143.535730001529, -12.839087296526], [24.890571297483, -141.161444479313, -15.25], [24.110156918418, -96.700557672946, -15.25], [23.526904347068, -94.36125938034, -12.839087296526], [23.526904347068, -94.36125938034, 12.839087296526], [24.110156918418, -96.700557672946, 15.25], [44.294213932821, -136.32357301316, 15.25], [45.039226930149, -138.616487250018, 12.839087296526], [45.039226930149, -138.616487250018, -12.839087296526], [44.294213932821, -136.32357301316, -15.25], [37.333635004569, -92.403989190051, -15.25], [36.430491209698, -90.16862985662, -12.839087296526], [36.430491209698, -90.16862985662, 12.839087296526], [37.333635004569, -92.403989190051, 15.25], [62.835720077878, -128.832318264074, 15.25], [63.892594644508, -130.999232248103, 12.839087296526], [63.892594644508, -130.999232248103, -12.839087296526], [62.835720077878, -128.832318264074, -15.25], [49.830456351737, -86.308882165552, -15.25], [48.625, -84.220970518037, -12.839087296526], [48.625, -84.220970518037, 12.839087296526], [49.830456351737, -86.308882165552, 15.25], [80.154200406191, -118.833488984567, 15.25], [81.502365680861, -120.832226199897, 12.839087296526], [81.502365680861, -120.832226199897, -12.839087296526], [80.154200406191, -118.833488984567, -15.25], [61.357384547322, -78.533870924598, -15.25], [59.87307847542, -76.634045788254, -12.839087296526], [59.87307847542, -76.634045788254, 12.839087296526], [61.357384547322, -78.533870924598, 15.25], [95.912570397649, -106.521701013065, 15.25], [97.525785876803, -108.31335831333, 12.839087296526], [97.525785876803, -108.31335831333, -12.839087296526], [95.912570397649, -106.521701013065, -15.25], [71.690061045684, -69.230287217052, -15.25], [69.955795582933, -67.555526527137, -12.839087296526], [69.955795582933, -67.555526527137, 12.839087296526], [71.690061045684, -69.230287217052, 15.25], [109.80411130525, -92.136589297985, 15.25], [111.650977584591, -93.686294111813, 12.839087296526], [111.650977584591, -93.686294111813, -12.839087296526], [109.80411130525, -92.136589297985, -15.25], [80.627372052028, -58.579214717109, -15.25], [78.676902702964, -57.162115785443, -12.839087296526], [78.676902702964, -57.162115785443, 12.839087296526], [80.627372052028, -58.579214717109, 15.25], [121.558440086618, -75.958143676034, 15.25], [123.6030100148, -77.23573276199, 12.839087296526], [123.6030100148, -77.23573276199, -12.839087296526], [121.558440086618, -75.958143676034, -15.25], [87.995362973656, -46.787964435568, -15.25], [85.86665340553, -45.656109480928, -12.839087296526], [85.86665340553, -45.656109480928, 12.839087296526], [87.995362973656, -46.787964435568, 15.25], [130.946772102377, -58.301259188539, 15.25], [133.149250451409, -59.281865728298, 12.839087296526], [133.149250451409, -59.281865728298, -12.839087296526], [130.946772102377, -58.301259188539, -15.25], [93.650624248243, -34.086039646809, -15.25], [91.38510737143, -33.261458938422, -12.839087296526], [91.38510737143, -33.261458938422, 15.117261889578], [93.650624248243, -34.086039646809, 20.75], [133.027988153577, -59.227876274857, 20.75], [138.173750468444, -61.518917265215, 15.117261889578], [138.173750468444, -61.518917265215, -15.117261889578], [133.027988153577, -59.227876274857, -20.75], [85.983854200609, -45.718426249069, -20.75], [81.010441644807, -43.074015885605, -15.117261889578], [81.010441644807, -43.074015885605, 15.117261889578], [85.983854200609, -45.718426249069, 20.75], [123.490441712969, -77.165392280179, 20.75], [128.26727454366, -80.150288715273, 15.117261889578], [128.26727454366, -80.150288715273, -15.117261889578], [123.490441712969, -77.165392280179, -20.75], [78.784290090096, -57.240137289166, -20.75], [74.227309233902, -53.929296897835, -15.117261889578], [74.227309233902, -53.929296897835, 15.117261889578], [78.784290090096, -57.240137289166, 20.75], [111.549294292712, -93.600971699101, 20.75], [115.864222021745, -97.22162596509, 15.117261889578], [115.864222021745, -97.22162596509, -15.117261889578], [111.549294292712, -93.600971699101, -20.75], [70.051279388782, -67.647734166621, -20.75], [65.999426681072, -63.734905489613, -15.117261889578], [65.999426681072, -63.734905489613, 15.117261889578], [70.051279388782, -67.647734166621, 20.75], [97.43696674449, -108.214714673426, 20.75], [101.206004211777, -112.400654853456, 15.117261889578], [101.206004211777, -112.400654853456, -15.117261889578], [97.43696674449, -108.214714673426, -20.75], [59.954800216314, -76.73864484668, -20.75], [56.486940361129, -72.299986643417, -15.117261889578], [56.486940361129, -72.299986643417, 15.117261889578], [59.954800216314, -76.73864484668, 20.75], [81.428139471493, -120.722181319047, 20.75], [84.57792664995, -125.39193284895, 15.117261889578], [84.57792664995, -125.39193284895, -15.117261889578], [81.428139471493, -120.722181319047, -20.75], [48.691369055211, -84.335925093712, -20.75], [45.875, -79.457830797222, -15.117261889578], [45.875, -79.457830797222, 15.117261889578], [48.691369055211, -84.335925093712, 20.75], [63.83440608682, -130.879928024739, 20.75], [66.303635951848, -135.942599502749, 15.117261889578], [66.303635951848, -135.942599502749, -15.117261889578], [63.83440608682, -130.879928024739, -20.75], [36.48021578106, -90.291702489489, -20.75], [34.37015494591, -85.069118656503, -15.117261889578], [34.37015494591, -85.069118656503, 15.117261889578], [36.48021578106, -90.291702489489, 20.75], [44.998208598227, -138.490245805141, 20.75], [46.738820399211, -143.847298089642, 15.117261889578], [46.738820399211, -143.847298089642, -15.117261889578], [46.738820399211, -143.847298089642, -17.39543648263], [44.998208598227, -138.490245805141, -26.25], [35.626796557549, -88.179415788927, -26.25], [32.309818682122, -79.969607456385, -17.39543648263], [32.309818682122, -79.969607456385, 17.39543648263], [35.626796557549, -88.179415788927, 26.25], [64.833092095761, -132.927537785405, 26.25], [68.714677259187, -140.885966757394, 17.39543648263], [68.714677259187, -140.885966757394, -17.39543648263], [64.833092095761, -132.927537785405, -26.25], [47.552281758685, -82.362968021873, -26.25], [43.125, -74.694691076408, -17.39543648263], [43.125, -74.694691076408, 17.39543648263], [47.552281758685, -82.362968021873, 26.25], [82.702078536796, -122.610873653528, 26.25], [87.65348761904, -129.951639498002, 17.39543648263], [87.65348761904, -129.951639498002, -17.39543648263], [87.65348761904, -129.951639498002, -52.5]]], [<ansys.aedt.core.modeler.cad.polylines.Polyline object at 0x0000029A95BC6770>, [[91.38510737143, 33.261458938422, -52.5], [91.38510737143, 33.261458938422, 12.839087296526], [93.650624248243, 34.086039646809, 15.25], [130.946772102377, 58.301259188538, 15.25], [133.149250451409, 59.281865728298, 12.839087296526], [133.149250451409, 59.281865728298, -12.839087296526], [130.946772102377, 58.301259188538, -15.25], [87.995362973656, 46.787964435568, -15.25], [85.86665340553, 45.656109480928, -12.839087296526], [85.86665340553, 45.656109480928, 12.839087296526], [87.995362973656, 46.787964435568, 15.25], [121.558440086618, 75.958143676034, 15.25], [123.6030100148, 77.23573276199, 12.839087296526], [123.6030100148, 77.23573276199, -12.839087296526], [121.558440086618, 75.958143676034, -15.25], [80.627372052028, 58.579214717109, -15.25], [78.676902702964, 57.162115785443, -12.839087296526], [78.676902702964, 57.162115785443, 12.839087296526], [80.627372052028, 58.579214717109, 15.25], [109.80411130525, 92.136589297985, 15.25], [111.650977584591, 93.686294111813, 12.839087296526], [111.650977584591, 93.686294111813, -12.839087296526], [109.80411130525, 92.136589297985, -15.25], [71.690061045684, 69.230287217052, -15.25], [69.955795582933, 67.555526527137, -12.839087296526], [69.955795582933, 67.555526527137, 12.839087296526], [71.690061045684, 69.230287217052, 15.25], [95.912570397649, 106.521701013065, 15.25], [97.525785876803, 108.31335831333, 12.839087296526], [97.525785876803, 108.31335831333, -12.839087296526], [95.912570397649, 106.521701013065, -15.25], [61.357384547322, 78.533870924598, -15.25], [59.87307847542, 76.634045788254, -12.839087296526], [59.87307847542, 76.634045788254, 12.839087296526], [61.357384547322, 78.533870924598, 15.25], [80.154200406191, 118.833488984567, 15.25], [81.502365680861, 120.832226199897, 12.839087296526], [81.502365680861, 120.832226199897, -12.839087296526], [80.154200406191, 118.833488984567, -15.25], [49.830456351737, 86.308882165552, -15.25], [48.625, 84.220970518037, -12.839087296526], [48.625, 84.220970518037, 12.839087296526], [49.830456351737, 86.308882165552, 15.25], [62.835720077878, 128.832318264074, 15.25], [63.892594644508, 130.999232248103, 12.839087296526], [63.892594644508, 130.999232248103, -12.839087296526], [62.835720077878, 128.832318264074, -15.25], [37.333635004569, 92.403989190051, -15.25], [36.430491209698, 90.16862985662, -12.839087296526], [36.430491209698, 90.16862985662, 12.839087296526], [37.333635004569, 92.403989190051, 15.25], [44.294213932821, 136.32357301316, 15.25], [45.039226930149, 138.616487250018, 12.839087296526], [45.039226930149, 138.616487250018, -12.839087296526], [44.294213932821, 136.32357301316, -15.25], [24.110156918418, 96.700557672946, -15.25], [23.526904347068, 94.36125938034, -12.839087296526], [23.526904347068, 94.36125938034, 12.839087296526], [24.110156918418, 96.700557672946, 15.25], [24.890571297483, 141.161444479313, 15.25], [25.309221894955, 143.535730001529, 12.839087296526], [25.309221894955, 143.535730001529, -12.839087296526], [24.890571297483, 141.161444479313, -15.25], [10.417402052746, 99.11495979599, -15.25], [10.165393052779, 96.717254324565, -12.839087296526], [10.165393052779, 96.717254324565, 12.839087296526], [10.417402052746, 99.11495979599, 15.25], [5.002462004445, 143.251768997437, 15.25], [5.086601644389, 145.661213038034, 12.839087296526], [5.086601644389, 145.661213038034, -12.839087296526], [5.002462004445, 143.251768997437, -15.25], [-3.478115694263, 99.600201968203, -15.25], [-3.393976054318, 97.190757927607, -12.839087296526], [-3.393976054318, 97.190757927607, 12.839087296526], [-3.478115694263, 99.600201968203, 15.25], [-14.983014521293, 142.5538607785, 15.25], [-15.23502352126, 144.951566249926, 12.839087296526], [-15.23502352126, 144.951566249926, -12.839087296526], [-14.983014521293, 142.5538607785, -15.25], [-17.305935875581, 98.146839502654, -15.25], [-16.887285278109, 95.772553980438, -12.839087296526], [-16.887285278109, 95.772553980438, 15.117261889578], [-17.305935875581, 98.146839502654, 20.75], [-15.221148610561, 144.819555292762, 20.75], [-15.809930069233, 150.421436674452, 15.117261889578], [-15.809930069233, 150.421436674452, -15.117261889578], [-15.221148610561, 144.819555292762, -20.75], [-3.398608547565, 97.323415177559, -20.75], [-3.202028822455, 91.694108379002, -15.117261889578], [-3.202028822455, 91.694108379002, 15.117261889578], [-3.398608547565, 97.323415177559, 20.75], [5.081969151142, 145.528555788082, 20.75], [5.278548876253, 151.157862586639, 15.117261889578], [5.278548876253, 151.157862586639, -15.117261889578], [5.081969151142, 145.528555788082, -20.75], [10.179267963479, 96.849265281729, -20.75], [9.590486504807, 91.24738390004, -15.117261889578], [9.590486504807, 91.24738390004, 15.117261889578], [10.179267963479, 96.849265281729, 20.75], [25.286172163974, 143.405008481266, 20.75], [26.264286872124, 148.952172643097, 15.117261889578], [26.264286872124, 148.952172643097, -15.117261889578], [25.286172163974, 143.405008481266, -20.75], [23.559016602359, 94.490054601597, -20.75], [22.196333921269, 89.024632885823, -15.117261889578], [22.196333921269, 89.024632885823, 15.117261889578], [23.559016602359, 94.490054601597, 20.75], [44.998208598227, 138.490245805141, 20.75], [46.738820399211, 143.847298089642, 15.117261889578], [46.738820399211, 143.847298089642, -15.117261889578], [44.998208598227, 138.490245805141, -20.75], [36.48021578106, 90.291702489489, -20.75], [34.37015494591, 85.069118656503, -15.117261889578], [34.37015494591, 85.069118656503, 15.117261889578], [36.48021578106, 90.291702489489, 20.75], [63.83440608682, 130.879928024739, 20.75], [66.303635951848, 135.942599502749, 15.117261889578], [66.303635951848, 135.942599502749, -15.117261889578], [63.83440608682, 130.879928024739, -20.75], [48.691369055211, 84.335925093712, -20.75], [45.875, 79.457830797222, -15.117261889578], [45.875, 79.457830797222, 15.117261889578], [48.691369055211, 84.335925093712, 20.75], [81.428139471494, 120.722181319047, 20.75], [84.57792664995, 125.39193284895, 15.117261889578], [84.57792664995, 125.39193284895, -15.117261889578], [81.428139471494, 120.722181319047, -20.75], [59.954800216314, 76.73864484668, -20.75], [56.486940361129, 72.299986643417, -15.117261889578], [56.486940361129, 72.299986643417, 15.117261889578], [59.954800216314, 76.73864484668, 20.75], [97.43696674449, 108.214714673426, 20.75], [101.206004211777, 112.400654853456, 15.117261889578], [101.206004211777, 112.400654853456, -15.117261889578], [101.206004211777, 112.400654853456, -17.39543648263], [97.43696674449, 108.214714673426, -26.25], [58.552215885307, 74.943418768761, -26.25], [53.100802246838, 67.965927498579, -17.39543648263], [53.100802246838, 67.965927498579, 17.39543648263], [58.552215885307, 74.943418768761, 26.25], [82.702078536796, 122.610873653528, 26.25], [87.65348761904, 129.951639498002, 17.39543648263], [87.65348761904, 129.951639498002, -17.39543648263], [82.702078536796, 122.610873653528, -26.25], [47.552281758685, 82.362968021873, -26.25], [43.125, 74.694691076408, -17.39543648263], [43.125, 74.694691076408, 17.39543648263], [47.552281758685, 82.362968021873, 26.25], [64.833092095761, 132.927537785405, 26.25], [68.714677259187, 140.885966757394, 17.39543648263], [68.714677259187, 140.885966757394, -17.39543648263], [68.714677259187, 140.885966757394, -52.5]]]]
Assign excitations#
[10]:
first_winding_faces = m3d.modeler.get_object_faces(
assignment=first_winding_list[0].name
)
second_winding_faces = m3d.modeler.get_object_faces(
assignment=second_winding_list[0].name
)
third_winding_faces = m3d.modeler.get_object_faces(
assignment=third_winding_list[0].name
)
m3d.assign_current(
assignment=[first_winding_faces[-1]],
amplitude=1000,
phase="0deg",
swap_direction=False,
name="phase_1_in",
)
m3d.assign_current(
assignment=[first_winding_faces[-2]],
amplitude=1000,
phase="0deg",
swap_direction=True,
name="phase_1_out",
)
m3d.assign_current(
assignment=[second_winding_faces[-1]],
amplitude=1000,
phase="120deg",
swap_direction=False,
name="phase_2_in",
)
m3d.assign_current(
assignment=[second_winding_faces[-2]],
amplitude=1000,
phase="120deg",
swap_direction=True,
name="phase_2_out",
)
m3d.assign_current(
assignment=[third_winding_faces[-1]],
amplitude=1000,
phase="240deg",
swap_direction=False,
name="phase_3_in",
)
m3d.assign_current(
assignment=[third_winding_faces[-2]],
amplitude=1000,
phase="240deg",
swap_direction=True,
name="phase_3_out",
)
[10]:
<ansys.aedt.core.modules.boundary.BoundaryObject at 0x29a95bc67d0>
Assign matrix#
[11]:
m3d.assign_matrix(
assignment=["phase_1_in", "phase_2_in", "phase_3_in"], matrix_name="current_matrix"
)
PyAEDT INFO: Infinite is the only return path option in EddyCurrent.
[11]:
<ansys.aedt.core.modules.boundary.MaxwellParameters at 0x29a92549a20>
Create mesh operation#
[12]:
mesh = m3d.mesh
mesh.assign_skin_depth(
assignment=[first_winding_list[0], second_winding_list[0], third_winding_list[0]],
skin_depth=0.20,
triangulation_max_length="10mm",
name="skin_depth",
)
mesh.assign_surface_mesh_manual(
assignment=[first_winding_list[0], second_winding_list[0], third_winding_list[0]],
surface_deviation=None,
normal_dev="30deg",
name="surface_approx",
)
PyAEDT INFO: Mesh class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Mesh class has been initialized! Elapsed time: 0m 0sec
[12]:
<ansys.aedt.core.modules.mesh.MeshOperation at 0x29a95bc6980>
Create boundaries#
Create the boundaries. A region with openings is needed to run the analysis.
[13]:
region = m3d.modeler.create_air_region(
x_pos=100, y_pos=100, z_pos=100, x_neg=100, y_neg=100, z_neg=0
)
Create setup#
Create a setup with a sweep to run the simulation. Depending on your machine’s computing power, the simulation can take some time to run.
[14]:
setup = m3d.create_setup("MySetup")
print(setup.props)
setup.props["Frequency"] = "100kHz"
setup.props["PercentRefinement"] = 15
setup.props["MaximumPasses"] = 10
setup.props["HasSweepSetup"] = True
setup.add_eddy_current_sweep(
range_type="LinearCount", start=100, end=1000, count=12, units="kHz", clear=True
)
{'Enabled': True, 'MeshLink': {'ImportMesh': False}, 'MaximumPasses': 6, 'MinimumPasses': 1, 'MinimumConvergedPasses': 1, 'PercentRefinement': 30, 'SolveFieldOnly': False, 'PercentError': 1, 'SolveMatrixAtLast': True, 'UseIterativeSolver': False, 'RelativeResidual': 1e-05, 'NonLinearResidual': 0.0001, 'SmoothBHCurve': False, 'Frequency': '60Hz', 'HasSweepSetup': False, 'SweepRanges': {'Subrange': {'SweepSetupType': 'LinearStep', 'StartValue': '1e-08GHz', 'StopValue': '1e-06GHz', 'StepSize': '1e-08GHz'}}, 'UseHighOrderShapeFunc': False, 'UseMuLink': False}
[14]:
True
Save project#
[15]:
m3d.save_project()
m3d.modeler.fit_all()
m3d.plot(
show=False,
output_file=os.path.join(temp_folder.name, "Image.jpg"),
plot_air_objects=True,
)
PyAEDT INFO: Project choke Saved correctly
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmp9cj28kmd.ansys/choke.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmp9cj28kmd.ansys/choke.aedt correctly loaded. Elapsed time: 0m 1sec
PyAEDT INFO: aedt file load time 1.3443422317504883
PyAEDT INFO: PostProcessor class has been initialized! Elapsed time: 0m 1sec
PyAEDT INFO: Post class has been initialized! Elapsed time: 0m 1sec
C:\actions-runner\_work\pyaedt-examples\pyaedt-examples\.venv\lib\site-packages\pyvista\jupyter\notebook.py:37: UserWarning: Failed to use notebook backend:
No module named 'trame'
Falling back to a static output.
warnings.warn(
[15]:
<ansys.aedt.core.visualization.plot.pyvista.ModelPlotter at 0x29a82561150>
Release AEDT#
[16]:
m3d.save_project()
m3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
PyAEDT INFO: Project choke Saved correctly
PyAEDT INFO: Desktop has been released and closed.
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.
[17]:
temp_folder.cleanup()
Download this example
Download this example as a Jupyter Notebook or as a Python script.