3.5.5 mcRpeI_RotorPositionEstim
C
/* Perform floating point rotor position estimation*/ void mcRpeI_RotorPositionEstim( const tmcRpe_Parameters_s * const pParameters, const tmcTypes_AlphaBeta_s * pIAlphaBeta, const tmcTypes_AlphaBeta_s * pUAlphaBeta, tmcTypes_AlphaBeta_s * pEAlphaBeta, float32_t * pAngle, float32_t * pSpeed ) /* Perform fixed point rotor position estimation*/ void mcRpeI_RotorPositionEstim( const tmcRpe_Parameters_s * const pParameters, const tmcTypes_AlphaBeta_s * pIAlphaBeta, const tmcTypes_AlphaBeta_s * pUAlphaBeta, tmcTypes_AlphaBeta_s * const pEAlphaBeta, uint16_t * pAngle, int16_t * pSpeed )
Summary
Performs the rotor position estimation.
Description
This function estimates the rotor position and speed for a PMSM motor. It utilizes the measured currents and voltages in the alpha-beta reference frame to calculate the back-EMF using a user-defined position estimation technique. From this calculation, it derives the rotor's angular position and speed. For a detailed explanation, please refer to the Harmony QSpin documentation.
Precondition
Rotor position estimation module must be initialized and enabled.
Parameters
Param | Description |
---|---|
pParameters | A pointer to the rotor position estimation module parameter structure |
pIAlphaBeta | A pointer to the structure that contains the stator current in the alpha-beta reference frame. |
pUAlphaBeta | A pointer to the structure that contains the stator voltage in the alpha-beta reference frame. |
pEAlphaBeta | A pointer to the structure where the calculated back-EMF in the alpha-beta reference frame will be stored. |
pAngle | A pointer to a variable where the estimated rotor angle (in radians) will be stored. Refer the generated header for the exact data type. |
pSpeed | A pointer to a variable where the estimated rotor speed (in radians per second) will be stored. Refer the generated header for the exact data type. |
Returns
None
Example
// Define the rotor position estimation module data structure
tmcRpe_Parameters_s rpeParameters;
tmcTypes_AlphaBeta_s currentAlphaBeta, voltageAlphaBeta, backEmfAlphaBeta;
float32_t rotorAngle, rotorSpeed;
/** Estimate rotor position */
mcRpeI_RotorPositionEstim(&rpeParameters, ¤tAlphaBeta, &voltageAlphaBeta, &backEmfAlphaBeta, &rotorAngle, &rotorSpeed);
Remarks
Note: Ensure that the
pParameters
structure
is properly updated with valid values before calling this function