# Position Compensation

Compensate for position offset due to different types of delays

• Library:
• Motor Control Blockset / Signal Management

## Description

The Position Compensation block compensates for position offset due to different types of delays in a system.

Motor control algorithms can introduce offsets in the computed position because of different algorithmic entities such as delays and filters. These offsets affect accuracy in motor control algorithms such as the field-oriented control (FOC) and direct-torque control (DTC) algorithms. You can use this block to compensate for these offsets in the motor control algorithms.

The block uses following computations for sample delay compensation:

The block uses following computations for 1st order Butterworth high-pass and low-pass filter compensation:

• For high-pass filter

`$Phase_offset=\frac{\pi }{2}-\mathrm{arctan}\left(\frac{{\omega }_{speed}}{{\omega }_{cutoff}}\right)=\mathrm{arctan}\left(\frac{{\omega }_{cutoff}}{{\omega }_{speed}}\right)$`
`$Phase_compensation=-\mathrm{arctan}\left(\frac{{\omega }_{cutoff}}{{\omega }_{speed}}\right)$`
• For low-pass filter

`$Phase_offset=-\mathrm{arctan}\left(\frac{{\omega }_{speed}}{{\omega }_{cutoff}}\right)$`
`$Phase_compensation=\mathrm{arctan}\left(\frac{{\omega }_{speed}}{{\omega }_{cutoff}}\right)$`

## Ports

### Input

expand all

Position input value that needs offset correction. This port supports the following range of values:

• 0 to 1 per-unit

• -360 to +360 degrees

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

Position offset value that is externally computed. This value must have same unit as that of θin input. This port supports the following range of values:

• 0 to 1 per-unit

• -360 to +360 degrees

#### Dependencies

To enable this port, select `External delay` for the Nature of offset parameter.

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

Externally computed angular velocity. This value indicates change in θin input.

#### Dependencies

To enable this port, select `Sample delay`, `High-pass filter delay`, or ```Low-pass filter delay``` for the Nature of offset parameter.

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

### Output

expand all

Position output value that is corrected for offset.

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

## Parameters

expand all

Type of delay or offset in the system that you want to compensate for. You can select one of the following values:

• Constant delay — Compensate for a fixed delay or offset.

• External delay — Compensate for a constant delay using an externally computed position offset value.

• Sample delay — Compensate for the delay based on discrete step size or block execution time.

• High-pass filter delay — Compensate for delay from 1st order Butterworth high-pass filter using a cut-off frequency value.

• Low-pass filter delay — Compensate for delay from 1st order Butterworth low-pass filter using a cut-off frequency value.

Position offset for constant delay in a system.

#### Dependencies

To enable this parameter, set Nature of offset to `Constant delay`.

Number of block execution time samples that the block should use for position offset compensation.

#### Dependencies

To enable this parameter, set Nature of offset to `Sample delay`.

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

#### Dependencies

To enable this parameter, set Nature of offset to `Sample delay`.

Cut-off frequency of the 1st order Butterworth high-pass or low-pass filter.

#### Dependencies

To enable this parameter, set Nature of offset to either `High-pass filter delay` or ```Low-pass filter delay```.

Unit of position input, θin of block.

Unit of angular velocity input, ω of block.

#### Dependencies

To enable this parameter, set Nature of offset to either `Sample delay`, ```High-pass filter delay```, or `Low-pass filter delay`.

Upper limit or maximum possible value of angular velocity input, ω, in RPM.

#### Dependencies

To enable this parameter, set Nature of offset to either `Sample delay`, ```High-pass filter delay```, or `Low-pass filter delay`.

## Version History

Introduced in R2022b