Jump to main content

##

# 3.3.18.4 mcFlxI_FluxControlAuto

## C

    /* Floating point flux control loop */
    void mcFlxI_FluxControlAuto(  const tmcFlx_Parameters_s * const pParameters,
                                                  const float32_t iDref, const float32_t iDact, const float32_t iDmax, float32_t * const pOut )

    /* Fixed point flux control loop */
    mcFlxI_FluxControlAuto( const tmcFlx_Parameters_s * const pParameters,
                                                  const int16_t iDref, const int16_t iDact, int16_t iDmax, int16_t * const pOut   )

## Summary

Performs the flux control.

## Description

This function controls the flux component Id current using a Proportional-Integral (PI) controller. It calculates the error between the reference and actual direct current components, updates the PI controller limits, and either executes or resets the PI controller based on the flux control module state.

## Precondition

The flux control module must be initialized and enabled.

## Parameters

Param | Description
--- | ---
pParameters | A pointer to the flux control module parameter structure
iDref | Reference d-axis current. Please refer the generated header for the exact data type.
iDact | Actual d-axis current. Please refer the generated header for the exact data type.
iDmax | The output limit for the PI controller.
pOut | A pointer to a variable where the output of the PI controller will be stored. Please refer the generated header for the exact data type.

## Returns

None

## Example

    // Define the flux module data structure
    tmcFlx_Parameters_s fluxParameters;

    // Define the parameters for floating point flux control loop
    float32_t iDrerf=1.0f;
    float32_t iDact=0.9f;
    float32_t limit = 1.0f;
    float32_t uDref;

    // Define the parameters for fixed point flux control loop
    int16_t iDrerf=1.0f;
    int16_t iDact=0.9f;
    int16_t uDref;

    /** execute flux control loop  */
    mcFlxI_FluxControlAuto(&fluxParameters, iDref, iDact, limit, &uDref);

## Remarks

Refer the generated header file for the exact function signature.