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
4 changes: 2 additions & 2 deletions machine_design/designs/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def create_setup(self, m2d: Maxwell2d) -> None:
m2d.change_symmetry_multiplier("SymmetryFactor")
# Calculation setup
setup = m2d.create_setup(name=self.setup_name)
setup.props["StopTime"] = "Nper/f"
setup.props["TimeStep"] = "1/(f*(PointPer-1))"
setup.props["StopTime"] = "2*pi*Nper/w"
setup.props["TimeStep"] = "2*pi/(w*(PointPer-1))"
setup.props["SaveFieldsType"] = "None"
setup.props["OutputPerObjectCoreLoss"] = False
setup.props["OutputPerObjectSolidLoss"] = True
Expand Down
3 changes: 3 additions & 0 deletions motors/synrm_3f_36s.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Anchor `synrm_3f_36s`: 3-phase synchronous reluctance machine, 36 stator slots."""

import numpy as np
from ansys.aedt.core import Maxwell2d
from ansys.aedt.core.modeler.modeler_2d import Modeler2D

Expand Down Expand Up @@ -172,11 +173,13 @@ class Computation(ComputationBase):
def set_oper_params(self):
f = 50 # [Hz]
RotSpeed = 60 * f / self.geometry.PolePairs # [rpm]
w = 2 * np.pi * f
self.oper_params = {
"Im": "1.5*sqrt(2)A",
"epsI": "pi/4", # current angle
"InitPos": "-30deg",
"f": f"{f}Hz",
"w": f"{w}Hz",
"RotSpeed": f"{RotSpeed}rpm",
"Nper": "1/6", # number of included periods
"PointPer": "101", # number of time points per period
Expand Down
23 changes: 12 additions & 11 deletions motors/synrm_5f_40s.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Computation(ComputationBase):
def set_oper_params(self):
f = 50 # [Hz]
RotSpeed = 60 * f / self.geometry.PolePairs # [rpm]
w = 2 * np.pi * f
self.oper_params = {
"Id1": "0.0A",
"Iq1": "0.0A",
Expand All @@ -42,7 +43,7 @@ def set_oper_params(self):
"Im1": "sqrt(Id1^2+Iq1^2)",
"Im3": "sqrt(Id3^2+Iq3^2)",
"InitPos": "-45deg",
"f": f"{f}Hz",
"w": f"{w}Hz",
"RotSpeed": f"{RotSpeed}rpm",
"Nper": "1/10", # number of included periods
"PointPer": "101", # number of time points per period
Expand Down Expand Up @@ -110,11 +111,11 @@ def set_output_vars(self):
"Vind_q1": "(InducedVoltage(PhaseA)*sin0_1 + InducedVoltage(PhaseB)*sin1_1 + InducedVoltage(PhaseC)*sin2_1 + InducedVoltage(PhaseD)*sin3_1 + InducedVoltage(PhaseE)*sin4_1) * 2/5",
"Vind_d3": "(InducedVoltage(PhaseA)*cos0_3 + InducedVoltage(PhaseB)*cos1_3 + InducedVoltage(PhaseC)*cos2_3 + InducedVoltage(PhaseD)*cos3_3 + InducedVoltage(PhaseE)*cos4_3) * 2/5",
"Vind_q3": "(InducedVoltage(PhaseA)*sin0_3 + InducedVoltage(PhaseB)*sin1_3 + InducedVoltage(PhaseC)*sin2_3 + InducedVoltage(PhaseD)*sin3_3 + InducedVoltage(PhaseE)*sin4_3) * 2/5",
"dIA_dt": "-Im1*2*pi*f*sin(2*pi*f*Time+epsI1-pi) - Im3*6*pi*f*sin(3*(2*pi*f*Time)+epsI3-pi)",
"dIB_dt": "-Im1*2*pi*f*sin(2*pi*f*Time-72deg+epsI1-pi) - Im3*6*pi*f*sin(3*(2*pi*f*Time-72deg)+epsI3-pi)",
"dIC_dt": "-Im1*2*pi*f*sin(2*pi*f*Time-144deg+epsI1-pi) - Im3*6*pi*f*sin(3*(2*pi*f*Time-144deg)+epsI3-pi)",
"dID_dt": "-Im1*2*pi*f*sin(2*pi*f*Time-216deg+epsI1-pi) - Im3*6*pi*f*sin(3*(2*pi*f*Time-216deg)+epsI3-pi)",
"dIE_dt": "-Im1*2*pi*f*sin(2*pi*f*Time-288deg+epsI1-pi) - Im3*6*pi*f*sin(3*(2*pi*f*Time-288deg)+epsI3-pi)",
"dIA_dt": "-Im1*w*sin(w*Time+epsI1-pi) - Im3*3*w*sin(3*(w*Time)+epsI3-pi)",
"dIB_dt": "-Im1*w*sin(w*Time-72deg+epsI1-pi) - Im3*3*w*sin(3*(w*Time-72deg)+epsI3-pi)",
"dIC_dt": "-Im1*w*sin(w*Time-144deg+epsI1-pi) - Im3*3*w*sin(3*(w*Time-144deg)+epsI3-pi)",
"dID_dt": "-Im1*w*sin(w*Time-216deg+epsI1-pi) - Im3*3*w*sin(3*(w*Time-216deg)+epsI3-pi)",
"dIE_dt": "-Im1*w*sin(w*Time-288deg+epsI1-pi) - Im3*3*w*sin(3*(w*Time-288deg)+epsI3-pi)",
"V_A": "InducedVoltage(PhaseA) + Rstat*InputCurrent(PhaseA) + Lew*dIA_dt",
"V_B": "InducedVoltage(PhaseB) + Rstat*InputCurrent(PhaseB) + Lew*dIB_dt",
"V_C": "InducedVoltage(PhaseC) + Rstat*InputCurrent(PhaseC) + Lew*dIC_dt",
Expand Down Expand Up @@ -216,11 +217,11 @@ def set_post_params(self):

def assign_stator_coils(self, m2d: Maxwell2d) -> None:
# Excitations
I_A = "Im1*cos(2*pi*f*time+epsI1-pi) + Im3*cos(3*(2*pi*f*time)+epsI3-pi)"
I_B = "Im1*cos(2*pi*f*time-72deg+epsI1-pi) + Im3*cos(3*(2*pi*f*time-72deg)+epsI3-pi)"
I_C = "Im1*cos(2*pi*f*time-144deg+epsI1-pi) + Im3*cos(3*(2*pi*f*time-144deg)+epsI3-pi)"
I_D = "Im1*cos(2*pi*f*time-216deg+epsI1-pi) + Im3*cos(3*(2*pi*f*time-216deg)+epsI3-pi)"
I_E = "Im1*cos(2*pi*f*time-288deg+epsI1-pi) + Im3*cos(3*(2*pi*f*time-288deg)+epsI3-pi)"
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(
Expand Down
2 changes: 2 additions & 0 deletions tests/test_synrm_3f_36s.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re

import numpy as np
import pytest

from motors.synrm_3f_36s import Computation, Geometry
Expand Down Expand Up @@ -75,6 +76,7 @@ def test_oper_params(computation):
"epsI": "pi/4",
"InitPos": "-30deg",
"f": "50Hz",
"w": f"{2 * np.pi * 50}Hz",
"RotSpeed": "1500.0rpm",
"Nper": "1/6",
"PointPer": "101",
Expand Down
3 changes: 2 additions & 1 deletion tests/test_synrm_5f_40s.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
import pytest

from motors.synrm_3f_36s import Geometry as BaseGeometry
Expand Down Expand Up @@ -50,7 +51,7 @@ def test_oper_params_fully_replaced(computation2):
"Im1": "sqrt(Id1^2+Iq1^2)",
"Im3": "sqrt(Id3^2+Iq3^2)",
"InitPos": "-45deg",
"f": "50Hz",
"w": f"{2 * np.pi * 50}Hz",
"RotSpeed": "1500.0rpm",
"Nper": "1/10",
"PointPer": "101",
Expand Down
Loading