From 362a4fa73369eae3c5fb4215ceda60ba08abc354 Mon Sep 17 00:00:00 2001 From: haitao-ZCU Date: Mon, 21 Sep 2026 10:24:05 +0200 Subject: [PATCH 1/5] parameterize crruents for 3f --- motors/synrm_3f_36s.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/motors/synrm_3f_36s.py b/motors/synrm_3f_36s.py index c8f4b65..dd3a840 100644 --- a/motors/synrm_3f_36s.py +++ b/motors/synrm_3f_36s.py @@ -175,8 +175,10 @@ def set_oper_params(self): 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 + "Id": "0.0A", + "Iq": "0.0A", + "epsI": "atan2(Iq,Id)", # current angle + "Im": "sqrt(Id^2+Iq^2)", "InitPos": "-30deg", "w": f"{w}Hz", "RotSpeed": f"{RotSpeed}rpm", @@ -263,8 +265,9 @@ def assign_stator_coils(self, m2d: Maxwell2d) -> None: def inductance_computation(self, m2d: Maxwell2d) -> None: m2d.change_inductance_computation(compute_transient_inductance=True, incremental_matrix=False) - def set_variables(self, m2d: Maxwell2d, *args): - pass + def set_variables(self, m2d: Maxwell2d, Id, Iq): + m2d.variable_manager["Id"] = f"{Id}A" + m2d.variable_manager["Iq"] = f"{Iq}A" def extract_results(self, solutions): return solutions.data_magnitude() From 68afc9558f50eb43881f3488e22c8e8dc4957e0d Mon Sep 17 00:00:00 2001 From: haitao-ZCU Date: Mon, 21 Sep 2026 10:34:00 +0200 Subject: [PATCH 2/5] use current_setpoint() to put the values of currents like 5f machine --- scripts/3f_torque_optimization/run.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/3f_torque_optimization/run.py b/scripts/3f_torque_optimization/run.py index cc58a40..4bf61d6 100644 --- a/scripts/3f_torque_optimization/run.py +++ b/scripts/3f_torque_optimization/run.py @@ -23,6 +23,7 @@ n_designs = 50 r_stator_end = 0.7 offset = 0.7 / 2 +current_setpoint = (1.5, 1.5) plot_design = True project_name = "SynRM_test" @@ -61,7 +62,7 @@ design.add_rotor_barrier(barrier) # Compute the torque - Tor = design.compute(NUM_CORES=num_cores) + Tor = design.compute(*current_setpoint, NUM_CORES=num_cores) # Tor = design.compute(num_cores) if Tor is None: TorAvg, TorRippleRms = np.nan, np.nan From e77c55d865b9f28d9de14c416991b215362a94c1 Mon Sep 17 00:00:00 2001 From: haitao-ZCU Date: Mon, 21 Sep 2026 10:38:14 +0200 Subject: [PATCH 3/5] use current_setpoint() like 5f machine --- tests/test_ansys_regression.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_ansys_regression.py b/tests/test_ansys_regression.py index 8c7b89e..e910202 100644 --- a/tests/test_ansys_regression.py +++ b/tests/test_ansys_regression.py @@ -29,6 +29,7 @@ OFFSET = 0.35 SEEDS = (42, 43) NUM_CORES = 1 +current_setpoint = (1.5, 1.5) def _load_legacy_design_class(): @@ -75,9 +76,9 @@ def _create_design(design_cls, project_name, file_name, extra_args=()): ) -def _compute_torque(design, barriers, add_rotor): +def _compute_torque(design, barriers, add_rotor, setpoint=current_setpoint): add_rotor(design, barriers) - torque = design.compute(NUM_CORES=NUM_CORES) + torque = design.compute(*setpoint, NUM_CORES=NUM_CORES) design.delete_rotor() return torque From 1d0915ff8f54d016c593adcac32e6ed81132d70b Mon Sep 17 00:00:00 2001 From: haitao-ZCU Date: Mon, 21 Sep 2026 10:42:22 +0200 Subject: [PATCH 4/5] parameterize currents --- tests/test_synrm_3f_36s.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_synrm_3f_36s.py b/tests/test_synrm_3f_36s.py index 490a020..d437288 100644 --- a/tests/test_synrm_3f_36s.py +++ b/tests/test_synrm_3f_36s.py @@ -73,8 +73,10 @@ def test_mod_params(geometry): def test_oper_params(computation): assert computation.oper_params == { - "Im": "1.5*sqrt(2)A", - "epsI": "pi/4", + "Id": "0.0A", + "Iq": "0.0A", + "epsI": "atan2(Iq,Id)", + "Im": "sqrt(Id^2+Iq^2)A", "InitPos": "-30deg", "w": f"{2 * np.pi * 50}Hz", "RotSpeed": "1500.0rpm", From 7f5b9f0dc4ee22901b0caf38952cadbab6b27da1 Mon Sep 17 00:00:00 2001 From: haitao-ZCU Date: Mon, 21 Sep 2026 10:44:10 +0200 Subject: [PATCH 5/5] delete A in Im --- tests/test_synrm_3f_36s.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_synrm_3f_36s.py b/tests/test_synrm_3f_36s.py index d437288..a05fa99 100644 --- a/tests/test_synrm_3f_36s.py +++ b/tests/test_synrm_3f_36s.py @@ -76,7 +76,7 @@ def test_oper_params(computation): "Id": "0.0A", "Iq": "0.0A", "epsI": "atan2(Iq,Id)", - "Im": "sqrt(Id^2+Iq^2)A", + "Im": "sqrt(Id^2+Iq^2)", "InitPos": "-30deg", "w": f"{2 * np.pi * 50}Hz", "RotSpeed": "1500.0rpm",