Resources

How to Automate Current Datasets for Each Parametric Case

Written by Batuhan Sirri YILMAZ | Jul 16, 2025 2:14:42 PM

In this blog post, we’ll explore how to automate different current excitation datasets for electric motor simulations using a custom function in Ansys Maxwell.

By default, when current or voltage sources are defined as AC expressions in Maxwell, the solver generates pure sinusoidal waveforms. However, real-world applications—such as evaluating the performance of electric motors or transformers—often require the inclusion of harmonic content in the excitation signals. Typically, this means manually simulating each dataset one by one, which can be time-consuming and error-prone, especially in parametric studies or optimization loops.

To streamline this process, we’ll introduce a simple function that allows you to automate the injection of different current or voltage waveforms into your design. This makes it possible to run batch simulations across datasets for parametric sweeps, optimization studies, or even multi-physics workflows—all with a single click.

Importing datasets into Ansys Maxwell

The first step is to import the current excitation datasets that will be used in your simulation. In this example, we’ll use three sets of current waveforms—one for each phase of a 3-phase PMSM (Permanent Magnet Synchronous Motor).

For reference, you can download the sample dataset file here: Sampledatasets.zip

To insert the datasets into Ansys Maxwell, follow these steps:

  1. Open Ansys Electronics Desktop and navigate to your project.

  2. From the top-left corner, click on Maxwell 2D (or select the relevant design type for your project).

  3. From the dropdown menu that appears below, choose Design Datasets....

 

This will open the dataset editor, where you can add, edit, and manage the waveform data that will drive your simulation. It is worth noting that Ansys Electronics supports .tab files for data reading. You can import your datasets by clicking Import... .

 

Function to call a dataset for a chosen parameter

To use the imported datasets dynamically during simulation, you'll need to create a custom function that pulls the appropriate dataset based on a specified parameter—such as motor speed, torque, or any design variable.

For example, if you want to apply a different current excitation waveform for each motor speed, you can use the following sample function structure:

if(Speed_mech == 1000, pwl_periodic(PhaseA1, time), if(Speed_mech == 2000, pwl_periodic(PhaseA2, time), if(Speed_mech == 3000, pwl_periodic(PhaseA3, time), 0)))

In this function, the parameter named speed_mech dynamically controls the rotational speed of the electric motor, allowing different current waveforms to be applied at each operating point.

To properly call the datasets in Ansys Maxwell, the function must use the pwl_periodic expression, which allows for time-based waveform definition using the imported datasets.

 

Verifying the Automation with a Sweep Analysis

To confirm that the dataset automation is functioning correctly, you can run a parametric sweep analysis.

In this example, the speed parameter is swept from 1000 RPM to 8000 RPM, using a step size of 2000 RPM. This allows the simulation to automatically select the appropriate current excitation dataset for each speed value using the function defined earlier.

The figure above shows one electrical cycle of current for each simulation point. As you can see, when the speed changes, the corresponding dataset is automatically pulled and applied—proving that the function-driven waveform selection is working as intended.

Potential Uses

Electric motors' torque, torque ripple, efficiency, etc., depend on the current waveform applied. Based an electric motor example, the following changes are observed with harmonic current excitation compared to a pure sinusoidal waveform:

1. Core Loss = 28% higher AC core loss in stator and rotor laminations due to additional harmonics in the current waveform.

2. Torque Ripple = Although the average torque remains the same due to equal RMS values, the torque ripple increases by 12.5% compared to the pure sinusoidal waveform.

 

Beyond the results shown above, this automation can also be used to analyze thermal performance differences under various excitations by coupling with Ansys Fluent, and to evaluate Noise, Vibration, and Harshness (NVH) performance differences by coupling with Ansys Mechanical.

For more advanced multi-physics simulations using harmonic current excitation, feel free to reach out to us! We're happy to help.

The reference simulation can be downloaded here: MaxwellPMSMExample.


 

The video can be reached from Ozen Engineering YouTube Channel: How to Automate Current Datasets for Each Parametric Case in Ansys Maxwell

 

Ozen Engineering Expertise

Ozen Engineering Inc. leverages its extensive consulting expertise in CFD, FEA, optics, photonics, and electromagnetic simulations to achieve exceptional results across various engineering projects, addressing complex challenges such as antenna design, signal integrity, electromagnetic interference (EMI), and electric motor analysis using Ansys software.

We offer support, mentoring, and consulting services to enhance the performance and reliability of your electronics systems. Trust our proven track record to accelerate projects, optimize performance, and deliver high-quality, cost-effective results. For more information, please visit https://ozeninc.com.

If you want to learn more about our consulting services, please visit: https://www.ozeninc.com/consulting/

CFD: https://www.ozeninc.com/consulting/cfd-consulting/ 

FEA: https://www.ozeninc.com/consulting/fea-consulting/ 

Optics: https://www.ozeninc.com/consulting/optics-photonics/ 

Photonics: https://www.ozeninc.com/consulting/optics-photonics/ 

Electromagnetic Simulations: https://www.ozeninc.com/consulting/electromagnetic-consulting/ 

Thermal Analysis & Electronics Cooling: https://www.ozeninc.com/consulting/thermal-engineering-electronics-cooling/