Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions motors/synrm_3f_36s.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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()
3 changes: 2 additions & 1 deletion scripts/3f_torque_optimization/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tests/test_ansys_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
OFFSET = 0.35
SEEDS = (42, 43)
NUM_CORES = 1
current_setpoint = (1.5, 1.5)


def _load_legacy_design_class():
Expand Down Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions tests/test_synrm_3f_36s.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
"InitPos": "-30deg",
"w": f"{2 * np.pi * 50}Hz",
"RotSpeed": "1500.0rpm",
Expand Down
Loading