Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dd3c1f6
add winding_layout_JL.py
haitao-ZCU Oct 14, 2026
74469e9
assign_phase_windings_new in computation to use new method
haitao-ZCU Oct 14, 2026
f37f98f
update coil_name
haitao-ZCU Oct 14, 2026
cb6d036
modify test file according to original test_ansys_regression.py
haitao-ZCU Oct 15, 2026
e3f9886
correct file name and unpdate testing function
haitao-ZCU Oct 15, 2026
9d4aa3c
add new_winding test of 5f_40s
haitao-ZCU Oct 15, 2026
ab06a59
compare new_winding with old and legacy
haitao-ZCU Oct 15, 2026
5ccb92b
compare new, live and legacy with each other
haitao-ZCU Oct 15, 2026
1e5aa90
define coil_name
haitao-ZCU Oct 15, 2026
81adacb
replace set_initpos
haitao-ZCU Oct 15, 2026
59fe886
use new method to replace compute_initpos
haitao-ZCU Oct 15, 2026
432dfe4
merge set_initpos and assign_phase_windings to use new method
haitao-ZCU Oct 16, 2026
cc3f936
ruff format
haitao-ZCU Oct 16, 2026
d29282c
delete belt_offset
haitao-ZCU Oct 16, 2026
0be06ba
read layers from machines instead of hardcoding
haitao-ZCU Oct 16, 2026
8c9740c
delete old unnecessary files
haitao-ZCU Oct 16, 2026
aeba6c4
update
haitao-ZCU Oct 16, 2026
0f702fb
ruff format
haitao-ZCU Oct 16, 2026
d0dc1a6
use original name winding.py
haitao-ZCU Oct 16, 2026
5b063cc
update assign_phse_windings to support layer2
haitao-ZCU Oct 19, 2026
a6dce77
update for layer2
haitao-ZCU Oct 19, 2026
3e321d7
support layer2
haitao-ZCU Oct 19, 2026
327a885
ruff format
haitao-ZCU Oct 19, 2026
c2658c7
fix Nc and coil edge
haitao-ZCU Oct 20, 2026
4925a24
update Nc values in test files
haitao-ZCU Oct 20, 2026
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
36 changes: 13 additions & 23 deletions machine_design/designs/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import numpy as np
from ansys.aedt.core import Maxwell2d

from machine_design.generic.compute_initpos import compute_initpos
from machine_design.generic.winding import phase_groups
from machine_design.generic.winding import assign_slot_currents_to_aedt, compute_winding_layout

from .geometry import GeometryBase
from .reserved_variables import check_no_reserved_variable_names
Expand Down Expand Up @@ -44,14 +43,10 @@ def extract_expression(solutions, expr: str) -> np.ndarray:
def set_initpos(self) -> None:
g = self.geometry
Q = int(g.geom_params["SlotNumber"])
self.InitPos = compute_initpos(Q, g.PolePairs, g.n_phases, belt_offset=g.belt_offset)
layout = compute_winding_layout(g.n_phases, Q, g.PolePairs, coil_pitch=int(g.wind_params["CoilPitch"]), layers=int(g.wind_params["Layers"]))
self.InitPos = (layout.phase_a_axis - 180) / g.PolePairs
self.oper_params["InitPos"] = f"{self.InitPos}deg"

def compute_phase_groups(self):
g = self.geometry
Q = int(g.geom_params["SlotNumber"])
return phase_groups(Q, g.PolePairs, g.n_phases, belt_offset=g.belt_offset)

def set_solution_expressions(self):
self.solution_expressions = [
"Moving1.Position",
Expand All @@ -74,21 +69,16 @@ def set_post_params(self):
}

def assign_phase_windings(self, m2d: Maxwell2d, phase_currents: list) -> None:
groups = self.compute_phase_groups()
for group in groups:
for coil_name, polarity in group:
m2d.assign_coil(assignment=[coil_name], conductors_number="Nc", polarity=polarity, name=f"CS_{coil_name}")

for phase_name, current, group in zip(self.phases, phase_currents, groups):
m2d.assign_winding(
assignment=None,
winding_type="Current",
is_solid=False,
current=current,
parallel_branches="ParallelPaths",
name=f"Phase{phase_name}",
)
m2d.add_winding_coils(assignment=f"Phase{phase_name}", coils=[f"CS_{coil_name}" for coil_name, _ in group])
g = self.geometry
Q = int(g.geom_params["SlotNumber"])
n = Q // (2 * g.PolePairs)
layers = int(g.wind_params["Layers"])
layout = compute_winding_layout(g.n_phases, Q, g.PolePairs, coil_pitch=int(g.wind_params["CoilPitch"]), layers=layers)
layer_coils = [[f"Coil{i_layer}" if k == 0 else f"Coil{i_layer}_{k}" for k in range(n)] for i_layer in range(layers)]
coil_objects = layer_coils[0]
coil_objects_back = layer_coils[1] if layers == 2 else None
phase_currents_dict = dict(zip(self.phases, phase_currents))
assign_slot_currents_to_aedt(m2d, coil_objects, layout, phase_currents_dict, coil_objects_back=coil_objects_back)

def extract_phase_results(self, solutions):
# SI units
Expand Down
3 changes: 1 addition & 2 deletions machine_design/generic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from .compute_initpos import compute_initpos
from .transforms import electrical_angle, to_dq, to_phases
from .winding import coil_name, phase_groups, sector_winding
from .winding import assign_slot_currents_to_aedt, compute_winding_layout
24 changes: 0 additions & 24 deletions machine_design/generic/compute_initpos.py

This file was deleted.

Loading
Loading