> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/pe-add-on-simulink/model-and-simulation/add-and-configure-a-circuit-model-to-the-system-definition/machine-section/machine-configuration-files/jmag-rt-rtt-file-generation-recommendations.md).

# JMAG-RT RTT File Generation Recommendations

## Overview <a href="#supported-jmag-rt-versions" id="supported-jmag-rt-versions"></a>

### Supported JMAG-RT Versions <a href="#supported-jmag-rt-versions" id="supported-jmag-rt-versions"></a>

The RTT file can be generated in JMAG-RT 10.5 or newer. No backward compatibility issues have been identified at this time.

### What is an RTT file? <a href="#what-is-an-rtt-file" id="what-is-an-rtt-file"></a>

The RTT file contains electrical parameters that define the motor model. These parameters are calculated from the JMAG CAD design using Finite Element Analysis.

It can contain two sets of parameters:

1. Parameters for the Spatial Harmonics model (3D tables describing Phase Inductance, Phase Total Flux, and Torque)
2. Parameters for the Variable DQ model (2D tables describing Direct Inductance, Quadrature Inductance, and Magnet Flux)

It is important to generate Spatial Harmonic Model data for use with the **PMSM SH Machine**.

### Spatial Harmonics Data Generation <a href="#spatial-harmonics-data-generation" id="spatial-harmonics-data-generation"></a>

The tables generated for the Spatial Harmonics model plot Phase Inductance, Phase Total Flux, and Torque values along the three following axes:

<table><thead><tr><th width="140.22216796875">Axis</th><th>Description</th></tr></thead><tbody><tr><td><strong>Theta</strong></td><td>Mechanical angle of the rotor.</td></tr><tr><td><strong>Beta</strong></td><td>Polar angle of the [Id, Iq] vector in the DQ reference frame, where Id is Direct Axis Current and Iq is Quadrature Axis Current. JMAG uses the power invariant DQ transform convention where the D axis is aligned with Phase A at Theta = 0.</td></tr><tr><td><strong>Iamp</strong></td><td>Amplitude of the [Id, Iq] vector in the DQ reference frame, where Id is Direct Axis Current and Iq is Quadrature Axis Current</td></tr></tbody></table>

The tables are formatted as follows, the information in brackets represents the allowable range of values for the axis.

<table><thead><tr><th width="119.4444580078125">Parameter</th><th width="93">Number of Tables</th><th width="181.5555419921875">Theta Axis Minimum Length</th><th>Beta Axis Minimum Length</th><th>lamp Axis Minimum Length</th></tr></thead><tbody><tr><td><strong>Phase Inductance</strong></td><td>9</td><td>65 samples [0 ... 180/Number of Pole Pairs]</td><td>33 samples or more [0 ... 360]</td><td>32 samples or more [0 ... 3*maximum peak phase current]</td></tr><tr><td><strong>Phase Total Flux</strong></td><td>3</td><td>129 samples [0 ... 360/Number of Pole Pairs]</td><td>33 samples or more [0 ... 360]</td><td>32 samples or more [0 ... 3*maximum peak phase current]</td></tr><tr><td><strong>Torque</strong></td><td>1</td><td>65 samples [0 ... 180/Number of Pole Pairs]</td><td>33 samples or more [0 ... 360]</td><td>32 samples or more [0 ... 3*maximum peak phase current]</td></tr></tbody></table>

{% hint style="info" %}
To obtain accuracy, it is important to have a sufficient number of samples per axis. The recommended axis lengths shown above are minimum values and longer axes can be used.
{% endhint %}

## Guidelines and Common Issues <a href="#guidelines-and-common-issues" id="guidelines-and-common-issues"></a>

### **Axis Boundaries**

It is important to respect the recommended boundaries of the axes because missing table sections may lead to unexpected model behavior. The PMSM SH model in particular can demonstrate noticeable stiffness if the currents exceed the axis limits and the LUT output is being saturated.

### **Axis Length**

The Theta Inductance and Theta Torque axes must be of the same length.

### **Use of Phase Symmetry**

The model does not support the use of any symmetry options for the generation of data (for example, generating one third of the data since phase A is symmetrical in regards to B with a 120deg electrical difference). This is valid for inductance/flux and torque (slot symmetry for torque).

### **Configuration of FEM Coil**

The **Connection Pattern** parameter for the coil must be set to Y-Connection.

### **Max Peak Current**

It is recommended that the maximum peak current be no more than four times higher than the machine peak current.

### Data Interpolation Performed Before Simulation <a href="#data-interpolation-performed-before-simulation" id="data-interpolation-performed-before-simulation"></a>

Before they are transferred to the machine model on the FPGA, the data tables are reshaped using a trilinear interpolation method. The resulting tables are made up of equally spaced samples and are resized according to the parameters described below. The size of each table is dependent on the version of the PMSM SH model, as well as the number of enabled machines in the simulation. Because the data in the resized tables is equally spaced, the resolution across each axis can be calculated by dividing the maximum possible value along the axis by the number of samples used.

Please refer to the description page for your **Hardware Configuration** to confirm the version of the PMSM SH model. Additional information can also be found under **Permanent Magnet Synchronous Machine Models Comparison**.

### **Single Machine Mode**

The **memory space of the PMSM SH model** core is shared between the **two machine models**. When a single machine is enabled, the full size of the table is available to model the machine. The default number of samples for each axis is shown below.

#### **PMSM SH v2**

<table><thead><tr><th width="139.88885498046875"></th><th>Theta Axis (Electrical angle)</th><th>Beta Axis</th><th>Iamp Axis</th></tr></thead><tbody><tr><td><strong>Phase Inductance</strong></td><td>65 samples per half-electrical turn (Resolution 2.77 deg)</td><td>33 (Resolution 10.9 deg)</td><td>32 (Resolution IampMax / 32 Amps)</td></tr><tr><td><strong>Phase Total Flux</strong></td><td>65 samples per full-electrical turn (Resolution 5.54 deg)</td><td>33 (Resolution 10.9 deg)</td><td>32 (Resolution IampMax / 32 Amps)</td></tr><tr><td><strong>Torque</strong></td><td>65 samples per slot (1/6 of electrical turn) (Resolution 0.92 deg)</td><td>33 (Resolution 10.9 deg)</td><td>32 (Resolution IampMax / 32 Amps)</td></tr></tbody></table>

#### **PMSM SH v1**

<table><thead><tr><th width="139.88885498046875"></th><th>Theta Axis (Electrical angle)</th><th>Beta Axis</th><th>Iamp Axis</th></tr></thead><tbody><tr><td><strong>Phase Inductance</strong></td><td>33 samples per half-electrical turn (Resolution 5.45 deg)</td><td>33 (Resolution 10.9 deg)</td><td>16 (Resolution = IampMax / 16 Amps)</td></tr><tr><td><strong>Phase Total Flux</strong></td><td>65 samples per full-electrical turn (Resolution 5.54 deg)</td><td>33 (Resolution 10.9 deg)</td><td>16 (Resolution = IampMax / 16 Amps)</td></tr><tr><td><strong>Torque</strong></td><td>33 samples per half-electrical turn (Resolution 5.45 deg)</td><td>33 (Resolution 10.9 deg)</td><td>16 (Resolution = IampMax / 16 Amps)</td></tr></tbody></table>

### **Dual Machine Mode**

When both PMSM SH machines are enabled, the total allocated FPGA memory is divided between the two machine models. The default number of samples for each axis is shown below.

#### **PMSM SH v2**

<table><thead><tr><th width="139.88897705078125"></th><th>Theta Axis (Electrical angle)</th><th>Beta Axis</th><th>Iamp Axis</th></tr></thead><tbody><tr><td><strong>Phase Inductance</strong></td><td>33 samples per half-electrical turn (Resolution 5.45 deg)</td><td>33 (Resolution 10.9 deg)</td><td>32 (Resolution = IampMax / 32 Amps)</td></tr><tr><td><strong>Phase Total Flux</strong></td><td>33 samples per full-electrical turn (Resolution 10.9 deg)</td><td>33 (Resolution 10.9 deg)</td><td>32 (Resolution = IampMax / 32 Amps)</td></tr><tr><td><strong>Torque</strong></td><td>33 samples per slot (1/6 of electrical turn) (Resolution 1.98 deg)</td><td>33 (Resolution 10.9 deg)</td><td>32 (Resolution = IampMax / 32 Amps)</td></tr></tbody></table>

#### **PMSM SH v1**

<table><thead><tr><th width="139.88885498046875"></th><th>Theta Axis (Electrical angle)</th><th>Beta Axis</th><th>Iamp Axis</th></tr></thead><tbody><tr><td><strong>Phase Inductance</strong></td><td>33 samples per half-electrical turn (Resolution 5.45 deg)</td><td>17 (Resolution 21.17 deg)</td><td>16 (Resolution = IampMax / 16 Amps)</td></tr><tr><td><strong>Phase Total Flux</strong></td><td>65 samples per full-electrical turn (Resolution 5.54 deg)</td><td>17 (Resolution 21.17 deg)</td><td>16 (Resolution = IampMax / 16 Amps)</td></tr><tr><td><strong>Torque</strong></td><td>33 samples per half-electrical turn (Resolution 5.45 deg)</td><td>17 (Resolution 21.17 deg)</td><td>16 (Resolution = IampMax / 16 Amps)</td></tr></tbody></table>

### Data Interpolation Performed During Simulation <a href="#data-interpolation-performed-during-simulation" id="data-interpolation-performed-during-simulation"></a>

During the simulation, the data in the tables is interpolated again to obtain the correct Phase Inductance, Phase Total Flux, and Torque values corresponding to the state of the machine at a specific time in the simulation. An **18 bit trilinear interpolation** is used. The effective resolution for a linear segment along a table axis can be calculated using the equation $$\frac{R}{2^{18}}$$ , where R is the resolution of the axis listed in the previous section.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/pe-add-on-simulink/model-and-simulation/add-and-configure-a-circuit-model-to-the-system-definition/machine-section/machine-configuration-files/jmag-rt-rtt-file-generation-recommendations.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
