# Resolver Decoder

Compute motor mechanical position and speed and sine and cosine values of motor electrical position

Since R2020a

• Libraries:
Motor Control Blockset / Sensor Decoders

## Description

The Resolver Decoder block computes the following for a resolver connected to the motor shaft:

• Mechanical angular position of motor

• Sine and cosine values of electrical angular position of motor

• Mechanical speed of motor

A resolver uses a primary excitation input signal to generate the modulated secondary sine and cosine waveforms, which are then sampled by the ADC. The resolver utilizes one winding to two winding transformations. The sine and cosine modulation occurs in the secondary windings because of the design and construction of these windings, which places them at positions that are 90 degrees apart. For more details about the algorithm used by the block, see Algorithm.

## Ports

### Input

expand all

Sampled secondary sine waveform output from the resolver. When using sinusoidal excitation, normalize this signal so that it lies in the range [-1, 1] and is centred at 0.

Data Types: `single` | `double` | `fixed point`

Sampled secondary cosine waveform output from the resolver. When using sinusoidal excitation, normalize this signal so that it lies in the range [-1, 1] and is centred at 0.

Data Types: `single` | `double` | `fixed point`

### Output

expand all

Mechanical angular position of the resolver (and the motor) in either degrees, radians, or per-unit.

Data Types: `single` | `double` | `fixed point`

Sine of the electrical angular position of the motor.

Data Types: `single` | `double` | `fixed point`

Cosine of the electrical angular position of the motor.

Data Types: `single` | `double` | `fixed point`

Mechanical speed of the motor in either degrees/sec, radians/sec, RPM, or per-unit.

Data Types: `single` | `double` | `fixed point`

## Parameters

expand all

Set the Resolver Decoder block to use one of the following computation techniques:

• `Arithmetic` — Use an algorithm based on arithmetic equations and atan2 based operations to compute the block outputs. For more information about this technique, see the Algorithm section on this page.

• `Sine and Cosine electrical position` — Use a PLL based algorithm to compute the block outputs. For more information about this technique, see .PLL with Feed Forward

Set the Resolver Decoder block to output one of more of the following:

• `Mechanical position` — Enable the block to compute motor mechanical position.

• `Sine and Cosine electrical position` — Enable the block to compute sine and cosine values of motor electrical position.

• `Mechanical speed` — Enable the block to compute the mechanical speed of the motor.

### Input Parameters

The number of pole pairs available in the resolver.

The resolver excitation method used to obtain the secondary sine and cosine waveforms.

When using square-pulse excitation method, the block normalizes the secondary sine and cosine inputs only if you select this parameter.

#### Dependencies

To enable this parameter, set Type of excitation method to `Square Pulse Excitation`.

The fixed time interval (in seconds) between every two consecutive instances of block execution.

#### Dependencies

To enable this parameter, set Block Output to `Mechanical speed`.

### Inputs for Sine and Cosine electrical position

The number of pole pairs available in the motor.

#### Dependencies

To enable this parameter, set Block Output to `Sine and Cosine electrical position`.

The offset between the resolver mechanical position and motor mechanical position (in radians).

#### Dependencies

To enable this parameter, set Block Output to `Sine and Cosine electrical position`.

Select the rounding mode for fixed-point operations used when computing the sine and cosine of the motor electrical position.

• `Simplest` — The block generates compact rounding code with faster computation. However, with time, this mode may add bias in the sine and cosine electrical position output.

• `Zero` — The block ensures that the rounding code does not add any bias in the sine and cosine electrical position output. However, this results in slower computation.

#### Dependencies

To enable this parameter, set Block Output to `Sine and Cosine electrical position`.

### Inputs for sinusoidal excitation method

The phase delay that the block adds to the `Sin` and `Cos` input port signals.

#### Dependencies

To enable this parameter, set Type of excitation method to `Sinusoidal Excitation`.

Number of samples available in one cycle of the `Sin` and `Cos` input port signals.

#### Dependencies

To enable this parameter, set Type of excitation method to `Sinusoidal Excitation`.

### Output Parameters

The unit of the mechanical position output of the block.

#### Dependencies

To enable this parameter, set Block Output to `Mechanical position`.

The unit of the mechanical speed output of the block.

#### Dependencies

To enable this parameter, set Block Output to `Mechanical speed`.

The rated speed of the motor (in RPM).

#### Dependencies

To enable this parameter, set Speed unit to `Per-Unit` and Block Output to `Mechanical speed`.

## Algorithms

expand all

The block uses the correctly sampled and normalized version of the secondary sine and cosine waveforms to demodulate the sine and cosine signals using which it determines the electrical position of the resolver. It converts this position into its mechanical equivalent according to the number of pole pairs available in the resolver. The resulting value indicates the mechanical position of the motor.

The block also uses the demodulated sine and cosine signals (sine and cosine of resolver electrical angle) to compute the motor speed as well as the sine and cosine values of the motor electrical position.

 The block's capability of resolver excitation using square-pulse carrier frequency is based on the collaboration (IITD/FT/03/2038/2020) between The MathWorks, Inc. and Indian Institute of Technology (IIT), Delhi - with inputs from Prof. Amit Kumar Jain (Faculty Consultant-Incharge, EE, IIT Delhi) and Apurva Verma (PhD student, IIT Delhi).