3.3.24.4 mcSpeI_SpeedControlAuto

C


/* speed control loop: floating point version */
void mcSpeI_SpeedControlAuto(  const tmcSpe_Parameters_s * const pParameters,
                                              const float32_t nref, const float32_t nact, float32_t * const pOut ) 

/* speed control loop: fixd point version */
void mcSpeI_SpeedControlAuto(  const tmcSpe_Parameters_s * const pParameters,
                                              const int16_t nref, const int16_t nact, int16_t * const pOut )
	

Summary

Performs speed control.

Description

This function controls speed using a PI controller. It calculates the error between the reference and actual speeds, controls the speed error using the PI controller based on the state of the speed control module, and updates the Q-axis reference current accordingly.

Precondition

The speed control module must be initialized and enabled.

Parameters

ParamDescription
pParametersA pointer to the speed control module parameter structure
nrefReference speed value. Please refer the generated header for the exact data type.
nactActual speed value. Please refer the generated header for the exact data type.
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 speed control module data structure
tmcSpe_Parameters_s speedParameters;

// Define the parameters for floating point speed control loop
float32_t nref = 1000.0f;
float32_t nact = 950.0f;
float32_t iQref

// Define the parameters for fixed point speed control loop
int16_t nref = 1000;
int16_t nact = 950;
int16_t iQref

/** Execute speed control loop */
void mcSpeI_SpeedControlAuto(&speedParameters, nref, nact, &iQref);
    

Remarks

None.