Skip to content

Commit

Permalink
Fix JMAG Naming Issue (#345)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
dmnewman3 and noguchi-takahiro authored Jun 21, 2024
1 parent 5eeb1e5 commit 233cd20
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
11 changes: 9 additions & 2 deletions mach_eval/analyzers/electromagnetic/SynR/SynR_em_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"""

Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"""

Expand All @@ -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):
Expand Down
8 changes: 7 additions & 1 deletion mach_eval/analyzers/electromagnetic/bspm/jmag_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 233cd20

Please sign in to comment.