3.4.7 tmcRpc_State_s Struct

C

/* Data structure for Rotor Position Calculation (RPC) */
typedef struct
{
    bool enable;                      /* Flag indicating if the module is enabled */
    bool initDone;                    /* Flag indicating if initialization is done */    
    uint16_t encPulsesPerElecRev;     /* Defines the number of encoder pulses per electrical revolution */
    uint16_t velocityCountPrescaler;  /* Prescaler value used to control the frequency of velocity updates */
    uint16_t encOverflow;             /* Encoder overflow value */
    uint16_t encUnderflow;            /* Encoder underflow value */
    uint16_t encUpperThreshold;       /* Upper threshold for detecting encoder count overflow */
    uint16_t encLowerThreshold;       /* Lower threshold for detecting encoder count underflow */
    float32_t encPulsesToElecVelocity; /* Scaling factor used to convert the encoder count to speed */
    float32_t encPulsesToElecAngle;    /* Scaling factor used to convert encoder count to an electrical angle */

    uint16_t synCounter;               /* Synchronization counter */
    uint16_t encCount;                 /* Current encoder pulse count */
    uint16_t encCountForPositionLast;  /* Encoder pulse count from the last calculation cycle */
    uint16_t encCountForPosition;      /* Compensated encoder pulse count */
    uint16_t positionCompensation;     /* Compensation value applied to the encoder count */
    int16_t encCountForVelocity;       /* Difference in encoder counts between cycles */
    int16_t encCountForVelocityLast;   /* Encoder count from the last velocity calculation cycle*/

<#if MCPMSMFOC_CONTROL_TYPE == 'POSITION_LOOP' >
    uint8_t gearFactor;                /* Gear factor used for calculating mechanical angle */
    int8_t electricalRotationsPositive;/* Number of positive electrical rotations */
    int8_t electricalRotationsNegative;/* Number of negative electrical rotations */
    float32_t accumElectricalAngle;    /* Accumulated electrical angle over multiple rotations*/
    float32_t mechanicalAngle;         /* The calculated mechanical angle */
</#if>

}tmcRpc_State_s;

Summary

RPC module parameter state structure.

Description

This structure holds the input parameters and state variables for the Rotor Position Calculation module.

Remarks

None.