1. Example of an automatic motor design workflow
Figure 1. Example of an automatic motor design workflow.
Traditional electric motor automatic optimization typically requires users to define the exact ranges for each design variable, necessitating some preliminary studies on the motor’s geometry to determine sufficient bounds for the design variables. Too narrow bounds increase the risk of suboptimal solutions, while overly wide bounds lead to extensive searches and potentially overlook optimal designs due to the vast search space. Too wide optimization variable bounds will also lead to a large percentage of designs with inconsistent geometry dimensions. To address these challenges, basic motor sizing rules are employed, and ratiobased design variables not directly tied to specific motor geometry dimensions are introduced. This approach effectively narrows the search space while minimizing the risk of overlooking optimal design candidates.
This article introduces a MATLAB code example, utilizing the dedicated MotorXPMATLAB API, to automate the design process for motors and generators with surfacemounted permanent magnets. By integrating basic motor sizing rules with advanced optimization algorithm, the code optimizes motor design by minimizing the motor weight and maximizing efficiency under userdefined operating conditions. The code offers versatility, allowing users to automate specific motor or generator designs, explore various design spaces, or develop customized routines for automation of the design workflows.
Key motor sizing rules implemented in the MATLAB code include:
 Magnet Volume Calculation
 Tooth Width and Slot Pitch Ratio
 Relationship between Stator Back Iron Depth and Tooth Width
 Relationship between Rotor Back Iron Depth and Stator Back Iron Depth
 Magnet Arc Angle
2. From motor sizing rules to ratiobased design variables
This section provides a detailed description of the motor sizing rules implemented in this example, along with corresponding design variables listed in Table 1 below.
Table 1. Default motor sizing design variables
Design Variable 
Symbol 
Default Range 

Lower bound 
Upper bound 

Magnet volume coefficient  Cν  0.2  4 
Tooth width angle to slot pitch angle ratio at the air gap  ratio_toothWidth  0.2  0.8 
Stator back iron depth coefficient  coef_statorBackIronDepth  0.3  1 
Rotor back iron depth to stator back iron depth ratio  ratio_rotorBackIronDepth  0.8  1.2 
Magnet Angle  magnetAngle  110 el.degrees  180 el.degrees 
1. Magnet Volume Calculation:
The volume of the magnet material required to build the motor is determined based on the approach described in [1]:
magnetVolume = Cν ·
targetPower
f_{1} · B_{r} · H_{c}
where:
 targetPower – the output power the motor is optimized for
 f_{1} – operational motor frequency
 B_{r} – residual flux density of the magnet
 H_{c} – coercivity of the magnet
 Cν – magnet volume coefficient (refer to Table 1)
2. Tooth Width and Slot Pitch Ratio:
The relationship between the areas occupied by stator teeth and slots is defined as a ratio between the tooth width angle and slot pitch angle (as show in Figure 1):
ratio_toothWidth =
toothWidthAngle
slotPitchAngle
3. Stator Back Iron Depth:
The relationship between the stator back iron depth and tooth width is determined by the magnetic flux carried by these parts of the motor. For concentrated windings (coil span equals one), the relationship is expressed as:
statorBackIronDepth = coef_statorBackIronDepth · toothWidth
For distributed windings (coil span higher than one) statorBackIronDepth also depends on the number of stator slots (Ns) and number of pole pairs:
statorBackIronDepth = coef_statorBackIronDepth ·
toothWidth · N_{s}
4 · nPolePairs
4. Rotor Back Iron Depth:
Ideally, the rotor back iron depth should equal the stator back iron depth since they carry the same magnetic flux. However, some variation is allowed to consider leakage flux, defined as a ratio between the rotor back iron depth and the stator back iron depth:
rotorBackIronDepth = ratio_rotorBackIronDepth · statorBackIronDepth
5. Magnet Angle:
The magnet angle, representing the angle of the magnet arc in electrical degrees, indicates the portion of the rotor pole occupied by the magnet. Gaps between magnets help reduce magnet flux leakage. Note that a full rotor pole pitch corresponds to 180 electrical degrees (refer to Figure 1).
To complete the proposed motor design workflow setup, the user should also specify the outer and inner diameters of the motor, lamination length, and air gap. These parameters can either be fixed values or defined as design variables within a specific range for inclusion in the optimization process. Additionally, users can specify desired slot opening dimensions and utilize fixed magnet weight for all design candidates.
During the execution of the proposed design workflow, the optimization algorithm generates various combinations of design variables, each corresponding to a different design candidate. An iterative search is then conducted for each design candidate to find the motor geometry satisfying the specific combination of design variables and constraints. In cases where the search leads to erroneous motor geometry with inconsistent dimensions, predefined geometry limits interrupt the search, excluding the corresponding design candidate from the optimization process.
For a more detailed description of the proposed automatic motor design workflow, refer to the MotorXP documentation, and the full source code is available with a free onemonth MotorXP trial.
3. Case study
The proposed automatic motor design workflow is applied to design an electric bike traction motor. The input data and requirements for the motor are as follows:
 Outer diameter: 70 mm
 Motor length: ≤110 mm
 Motor weight (active materials): < 2kg
 Air gap: 0.6 mm
 Maximum speed: 8000 RPM
 Maximum supply frequency @8000 RPM: ≤ 1000 Hz
 Rated DC voltage: 48V
 Iron core material: M19, stacking factor ~0.95
 Magnet material: N42UH
 Slot fill factor: ~0.35
 Winding type: concentrated
 Estimated winding temperature: 80°C
 Estimated magnet temperature: 60°C
The task is to design the motor optimized for operation at 2000 RPM and 7 Nm.
After analyzing the possible slotpole combinations for concentrated winding, considering that the supply frequency should not exceed 1000 Hz for maximum rotor speed of 8000 RPM, only two optimal slot/pole combinations are identified: 12 slots / 10 poles and 12 slots / 14 poles. There is a useful article on selecting slotpole combinations for concentrated windings.
With the motor being either of an inner rotor or outer rotor configuration, four potential motor configurations emerge:
 Outrunner with 12 slots and 10 poles
 Outrunner with 12 slots and 14 poles
 Inrunner with 12 slots and 10 poles
 Inrunner with 12 slots and 14 poles
The task is to assess these four motor configurations and determine the most suitable one for the given application. This results in four design spaces to be explored using the proposed automatic motor design workflow. To set up the MATLAB script, the user defines a range only for two motor parameters: the inner diameter of the motor and the lamination length. These ranges, which are provided in Table 2, are selected to maintain the motor weight around 2 kg for the specified outer diameter of 70 mm.
Table 2. Userdefined design variables
Design Variable 
Default Range 

Lower bound 
Upper bound 

Inner diameter  15  35 
Lamination length  85  110 
Additionally, the initial slot opening parameters are set as follows
 Slot opening depth: 1 mm
 Slot opening width: 2 mm
The Pareto plots generated by the optimization algorithm for each design space are presented in Figure 3, providing a comprehensive comparison of the analyzed motor configurations to facilitate an informed design decision, aiming to minimize motor weight and maximize efficiency.
click on image to enlarge
Figure 3. Results of the exploration of four design spaces and corresponding Pareto plots.
Based on the results, the outrunner motor configuration with 12 slots and 14 poles is selected, and the corresponding initial design candidate is shown in Figure 4. This chosen design candidate will undergo further analysis and optimization.
Figure 4. Geometry of the selected design candidate.
References
[1]. C. C. Mi and L. Luo, “Analytical design of permanent magnet traction drive motors,” 2005 IEEE Vehicle Power and Propulsion Conference, Chicago, IL, 2005, pp. 5 pp., doi: 10.1109/VPPC.2005.1554577.
Related articles
From SimulationDriven to OptimizationDriven Electric Motor Design
Overview of the automatic electric motor optimization using the MotorXP software. Read article>>
Designing an axial flux permanent magnet motor with ferrite magnets to match the efficiency and power density of the Tesla Model 3 motor using the automatic optimization features of the MotorXP software. Read article>>