Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug located in set_coreloss_at_frequency #5929

Closed
2 tasks done
yliu44197 opened this issue Mar 19, 2025 · 1 comment · Fixed by #5939
Closed
2 tasks done

Bug located in set_coreloss_at_frequency #5929

yliu44197 opened this issue Mar 19, 2025 · 1 comment · Fixed by #5939
Assignees
Labels
bug Something isn't working

Comments

@yliu44197
Copy link

Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

Description of the bug

Core loss model in Maxwell can be set up as Electrical Steel or Power Ferrite as known to all. A bug issue was noticed when setting up these types of core loss model with pyaedt by regression.

"coefficient_setup" is a parameter which was supposed to enable users to calculate the coefficients by entering the BP data in various core loss units. In the latest release of pyaedt, however, users can only obtain the desired result if they use "w_per_cubic_meter" as the unit.

Steps To Reproduce

By running the code below we added a new electrical steel material in AEDT.

from ansys.aedt.core import Maxwell3d

M3D = Maxwell3d(project="Project1", design="Maxwell3DDesign1", solution_type="EddyCurrent")
CoreMaterial = M3D.materials.add_material(name="Core_Grade_1")
CoreMaterial.mass_density = 7650
CoreMaterial.set_coreloss_at_frequency(points_at_frequency={60 : [[0,0], [0.5,0.06], [1,0.22], [1.5,0.51], [2,1.54]]},
                                       thickness="0.2mm", conductivity=2000000, coefficient_setup="w_per_kg",
                                       core_loss_model_type="Electrical Steel")

M3D.release_desktop(False, False)

However, we obtained the incorrect core loss model.

Image

Fixing this bug is simple. The root cause is that there is no parameter for core loss unit when calculating the coefficients by executing "get_core_loss_coefficients" in the function. As a result, the coefficients can only be calculated with core loss unit by default in "w_per_cubic_meter".

coefficients = self.get_core_loss_coefficients(
            points_at_frequency, thickness=thickness, conductivity=conductivity
        )

By correlating the parameters, the bug can be fixed and we may now obtain the correct core loss model.

coefficients = self.get_core_loss_coefficients(
            points_at_frequency, thickness=thickness, conductivity=conductivity, coefficient_setup=coefficient_setup
        )

Image

Which Operating System are you using?

Windows

Which Python version are you using?

3.12

Installed packages

annotated-types==0.7.0
ansys-pythonnet==3.1.0rc6
attrs==24.2.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
clr_loader==0.2.7.post0
contourpy==1.3.1
cycler==0.12.1
defusedxml==0.7.1
et_xmlfile==2.0.0
fonttools==4.56.0
fpdf2==2.8.2
grpcio==1.70.0
idna==3.10
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
kiwisolver==1.4.8
matplotlib==3.10.1
numpy==2.2.3
openpyxl==3.1.5
packaging==24.2
pandas==2.2.3
pillow==11.1.0
platformdirs==4.3.6
plumbum==1.9.0
pooch==1.8.2
psutil==7.0.0
pyaedt==0.15.0
pycparser==2.22
pydantic==2.10.6
pydantic_core==2.27.2
pyedb==0.38.0
pyparsing==3.2.1
python-dateutil==2.9.0.post0
pytz==2025.1
pyvista==0.44.1
pywin32==309
PyYAML==6.0.2
referencing==0.35.1
requests==2.32.3
rpds-py==0.23.1
rpyc==6.0.1
rtree==1.4.0
scikit-rf==1.6.2
scipy==1.15.2
scooby==0.10.0
six==1.17.0
toml==0.10.2
tomli_w==1.2.0
typing_extensions==4.12.2
tzdata==2025.1
urllib3==2.3.0
vtk==9.4.1
xlwings==0.33.11

@yliu44197 yliu44197 added the bug Something isn't working label Mar 19, 2025
@gmalinve gmalinve self-assigned this Mar 21, 2025
@gmalinve gmalinve linked a pull request Mar 21, 2025 that will close this issue
7 tasks
@gmalinve
Copy link
Contributor

Hi @yliu44197, thanks for your feedback. I just open a PR #5939 to fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants