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

Core loss electrical steel #3829

Merged
merged 37 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
dce1d1a
enhance core loss electrical steel
gmalinve Oct 19, 2023
730bdf2
implement core losses
gmalinve Oct 30, 2023
5513be2
Merge branch 'main' into core_loss_electrical_steel
gmalinve Oct 31, 2023
7391fa0
fix
gmalinve Oct 31, 2023
24d48dd
set_electrical_steel core losses with coefficients
gmalinve Oct 31, 2023
9677b65
Merge branch 'main' into core_loss_electrical_steel
gmalinve Oct 31, 2023
bd715fd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2023
e550874
remove imports
gmalinve Oct 31, 2023
5b43389
Merge remote-tracking branch 'origin/core_loss_electrical_steel' into…
gmalinve Oct 31, 2023
5ece5f4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2023
e0dfea6
Merge branch 'main' into core_loss_electrical_steel
gmalinve Nov 2, 2023
b43b84e
add get coreloss coefficients test
gmalinve Nov 2, 2023
c3a68b7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 2, 2023
2188263
Merge branch 'main' into core_loss_electrical_steel
gmalinve Nov 6, 2023
21f5ce4
Merge branch 'main' into core_loss_electrical_steel
gmalinve Nov 15, 2023
6e97530
set core loss test implement
gmalinve Nov 15, 2023
4c8a95c
Update pyaedt/modules/Material.py
gmalinve Nov 15, 2023
eb66357
Update pyaedt/modules/Material.py
gmalinve Nov 15, 2023
0a9afed
Update pyaedt/modules/Material.py
gmalinve Nov 15, 2023
e06d129
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2023
144f522
Apply suggestions from code review
gmalinve Nov 16, 2023
3e959ef
Update pyaedt/modules/Material.py
gmalinve Nov 16, 2023
77a3aac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 16, 2023
39acaaf
Update pyaedt/modules/Material.py
gmalinve Nov 16, 2023
b1a83cc
fix comments review
gmalinve Nov 16, 2023
f17f92a
Apply suggestions from code review
gmalinve Nov 21, 2023
0ea57f0
Merge branch 'main' into core_loss_electrical_steel
gmalinve Nov 21, 2023
b443b0d
fix comments review
gmalinve Nov 22, 2023
f857679
Merge branch 'main' into core_loss_electrical_steel
gmalinve Nov 22, 2023
31c672a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 22, 2023
9442f01
fix comments review
gmalinve Nov 22, 2023
11986ec
Merge remote-tracking branch 'origin/core_loss_electrical_steel' into…
gmalinve Nov 22, 2023
3039939
fix docstring
gmalinve Nov 23, 2023
7064866
Merge branch 'main' into core_loss_electrical_steel
gmalinve Nov 23, 2023
52b3e63
Fix return list
Samuelopez-ansys Nov 23, 2023
9d6e466
Merge remote-tracking branch 'origin/core_loss_electrical_steel' into…
gmalinve Nov 23, 2023
0baae87
fix regression error
gmalinve Nov 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 107 additions & 2 deletions _unittest/test_03_Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_02_create_material(self):

assert mat1.set_electrical_steel_coreloss(1, 2, 3, 4, 0.002)
assert mat1.get_curve_coreloss_type() == "Electrical Steel"
assert mat1.get_curve_coreloss_values()["core_loss_equiv_cut_depth"] == "0.002meter"
assert mat1.get_curve_coreloss_values()["core_loss_equiv_cut_depth"] == 0.002
assert mat1.set_hysteresis_coreloss(1, 2, 3, 4, 0.002)
assert mat1.get_curve_coreloss_type() == "Hysteresis Model"
assert mat1.set_bp_curve_coreloss([[0, 0], [10, 10], [20, 20]])
Expand Down Expand Up @@ -210,7 +210,7 @@ def test_08B_import_materials_from_excel(self):
assert len(mats) == 2

def test_09_non_linear_materials(self, add_app):
app = add_app(application=Maxwell3d)
app = add_app(application=Maxwell3d, solution_type="Transient")
mat1 = app.materials.add_material("myMat")
mat1.permeability = [[0, 0], [1, 12], [10, 30]]
mat1.permittivity = [[0, 0], [2, 12], [10, 30]]
Expand Down Expand Up @@ -274,3 +274,108 @@ def test_13_get_materials_in_project(self):
assert isinstance(used_materials, list)
for m in [mat for mat in self.aedtapp.materials if mat.is_used]:
assert m.name in used_materials

def test_14_get_coreloss_coefficients(self):
mat = self.aedtapp.materials.add_material("mat_test")
# Test points_list_at_freq
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}
)
assert isinstance(coeff, list)
assert len(coeff) == 3
assert all(isinstance(c, float) for c in coeff)
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq={"60Hz": [[0, 0], [1, 3.5], [2, 7.4]]}
)
assert isinstance(coeff, list)
assert len(coeff) == 3
assert all(isinstance(c, float) for c in coeff)
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq={"0.06kHz": [[0, 0], [1, 3.5], [2, 7.4]]}
)
assert isinstance(coeff, list)
assert len(coeff) == 3
assert all(isinstance(c, float) for c in coeff)
try:
self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq=[[0, 0], [1, 3.5], [2, 7.4]]
)
assert False
except TypeError:
assert True
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq={
60: [[0, 0], [1, 3.5], [2, 7.4]],
100: [[0, 0], [1, 8], [2, 9]],
150: [[0, 0], [1, 10], [2, 19]],
}
)
assert isinstance(coeff, list)
assert len(coeff) == 3
assert all(isinstance(c, float) for c in coeff)
# Test thickness
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="0.6mm"
)
assert isinstance(coeff, list)
assert len(coeff) == 3
assert all(isinstance(c, float) for c in coeff)
try:
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="invalid"
)
assert False
except TypeError:
assert True
try:
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness=50
)
assert False
except TypeError:
assert True

def test_14_set_core_loss(self):
mat = self.aedtapp.materials["mat_test"]
# Test points_list_at_freq
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}
)
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq={"60Hz": [[0, 0], [1, 3.5], [2, 7.4]]}
)
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq={"0.06kHz": [[0, 0], [1, 3.5], [2, 7.4]]}
)
try:
self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq=[[0, 0], [1, 3.5], [2, 7.4]]
)
assert False
except TypeError:
assert True
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq={
60: [[0, 0], [1, 3.5], [2, 7.4]],
100: [[0, 0], [1, 8], [2, 9]],
150: [[0, 0], [1, 10], [2, 19]],
}
)
# Test thickness
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="0.6mm"
)
try:
coeff = self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="invalid"
)
assert False
except TypeError:
assert True
try:
coeff = self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness=50
)
assert False
except TypeError:
assert True
Loading
Loading