AM243x Motor Control SDK  09.02.00
APIs for Transformation Algorithms

Introduction

Here is the list of motor transformation function APIs

Here is the list of SVGEN_CURRENT function APIs

Sub Modules

 APIs for Phase Voltage Calculation (VOLREC)
 

Files

file  clarke.h
 Contains abc to alpha/beta/0 transform implementation.
 
file  park.h
 Contains alpha/beta/0 to d/q/0 transform implementation.
 
file  ipark.h
 Contains d/q/0 to alpha/beta/0 transform implementation.
 
file  svgen.h
 Contains svpwm generation implementation.
 
file  svgen_current.h
 Contains space vector generation current (SVGENCURRENT) functions implementation.
 

Data Structures

struct  SVGENCURRENT_Obj
 Defines the Svgen Current object. More...
 

Functions

static void CLARKE_run_threeInput (const float32_t inIa, const float32_t inIb, const float32_t inIc, float32_t *pIalpha, float32_t *pIbeta)
 Runs the Clarke transform module for three inputs. More...
 
static void CLARKE_run_twoInput (const float32_t inIa, const float32_t inIb, float32_t *pIalpha, float32_t *pIbeta)
 Runs the Clarke transform module for two inputs. More...
 
static void PARK_run (const float32_t sinTh, const float32_t cosTh, const float32_t inIalpha, const float32_t inIbeta, float32_t *pId, float32_t *pIq)
 Runs the Park transform module. More...
 
static void IPARK_run (const float32_t sinTh, const float32_t cosTh, const float32_t inVd, const float32_t inVq, float32_t *pValpha, float32_t *pVbeta)
 Runs the inverse Park transform module. More...
 
static void SVGEN_runCom (const float32_t oneOverDcBus_invV, const float32_t inValpha, const float32_t inVbeta, float32_t *pVa, float32_t *pVb, float32_t *pVc)
 Implements a SVM that subtracts common-mode term to achieve SV modulation. More...
 
static void SVGEN_runMax (const float32_t oneOverDcBus_invV, const float32_t inValpha, const float32_t inVbeta, float32_t *pVa, float32_t *pVb, float32_t *pVc)
 Implements a DPWM that uses maximum modulation. More...
 
static void SVGEN_runMin (const float32_t oneOverDcBus_invV, const float32_t inValpha, const float32_t inVbeta, float32_t *pVa, float32_t *pVb, float32_t *pVc)
 Implements a DPWM that uses minimum modulation. More...
 
static void SVGEN_clamp (const float32_t Umax, const float32_t Umin, float32_t *pVa, float32_t *pVb, float32_t *pVc)
 Saturates the SVM variable base on modulation limits. More...
 
SVGENCURRENT_Handle SVGENCURRENT_init (void *pMemory, const size_t numBytes)
 Initializes the svgen current object. More...
 
void SVGENCURRENT_setup (SVGENCURRENT_Handle handle, const float32_t minWidth_usec, const float32_t pwmFreq_kHz, const float32_t systemFreq_MHz)
 Sets up the PWM minimum width. More...
 
static void SVGENCURRENT_setMinWidth (SVGENCURRENT_Handle handle, const int16_t minwidth)
 Sets the minimum Duty Cycle width that the lower switch can be on before. More...
 
static void SVGENCURRENT_setIgnoreShunt (SVGENCURRENT_Handle handle, const SVGENCURRENT_IgnoreShunt_e ignoreShunt)
 Sets the ignore shunt value. More...
 
static void SVGENCURRENT_setMode (SVGENCURRENT_Handle handle, const SVGENCURRENT_MeasureShunt_e compMode)
 Sets the compensation mode. More...
 
static void SVGENCURRENT_setVlimit (SVGENCURRENT_Handle handle, const float32_t Vlimit)
 Sets the output voltage limit value for gurrantee a current sampling. More...
 
static SVGENCURRENT_IgnoreShunt_e SVGENCURRENT_getIgnoreShunt (SVGENCURRENT_Handle handle)
 Gets the ignore shunt value. More...
 
static int16_t SVGENCURRENT_getMinWidth (SVGENCURRENT_Handle handle)
 Gets the minimum Duty Cycle width that the lower switch can be on before. More...
 
static float32_t SVGENCURRENT_getVlimit (SVGENCURRENT_Handle handle)
 Gets the Voltage(Duty) Limit value. More...
 
static SVGENCURRENT_MeasureShunt_e SVGENCURRENT_getMode (SVGENCURRENT_Handle handle)
 Gets the current reconstruction mode. More...
 
static SVGENCURRENT_VmidShunt_e SVGENCURRENT_getVmid (SVGENCURRENT_Handle handle)
 Gets the middle amplitude voltage. More...
 
static void SVGENCURRENT_RunIgnoreShunt (SVGENCURRENT_Handle handle, uint16_t cmp1, uint16_t cmp2, uint16_t cmp3, uint16_t cmpM1, uint16_t cmpM2, uint16_t cmpM3)
 Gets the svgen current module ignore shunt. More...
 
static void SVGENCURRENT_RunRegenCurrent (SVGENCURRENT_Handle handle, MATH_Vec3 *pADCData, MATH_Vec3 *pADCDataPrev)
 Reconstructs the missed measured currents due to a small sampling window. More...
 
static void SVGENCURRENT_compPWMData (SVGENCURRENT_Handle handle, MATH_Vec3 *pPWMData, MATH_Vec3 *pPWMData_prev)
 output voltage reconsturction to guarantee min duty in two phase at least More...
 

Typedefs

typedef float float32_t
 
typedef double float64_t
 
typedef float float32_t
 
typedef double float64_t
 
typedef float float32_t
 
typedef double float64_t
 
typedef float float32_t
 
typedef double float64_t
 
typedef struct _SVGENCURRENT_Obj_ * SVGENCURRENT_Handle
 Defines the Svgen Current handle. More...
 

Enumerations

enum  SVGENCURRENT_IgnoreShunt_e {
  SVGENCURRENT_USE_ALL = 0, SVGENCURRENT_IGNORE_A, SVGENCURRENT_IGNORE_B, SVGENCURRENT_IGNORE_C,
  SVGENCURRENT_IGNORE_AB, SVGENCURRENT_IGNORE_AC, SVGENCURRENT_IGNORE_BC, SVGENCURRENT_IGNORE_ALL
}
 
enum  SVGENCURRENT_MeasureShunt_e { SVGENCURRENT_ALL_PHASE_MEASURABLE = 1, SVGENCURRENT_TWO_PHASE_MEASURABLE, SVGENCURRENT_ONE_PHASE_MEASURABLE, SVGENCURRENT_IMMEASUREABLE }
 
enum  SVGENCURRENT_VmidShunt_e { SVGENCURRENT_VMID_A =0, SVGENCURRENT_VMID_B, SVGENCURRENT_VMID_C }
 

Macros

#define IEEE754_TYPES
 
#define ONE_OVER_THREE   0.33333333333333f
 
#define ONE_OVER_SQRT_THREE   0.57735026918963f
 
#define IEEE754_TYPES
 
#define IEEE754_TYPES
 
#define IEEE754_TYPES
 
#define SQRT_THREE_OVER_TWO   0.8660254037844f
 
#define TWO_OVER_SQRT_THREE   1.15470053837926f
 

Macro Definition Documentation

◆ IEEE754_TYPES [1/4]

#define IEEE754_TYPES

◆ ONE_OVER_THREE

#define ONE_OVER_THREE   0.33333333333333f

◆ ONE_OVER_SQRT_THREE

#define ONE_OVER_SQRT_THREE   0.57735026918963f

◆ IEEE754_TYPES [2/4]

#define IEEE754_TYPES

◆ IEEE754_TYPES [3/4]

#define IEEE754_TYPES

◆ IEEE754_TYPES [4/4]

#define IEEE754_TYPES

◆ SQRT_THREE_OVER_TWO

#define SQRT_THREE_OVER_TWO   0.8660254037844f

◆ TWO_OVER_SQRT_THREE

#define TWO_OVER_SQRT_THREE   1.15470053837926f

Typedef Documentation

◆ float32_t [1/4]

typedef float float32_t

◆ float64_t [1/4]

typedef double float64_t

◆ float32_t [2/4]

typedef float float32_t

◆ float64_t [2/4]

typedef double float64_t

◆ float32_t [3/4]

typedef float float32_t

◆ float64_t [3/4]

typedef double float64_t

◆ float32_t [4/4]

typedef float float32_t

◆ float64_t [4/4]

typedef double float64_t

◆ SVGENCURRENT_Handle

typedef struct _SVGENCURRENT_Obj_* SVGENCURRENT_Handle

Defines the Svgen Current handle.

Enumeration Type Documentation

◆ SVGENCURRENT_IgnoreShunt_e

Enumerator
SVGENCURRENT_USE_ALL 

Use all shunt measurements.

SVGENCURRENT_IGNORE_A 

Ignore the A phase shunt measurement.

SVGENCURRENT_IGNORE_B 

Ignore the B phase shunt measurement.

SVGENCURRENT_IGNORE_C 

Ignore the C phase shunt measurement.

SVGENCURRENT_IGNORE_AB 

Ignore the AB phase shunt measurement.

SVGENCURRENT_IGNORE_AC 

Ignore the AC phase shunt measurement.

SVGENCURRENT_IGNORE_BC 

Ignore the BC phase shunt measurement.

SVGENCURRENT_IGNORE_ALL 

Ignore the ABC phase shunt measurement.

◆ SVGENCURRENT_MeasureShunt_e

Enumerator
SVGENCURRENT_ALL_PHASE_MEASURABLE 

all shunt measurable

SVGENCURRENT_TWO_PHASE_MEASURABLE 

just two shunt measurable

SVGENCURRENT_ONE_PHASE_MEASURABLE 

just one shunt measurable

SVGENCURRENT_IMMEASUREABLE 

◆ SVGENCURRENT_VmidShunt_e

Enumerator
SVGENCURRENT_VMID_A 

Middle voltage is A phase.

SVGENCURRENT_VMID_B 

Middle voltage is B phase.

SVGENCURRENT_VMID_C 

Middle voltage is C phase.

Function Documentation

◆ CLARKE_run_threeInput()

static void CLARKE_run_threeInput ( const float32_t  inIa,
const float32_t  inIb,
const float32_t  inIc,
float32_t pIalpha,
float32_t pIbeta 
)
static

Runs the Clarke transform module for three inputs.

Parameters
[in]inIaInput current value in a-axis
[in]inIbInput current value in b-axis
[in]inIcInput current value in c-axis
[in]pIalphaOutput pointer to current value in alpha-axis
[in]pIbetaOutput pointer to current value in beta-axis

◆ CLARKE_run_twoInput()

static void CLARKE_run_twoInput ( const float32_t  inIa,
const float32_t  inIb,
float32_t pIalpha,
float32_t pIbeta 
)
static

Runs the Clarke transform module for two inputs.

Parameters
[in]inIaInput current value in a-axis
[in]inIbInput current value in b-axis
[in]pIalphaOutput pointer to current value in alpha-axis
[in]pIbetaOutput pointer to current value in beta-axis

◆ PARK_run()

static void PARK_run ( const float32_t  sinTh,
const float32_t  cosTh,
const float32_t  inIalpha,
const float32_t  inIbeta,
float32_t pId,
float32_t pIq 
)
static

Runs the Park transform module.

Parameters
[in]sinThSine value in radians
[in]cosThCosine value in radians
[in]inIalphaInput current value in alpha-axis
[in]inIbetaInput current value in beta-axis
[in]pIdOutput pointer to voltage value in d-axis
[in]pIqOutput pointer to voltage value in q-axis

◆ IPARK_run()

static void IPARK_run ( const float32_t  sinTh,
const float32_t  cosTh,
const float32_t  inVd,
const float32_t  inVq,
float32_t pValpha,
float32_t pVbeta 
)
static

Runs the inverse Park transform module.

Parameters
[in]sinThSine value in radian
[in]cosThCosine value in radian
[in]inVdInput voltage value in d-axis
[in]inVqInput voltage value in q-axis
[in]pValphaOutput pointer to voltage value in alpha-axis
[in]pVbetaOutput pointer to voltage value in beta-axis

◆ SVGEN_runCom()

static void SVGEN_runCom ( const float32_t  oneOverDcBus_invV,
const float32_t  inValpha,
const float32_t  inVbeta,
float32_t pVa,
float32_t pVb,
float32_t pVc 
)
static

Implements a SVM that subtracts common-mode term to achieve SV modulation.

Parameters
[in]oneOverDcBus_invVThe inverse dc bus voltage scale factor, used to convert inputs to pu, use 1 if units are already in pu.
[in]inValphaInput voltage value in alpha-axis, V or pu
[in]inVbetaInput voltage value in beta-axis, V or pu
[in]pVaOutput pointer to voltage value in a-axis, pu
[in]pVbOutput pointer to voltage value in b-axis, pu
[in]pVcOutput pointer to voltage value in c-axis, pu

◆ SVGEN_runMax()

static void SVGEN_runMax ( const float32_t  oneOverDcBus_invV,
const float32_t  inValpha,
const float32_t  inVbeta,
float32_t pVa,
float32_t pVb,
float32_t pVc 
)
static

Implements a DPWM that uses maximum modulation.

Parameters
[in]oneOverDcBus_invVThe inverse dc bus voltage scale factor, used to convert inputs to pu, use 1 if units are already in pu.
[in]inValphaInput voltage value in alpha-axis, V or pu
[in]inVbetaInput voltage value in beta-axis, V or pu
[in]pVaOutput pointer to voltage value in a-axis, pu
[in]pVbOutput pointer to voltage value in b-axis, pu
[in]pVcOutput pointer to voltage value in c-axis, pu

◆ SVGEN_runMin()

static void SVGEN_runMin ( const float32_t  oneOverDcBus_invV,
const float32_t  inValpha,
const float32_t  inVbeta,
float32_t pVa,
float32_t pVb,
float32_t pVc 
)
static

Implements a DPWM that uses minimum modulation.

Parameters
[in]oneOverDcBus_invVThe inverse dc bus voltage scale factor, used to convert inputs to pu, use 1 if units are already in pu.
[in]inValphaInput voltage value in alpha-axis, V or pu
[in]inVbetaInput voltage value in beta-axis, V or pu
[in]pVaOutput pointer to voltage value in a-axis, pu
[in]pVbOutput pointer to voltage value in b-axis, pu
[in]pVcOutput pointer to voltage value in c-axis, pu

◆ SVGEN_clamp()

static void SVGEN_clamp ( const float32_t  Umax,
const float32_t  Umin,
float32_t pVa,
float32_t pVb,
float32_t pVc 
)
static

Saturates the SVM variable base on modulation limits.

Parameters
[in]UmaxMaximum modulation limit
[in]UminMinimum modulation limit
[in]pVapointer to voltage value in a-axis
[in]pVbpointer to voltage value in b-axis
[in]pVcpointer to voltage value in c-axis

◆ SVGENCURRENT_init()

SVGENCURRENT_Handle SVGENCURRENT_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the svgen current object.

Parameters
[in]*pMemoryPointer in to the svgen current object
[in]numBytesSize of the object

◆ SVGENCURRENT_setup()

void SVGENCURRENT_setup ( SVGENCURRENT_Handle  handle,
const float32_t  minWidth_usec,
const float32_t  pwmFreq_kHz,
const float32_t  systemFreq_MHz 
)

Sets up the PWM minimum width.

Parameters
[in]handleThe svgen current (SVGEN) handle
[in]minWidth_usecThe minimum pwm width
[in]pwmFreq_kHzThe PWM frequency, in MHz
[in]systemFreq_MHzThe system SoC frequency, in MHz

◆ SVGENCURRENT_setMinWidth()

static void SVGENCURRENT_setMinWidth ( SVGENCURRENT_Handle  handle,
const int16_t  minwidth 
)
inlinestatic

Sets the minimum Duty Cycle width that the lower switch can be on before.

the current data is invalid.

Parameters
[in]handleThe Svgen Current handle
[in]minwidthInteger value of the minimum number of pwm counts

◆ SVGENCURRENT_setIgnoreShunt()

static void SVGENCURRENT_setIgnoreShunt ( SVGENCURRENT_Handle  handle,
const SVGENCURRENT_IgnoreShunt_e  ignoreShunt 
)
inlinestatic

Sets the ignore shunt value.

Parameters
[in]handleThe Svgen Current handle
[in]ignoreShuntThe ignore shunt value

◆ SVGENCURRENT_setMode()

static void SVGENCURRENT_setMode ( SVGENCURRENT_Handle  handle,
const SVGENCURRENT_MeasureShunt_e  compMode 
)
inlinestatic

Sets the compensation mode.

Parameters
[in]handleThe Svgen Current handle
[in]compModeThe compensation mode

◆ SVGENCURRENT_setVlimit()

static void SVGENCURRENT_setVlimit ( SVGENCURRENT_Handle  handle,
const float32_t  Vlimit 
)
inlinestatic

Sets the output voltage limit value for gurrantee a current sampling.

Parameters
[in]handleThe Svgen Current handle
[in]VlimitThe output voltage limit

◆ SVGENCURRENT_getIgnoreShunt()

static SVGENCURRENT_IgnoreShunt_e SVGENCURRENT_getIgnoreShunt ( SVGENCURRENT_Handle  handle)
inlinestatic

Gets the ignore shunt value.

Parameters
[in]handleThe Svgen Current handle
Returns
Ignore shunt value

◆ SVGENCURRENT_getMinWidth()

static int16_t SVGENCURRENT_getMinWidth ( SVGENCURRENT_Handle  handle)
inlinestatic

Gets the minimum Duty Cycle width that the lower switch can be on before.

the current data is invalid.

Parameters
[in]handleThe Svgen Current handle
Returns
Integer value of the minimum number of pwm counts

◆ SVGENCURRENT_getVlimit()

static float32_t SVGENCURRENT_getVlimit ( SVGENCURRENT_Handle  handle)
inlinestatic

Gets the Voltage(Duty) Limit value.

Parameters
[in]handleThe Svgen Current handle
Returns
Integer value of the voltage(duty) limit

◆ SVGENCURRENT_getMode()

static SVGENCURRENT_MeasureShunt_e SVGENCURRENT_getMode ( SVGENCURRENT_Handle  handle)
inlinestatic

Gets the current reconstruction mode.

Parameters
[in]handleThe Svgen Current handle
Returns
CompMode

◆ SVGENCURRENT_getVmid()

static SVGENCURRENT_VmidShunt_e SVGENCURRENT_getVmid ( SVGENCURRENT_Handle  handle)
inlinestatic

Gets the middle amplitude voltage.

Parameters
[in]handleThe Svgen Current handle
Returns
middle voltage

◆ SVGENCURRENT_RunIgnoreShunt()

static void SVGENCURRENT_RunIgnoreShunt ( SVGENCURRENT_Handle  handle,
uint16_t  cmp1,
uint16_t  cmp2,
uint16_t  cmp3,
uint16_t  cmpM1,
uint16_t  cmpM2,
uint16_t  cmpM3 
)
static

Gets the svgen current module ignore shunt.

In the pwm structure, the value variable is the on-time of the low fet.

A low value is a small on-time for the low switch of the bridge and thus a short current window.

Parameters
[in]handleThe Svgen Current handle
[in]cmp1compare value 1
[in]cmp2compare value 2
[in]cmp3compare value 3
[in]cmpM1active compare value 1, from mirror register
[in]cmpM2active compare value 2, from mirror register
[in]cmpM3active compare value 3, from mirror register

◆ SVGENCURRENT_RunRegenCurrent()

static void SVGENCURRENT_RunRegenCurrent ( SVGENCURRENT_Handle  handle,
MATH_Vec3 *  pADCData,
MATH_Vec3 *  pADCDataPrev 
)
static

Reconstructs the missed measured currents due to a small sampling window.

Parameters
[in]handleThe svgen current handle
[in]pADCDataPointer to the shunt currents
[in]pADCDataPrevPointer to the previous shunt currents

◆ SVGENCURRENT_compPWMData()

static void SVGENCURRENT_compPWMData ( SVGENCURRENT_Handle  handle,
MATH_Vec3 *  pPWMData,
MATH_Vec3 *  pPWMData_prev 
)
static

output voltage reconsturction to guarantee min duty in two phase at least

Parameters
[in]handleThe svgen current handle
[in]pPWMDataThe pointer of the PWM data
[in]pPWMData_prevThe pointer of old PWM data