diff --git a/motors/motor2.py b/motors/motor2.py index 0162493..40c5bd6 100644 --- a/motors/motor2.py +++ b/motors/motor2.py @@ -1,4 +1,3 @@ -import numpy as np from ansys.aedt.core import Maxwell2d from machine_design.designs.computation import ComputationBase @@ -333,14 +332,15 @@ def set_variables(self, m2d: Maxwell2d, Id1, Iq1, Id3, Iq3): m2d.variable_manager["Iq3"] = f"{Iq3}A" def extract_results(self, solutions): - # TODO: this works only because torque is the last one in the array - out = np.zeros(len(self.solution_expressions)) - for i, expr in enumerate(self.solution_expressions): - data = solutions.data_real(expr) - val = float(np.mean(data[:-1])) + out = {} + for expr in self.solution_expressions: + val = solutions.data_real(expr) - if expr.startswith("L_"): + if expr.startswith("Ld") or expr.startswith("Lq"): val /= 1e9 + elif expr.startswith("I_"): + val /= 1e3 - out[i] = val + # TODO: possibly assign val[:-1]. check whether values are identical + out[expr] = val return out