Electric motor design is a complex dance of trade-offs. Engineers strive to create motors that are powerful, efficient, and lightweight, all while adhering to strict thermal and mechanical constraints. Finding the "perfect" design in this vast, multi-dimensional space is a significant challenge. Simulation tools like Ansys Motor-CAD are indispensable, providing high-fidelity multiphysics analysis. However, each simulation is computationally expensive, making a brute-force exploration of the design space impractical.
This article explores a modern, intelligent approach to motor optimization that brings new, AI-driven capabilities to the design process. By leveraging the power of Bayesian Optimization with the Stochos Python library, engineers can find better designs faster and more efficiently than ever before.
The Challenge of Traditional Design Space Exploration
A common approach to design optimization involves creating a simplified "metamodel" of the high-fidelity simulation. We covered this in greater detail in these previous blogs:
Understanding Sensitivity Analysis in optiSLang: A Deep Dive into Sampling Methods
Building a Robust Metamodel for Electric Motor Optimization with OptiSLang & MotorCAD
This process generally includes:
-
Initial Design of Experiments (DoE): The process begins with generating a large number of design points—often hundreds—that are spread out to cover the entire design space. Each of these points is then evaluated using a full Motor-CAD simulation.
-
Metamodel Creation: The data from this large DoE is used to build a surrogate model—an approximation of the complex Motor-CAD simulation—that is much faster to evaluate.
-
Optimization on the Metamodel: An optimization algorithm is then run on this static surrogate model. Because the metamodel is so fast, thousands of potential designs can be evaluated in a short amount of time to find an optimal solution or set of solutions.
While this method is a cornerstone of engineering design, the initial, large-scale DoE can be computationally expensive. It requires a significant upfront investment of time and resources to simulate many designs, some of which may be in regions that are ultimately not relevant to the final, optimal solution.
Introducing Bayesian Optimization with Stochos
The conventional approach of mapping an entire design space upfront is often impractical. Bayesian Optimization offers a more dynamic method, building a model of the design space progressively. This powerful engineering tool intelligently determines the next most promising point to evaluate, creating the map as it explores.
Bayesian Optimization is a sequential, model-based approach to finding the optimum of expensive-to-evaluate functions. Instead of a large, upfront DoE, it follows an intelligent, iterative loop:
-
Build a Probabilistic Model: It starts with just a few initial data points and builds a surrogate model. This is a probabilistic model, meaning it doesn't just predict the motor's performance but also quantifies its own uncertainty about that prediction.
-
Use an Acquisition Function: An "acquisition function" then uses the model's predictions and uncertainty to decide where to sample next. This function balances exploitation (sampling in areas where the model predicts good performance) with exploration (sampling in areas where the model is most uncertain and there's a chance to discover something new and better).
-
Sample and Update: The expensive Motor-CAD simulation is run at the new, intelligently chosen point. The result is then used to update the probabilistic model, reducing its uncertainty and improving its accuracy.
This loop repeats, with each step getting progressively smarter, ensuring that computational effort is focused on the most promising regions of the design space.
Stochos and DIM-GP
The Stochos Python library is a powerful tool designed to bring this advanced AI and machine learning capability to simulation and product development. It provides the framework for implementing Bayesian Optimization, and its key innovation lies in the surrogate model it employs: the Deep Input Mixture of Gaussian Processes (DIM-GP).
At a high level, DIM-GP is a state-of-the-art surrogate model that fuses the power of deep learning with the statistical rigor of Gaussian Processes. This allows it to create highly accurate and robust models of complex physical phenomena, complete with the uncertainty predictions that are essential for driving an efficient Bayesian optimization loop.
PyMotorCAD
PyMotorCAD is part of the PyAnsys ecosystem that facilitates the use of Motor-CAD within a Python environment in conjunction with other PyAnsys libraries and external Python libraries. It allows you to programmatically create, interact with, and control a Motor-CAD model, with or without using the Motor-CAD GUI. You can achieve Motor-CAD automation by running scripts, either internally via the Motor-CAD Scripting tab or externally. It's an integral component of the PyAnsys ecosystem, simplifies the integration of Motor-CAD into a Python environment, enabling its use alongside other PyAnsys and external Python libraries like Stochos.
PyMotorCAD can be operated in any IDE or in a Jupyter Notebook, as seen below:
The Stochos and Motor-CAD Workflow
By combining Stochos with Motor-CAD, we can create a highly efficient optimization workflow:
- Define the Problem in Stochos: The optimization problem (input parameters, output parameters, objectives, and constraints) is defined in a Python script using the Stochos library.
- Create an Evaluator Function: A Python function is created that takes a set of design parameters as input, runs a Motor-CAD simulation, and returns the performance metrics.
- Run the Bayesian Optimization: The Stochos bayesian_opt object is used to run the optimization. Stochos will intelligently call the evaluator function, using the dimgp surrogate model and an acquisition function to guide the search for the optimal design
The Iterative Process
The Bayesian optimization process is iterative:
- Initial Samples: A small number of initial points are sampled from the design space.
- Fit the Surrogate Model: The surrogate model is fit to the initial data.
- Optimize the Acquisition Function: The acquisition function is optimized to find the next best point to sample.
- Evaluate the Objective Function: The objective function (the Motor-CAD simulation) is evaluated at the new point.
- Update the Surrogate Model: The new data point is added to the set of observations, and the surrogate model is updated.
- Repeat: Steps 3-5 are repeated until a stopping criterion is met (e.g., a certain number of iterations or convergence to an optimal solution).
The Power of an Adaptive Approach
This new, AI-driven capability offers significant benefits for motor design:
-
Exceptional Efficiency: By intelligently exploring the design space, this method can find optimal solutions with significantly fewer simulations, saving valuable time and computational resources.
-
Focused Exploration: The adaptive nature of the search ensures that engineering effort is concentrated on the most promising regions of the design space.
-
Faster Innovation: By accelerating the design cycle, engineers can explore more innovative concepts and bring better products to market faster.
Conclusion: A New Era of Motor Optimization
The integration of Bayesian optimization with powerful simulation tools like Motor-CAD represents a significant step forward in the field of electric motor design. By moving away from brute-force methods and embracing intelligent, adaptive search strategies, engineers can accelerate the design cycle, reduce costs, and ultimately, create better products.
As the demand for high-performance electric motors continues to grow, the adoption of these advanced optimization techniques will be crucial for staying ahead of the curve. The combination of Motor-CAD's detailed multiphysics analysis and the intelligent search capabilities of Stochos provides a powerful toolkit for tackling the complex challenges of modern motor design.
Keep an eye out for our future blog entry where we will give a step-by-step example on using Stochos to optimize a MotorCAD design, and directly compare this with the previous optislang based optimization.
Jun 26, 2025 12:22:25 PM