S/C - Sin/cos encoder

The sin/cos encoder (S/C) block retrieves the Sine and Cosine signals of a sin/cos encoder connected to the Motor Interface.

The B-Box RCP supports up to two sin/cos encoders through the Motor Interface for B-Box RCP. This type of sensor encodes the position of the rotor using two signals in quadrature (sin and cos). The principle is similar to an incremental encoder: the signals in quadrature are periodic, and the sensor produces a fixed number of periods per revolution (PPR). Unlike an incremental encoder, signals in quadrature are analog, which allows computing the angle within one electrical period of the sensor. As a result, a sin/cos encoder offers a better resolution at the same PPR. Additionally, some sin/cos encoders also provide an index signal (ns) equivalent to the Z reset signal of an incremental encoder. The Motor Interface does not support absolute sin/cos encoders.

Version 3.7 beta of the ACG SDK for Simulink does not implement an angle decoder. Instead, the S/C block provides the raw analog signals of the sensor read by some ADCs, and the control must implement angle decoding.

Signal specification

  • The output s/c is a vector containing the Sine and Cosine signals in [V].
  • The optional output ns corresponds to the index signal.
  • The sim input is used in simulation and represents the actual Sine and Cosine signals, computed by the simulation plant model.
  • The > input signal needs to be connected to the sampling clock generated by the CONFIG block to account for the exact sampling instant in simulation.
Screenshot of the sin/cos encoder block for Simulink.

Parameters

  • Device ID selects which B-Box/B-Board to address when used in a multi-device configuration.
  • Motor Interface input selects which connector of the Motor Interface is used as an input.
  • Output index signal defines if the index signal is output or not.
Screenshot of the sin/cos interface block for Simulink

PLECS block

Signal specification

  • The output s/c is a vector containing the Sine and Cosine signals in [V].
  • The optional output ns corresponds to the index signal.
  • The sim input is used in simulation and represents the actual Sine and Cosine signals, computed by the simulation plant model.
  • The > input signal needs to be connected to the sampling clock generated by the CONFIG block to account for the exact sampling instant in simulation.
Screenshot of the sin/cos encoder block for PLECS.

Parameters

  • Device ID selects which B-Box/B-Board to address when used in a multi-device configuration.
  • Motor Interface input selects which connector of the Motor Interface is used as an input.
  • Output index signal defines if the index signal is output or not.
Screenshot of the sin/cos encoder parameters for the PLECS block (addressing).
Screenshot of the sin/cos encoder parameters for the PLECS block (configuration).

C++ functions

void MotInt_EnableMotorInterface(unsigned int device=0);Code language: C++ (cpp)

Enables the drivers of the Motor Interface.

It has to be called in UserInit().

Parameters

  • device: the id of the addressed device (optional, used in multi-device configuration only).
float Sc_GetSin(tMotIntMachine machine, unsigned int device=0);Code language: C++ (cpp)

Read the value of the sine signal.

It has to be called during the control interrupt.

Parameters

  • machine: the machine to configure (MACHINE_A or MACHINE_B).
  • device: the id of the addressed device (optional, used in multi-device configuration only).
float Sc_GetCos(tMotIntMachine machine, unsigned int device=0);Code language: C++ (cpp)

Reads the value of the cosine signal.

It has to be called during the control interrupt.

Parameters

  • machine: the machine to configure (MACHINE_A or MACHINE_B).
  • device: the id of the addressed device (optional, used in multi-device configuration only).
float Sc_GetNs(tMotIntMachine machine, unsigned int device=0);Code language: C++ (cpp)

Reads the value of the index signal.

It has to be called during the control interrupt.

Parameters

  • machine: the machine to configure (MACHINE_A or MACHINE_B).
  • device: the id of the addressed device (optional, used in multi-device configuration only).