Data Structures | Macros | Typedefs | Functions | Variables
MTPA

Data Structures

struct  _MTPA_Obj_
 Defines the MTPA object. More...
 

Macros

#define MTPA_LUT_INDEX_LD_MAX   20
 Defines the maximum length of LUT for Ld. More...
 
#define MTPA_LUT_INDEX_LQ_MAX   20
 Defines the maximum length of LUT for Lq. More...
 
#define MTPA_LUT_DELTA_CURRENT_LD_A   0.5
 Defines the current delta of LUT for Ld, A. More...
 
#define MTPA_LUT_DELTA_CURRENT_LD_A   0.5
 Defines the current delta of LUT for Ld, A. More...
 

Typedefs

typedef struct _MTPA_Obj_ MTPA_Obj
 Defines the MTPA object. More...
 
typedef struct _MTPA_Obj_MTPA_Handle
 Defines the MTPA handle. More...
 

Functions

void MTPA_computeParameters (MTPA_Handle handle, const float32_t Ls_d_H, const float32_t Ls_q_H, const float32_t flux_Wb)
 Computes the motor constant for MTPA module. More...
 
static void MTPA_disable (MTPA_Handle handle)
 Disables the MTPA. More...
 
static void MTPA_enable (MTPA_Handle handle)
 Enables the MTPA. More...
 
static float32_tMTPA_getCurrentAnglePhase_rad_addr (MTPA_Handle handle)
 Gets the stator current phase angle memory address. More...
 
static float32_t MTPA_getCurrentAngle_rad (MTPA_Handle handle)
 Gets the stator current phase angle value (angleCurrent_rad) More...
 
static float32_t MTPA_getKconst (MTPA_Handle handle)
 Gets the motor constant of MTPA. More...
 
static float32_tMTPA_getIs_ref_A_addr (MTPA_Handle handle)
 Gets the stator current reference memory address. More...
 
static bool MTPA_getFlagEnable (MTPA_Handle handle)
 Gets the enable controller flag value from the controller. More...
 
static float32_t MTPA_getId_ref_A (MTPA_Handle handle)
 Gets the direct current reference value (Id_ref_A) More...
 
static float32_t MTPA_getIq_ref_A (MTPA_Handle handle)
 Gets the quadrature current reference value (Iq_ref_A) More...
 
static float32_t MTPA_getIs_ref_A (MTPA_Handle handle)
 Gets the stator current reference value (Is_ref_A) More...
 
static void MTPA_setFlagEnable (MTPA_Handle handle, const bool flagEnable)
 Sets the enable flag. More...
 
static void MTPA_setCurrentAngle_rad (MTPA_Handle handle, const float32_t angleCurrent_rad)
 Sets the stator current phase angle value. More...
 
static void MTPA_setId_ref_A (MTPA_Handle handle, const float32_t Id_ref_A)
 Sets the direct current (Id_ref) reference vector value. More...
 
static void MTPA_setIq_ref_A (MTPA_Handle handle, const float32_t Iq_ref_A)
 Sets the quadrature current (Iq_ref) reference value. More...
 
static void MTPA_setIs_ref_A (MTPA_Handle handle, const float32_t Is_ref_A)
 Sets the stator current reference value (Is_ref) More...
 
MTPA_Handle MTPA_init (void *pMemory, const size_t numBytes)
 Initializes the maximum torque per ampere (MTPA) module. More...
 
MTPA_Handle cla_MTPA_init (void *pMemory, const size_t numBytes)
 
static void MTPA_computeCurrentReference (MTPA_Handle handle, const float32_t Is_ref_A)
 Compute the current reference of MTPA. More...
 
static float32_t MTPA_computeCurrentAngle (MTPA_Handle handle, const float32_t Is_ref_A)
 Compute the current angle of MTPA. More...
 
static float32_t MTPA_updateLs_d_withLUT (MTPA_Handle handle, const float32_t Is_A)
 Update the motor inductances. More...
 
static float32_t MTPA_updateLs_q_withLUT (MTPA_Handle handle, const float32_t Is_A)
 Update the motor inductances. More...
 

Variables

const float32_t MTPA_Ld_tableData_H [20+1]
 Defines the Ld array. More...
 
const float32_t MTPA_Lq_tableData_H [20+1]
 Defines the Lq array. More...
 

Detailed Description

Macro Definition Documentation

◆ MTPA_LUT_INDEX_LD_MAX

#define MTPA_LUT_INDEX_LD_MAX   20

Defines the maximum length of LUT for Ld.

◆ MTPA_LUT_INDEX_LQ_MAX

#define MTPA_LUT_INDEX_LQ_MAX   20

Defines the maximum length of LUT for Lq.

◆ MTPA_LUT_DELTA_CURRENT_LD_A [1/2]

#define MTPA_LUT_DELTA_CURRENT_LD_A   0.5

Defines the current delta of LUT for Ld, A.

Defines the current delta of LUT for Lq, A.

◆ MTPA_LUT_DELTA_CURRENT_LD_A [2/2]

#define MTPA_LUT_DELTA_CURRENT_LD_A   0.5

Defines the current delta of LUT for Ld, A.

Defines the current delta of LUT for Lq, A.

Typedef Documentation

◆ MTPA_Obj

typedef struct _MTPA_Obj_ MTPA_Obj

Defines the MTPA object.

◆ MTPA_Handle

typedef struct _MTPA_Obj_* MTPA_Handle

Defines the MTPA handle.

Function Documentation

◆ MTPA_computeParameters()

void MTPA_computeParameters ( MTPA_Handle  handle,
const float32_t  Ls_d_H,
const float32_t  Ls_q_H,
const float32_t  flux_Wb 
)

Computes the motor constant for MTPA module.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Ls_d_HThe direct stator inductance, Henry
[in]Ls_q_HThe quadrature stator inductance, Henry
[in]flux_WbThe rated flux value, Wb

◆ MTPA_disable()

static void MTPA_disable ( MTPA_Handle  handle)
inlinestatic

Disables the MTPA.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle

References _MTPA_Obj_::flagEnable.

◆ MTPA_enable()

static void MTPA_enable ( MTPA_Handle  handle)
inlinestatic

Enables the MTPA.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle

References _MTPA_Obj_::flagEnable.

◆ MTPA_getCurrentAnglePhase_rad_addr()

static float32_t* MTPA_getCurrentAnglePhase_rad_addr ( MTPA_Handle  handle)
inlinestatic

Gets the stator current phase angle memory address.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The stator current phase angle memory address

References _MTPA_Obj_::angleCurrent_rad.

◆ MTPA_getCurrentAngle_rad()

static float32_t MTPA_getCurrentAngle_rad ( MTPA_Handle  handle)
inlinestatic

Gets the stator current phase angle value (angleCurrent_rad)

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The stator current phase angle value, rad

References _MTPA_Obj_::angleCurrent_rad.

◆ MTPA_getKconst()

static float32_t MTPA_getKconst ( MTPA_Handle  handle)
inlinestatic

Gets the motor constant of MTPA.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The motor constant of MTPA

References _MTPA_Obj_::kconst.

◆ MTPA_getIs_ref_A_addr()

static float32_t* MTPA_getIs_ref_A_addr ( MTPA_Handle  handle)
inlinestatic

Gets the stator current reference memory address.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The stator current reference memory address

References _MTPA_Obj_::Is_ref_A.

◆ MTPA_getFlagEnable()

static bool MTPA_getFlagEnable ( MTPA_Handle  handle)
inlinestatic

Gets the enable controller flag value from the controller.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The enable MTPA flag value

References _MTPA_Obj_::flagEnable.

Referenced by MTPA_computeCurrentAngle(), and MTPA_computeCurrentReference().

◆ MTPA_getId_ref_A()

static float32_t MTPA_getId_ref_A ( MTPA_Handle  handle)
inlinestatic

Gets the direct current reference value (Id_ref_A)

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The direct reference reference current, A

References _MTPA_Obj_::Idq_ref_A, and _MATH_Vec2_::value.

◆ MTPA_getIq_ref_A()

static float32_t MTPA_getIq_ref_A ( MTPA_Handle  handle)
inlinestatic

Gets the quadrature current reference value (Iq_ref_A)

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The quadrature current reference value, A

References _MTPA_Obj_::Idq_ref_A, and _MATH_Vec2_::value.

◆ MTPA_getIs_ref_A()

static float32_t MTPA_getIs_ref_A ( MTPA_Handle  handle)
inlinestatic

Gets the stator current reference value (Is_ref_A)

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
Returns
The stator current reference value, A

References _MTPA_Obj_::Is_ref_A.

◆ MTPA_setFlagEnable()

static void MTPA_setFlagEnable ( MTPA_Handle  handle,
const bool  flagEnable 
)
inlinestatic

Sets the enable flag.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]flagEnableThe enable flag

References _MTPA_Obj_::flagEnable.

◆ MTPA_setCurrentAngle_rad()

static void MTPA_setCurrentAngle_rad ( MTPA_Handle  handle,
const float32_t  angleCurrent_rad 
)
inlinestatic

Sets the stator current phase angle value.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]angleCurrent_radThe stator current phase angle value, rad

References _MTPA_Obj_::angleCurrent_rad.

◆ MTPA_setId_ref_A()

static void MTPA_setId_ref_A ( MTPA_Handle  handle,
const float32_t  Id_ref_A 
)
inlinestatic

Sets the direct current (Id_ref) reference vector value.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Id_ref_AThe direct current reference value, A

References _MTPA_Obj_::Idq_ref_A, and _MATH_Vec2_::value.

◆ MTPA_setIq_ref_A()

static void MTPA_setIq_ref_A ( MTPA_Handle  handle,
const float32_t  Iq_ref_A 
)
inlinestatic

Sets the quadrature current (Iq_ref) reference value.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Iq_ref_AThe quadrature current reference value, A

References _MTPA_Obj_::Idq_ref_A, and _MATH_Vec2_::value.

◆ MTPA_setIs_ref_A()

static void MTPA_setIs_ref_A ( MTPA_Handle  handle,
const float32_t  Is_ref_A 
)
inlinestatic

Sets the stator current reference value (Is_ref)

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Is_ref_AThe stator current reference value, A

References _MTPA_Obj_::Is_ref_A.

◆ MTPA_init()

MTPA_Handle MTPA_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the maximum torque per ampere (MTPA) module.

Parameters
[in]pMemoryA pointer to the memory for the MTPA object
[in]numBytesThe number of bytes allocated for the MTPA object
Returns
The Maximum torque per ampere (MTPA) object handle

◆ cla_MTPA_init()

MTPA_Handle cla_MTPA_init ( void *  pMemory,
const size_t  numBytes 
)

◆ MTPA_computeCurrentReference()

static void MTPA_computeCurrentReference ( MTPA_Handle  handle,
const float32_t  Is_ref_A 
)
inlinestatic

Compute the current reference of MTPA.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Is_ref_AThe stator current reference value, A
Returns
None

References _MTPA_Obj_::Idq_ref_A, _MTPA_Obj_::Is_ref_A, _MTPA_Obj_::kconst, MATH_abs(), MTPA_getFlagEnable(), and _MATH_Vec2_::value.

◆ MTPA_computeCurrentAngle()

static float32_t MTPA_computeCurrentAngle ( MTPA_Handle  handle,
const float32_t  Is_ref_A 
)
inlinestatic

Compute the current angle of MTPA.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Is_ref_AThe stator current reference value, A
Returns
None

References _MTPA_Obj_::angleCurrent_rad, _MTPA_Obj_::gconst, _MTPA_Obj_::Is_ref_A, _MTPA_Obj_::kconst, MATH_PI_OVER_TWO, and MTPA_getFlagEnable().

◆ MTPA_updateLs_d_withLUT()

static float32_t MTPA_updateLs_d_withLUT ( MTPA_Handle  handle,
const float32_t  Is_A 
)
inlinestatic

Update the motor inductances.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Is_AThe stator current value, A
Returns
The d-axis inductance

References _MTPA_Obj_::deltaIs_Ld_A, _MTPA_Obj_::indexMax_Ld, and MTPA_Ld_tableData_H.

◆ MTPA_updateLs_q_withLUT()

static float32_t MTPA_updateLs_q_withLUT ( MTPA_Handle  handle,
const float32_t  Is_A 
)
inlinestatic

Update the motor inductances.

Parameters
[in]handleThe maximum torque per ampere (MTPA) handle
[in]Is_AThe stator current value, A
Returns
The q-axis inductance

References _MTPA_Obj_::deltaIs_Lq_A, _MTPA_Obj_::indexMax_Lq, and MTPA_Ld_tableData_H.

Variable Documentation

◆ MTPA_Ld_tableData_H

const float32_t MTPA_Ld_tableData_H[20+1]

Defines the Ld array.

Referenced by MTPA_updateLs_d_withLUT(), and MTPA_updateLs_q_withLUT().

◆ MTPA_Lq_tableData_H

const float32_t MTPA_Lq_tableData_H[20+1]

Defines the Lq array.


Copyright 2023, Texas Instruments Incorporated