From 233cd20f9db441027589c1b7ff0f4fbf5560b0de Mon Sep 17 00:00:00 2001 From: Dante Newman <112111913+dmnewman3@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:44:52 -0500 Subject: [PATCH] Fix JMAG Naming Issue (#345) * add code to specify geometry to avoid naming issues - main mach_cad file - tutorial 5 file * Fix Stator ID in imag_2d * Uncomment codes to rename parts * make changes based on feedback: - remove references to version 21.1 - remove extra stator id naming line * fix SynR and flux linkage analyzer for JMAG23 --------- Co-authored-by: Takahiro Noguchi --- .../electromagnetic/SynR/SynR_em_analyzer.py | 11 +++++++++-- .../electromagnetic/SynR/SynR_inductance_analyzer.py | 10 ++++++++-- mach_eval/analyzers/electromagnetic/bspm/jmag_2d.py | 8 +++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/mach_eval/analyzers/electromagnetic/SynR/SynR_em_analyzer.py b/mach_eval/analyzers/electromagnetic/SynR/SynR_em_analyzer.py index 8774c2a5..d29e7ed1 100644 --- a/mach_eval/analyzers/electromagnetic/SynR/SynR_em_analyzer.py +++ b/mach_eval/analyzers/electromagnetic/SynR/SynR_em_analyzer.py @@ -118,7 +118,7 @@ def analyze(self, problem): model.SetName(self.project_name) model.SetDescription(self.show(self.project_name, toString=True)) - valid_design = self.pre_process(model) + valid_design = self.pre_process(app, model) if not valid_design: raise InvalidDesign @@ -403,7 +403,7 @@ def show(self, name, toString=False): "%s = %s" % item for item in tuple_list ) - def pre_process(self, model): + def pre_process(self, app, model): # pre-process : you can select part by coordinate! """Group""" @@ -427,6 +427,13 @@ def group(name, id_list): group("Coils", partIDRange_Coil) + # """ Set Parts names """ + + app.GetModel(0).SetPartName(id_rotorCore, u"RotorCore") + app.GetModel(0).SetPartName(id_shaft, u"Shaft") + app.GetModel(0).SetPartName(id_statorCore, u"StatorCore") + + """ Add Part to Set for later references """ def add_part_to_set(name, x, y, ID=None): diff --git a/mach_eval/analyzers/electromagnetic/SynR/SynR_inductance_analyzer.py b/mach_eval/analyzers/electromagnetic/SynR/SynR_inductance_analyzer.py index 241c9670..7f25dd3b 100644 --- a/mach_eval/analyzers/electromagnetic/SynR/SynR_inductance_analyzer.py +++ b/mach_eval/analyzers/electromagnetic/SynR/SynR_inductance_analyzer.py @@ -104,7 +104,7 @@ def analyze(self, problem): model.SetName(self.project_name) model.SetDescription(self.show(self.project_name, toString=True)) - valid_design = self.pre_process(model) + valid_design = self.pre_process(app, model) if not valid_design: raise InvalidDesign @@ -385,7 +385,7 @@ def show(self, name, toString=False): "%s = %s" % item for item in tuple_list ) - def pre_process(self, model): + def pre_process(self, app, model): # pre-process : you can select part by coordinate! """Group""" @@ -409,6 +409,12 @@ def group(name, id_list): group("Coils", partIDRange_Coil) + # """ Set Parts names """ + + app.GetModel(0).SetPartName(id_rotorCore, u"RotorCore") + app.GetModel(0).SetPartName(id_shaft, u"Shaft") + app.GetModel(0).SetPartName(id_statorCore, u"StatorCore") + """ Add Part to Set for later references """ def add_part_to_set(name, x, y, ID=None): diff --git a/mach_eval/analyzers/electromagnetic/bspm/jmag_2d.py b/mach_eval/analyzers/electromagnetic/bspm/jmag_2d.py index 490c1545..a9f6eb7b 100644 --- a/mach_eval/analyzers/electromagnetic/bspm/jmag_2d.py +++ b/mach_eval/analyzers/electromagnetic/bspm/jmag_2d.py @@ -305,7 +305,7 @@ def group(name, id_list): id_shaft = part_ID_list[1] partIDRange_Magnet = part_ID_list[2 : int(2 + self.machine_variant.p * 2)] # id_sleeve = part_ID_list[int(2 + self.machine_variant.p * 2)] - id_statorCore = part_ID_list[int(2 + self.machine_variant.p * 2) + 1] + id_statorCore = part_ID_list[int(2 + self.machine_variant.p * 2)] partIDRange_Coil = part_ID_list[ int(1 + self.machine_variant.p * 2) + 2 : int(2 + self.machine_variant.p * 2) @@ -318,6 +318,12 @@ def group(name, id_list): group("Magnet", partIDRange_Magnet) group("Coils", partIDRange_Coil) + # """ Set Parts names """ + + app.GetModel(0).SetPartName(id_backiron, u"NotchedRotor") + app.GetModel(0).SetPartName(id_shaft, u"Shaft") + app.GetModel(0).SetPartName(id_statorCore, u"StatorCore") + """ Add Part to Set for later references """ def add_part_to_set(name, x, y, ID=None):