diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d3a769..c907513 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ Ansys computes only what needs the field solution. Everything downstream of it i | in Ansys (needs the solve) | in Python (algebra on solved quantities) | |---|---| -| torque waveform, flux linkage, `InducedVoltage`, forces, core loss | Park/Clarke dq1/dq3 (`machine_design/transforms.py`), `Rs*I`, `Lew*dI/dt`, peak search over a waveform, terminal voltage at any speed | +| torque waveform, flux linkage, `InducedVoltage`, forces, core loss | Park/Clarke dq1/dq3 (`machine_design/generic/transforms.py`), `Rs*I`, `Lew*dI/dt`, peak search over a waveform, terminal voltage at any speed | Why: diff --git a/machine_design/generic/__init__.py b/machine_design/generic/__init__.py new file mode 100644 index 0000000..bd6633f --- /dev/null +++ b/machine_design/generic/__init__.py @@ -0,0 +1 @@ +from .transforms import electrical_angle, to_dq, to_phases diff --git a/machine_design/transforms.py b/machine_design/generic/transforms.py similarity index 100% rename from machine_design/transforms.py rename to machine_design/generic/transforms.py diff --git a/motors/synrm_5f_40s.py b/motors/synrm_5f_40s.py index 5d1f0c6..de271c9 100644 --- a/motors/synrm_5f_40s.py +++ b/motors/synrm_5f_40s.py @@ -8,7 +8,7 @@ from ansys.aedt.core import Maxwell2d from machine_design.designs.computation import ComputationBase -from machine_design.transforms import electrical_angle, to_dq +from machine_design.generic.transforms import electrical_angle, to_dq from .synrm_3f_36s import Geometry as BaseGeometry diff --git a/pyproject.toml b/pyproject.toml index 9590725..6e7ff08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ dev = [ packages = [ "machine_design", "machine_design.designs", + "machine_design.generic", "machine_design.optimization", "motors", ] diff --git a/tests/test_ansys_transforms.py b/tests/test_ansys_transforms.py index 9328355..b929707 100644 --- a/tests/test_ansys_transforms.py +++ b/tests/test_ansys_transforms.py @@ -1,9 +1,9 @@ """Live check that the Python dq transform agrees with the Ansys output variables. -`machine_design/transforms.py` and `motors/synrm_5f_40s.py`'s `set_output_vars` implement the -same five-phase Park/Clarke transform twice -- once in Python, once as Ansys expressions. -This solves one rotor with both dq1 and dq3 excited, then asserts that transforming the -per-phase quantities in Python reproduces Ansys's own dq outputs. +`machine_design/generic/transforms.py` and `motors/synrm_5f_40s.py`'s `set_output_vars` +implement the same five-phase Park/Clarke transform twice -- once in Python, once as +Ansys expressions.This solves one rotor with both dq1 and dq3 excited, then asserts that +transforming the per-phase quantities in Python reproduces Ansys's own dq outputs. Two subjects, deliberately: @@ -25,8 +25,8 @@ from machine_design.config import load_config from machine_design.designs.design import Design +from machine_design.generic.transforms import to_dq from machine_design.optimization.generators import HacklGenerator_OneLambda -from machine_design.transforms import to_dq from motors.synrm_5f_40s import Computation, Geometry pytestmark = pytest.mark.ansys diff --git a/tests/test_synrm_5f_40s.py b/tests/test_synrm_5f_40s.py index 75fa0b9..bd5a5dc 100644 --- a/tests/test_synrm_5f_40s.py +++ b/tests/test_synrm_5f_40s.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from machine_design.transforms import electrical_angle, to_dq +from machine_design.generic.transforms import electrical_angle, to_dq from motors.synrm_3f_36s import Geometry as BaseGeometry from motors.synrm_5f_40s import Computation, Geometry diff --git a/tests/test_transforms.py b/tests/test_transforms.py index 6fc8fd8..b35a01f 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -1,4 +1,4 @@ -"""Pins the m-phase dq convention used by `machine_design.transforms`. +"""Pins the m-phase dq convention used by `machine_design.generic.transforms`. These need no Ansys. They exist because the same transform is written out by hand in `motors/synrm_5f_40s.py`'s output variables, and a silent disagreement between the two @@ -12,7 +12,7 @@ import numpy as np import pytest -from machine_design.transforms import electrical_angle, to_dq, to_phases +from machine_design.generic.transforms import electrical_angle, to_dq, to_phases THETA = np.linspace(0.0, 2.0 * np.pi, 37)