> 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/rt-lab/simulink-blocks-reference/efpgasim-library/simulink-sps-workflow/machines/dual-pmsm-motors-vdq.md).

# Dual PMSM Motors VDQ

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2F4suAE44GoFWf1ipVELJ2%2Fimage.png?alt=media&amp;token=eea6e469-e1b3-4e9e-9fc3-f8f02b3a3b2a" alt=""><figcaption></figcaption></figure>

The **Dual PMSM Motors VDQ** block, located in the **eFPGAsim/External circuit editor workflow/Machines** library, handles communication between the RT-LAB model and the FPGA motor model. It also initializes the FPGA motor solver with user-defined flux, Ld, and Lq tables.

Supported operating modes:

* **JMAG RTT file**: Ld, Lq, and flux tables are loaded from a JMAG RTT file.
* **Fixed Ld/Lq**: Constant inductance values specified by the user.
* **Variable Ld/Lq**: Inductance values obtained from user-defined lookup tables.

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-a3f3390538dbbbfd75e172e63981134fc7a26794%2Fehs-dual-pmsm-vdq-mask.png?alt=media" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="Motor#" %}

<table data-search="false"><thead><tr><th width="180.20001220703125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Motor Type</strong></td><td><p>Select between three options:</p><ul><li><strong>Rtt File</strong> uses the table of Ld Lq table stored directly in the file</li><li><strong>Fix LdLq</strong> configures the solver to perform a standard PMSM dq model.</li><li><strong>LsLq Tables</strong> configures the solver to perform a PMSM Variable Ldq model. This mode uses tables of Ld Lq and Flux. Depending on the Id Iq operating point, the inductances and flux values will change to emulate the saturation.</li></ul></td></tr><tr><td><strong>Rtt file Path</strong></td><td>If RttFile is selected, path of your Rtt file. You must encapsulate the path name between quote or your file may not be found. This motor support Jmag 10.5 version of rtt files. It only uses the d and q inductances of the file.<br>This block does not support Spatial Harmonic PMSM model. Natively, rtt file contains both motor topologies (dq and Spatial Harmonics topologies) and all the information needed by the solver to work.</td></tr><tr><td><strong>Ld/Lq Value [H]</strong></td><td>If Fix LdLq mode is selected, value of Ld Lq in Henry.<br>As a physical quantity, this value cannot be null or negative.</td></tr><tr><td><strong>Flux Linkage [Wb]</strong></td><td>If Fix LdLq mode is selected, flux linkage value in Weber.<br>As a physical quantity, this value cannot be null or negative.</td></tr><tr><td><strong>Id/Iq breakpoints [Amps]</strong></td><td>If Ls Lq Tables is selected, these vectors defined the Id and Iq breakpoints for the Ld Lq and Flux tables. Their size must match with the Ld Lq Flux tables defined below (Id length must be equal to Ld/Lq/Flux first dimension and Iq to Ld/Lq/Flux second dimension). The minimum number of breakpoints is 2.<br>Each element must be unique in the respective vector.</td></tr><tr><td><strong>Ld/Lq table [H]</strong></td><td><p>If Ls Lq Tables is selected, tables for Ld and Lq. Ld/Lq(N,M) value represent Ld/Lq value when Id = Id_breakpoints(N) and Iq = Iq_breakpoints(M). Thus, the first dimension is Id axis, the second is Iq axis.</p><p>As a physical quantity, this value cannot be null or negative.</p></td></tr><tr><td><strong>Flux table [Wb]</strong></td><td>If Ls Lq Tables is selected, flux table. Flux(N,M) value represent Flux value when Id = Id_breakpoints(N) and Iq = Iq_breakpoints(M). Thus, the first dimension is Id axis, the second is Iq axis.<br>As a physical quantity, this value cannot be null or negative.</td></tr><tr><td><strong>Number of pole pairs</strong></td><td>Number of the motor pole pairs. This value must be an unsigned integer between 1 and 127.</td></tr><tr><td><strong>Ra/Rb/Rc [Ohm]</strong></td><td>Stator resistance of the phase a/b/c of the motor. Because this value is physical, it cannot be a negative/null value.</td></tr><tr><td><strong>Park transform for Id Iq scaling</strong></td><td><p>Selects the scaling convention used for the <strong>Id/Iq</strong> and <strong>Vd/Vq</strong> signals within the RT-LAB model. Depending on the Park transformation used to generate these signals, the monitored values may require rescaling to match the correct magnitude.</p><p>Available options are:</p><ul><li><strong>Quadrature Park transform</strong> (scaling factor: <span class="math">\sqrt{2/3}</span></li><li><strong>Park-Clarke transform</strong> (scaling factor: <span class="math">2/3</span>)</li></ul><p>This setting only affects signal scaling in the RT-LAB model and does <strong>not</strong> modify the scaling of the <strong>Id/Iq</strong> signals computed inside the FPGA or mapped to analog outputs. By default, the FPGA uses the <strong>quadrature Park transform</strong>.</p></td></tr><tr><td><strong>Rotor Flux position when theta = 0</strong></td><td>Allow you to choose to have q axis on the A axis when theta = 0 (modified park) or d axis on the A axis when theta = 0. This will set the FPGA dq transform in the right referential. You can also manually change the angle offset.</td></tr><tr><td><strong>Vabc filter cut-off Frequency [Hz]</strong></td><td>There is an embedded filter in the motor solver to help the user to visualise the Vabc voltage. Because the original traces are square like, it is very hard to figure out the trace of Vabc. This tool simulates a low pass filter on Vabc. The gain is 1, but the cut-off frequency can be easily tuned. This value must be between 0.01 and 100 kHz. For a good result, the value has to be more than twice the electrical motor speed (in Hz) and less than half the PWM frequency.</td></tr><tr><td><strong>Table Idq input low pass filter Frequency [Hz]</strong></td><td>This filter a first order filter used to remove high harmonics of the DQ currents accessing the table, that could make the stiffer.<br>-1 to disable</td></tr><tr><td><strong>Add cogging torque</strong></td><td>Allows to add torque ripple to the torque output.</td></tr></tbody></table>

{% hint style="info" %}

### Table notes

Before being transferred to the FPGA, the tables are preprocessed into an FPGA-compatible format. The FPGA requires **Id** and **Iq** axes centered on zero. Missing regions are extrapolated, and values outside the user-defined range are saturated to the nearest available value.

The FPGA supports a maximum table size of **128 × 128**. Tables with different dimensions are automatically interpolated or extrapolated during preprocessing.

The FPGA uses the **quadrature Park transformation**. If a different convention was used to generate the **Id/Iq** axes, the preprocessing stage automatically converts them.

If only part of the operating range is available (for example, a single quadrant from the manufacturer), no symmetry is assumed. The user must extend the data to the missing quadrants when required.
{% endhint %}
{% endtab %}

{% tab title="Other" %}

<table><thead><tr><th width="180.199951171875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Solver Step Time</strong></td><td>Step time in seconds of the FPGA PMSM solver step time. This parameter must be between 125ns and 4us.</td></tr><tr><td><strong>Block Index</strong></td><td>This value is used to index initialization data when the same solver is used several times in the FPGA. For example, to make sure that subsystem A does not receive data from subsystem B. This value must be between 0 and 15.</td></tr><tr><td><strong>Number of Motors Enable</strong></td><td>This parameter activates the 2nd motor or optimizes the solver for use by only one motor. When only one motor is used, the memory that would have been used for the 2nd motor's inductance/flux and torque tables will be used to improve the tables for motor 1. Motor 2 is therefore disabled.</td></tr><tr><td><strong>Data In/Load In/Data Out port number</strong></td><td>Number of communication ports from/to FPGA to send/receive solver data. Port numbers depend on the bitstream (See bitstream technical documentation to know the right port numbers). If your bitstream was modified, consult its technical note for the port numbers associated to the dual PMSM motors SH block.</td></tr><tr><td><strong>Controller Name</strong></td><td>FPGA controller name that refers to the motor model bitstream (in OpCtrl or Oplnk block. Usually 'OpCtrl'.).</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Inputs

<table><thead><tr><th width="180.20001220703125">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>Motor#MecSpeedRPM</strong></td><td>Mechanical speed of the motor in RPM.<br>The natural limit of this value is 366000 RPM.<br>The resolution is 1.7e-4 RPM. Depending on the motor topologies this could be an unrealistic limit.<br>If the input goes over the limit, the value sent to the FPGA will be the nearest correct value.</td></tr><tr><td><strong>Rst</strong></td><td>Reset of the FPGA motor solver. This action will result to a reset of all motors' current states to 0. This is a double signal. The reset is active when input is higher than 0.5.</td></tr><tr><td><strong>Advanceport#</strong></td><td>This port provides an access to advance solver request. You have to use the "VDQ_motor_AdvanceCmd" block in tools lib to access its functionality. With the VDQ model, this port allow the user to update the Rabc values, change the LdLq values, change the IdIq values at the table Input, force the angle to a position or change the cut-off frequency of the VABC monitoring filter and change the flux value. Help documentation for this block is available here: Cpu Advanced Command block</td></tr></tbody></table>

## Outputs

| Output            | Description                                                                                                                                                                                                                                                                                                                          |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Motor#signals** | <p>These signals are the motor monitoring signals from the FPGA. Please see the list below to have an overview of the available signals:</p><p>Signal List:</p><ul><li>Ia/Ib/Ic</li><li>Vn (currently unsupported)</li><li>Idq</li><li>Theta Mec/Elec</li><li>Torque</li><li>RPM\_speed</li><li>Vabc\_filtered</li><li>Vdq</li></ul> |

{% hint style="info" %}
You can change the scaling of **Idq** and **Vdq** by selecting the Park transform in the GUI.
{% endhint %}

## Characteristics and limitations

| Direct Feedthrough   | N/A |
| -------------------- | --- |
| Discrete sample time | YES |
| XHP support          | YES |
| Work offline         | NO  |


---

# 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/rt-lab/simulink-blocks-reference/efpgasim-library/simulink-sps-workflow/machines/dual-pmsm-motors-vdq.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.
