ansys / pyaedt

AEDT Python Client Package
https://aedt.docs.pyansys.com
MIT License
213 stars 129 forks source link

Extract the results from RMxprt #5401

Open lijinlong0308 opened 2 weeks ago

lijinlong0308 commented 2 weeks ago

Dear all, How can I extract the results from an analyzed RMxprt project with python code? the APIs seems not work. Best, Jinlong

gmalinve commented 2 weeks ago

Hi @lijinlong0308,

What do you mean the API doesn't work? Could you paste your code snippet? it will help me understand what you are trying to do.

Thanks,

Giulia

lijinlong0308 commented 2 weeks ago

Dear Giulia @gmalinve , Thanks for your help. After I run the "rmxprt.analyze()" command, the rmxprt can analyse the performance of the target machine. And we can check the design results by solution data. Now I wanna obtained the information from Design sheet, I try to use the api command "rmxprt.export_profile(setup)", but it end with error. Best, Jinlong

import os import tempfile import time

import ansys.aedt.core

Define constants.

AEDT_VERSION = "2024.2" NUM_CORES = 4 NG_MODE = True # 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 = './'

Launch AEDT and RMxprt

#

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, "AFSM-bench.aedt") rmxprt = ansys.aedt.core.Rmxprt( version=AEDT_VERSION, new_desktop=True, close_on_exit=True, solution_type="APSM", project=project_name, non_graphical=NG_MODE, )

Define global machine settings

rmxprt.general["Source Type"] = "DC" rmxprt.general["Structure"] = "Axial-Flux Rotor" rmxprt.general["Stator Type"] = "AXIAL_AC" rmxprt.general["Rotor Type"] = "AXIAL_PM" rmxprt.general["Double-Sided"] = "None" rmxprt.general["Air Gap Length"] = "1mm"

Define stator

#

Define stator and slot and winding settings.

rmxprt.stator["Number of Poles"] = 12 rmxprt.stator["Number of Slots"] = 15 rmxprt.stator["Circuit Type"] = "Y3" rmxprt.stator["Slot Type"] = 3 rmxprt.stator.properties.children["Core"].props["Outer Diameter"] = "120mm" rmxprt.stator.properties.children["Core"].props["Inner Diameter"] = "70mm" rmxprt.stator.properties.children["Core"].props["Length"] = "25mm" rmxprt.stator.properties.children["Core"].props["Stacking Factor"] = 0.95 rmxprt.stator.properties.children["Core"].props["Steel Type"] = [ "Material:=", "steel_1008", ]

rmxprt.stator.properties.children["Core"].children["Slot"].props["Auto Design"] = False rmxprt.stator.properties.children["Core"].children["Slot"].props["Hs0"] = "1.5mm" rmxprt.stator.properties.children["Core"].children["Slot"].props["Hs1"] = "2mm" rmxprt.stator.properties.children["Core"].children["Slot"].props["Hs2"] = "13mm" rmxprt.stator.properties.children["Core"].children["Slot"].props["Bs0"] = "3mm" rmxprt.stator.properties.children["Core"].children["Slot"].props["Bs1"] = "8mm" rmxprt.stator.properties.children["Core"].children["Slot"].props["Bs2"] = "8mm" rmxprt.stator.properties.children["Core"].children["Slot"].props["Rs"] = "0.4mm" rmxprt.stator.properties.children["Winding"].props["Winding Layers"] = 2 rmxprt.stator.properties.children["Winding"].props["Parallel Branches"] = 1 rmxprt.stator.properties.children["Winding"].props["Conductors per Slot"] = 48 rmxprt.stator.properties.children["Winding"].props["Coil Pitch"] = 1 rmxprt.stator.properties.children["Winding"].props["Number of Strands"] = 1 rmxprt.stator.properties.children["Winding"].props["Conductor Type"] = [ "Material:=", "copper", ]

circuit

rmxprt.stator.properties.children["Circuit"].props["Control Type"] = "DC" rmxprt.stator.properties.children["Circuit"].props["Trigger Pulse Width"] = "120deg" rmxprt.stator.properties.children["Circuit"].props["Transistor Drop"] = "0.7V" rmxprt.stator.properties.children["Circuit"].props["Diode Drop"] = "0.7V"

Define rotor

#

Define rotor and pole settings.

rmxprt.rotor["Number of Poles"] = 12 rmxprt.rotor.properties.children["Core"].props["Outer Diameter"] = "120mm" rmxprt.rotor.properties.children["Core"].props["Inner Diameter"] = "70mm" rmxprt.rotor.properties.children["Core"].props["Length"] = "15mm" rmxprt.rotor.properties.children["Core"].props["Steel Type"] = [ "Material:=", "steel_1008", ] rmxprt.rotor.properties.children["Core"].props["Stacking Factor"] = 0.95 rmxprt.rotor.properties.children["Core"].children["Pole"].props["Embrace"] = 0.9 rmxprt.rotor.properties.children["Core"].children["Pole"].props["Magnet Type"] = [ "Material:=", "NdFe35", ] rmxprt.rotor.properties.children["Core"].children["Pole"].props["Magnet Thickness"] = "8mm" rmxprt.rotor.properties.children["Core"].children["Pole"].props["Magnet Length"] = "25mm"

shaft

rmxprt.shaft["Magnetic Shaft"] = False rmxprt.shaft["Frictional Loss"] = "12W" rmxprt.shaft["Windage Loss or Power"] = "12W" rmxprt.shaft["Reference Speed"] = "3000rpm"

Create setup

#

Create a setup and define the main settings.

setup = rmxprt.create_setup() setup["name"] ="MySetupAuto" setup.props["Enabled"] = True setup.props["OperationType"] = "Motor" setup.props["LoadType"] = "Const Power" setup.props["RatedOutputPower"] = "2.5kW" setup.props["RatedVoltage"] = "220V" setup.props["RatedSpeed"] = "3900rpm" setup.props["OperatingTemperature"] = "75cel" setup.update() rmxprt.analyze() rmxprt.export_profile(setup) exported_files = rmxprt.get_traces_for_plot() print(exported_files) rmxprt.save_project()

gmalinve commented 1 week ago

Hi @lijinlong0308,

I'd suggest first to test this example in graphical mode so you can actually see what is going on in AEDT. Then I'd suggest to debug the code to see which properties you can access in an axial flux machine. My IDE of choice is PyCharm and if I debug I can see this: Image Could you please check in graphical mode if you are actually analyzing an axial flux machine and which errors do you get?

Thanks,

Giulia