Import Axial Flux Motor (AFM) from MotorXP
This example shows how to import an axial flux machine (AFM) from MotorXP into a Simscape™ model.
An AFM, or pancake motor, features a compact design where the magnetic flux flows along the axis of rotation. This geometry provides a compact form factor and enhances the torque density due to a large magnetic surface area for a given volume. This feature makes AFMs highly efficient for applications where space and performance are critical.
Load FEM Data from MotorXP
To export the flux linkage, torque, and loss characteristics from a MotorXP finite element method (FEM) model and use them as parameters for the FEM-Parameterized PMSM block, generate a .mat file by running the MATLAB® script that the MotorXP software includes in the folder /CustomScripts/Build_simscape_fem_pmsm_multipleCPU.m.
To download the latest version of the MATLAB script, see Parameterizing Simscape PMSM Blocks with MotorXP on the MotorXP website.
In this example, the data corresponds to a motor model that the MotorXP software includes in the folder /SimFiles/EMRAX-228/EMRAX-228.mxa.
This figure shows the motor model inside the MotorXP Geometry Editor.

edit AFMFromMotorXPLoadData.m;Visualize FEM Data
Plot the flux linkage and torque FEM data as a function of peak current, current advance angle, and rotor position. These lookup tables define the Simscape model behavior.
AFMFromMotorXPVisualizeData
![Figure AFM Flux And Torque Data From MotorXP contains 2 axes objects and other objects of type uilabel, uislider. Axes object 1 with title A-Phase Flux Linkage, xlabel Current Magnitude [A], ylabel Mechanical Rotor Position [deg] contains an object of type surface. Axes object 2 with title Electromagnetic Torque, xlabel Current Magnitude [A], ylabel Mechanical Rotor Position [deg] contains an object of type surface.](../../examples/simscapeelectrical/win64/AFMFromMotorXPExample_02.png)
Open Model
Open the AFMFromMotorXP model. The dynamometer rotates the machine at a constant speed and the motor terminals connect to a resistive wye load. In this model, the machine operates as a generator.
close(AFMFluxVisualizerApp.UIFigure)
open_system("AFMFromMotorXP");View Simulation Results from Simscape Logging
Run a simulation and plot the AFM voltage, current, and torque.
AFMFromMotorXPPlotResults
![Figure AFMFromMotorXP contains 3 axes objects. Axes object 1 with title Phase Voltages, ylabel [V] contains 3 objects of type line. These objects represent v_A, v_B, v_C. Axes object 2 with title Phase Currents, ylabel [A] contains 3 objects of type line. These objects represent i_A, i_B, i_C. Axes object 3 with title Electrical Torque, xlabel Time (s), ylabel [N*m] contains an object of type line.](../../examples/simscapeelectrical/win64/AFMFromMotorXPExample_03.png)
This model captures the nonlinear back electromotive force (EMF) profile and torque ripple that a simplified PMSM model with a fixed back EFM constant does not capture.