Jump to main content

##

# 3.3.18.14 mcFlxI_MTPA

## C

    /* MTPA control */
    void  mcFlxI_MTPA( tmcFlx_Parameters_s * const pParameters,
                       const tmcTypes_DQ_s * const pIdq, float32_t * const pIdref )

## Summary

Executes Maximum Torque per Ampere (MTPA) control .

## Description

This function computes the d-axis current reference for Maximum Torque Per Ampere (MTPA) operation in a Permanent Magnet Synchronous Motor (PMSM) , allowing the motor to operate at maximum efficiency. The following equation is sued to compute the MTPA d-axis reference current.

I d_m t p a=ψ m 2(L d−L q)+(ψ m 2(L d−L q))2+I q 2

where ψ m is the back emf constant in volts per electrical rad/s, L d and L q are d and q axis inductance values.

## Precondition

The MTPA 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.
pIDQ | Pointer to the 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 iDQ ={ .d = 0.3f, .q = 0.4f };
    float32_t idRef;
    /* Flux weakening control */
    mcFlxI_MTPA(&fluxParameters, &iDQ, &idRef);

## Remarks

None.