Jump to main content

##

# 3.3.18.9 mcFlxI_FluxWeakening

## C

    /* Flux weakening control */
    void mcFlxI_FluxWeakening(  const tmcFlx_Parameters_s * const pParameters,
                                                   const tmcTypes_DQ_s * const pUDQ,
                                                   const tmcTypes_AlphaBeta_s * const pEAlphaBeta,
                                                   const float32_t uBus,
                                                   const float32_t wmechRPM,
                                                   tmcTypes_DQ_s * const pIDQ,
                                                   float32_t * const pIdref )

## Summary

Performs the flux weakening control .

## Description

This function computes the d-axis current reference for flux weakening, allowing the motor to operate at speeds higher than its rated speed without increasing the motor voltage. The algorithm uses a closed-loop approach to calculate the current reference for flux weakening by applying motor voltage equations and a voltage control loop. The feed-forward component is computed using motor characteristic equations, while the feedback term is derived from controlling the voltage error between the maximum voltage and the reference voltage. For additional details, please refer to the QSpin motor control documentation.

## Precondition

The flux weakening module must be initialized and enabled.

## Parameters

Param | Description
--- | ---
pParameters | A pointer to the flux control module structure, which includes the MTPA, flux weakening, and flux control parameters.
pUDQ | Pointer to the DQ voltage vector
pEAlphaBeta | Pointer to the Alpha-Beta voltage vector
uBus | DC bus voltage value
wmechRPM | Mechanical speed in RPM
pIDQ | Pointer to the output DQ current vector
pIdref | Pointer to the output reference ID current

## Returns

None

## Example

    // Define the flux module data structure
    tmcFlx_Parameters_s fluxParameters;
    tmcTypes_DQ_s uDQ ={ .d = 0.3f, .q = 0.4f };
    tmcTypes_AlphaBeta_s eAlphaBeta ={ .alpha = 1.0f, .beta = 0.0f };
    float32_t uBus = 24.0f;
    float32_t wmechRPM = 1500.0f;
    tmcTypes_DQ_s iDQ ={ .d = 0.3f, .q = 0.4f };
    float32_t idRef;
    /* Flux weakening control */
    mcFlxI_FluxWeakening(&fluxParameters, &uDQ, &eAlphaBeta, uBus, wmechRPM, &iDQ, &idRef);

## Remarks

None.