Main Content

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.

  • PLL — 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. If you select this value, the block enables the Inputs for Sine and Cosine electrical position section in the Input Parameters tab.

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

Note

When you use the PLL computation technique, if you enable all the three block outputs, then the block uses PLL to compute the sine and cosine electrical positions and mechanical speed but uses the atan2 function to compute the mechanical position.

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

  • If you configure the block to use arithmetic computation method, you can enable this parameter by selecting the Mechanical speed parameter available in the Block Output section.

  • If you configure the block to use PLL computation method, the block always enables this parameter.

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.

PLL Parameters

Maximum possible frequency of the input signals (in hertz).

Dependencies

To enable this parameter set the Computation method parameter to PLL

Cutoff frequency of the lowpass filter that the block uses to filter the estimated angular frequency (in hertz).

Dependencies

To enable this parameter set the Computation method parameter to PLL

Size of the lookup table array. This parameter accepts a value between 125 and 4095.

Dependencies

To enable this parameter:

  • Set the Computation method parameter to PLL.

  • Select the Mechanical position parameter available in the Block Output section.

  • Clear the Sine and Cosine electrical position parameter available in the Block Output section.

Proportional gain (Kp) of the PID controller used by the block to compute the angular frequency.

Dependencies

To enable this parameter set the Computation method parameter to PLL

Integral gain (Ki) of the PID controller used by the block to compute the angular frequency.

Dependencies

To enable this parameter set the Computation method parameter to PLL

Click Compute default parameters to calculate an approximate proportional gain (Kp) and integral gain (Ki) and update these fields.

Threshold for the error in the phase-locked loop (PLL) used by the block.

Dependencies

To enable this parameter set the Computation method parameter to PLL

Output Parameters

The unit of the mechanical position output of the block.

Dependencies

For both arithmetic and PLL computation methods, the block enables this parameter only if you select the Mechanical position parameter available in the Block Output section.

The data type for the angular position output.

Dependencies

To enable this parameter, set the Computation method parameter to PLL and select the Mechanical position parameter available in the Block Output section.

Data type of the sine-cosine lookup table used by the block.

Dependencies

To enable this parameter, set the Computation method parameter to PLL and select the Mechanical position parameter available in the Block Output section.

The unit of the mechanical speed output of the block.

Dependencies

For both arithmetic and PLL computation methods, the block enables this parameter only if you select the Mechanical speed parameter available in the Block Output section.

The data type for the angular speed output.

Dependencies

To enable this parameter, set the Computation method parameter to PLL and select the Mechanical speed parameter available in the Block Output section.

The rated speed of the motor (in RPM).

Dependencies

For both arithmetic and PLL computation methods, the block enables this parameter only if you select the Mechanical speed parameter available in the Block Output section and then set Speed unit to Per-Unit.

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.

References

[1] 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).

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced in R2020a