From 3e1a3dba28b1eef30bcef1d157ff66073b57f51d Mon Sep 17 00:00:00 2001 From: haitao-ZCU Date: Thu, 3 Sep 2026 16:39:28 +0200 Subject: [PATCH 1/2] Convert extract_results values to numpy arrays so unit conversion works --- motors/motor2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/motors/motor2.py b/motors/motor2.py index b6f8041..14613eb 100644 --- a/motors/motor2.py +++ b/motors/motor2.py @@ -1,3 +1,4 @@ +import numpy as np from ansys.aedt.core import Maxwell2d from machine_design.designs.computation import ComputationBase @@ -339,7 +340,7 @@ def set_variables(self, m2d: Maxwell2d, Id1, Iq1, Id3, Iq3): def extract_results(self, solutions): out = {} for expr in self.solution_expressions: - val = solutions.data_real(expr) + val = np.array(solutions.data_real(expr)) if expr.startswith("Ld") or expr.startswith("Lq"): val /= 1e9 From 343ada37aabb070b5d6b574531228d2e94a45c88 Mon Sep 17 00:00:00 2001 From: haitao-ZCU Date: Fri, 4 Sep 2026 08:32:49 +0200 Subject: [PATCH 2/2] Only convert to numpy array for the Ld/Lq/I_ unit conversion branches --- motors/motor2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/motors/motor2.py b/motors/motor2.py index 14613eb..ff5fb95 100644 --- a/motors/motor2.py +++ b/motors/motor2.py @@ -340,12 +340,12 @@ def set_variables(self, m2d: Maxwell2d, Id1, Iq1, Id3, Iq3): def extract_results(self, solutions): out = {} for expr in self.solution_expressions: - val = np.array(solutions.data_real(expr)) + val = solutions.data_real(expr) if expr.startswith("Ld") or expr.startswith("Lq"): - val /= 1e9 + val = np.array(val) / 1e9 elif expr.startswith("I_"): - val /= 1e3 + val = np.array(val) / 1e3 # TODO: possibly assign val[:-1]. check whether values are identical out[expr] = val