Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 30 additions & 11 deletions machine_design/designs/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ def __init__(self, geometry: GeometryBase) -> None:
@abstractmethod
def set_oper_params(self): ...

@abstractmethod
def set_solution_expressions(self): ...

@abstractmethod
def set_output_vars(self): ...

@abstractmethod
def set_post_params(self): ...

@abstractmethod
def assign_stator_coils(self, m2d: Maxwell2d) -> None: ...

Expand Down Expand Up @@ -61,8 +52,8 @@ def compute_phase_groups(self):
Q = int(g.geom_params["SlotNumber"])
return phase_groups(Q, g.PolePairs, g.n_phases, belt_offset=g.belt_offset)

def compute_solution_expressions(self):
return [
def set_solution_expressions(self):
self.solution_expressions = [
"Moving1.Position",
"Moving1.Torque",
*[f"FluxLinkage(Phase{p})" for p in self.phases],
Expand All @@ -71,6 +62,34 @@ def compute_solution_expressions(self):
*[f"L(Phase{x},Phase{y})" for x in self.phases for y in self.phases],
]

def set_output_vars(self):
self.output_vars = {}

def set_post_params(self):
self.post_params = {
tuple(f"InducedVoltage(Phase{p})" for p in self.phases): "InducedVoltage",
("Moving1.Torque"): "Torque",
tuple(f"InputCurrent(Phase{p})" for p in self.phases): "Current",
tuple(f"FluxLinkage(Phase{p})" for p in self.phases): "FluxLinkage",
}

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])

def extract_phase_results(self, solutions):
# SI units
flux_phases = np.stack([self.extract_expression(solutions, f"FluxLinkage(Phase{p})") for p in self.phases], axis=-1)
Expand Down
49 changes: 3 additions & 46 deletions motors/synrm_3f_36s.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,54 +189,11 @@ def set_oper_params(self):
}
self.set_initpos()

def set_solution_expressions(self):
self.solution_expressions = self.compute_solution_expressions()

def set_output_vars(self):
self.output_vars = {}

def set_post_params(self):
self.post_params = { # reports
("InducedVoltage(PhaseA)", "InducedVoltage(PhaseB)", "InducedVoltage(PhaseC)"): "InducedVoltage",
("Moving1.Torque"): "Torque",
("InputCurrent(PhaseA)", "InputCurrent(PhaseB)", "InputCurrent(PhaseC)"): "Current",
(
"FluxLinkage(PhaseA)",
"FluxLinkage(PhaseB)",
"FluxLinkage(PhaseC)",
): "FluxLinkage",
}

def assign_stator_coils(self, m2d: Maxwell2d) -> None:
# Excitations
I_A = "Im * cos(w*Time+epsI)"
I_B = "Im * cos(w*Time-120deg+epsI)"
I_C = "Im * cos(w*Time-240deg+epsI)"

phases_polarity = ["Positive", "Negative", "Positive"]
phases_name = ["A", "C", "B"]
phases_current = [I_A, I_C, I_B]
i_coil = 0
for phase_polarity, phase_name, phase_current in zip(phases_polarity, phases_name, phases_current):
names = []
for _ in range(3):
m2d.assign_coil(
assignment=[self.geometry.id_coils[i_coil]],
conductors_number="Nc",
polarity=phase_polarity,
name=f"CS{i_coil + 1}",
)
names.append(f"CS{i_coil + 1}")
i_coil += 1
m2d.assign_winding(
assignment=None,
winding_type="Current",
is_solid=False,
current=phase_current,
parallel_branches="ParallelPaths",
name=f"Phase{phase_name}",
)
m2d.add_winding_coils(assignment=f"Phase{phase_name}", coils=names)
m = self.geometry.n_phases
phase_currents = [f"Im * cos(w*Time-{360 * k / m}deg+epsI)" for k in range(m)]
self.assign_phase_windings(m2d, phase_currents)

def inductance_computation(self, m2d: Maxwell2d) -> None:
m2d.change_inductance_computation(compute_transient_inductance=True, incremental_matrix=False)
Expand Down
25 changes: 0 additions & 25 deletions motors/synrm_3f_60s.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Anchor `synrm_3f_60s`: 3-phase synchronous reluctance machine, 60 stator slots."""

from ansys.aedt.core import Maxwell2d

from .synrm_3f_36s import Computation as BaseComputation
from .synrm_3f_36s import Geometry as BaseGeometry

Expand All @@ -28,28 +26,5 @@ class Computation(BaseComputation):
def set_solution_expressions(self):
self.solution_expressions = ["Moving1.Torque"]

def assign_stator_coils(self, m2d: Maxwell2d) -> None:
# Excitations
I_A = "Im * cos(w*Time+epsI)"
I_B = "Im * cos(w*Time-120deg+epsI)"
I_C = "Im * cos(w*Time-240deg+epsI)"

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("ABC", [I_A, I_B, I_C], 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])

def extract_results(self, solutions):
return {"Moving1.Torque": self.extract_expression(solutions, "Moving1.Torque")}
149 changes: 3 additions & 146 deletions motors/synrm_5f_40s.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,154 +59,11 @@ def set_oper_params(self):
}
self.set_initpos()

def set_solution_expressions(self):
self.solution_expressions = self.compute_solution_expressions()

def set_output_vars(self):
self.output_vars = {}

def set_post_params(self):
self.post_params = { # reports
(
"InducedVoltage(PhaseA)",
"InducedVoltage(PhaseB)",
"InducedVoltage(PhaseC)",
"InducedVoltage(PhaseD)",
"InducedVoltage(PhaseE)",
): "InducedVoltage",
("Moving1.Torque"): "Torque",
(
"InputCurrent(PhaseA)",
"InputCurrent(PhaseB)",
"InputCurrent(PhaseC)",
"InputCurrent(PhaseD)",
"InputCurrent(PhaseE)",
): "Current",
(
"FluxLinkage(PhaseA)",
"FluxLinkage(PhaseB)",
"FluxLinkage(PhaseC)",
"FluxLinkage(PhaseD)",
"FluxLinkage(PhaseE)",
): "FluxLinkage",
}

def assign_stator_coils(self, m2d: Maxwell2d) -> None:
# Excitations
I_A = "Im1*cos(w*Time+epsI1-pi) + Im3*cos(3*(w*Time)+epsI3-pi)"
I_B = "Im1*cos(w*Time-72deg+epsI1-pi) + Im3*cos(3*(w*Time-72deg)+epsI3-pi)"
I_C = "Im1*cos(w*Time-144deg+epsI1-pi) + Im3*cos(3*(w*Time-144deg)+epsI3-pi)"
I_D = "Im1*cos(w*Time-216deg+epsI1-pi) + Im3*cos(3*(w*Time-216deg)+epsI3-pi)"
I_E = "Im1*cos(w*Time-288deg+epsI1-pi) + Im3*cos(3*(w*Time-288deg)+epsI3-pi)"
m2d.assign_coil
# Define phase windings
m2d.assign_coil(
assignment=["Coil"],
conductors_number="Nc",
polarity="Positive",
name="CS1",
)
m2d.assign_coil(
assignment=["Coil_1"],
conductors_number="Nc",
polarity="Negative",
name="CS2",
)
m2d.assign_coil(
assignment=["Coil_2"],
conductors_number="Nc",
polarity="Negative",
name="CS3",
)
m2d.assign_coil(
assignment=["Coil_3"],
conductors_number="Nc",
polarity="Positive",
name="CS4",
)
m2d.assign_coil(
assignment=["Coil_4"],
conductors_number="Nc",
polarity="Positive",
name="CS5",
)
m2d.assign_coil(
assignment=["Coil_5"],
conductors_number="Nc",
polarity="Negative",
name="CS6",
)
m2d.assign_coil(
assignment=["Coil_6"],
conductors_number="Nc",
polarity="Negative",
name="CS7",
)
m2d.assign_coil(
assignment=["Coil_7"],
conductors_number="Nc",
polarity="Positive",
name="CS8",
)
m2d.assign_coil(
assignment=["Coil_8"],
conductors_number="Nc",
polarity="Positive",
name="CS9",
)
m2d.assign_coil(
assignment=["Coil_9"],
conductors_number="Nc",
polarity="Negative",
name="CS10",
)

m2d.assign_winding(
assignment=None,
winding_type="Current",
is_solid=False,
current=I_A,
parallel_branches="ParallelPaths",
name="PhaseA",
)
m2d.assign_winding(
assignment=None,
winding_type="Current",
is_solid=False,
current=I_B,
parallel_branches="ParallelPaths",
name="PhaseB",
)
m2d.assign_winding(
assignment=None,
winding_type="Current",
is_solid=False,
current=I_C,
parallel_branches="ParallelPaths",
name="PhaseC",
)
m2d.assign_winding(
assignment=None,
winding_type="Current",
is_solid=False,
current=I_D,
parallel_branches="ParallelPaths",
name="PhaseD",
)
m2d.assign_winding(
assignment=None,
winding_type="Current",
is_solid=False,
current=I_E,
parallel_branches="ParallelPaths",
name="PhaseE",
)

m2d.add_winding_coils(assignment="PhaseA", coils=["CS1", "CS10"])
m2d.add_winding_coils(assignment="PhaseB", coils=["CS4", "CS5"])
m2d.add_winding_coils(assignment="PhaseC", coils=["CS8", "CS9"])
m2d.add_winding_coils(assignment="PhaseD", coils=["CS2", "CS3"])
m2d.add_winding_coils(assignment="PhaseE", coils=["CS6", "CS7"])
m = self.geometry.n_phases
phase_currents = [f"Im1 * cos(w*Time-{360 * k / m}deg+epsI1-pi)+Im3*cos(3*(w*Time-{360 * k / m}deg)+epsI3-pi)" for k in range(m)]
self.assign_phase_windings(m2d, phase_currents)

def inductance_computation(self, m2d: Maxwell2d) -> None:
m2d.change_inductance_computation(compute_transient_inductance=True, incremental_matrix=True)
Expand Down
27 changes: 0 additions & 27 deletions motors/synrm_5f_60s.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
phases. Excitation is dq1 + dq3.
"""

from ansys.aedt.core import Maxwell2d

from .synrm_5f_40s import Computation as BaseComputation
from .synrm_5f_40s import Geometry as BaseGeometry

Expand All @@ -32,30 +30,5 @@ class Computation(BaseComputation):
def set_solution_expressions(self):
self.solution_expressions = ["Moving1.Torque"]

def assign_stator_coils(self, m2d: Maxwell2d) -> None:
# Excitations
I_A = "Im1*cos(w*Time+epsI1-pi) + Im3*cos(3*(w*Time)+epsI3-pi)"
I_B = "Im1*cos(w*Time-72deg+epsI1-pi) + Im3*cos(3*(w*Time-72deg)+epsI3-pi)"
I_C = "Im1*cos(w*Time-144deg+epsI1-pi) + Im3*cos(3*(w*Time-144deg)+epsI3-pi)"
I_D = "Im1*cos(w*Time-216deg+epsI1-pi) + Im3*cos(3*(w*Time-216deg)+epsI3-pi)"
I_E = "Im1*cos(w*Time-288deg+epsI1-pi) + Im3*cos(3*(w*Time-288deg)+epsI3-pi)"

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("ABCDE", [I_A, I_B, I_C, I_D, I_E], 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])

def extract_results(self, solutions):
return {"Moving1.Torque": self.extract_expression(solutions, "Moving1.Torque")}
Loading