diff --git a/machine_design/designs/computation.py b/machine_design/designs/computation.py index f75c095..20b2d74 100644 --- a/machine_design/designs/computation.py +++ b/machine_design/designs/computation.py @@ -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 diff --git a/motors/synrm_3f_36s.py b/motors/synrm_3f_36s.py index 5b10713..6ad8369 100644 --- a/motors/synrm_3f_36s.py +++ b/motors/synrm_3f_36s.py @@ -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 @@ -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 diff --git a/motors/synrm_5f_40s.py b/motors/synrm_5f_40s.py index d33e294..1a10a1d 100644 --- a/motors/synrm_5f_40s.py +++ b/motors/synrm_5f_40s.py @@ -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", @@ -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 @@ -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", @@ -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( diff --git a/tests/test_synrm_3f_36s.py b/tests/test_synrm_3f_36s.py index 2c35e5c..9dfe35a 100644 --- a/tests/test_synrm_3f_36s.py +++ b/tests/test_synrm_3f_36s.py @@ -1,5 +1,6 @@ import re +import numpy as np import pytest from motors.synrm_3f_36s import Computation, Geometry @@ -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", diff --git a/tests/test_synrm_5f_40s.py b/tests/test_synrm_5f_40s.py index dc7f97a..e0d82ba 100644 --- a/tests/test_synrm_5f_40s.py +++ b/tests/test_synrm_5f_40s.py @@ -1,3 +1,4 @@ +import numpy as np import pytest from motors.synrm_3f_36s import Geometry as BaseGeometry @@ -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",