Multi-Objective Rotor Topology and Motor Size Selection with Geometry Optimization of Synchronous Reluctance Motors (SynRM) Using Hybrid Machine Learning
Technical README
Author: Soham Wankhade
Version: 1.0
Document Type: Setup and Operating Guide
Status: Draft
Welcome to the SynRM Rotor Topology and Geometry Optimization Pipeline.
This tool combines hybrid machine learning (XGBoost and CatBoost) with the NSGA-II evolutionary algorithm to identify optimal rotor topologies and motor sizing for Synchronous Reluctance Motors, based on Altair HyperStudy simulation data.
This guide walks you through setting up and running the software on a new computer, from a clean install to your first optimized design.
IMPORTANT SYSTEM REQUIREMENT
Python Version: Python 3.12 or newer is STRICTLY REQUIRED.
-
Install Python
- Go to python.org/downloads and download Python 3.12 (or newer).
- Run the installer.
- CRITICAL STEP: At the bottom of the first installation screen, you MUST check the box that says "Add Python.exe to PATH" before clicking Install.
-
Install Visual Studio Code (VS Code)
- Go to code.visualstudio.com and download the installer.
- Install it using the default settings.
For the pipeline to work, your files must be organized exactly like this. Your main code lives inside the Motor_optimizer folder, alongside your raw Altair HyperStudy output folders.
Motor_optimizer/ <-- YOUR MAIN PROJECT FOLDER
├── data/ <-- Copy the .data files here WITH MAPPING
├── models/ <-- AI models are saved here automatically
├── results/ <-- Global metrics and scorecards saved here
│ ├── designs/ <-- Final optimized geometry data saved here
│ └── plots/ <-- Visual scatter plots and charts saved here
├── utils/
│ ├── __pycache__/ <-- Auto-generated Python cache (safely ignore)
│ └── data_parser.py <-- Helper script that reads HyperStudy files
├── optimize.py <-- The NSGA-II optimizer script
├── train.py <-- The AI training script
├── requirements.txt <-- Python dependencies list
└── README.md <-- This instruction guide
- Move the Project: Ensure your entire
Motor_optimizerfolder (as shown above) is copied onto your new PC. - Open in VS Code:
- Open Visual Studio Code.
- Click on File > Open Folder... in the top left menu.
- Locate and select the
Motor_optimizerfolder. Click "Select Folder". - If asked to trust the authors, check the box and click "Yes".
We use a Virtual Environment to install the project's dependencies safely without affecting your computer's main Python installation.
- Open the Terminal inside VS Code by clicking Terminal > New Terminal at the top menu.
- Create the virtual environment by typing this command and hitting Enter:
python -m venv venv- Activate the environment:
For Windows:
.\venv\Scripts\activateFor Mac / Linux:
source venv/bin/activateSUCCESS CHECK: You should now see (venv) appear at the very beginning of your terminal command prompt.
(Windows Troubleshooting: If you get a red error saying "running scripts is disabled", type this command: Set-ExecutionPolicy Unrestricted -Scope Process hit Enter, and then try the activate command again.)
- Ensure
(venv)is showing in your terminal. - Run the following command:
pip install -r requirements.txt- Wait for the installation to finish.
The AI needs your Altair HyperStudy data to learn.
- In VS Code, open the
datafolder insideMotor_optimizer. - Go to your raw HyperStudy folders (for example,
ivr_RFB_C3_A0(11t15)), find the.datarunsummary files, and copy them into theMotor_optimizer/datafolder. - THE MAPPING RULE: You must open every single
.datafile in VS Code and ensure the custom mapping instructions are pasted at the very top.
- Each
.datafile can contain several geometries or runs. - The explicit mapping prevents the input variables and response values from getting mixed up.
- It also lets you keep or remove individual failed runs without breaking the rest of the dataset.
- That is why every run gets a separate
# MAPentry.
Each HyperStudy .data file may contain results from multiple SynRM rotor topologies. The mapping header tells the software which geometry the data belongs to and which columns represent the inputs and outputs.
Mapping format
# MAP | <Geometry_ID> | <Input Variables> | <Output Responses>
Example
# MAP | ivr_RFB_C3_A11 | var_1,var_2,var_3,var_4,var_5,var_6,var_7 | r_1,r_2,r_3,r_4
| Field | Meaning |
|---|---|
ivr_RFB_C3_A11 |
Geometry ID exported from Altair FluxMotor |
var_1 ... var_7 |
Input variables such as barrier dimensions, motor dimensions, and control angle |
r_1 ... r_4 |
Output responses such as Torque, Efficiency, Power Factor, and Torque Ripple |
Why is mapping required?
A single.datafile can contain results from multiple rotor geometries. The mapping ensures every input/output set is linked to the correct SynRM topology, so individual geometries can be added or removed without affecting the rest of the dataset.
Flexible Mapping Note
If any geometry within a batch file is unsuitable for training due to failed simulations or bad data, you can simply delete its # MAP line from the top of the file. The software will ignore it. If you rerun that geometry separately later, add the new .data file into the data folder and map that single geometry at the top of the new file. The AI will automatically stitch everything together.
Make sure your terminal still shows (venv) before running these.
Run this command to analyze your data and build the XGBoost and CatBoost models:
python train.pyRun this command to execute the NSGA-II evolutionary algorithm. This will use the trained models to find the Pareto-optimal rotor geometries matching your specific performance targets and tolerances:
python optimize.py --torque 55.0 --efficiency 90.5 --power_factor 0.6 --ripple 20.0 --torque_tol 4.0 --efficiency_tol 5 --power_factor_tol 0.2 --ripple_tol 5 --top_n 8The --top_n 8 parameter specifies the total number of top optimized geometries you want the software to output. You can change it to 5, 10, or any other value.
When train.py analyzes your data, it automatically detects whether the airgap in your training data is FIXED (only one gap was ever tested) or VARIABLE (your data spans a real range of gaps). This is reported during training, for example:
↳ D03: airgap detected as VARIABLE, 0.350-0.900mm radial (from data)
If your geometry's airgap is VARIABLE, you can instruct the optimizer to search only within the gap range your manufacturing process can actually hold, using the --airgap_min and --airgap_max flags (both are DIAMETRIC values in mm, and must be provided together):
python optimize.py --torque 55.0 --efficiency 90.5 --power_factor 0.6 --ripple 20.0 --airgap_min 1.0 --airgap_max 1.8 --top_n 8- The optimizer will only search within your requested range, intersected with whatever range the AI actually observed during training.
- If your requested range is wider than what the data supports, it is automatically clipped, and a message is printed indicating the usable range that was applied.
- If your geometry's airgap was detected as FIXED (not variable), these flags are ignored and a warning is printed.
- If only one of
--airgap_min/--airgap_maxis provided, the optimizer will stop and prompt you to provide both.