Import a Motor-CAD Thermal Model in Simulink and Simscape
This example shows how to import an Ansys Motor-CAD motor model in Simulink®. This example also contains a previously generated Simulink reduced-order thermal model (SROTM) of an interior permanent magnet synchronous motor (IPMSM) with housing water jacket and self-ventilated cooling. You can download this model in MATLAB® or access it from MATLAB Central File Exchange and GitHub®.
In this example, you learn how to:
Import a Motor-CAD model in MATLAB.
Generate an SROTM.
Validate the SROTM.
Use the SROTM in Simscape™ models.
You can use the automatically-generated Simulink model to:
Predict the transient temperature of the elements of a motor under dynamic operating points and cooling scenarios.
Run simulations faster than real time.
Integrate the motor in a system-level model using Simscape™.
Analyze the performance of your system design in a holistic way.
For more information, follow these steps to explore the overview that opens in your web browser or see Import a Motor-CAD Thermal Model into Simulink and Simscape (MATLAB Central File Exchange).
Clone the up-to-date repository in the current folder using the
Alternatively, you can download the latest files using these options.
Download ZIP files of this project from Import a Motor-CAD Thermal Model into Simulink and Simscape (MATLAB Central File Exchange).
Clone the Git™ repository from Import a Motor-CAD Thermal Model into Simulink and Simscape (GitHub).
After you use the
gitclone function, MATLAB creates a new folder in the current folder. This example uses projects to manage the supporting files. Open the
ImportMotorCADThermalModel project file. If you have any projects open, MATLAB closes them before loading this project. Configuring the project environment takes several minutes because the model has hundreds of supporting files. The project opens an overview that shows the previously-generated Simulink ROM thermal model of an IPMSM and how to use it inside a Simscape model
Import Motor-CAD Model and Generate SROTM
To import a Motor-CAD model in MATLAB, modify the motor properties, and run Motor-CAD calculations, use the MATLAB - Motor-CAD interface inside the project. For more information about this objected-oriented interface, at the MATLAB Command Window, run:
The package comprises a
BasicInterface.m class file and a
ThermalInterface.m class file. The
BasicInterface implements basic Motor-CAD commands available in the ActiveX Command list. The
ThermalInterface extends the
BasicInterface with additional commands that are useful to automate common workflows in the Thermal context of Motor-CAD.
GenerateSimulinkThermalModel.mlx file allows you to automatically import Motor-CAD files and generate an SROTM. To use this file, you must have Motor-CAD v15 (or higher) installed, with ActiveX scripting enabled.
You can customize, extend, and improve both the interface and the MLX file to help you automate your Motor-CAD workflows.
If you do not modify the
GenerateSimulinkThermalModel.mlx file, the software imports an IPMSM with housing water jacket and self-ventilated cooling, based on the
e8_eMobility_IPM Motor-CAD template, and a water-cooled induction motor, based on the
e5_IM_HWJ Motor-CAD template.
To compare the simulation results of an SROTM with the corresponding Motor-CAD transient calculations, run the
ValidateSimulinkThermalModel.mlx file. You can customize this file to validate your own SROTM. To use this file, you must have Motor-CAD v15 (or higher) installed, with ActiveX scripting enabled.
If you do not modify the
ValidateSimulinkThermalModel.mlx file, the software validates the SROTMs of the induction motor and IPMSM. This plot compares the Simulink ROM model transient results of the IPMSM against the Motor-CAD transient results with the last breakpoint values as inputs.
Use SROTM in Simscape Models
UseSimulinkThermalModel.mlx file shows an example on how to integrate the SROTM of the motor inside a Simscape model.
This figure shows the Simscape system-level model of an electric vehicle powertrain and the motor cooling systems. The model comprises the e8_IPMSM_HWJandVent_ROM subsystem, a Vehicle Dynamics subsystem, a Driver subsystem, a thermal liquid circuit with a pump, radiator, and a gas circuit with a fan.
The e8_IPMSM_HWJandVent_ROM subsystem contains the automatically-generated Simulink ROM subsystem and some interface subsystems. The interface subsystems allow you to use the Simulink ROM model with physical models in Simscape.
To find the latest examples from the MathWorks Simscape Team, see MathWorks Simscape Team on MATLAB Central.