Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
1
Custom geometry scripting in Motor-CAD EMag
Contents
1. Files ..................................................................................................................... 2
2. Introduction .......................................................................................................... 2
3. Initial script generation ......................................................................................... 3
4. Adding custom parameterisation ......................................................................... 5
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
2
1. Files
The files that accompany this tutorial are:
- Example_bar_wound_ferrite.mot
- Geometry_generation_script.m
These files can be downloaded from the Motor-CAD client area: http://www.motor-design-
clients.com/motorcad/Motor-CAD_tutorials/Custom_Geometry_Scripting_Tutorial.zip
2. Introduction
Motor-CAD Emag simplifies the electromagnetic design of electric motors with its fast FEA
solver and parameterised geometry editor. However, for the design of motors with geometries
that cannot be modelled using the pre-existing templates, Motor-CAD provides functionality for
both dxf import and custom geometry scripting. Using the scripting functionality engineers can
generate their own geometric parameterisation, create custom regions and automate
calculations. The functionality used in this tutorial is available with Motor-CAD v9.3.5.
In this tutorial a multi-layer IPM with curved magnets and bar windings is modelled. This design
concept is based upon the ferrite magnet motor/generator in the 2016 GM Chevy Volt which
was presented at the ECCE conference in Montreal, September 2015:
http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=7310394
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
3
3. Initial script generation
Motor-CAD allows you to initially generate a script based upon the parameterised geometry.
This is done in the file menu->geometry export:
A new window will be opened, select the Matlab FEA script and export the file.
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
4
A Matlab script will be generated that draws the geometry in the FEA solver in Motor-CAD and
runs an electromagnetic calculation:
Changes can now be made to this script to modify the geometry.
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
5
4. Adding custom parameterisation
In this example the stator geometry is accurately described by the existing Motor-CAD
parameterisation and as such the stator is unchanged from the initial script. The rotor air and
magnet region drawings are deleted:
And the magnet and air material regions are also deleted:
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
6
This is replaced by a section of code that draws a set of curved magnet regions based upon
some initial parameters:
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
7
Open Motor-CAD and load the bar_wound_ferrite.mot file:
Ensure that the Motor-CAD activeX server has been registered:
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
8
Then run the script, the magnet geometry is drawn and the FEA calculation started:
By changing the parameters in the script and re-running, geometric variations can be analysed:
Custom geometry scripting Tutorial
Date: December 2015
Motor Design Ltd. www.motor-design.com
9
Use the FEA editor to visualise the drawing of the geometry and materials:
Calculated torque output: