3.3.25.3 mcTorI_TorqueControlAuto

C

/* Torque control - auto mode : floating point version  */
void mcTorI_TorqueControlAuto(  const tmcTor_Parameters_s * const pParameters,
                                              const float32_t iQref, const float32_t iQact, const float32_t iQmax,
                                              float32_t * const pOut )

/* Torque control - auto mode : fixed point version  */	
void mcTorI_TorqueControlAuto(  const tmcTor_Parameters_s * const pParameters,
                                              const int16_t iQref, const int16_t iQact, int16_t iQmax, int16_t * const pOut )

Summary

Performs the torque control.

Description

This function controls the torque using a PI controller. It calculates the error between the reference and actual quadrature axis current, updates the PI controller limits, and either executes or resets the PI controller based on the state of the torque control module.

Precondition

The torque control module must be initialized and enabled.

Parameters

ParamDescription
pParametersA pointer to the torque control module parameter structure.
iQrefReference q-axis current. Please refer the generated header for the exact data type.
iQactActual q-axis current. Please refer the generated header for the exact data type.
iQmaxThe output limit for the PI controller.
pOutA 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 torque control module data structure
tmcTor_Parameters_s torqParameters;

// Define the parameters for floating point torque control loop
float32_t iQref = 0.5f;
float32_t iQact = 0.4f;
float32_t limit = 1.0f;
float32_t uQref;

// Define the parameters for fixed point torque control loop
int16_t iQref = 0.5f;
int16_t iQact = 0.4f;
int16_t uQref;

/** torque control loop */
void mcTorI_TorqueControlAuto(&torqParameters, iQref, iQact, limit &uQref);
    

Remarks

Refer the generated header file for the exact function signature.