Power Electronics Group LLC

Finite Element Motor Design and Automation Using FEMM and MATLAB: A Practical Methodology for Motor Engineers

Rakesh Dhawan


Abstract
The Finite Element Method Magnetics (FEMM) has emerged as a vital open-source tool for electromagnetic simulation, offering a cost-effective and reliable platform for electric motor analysis. This article presents a comprehensive overview of using FEMM for motor modeling and design validation, followed by its integration with MATLAB for automated simulation and data analysis. The methodology is demonstrated by designing an outer rotor permanent magnet motor (PMM), targeting 90 Nm of torque. Key steps such as geometry import, material assignment, winding configuration, meshing, solution processing, and torque-flux analysis are detailed. Furthermore, the automation process using MATLAB scripts allows efficient extraction of torque vs. current and torque vs. angle characteristics, which are critical for motor optimization. The framework presented offers researchers and engineers a validated, scalable workflow for accelerating motor development cycles.


1. Introduction
The demand for high-performance, energy-efficient electric motors continues to grow, especially in electric vehicles, industrial automation, and robotics sectors. Accurate electromagnetic simulation tools are indispensable for motor design and analysis, particularly during early-stage development and optimization. While commercial finite element (FE) tools are widely adopted in the industry, their high cost and licensing restrictions limit access for startups, academia, and prototyping efforts.

Finite Element Method Magnetics (FEMM) offers a compelling alternative: a free, open-source 2D solver for low-frequency electromagnetic problems. FEMM’s functionality is well-suited for modeling rotating machines, transformers, actuators, and other magnetic systems. Its effectiveness is significantly enhanced with MATLAB to automate multi-point simulation, parameter sweeps, and post-processing. FEMM and MATLAB create a lightweight yet powerful environment for electromagnetic design and analysis.

This article documents a structured approach for using FEMM and MATLAB to design and evaluate a high-torque outer rotor motor. It presents a replicable workflow that includes defining the geometry and materials, solving for magnetic fields, and calculating torque and losses, followed by MATLAB scripting for automated simulation and data extraction.


2. FEMM Fundamentals

FEMM is a finite element analysis tool for 2D planar and axisymmetric problems. It supports:

  • Magnetostatic Analysis: Simulates steady-state magnetic fields.
  • Time-Harmonic Magnetic Analysis: For AC magnetic field simulations.
  • Electrostatic Analysis: Simulates electric field distributions.
  • Heat Flow Analysis: Useful for estimating static thermal performance.

The tool consists of three components:

  1. Preprocessor defines the problem geometry, material properties, and boundary conditions.
  2. Solver executes the finite element computation.
  3. Postprocessor visualizes results and extracts data (e.g., field plots, force, torque).

3. Methods

3.1 Motor Model Setup in FEMM
The motor under analysis is an outer rotor Permanent Magnet Synchronous Motor (PMSM) featuring:

  • 28 poles and 24 stator slots
  • Radially magnetized surface-mounted magnets
  • Outer diameter: 262 mm; Inner diameter: 180 mm
  • Magnet thickness: 9 mm; Back iron depth: 31.2 mm
  • Target torque: 90 Nm

Step-by-step process in FEMM:

  • Geometry Import: Geometry is either drawn in FEMM or imported from CAD software. Corrections are made for lost arcs or node alignment.
  • Material Selection: FEMM offers an extensive material library. Common selections include:
    • Permanent magnets (e.g., NdFeB)
    • Air regions
    • Stator laminations (e.g., M-19 steel)
    • Back iron (e.g., 1020 steel)
    • Copper windings
  • Winding Definition: Windings are grouped into circuits (Coil A, B, C), with turn counts (e.g., 195–200 turns) and wire gauge (e.g., 26 AWG) defined for each coil.
  • Boundary Conditions: A bounding region is defined to enclose the motor model. All fields are contained within this boundary.
  • Meshing and Solution: The mesh density is adjusted for accuracy. The mesh is validated to check for undefined regions (gray triangles). The magnetic solver is then executed.

3.2 MATLAB Automation for Parametric Simulation
Manual parameter variation is time-consuming. MATLAB scripts are used to:

  • Define electrical parameters (phase current, speed, frequency)
  • Issue FEMM commands (open model, modify circuits, rotate geometry)
  • Automate mesh solving, data extraction, and plotting

Key MATLAB Functions Used:

  • mi_modifycircprop
  • mi_analyze, mi_loadsolution
  • mo_blockintegral, mo_groupselectblock
  • openfemm, newdocument, mi_selectcircle

Workflow:

  1. The user specifies the current speed and angle sweep ranges.
  2. FEMM models are iteratively solved at each input condition.
  3. Results (torque, flux linkage, losses) are saved in .txt files.
  4. Torque vs. current and torque vs. angle plots are generated.

4. Results

4.1 Magnetic Flux Density and Saturation
Simulation showed a peak flux density of 1.65 T under nominal operating conditions (5 A phase current). The motor design exhibited no magnetic saturation, confirming appropriate back iron and magnet dimensions.

4.2 Torque vs. Current Performance
At 5 A, the motor achieved approximately 90 Nm torque. Additional simulations at 8 A showed 140 Nm torque, indicating scalability. Multiple design variants (e.g., 12-slot, 22-slot) were simulated for comparative performance.

4.3 Resistive Losses
Using FEMM’s built-in analysis, copper losses were estimated at 27.4 W under nominal load. These losses increased predictably with current.

4.4 Automation Output
Automated MATLAB runs provided:

  • Torque vs. phase current plots
  • Torque vs. electrical angle
  • Power output and efficiency estimates
  • Flux linkage waveforms

5. Discussion

The FEMM-MATLAB framework offers a significant advantage in motor design validation for low-cost development environments. Although FEMM is limited to 2D planar analysis, it provides sufficient fidelity for preliminary and mid-level motor evaluations. Integration with MATLAB expands its utility into batch simulation, data handling, and visualization.

The scripted automation enables:

  • Fast sensitivity analysis (e.g., varying current, rotor position)
  • Objective comparison between design variants
  • Exportable and reproducible simulation data

For engineers seeking higher accuracy, results can be later benchmarked against 3D solvers or experimental test benches.

Limitations:

  • FEMM does not support 3D analysis or mechanical/thermal coupling beyond static heat flow
  • Requires scripting knowledge for automation
  • Lacks native GUI for parametric sweeps

Despite these limitations, FEMM remains a valuable educational and prototyping tool, particularly when combined with MATLAB.


6. Practical Tips and Lessons Learned

  • Mesh Quality: Avoid undefined triangles; always inspect the mesh before solving.
  • Material Selection: Validate magnetic properties against datasheets to ensure realistic results.
  • Parameter Grouping: Use FEMM groups to categorize windings, stator, rotor, and losses for clear post-processing.
  • MATLAB Path Setup: Ensure FEMM folders are added to the MATLAB path before running macros.
  • Validation Strategy: Start with a simple configuration, compare results with analytical expectations, and then scale.

7. Conclusion

This paper demonstrated a complete workflow for electromagnetic simulation of a surface-mounted PM motor using FEMM, augmented by MATLAB for automated evaluation. The results highlight FEMM’s effectiveness in modeling torque, flux, and losses and MATLAB’s capacity to automate and extend its functionality. Engineers and students can benefit from adopting this lightweight toolchain in early-stage motor development, enabling faster iteration, deeper insights, and a smoother path to final design validation.

Future work may expand the toolchain to include thermal modeling, 3D simulation benchmarking, and control-loop co-simulation with Simulink or Altair Embed.


YouTube Video

Leave a Reply

Your email address will not be published. Required fields are marked *