Data Structures | Macros | Typedefs | Enumerations | Functions
CTRL

Data Structures

struct  _CTRL_Version_
 Defines the controller (CTRL) version number. More...
 
struct  _CTRL_Obj_
 Defines the controller (CTRL) object. More...
 

Macros

#define CTRL_MAJOR_RELEASE_NUMBER   (2u)
 Defines the major release number. More...
 
#define CTRL_MINOR_RELEASE_NUMBER   (0u)
 Defines the major release number. More...
 
#define CTRL_NUM_CONTROLLERS   (2)
 Defines the number of controllers. More...
 

Typedefs

typedef struct _CTRL_Version_ CTRL_Version
 Defines the controller (CTRL) version number. More...
 
typedef struct _CTRL_Obj_ CTRL_Obj
 Defines the controller (CTRL) object. More...
 
typedef struct _CTRL_Obj_CTRL_Handle
 Defines the CTRL handle. More...
 

Enumerations

enum  CTRL_ErrorCode_e {
  CTRL_ERRORCODE_NOERROR = 0,
  CTRL_ERRORCODE_IDCLIP = 1,
  CTRL_ERRORCODE_ESTERROR = 2,
  CTRL_NUMERRORCODES = 3
}
 Enumeration for the error codes. More...
 
enum  CTRL_TargetProc_e {
  CTRL_TARGETPROC_2806X = 0,
  CTRL_TARGETPROC_2805X = 1,
  CTRL_TARGETPROC_2803X = 2,
  CTRL_TARGETPROC_2802X = 3
}
 Enumeration for the target processors. More...
 
enum  CTRL_Type_e {
  CTRL_TYPE_PI_SPD = 0,
  CTRL_TYPE_PI_ID = 1,
  CTRL_TYPE_PI_IQ = 2
}
 Enumeration for the controller (CTRL) types. More...
 
enum  CTRL_State_e {
  CTRL_STATE_ERROR = 0,
  CTRL_STATE_IDLE = 1,
  CTRL_STATE_OFFLINE = 2,
  CTRL_STATE_ONLINE = 3,
  CTRL_NUMSTATES = 4
}
 Enumeration for the controller states. More...
 

Functions

static void CTRL_checkForErrors (CTRL_Handle handle)
 Checks for any controller errors and, if found, sets the controller state to the error state. More...
 
static void CTRL_computePhasor (const float32_t angle_rad, MATH_Vec2 *pPhasor)
 Computes a phasor for a given angle. More...
 
static void CTRL_disable (CTRL_Handle handle)
 Disables the controller. More...
 
static void CTRL_enable (CTRL_Handle handle)
 Enables the controller. More...
 
static float32_t CTRL_getBWc_rps (CTRL_Handle handle)
 Gets the current controller bandwidth. More...
 
static float32_t CTRL_getBWdelta (CTRL_Handle handle)
 Gets the bandwidth scale factor used to maximize phase margin. More...
 
static float32_t CTRL_getKctrl_Wb_p_kgm2 (CTRL_Handle handle)
 Gets the speed controller constant. More...
 
static float32_t CTRL_getVd_sf (CTRL_Handle handle)
 Gets the direct voltage scale factor. More...
 
static float32_t CTRL_getMaxVsMag_V (CTRL_Handle handle)
 Gets the maximum stator voltage magnitude value. More...
 
static void CTRL_computeOutputLimits_Id (CTRL_Handle handle, float32_t *outMin, float32_t *outMax)
 Computes the Id controller output limits. More...
 
static void CTRL_computeOutputLimits_Iq (CTRL_Handle handle, const float32_t Vd_out_V, float32_t *outMin, float32_t *outMax)
 Computes the Iq controller output limits. More...
 
static int16_t CTRL_getCount_current (CTRL_Handle handle)
 Gets the current loop count. More...
 
static int16_t CTRL_getCount_isr (CTRL_Handle handle)
 Gets the isr count. More...
 
static int16_t CTRL_getCount_speed (CTRL_Handle handle)
 Gets the speed loop count. More...
 
static int32_t CTRL_getCount_state (CTRL_Handle handle)
 Gets the state count. More...
 
static float32_t CTRL_getCtrlFreq_Hz (CTRL_Handle handle)
 Gets the controller execution frequency. More...
 
static float32_t CTRL_getCurrentCtrlPeriod_sec (CTRL_Handle handle)
 Gets the current controller period. More...
 
static float32_t CTRL_getCtrlPeriod_sec (CTRL_Handle handle)
 Gets the controller execution period. More...
 
static CTRL_ErrorCode_e CTRL_getErrorCode (CTRL_Handle handle)
 Gets the error code from the controller (CTRL) object. More...
 
static bool CTRL_getFlag_enable (CTRL_Handle handle)
 Gets the enable controller flag value from the controller. More...
 
static bool CTRL_getFlag_enableCurrentCtrl (CTRL_Handle handle)
 Gets the enable current controllers flag value from the controller. More...
 
static bool CTRL_getFlag_enableSpeedCtrl (CTRL_Handle handle)
 Gets the enable speed control flag value from the controller. More...
 
static bool CTRL_getFlag_resetInt_Id (CTRL_Handle handle)
 Gets the reset Id integrator flag value from the controller. More...
 
static bool CTRL_getFlag_resetInt_Iq (CTRL_Handle handle)
 Gets the reset Iq integrator flag value from the controller. More...
 
static bool CTRL_getFlag_resetInt_spd (CTRL_Handle handle)
 Gets the reset speed integrator flag value from the controller. More...
 
static bool CTRL_getFlag_useZeroIq_ref (CTRL_Handle handle)
 Gets the use zero Iq reference flag value from the controller. More...
 
static float32_t CTRL_getId_A (CTRL_Handle handle)
 Gets the direct current (Id) value from the controller. More...
 
static float32_tCTRL_getId_A_addr (CTRL_Handle handle)
 Gets the direct current (Id) memory address from the controller. More...
 
static float32_t CTRL_getId_offset_A (CTRL_Handle handle)
 Gets the direct offset current (Id_offset) value from the controller. More...
 
static float32_tCTRL_getId_offset_A_addr (CTRL_Handle handle)
 Gets the direct offset current (Id_offset) memory address from the controller. More...
 
static float32_t CTRL_getId_ref_A (CTRL_Handle handle)
 Gets the direct reference current (Id_ref) value from the controller. More...
 
static float32_tCTRL_getId_ref_A_addr (CTRL_Handle handle)
 Gets the direct reference current (Id_ref) memory address from the controller. More...
 
static void CTRL_getIdq_A (CTRL_Handle handle, MATH_Vec2 *pIdq_A)
 Gets the direct/quadrature current vector values from the controller. More...
 
static MATH_Vec2CTRL_getIdq_A_addr (CTRL_Handle handle)
 Gets the direct/quadrature current (Idq) vector memory address from the controller. More...
 
static void CTRL_getIdq_offset_A (CTRL_Handle handle, MATH_Vec2 *pIdq_offset_A)
 Gets the direct/quadrature offset current (Idq_offset) vector values from the controller. More...
 
static MATH_Vec2CTRL_getIdq_offset_A_addr (CTRL_Handle handle)
 Gets the direct/quadrature offset current (Idq_offset) vector memory address from the controller. More...
 
static void CTRL_getIdq_ref_A (CTRL_Handle handle, MATH_Vec2 *pIdq_ref_A)
 Gets the direct/quadrature reference current (Idq_ref) vector values from the controller. More...
 
static MATH_Vec2CTRL_getIdq_ref_A_addr (CTRL_Handle handle)
 Gets the direct/quadrature reference current (Idq_ref) vector memory address from the controller. More...
 
static float32_t CTRL_getIq_A (CTRL_Handle handle)
 Gets the quadrature current (Iq) value from the controller. More...
 
static float32_tCTRL_getIq_A_addr (CTRL_Handle handle)
 Gets the quadrature current (Iq) memory address from the controller. More...
 
static float32_t CTRL_getIq_offset_A (CTRL_Handle handle)
 Gets the quadrature offset current (Iq_offset) value from the controller. More...
 
static float32_tCTRL_getIq_offset_A_addr (CTRL_Handle handle)
 Gets the quadrature offset current (Iq_offset) memory address from the controller. More...
 
static float32_t CTRL_getIq_ref_A (CTRL_Handle handle)
 Gets the quadrature reference current (Iq_ref) value from the controller. More...
 
static float32_tCTRL_getIq_ref_A_addr (CTRL_Handle handle)
 Gets the quadrature reference current (Iq_ref) memory address from the controller. More...
 
static float32_t CTRL_getKi (CTRL_Handle handle, const CTRL_Type_e ctrlType)
 Gets the integral gain (Ki) value from the specified controller. More...
 
static float32_t CTRL_getKp (CTRL_Handle handle, const CTRL_Type_e ctrlType)
 Gets the proportional gain (Kp) value from the specified controller. More...
 
static void CTRL_getGains (CTRL_Handle handle, const CTRL_Type_e ctrlType, float32_t *pKp, float32_t *pKi)
 Gets the gain values for the specified controller. More...
 
static MOTOR_Type_e CTRL_getMotorType (CTRL_Handle handle)
 Gets the motor type. More...
 
static int16_t CTRL_getNumCtrlTicksPerCurrentTick (CTRL_Handle handle)
 Gets the number of controller clock ticks per current controller clock tick. More...
 
static int16_t CTRL_getNumCtrlTicksPerSpeedTick (CTRL_Handle handle)
 Gets the number of controller clock ticks per speed controller clock tick. More...
 
static int16_t CTRL_getNumIsrTicksPerCtrlTick (CTRL_Handle handle)
 Gets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick. More...
 
static float32_t CTRL_getRefValue (CTRL_Handle handle, const CTRL_Type_e ctrlType)
 Gets the reference value from the specified controller. More...
 
static float32_t CTRL_getSpeed_fb_Hz (CTRL_Handle handle)
 Gets the feedback speed value from the controller. More...
 
static float32_t CTRL_getSpeed_out_A (CTRL_Handle handle)
 Gets the output value from the speed controller. More...
 
static float32_tCTRL_getSpeed_out_A_addr (CTRL_Handle handle)
 Gets the output value memory address from the speed controller. More...
 
static float32_t CTRL_getSpeed_outMax_A (CTRL_Handle handle)
 Gets the maximum value for the speed controller. More...
 
static float32_t CTRL_getSpeed_outMin_A (CTRL_Handle handle)
 Gets the minimum value for the speed controller. More...
 
static float32_t CTRL_getSpeed_ref_Hz (CTRL_Handle handle)
 Gets the output speed reference value from the controller. More...
 
static float32_t CTRL_getSpeedCtrlPeriod_sec (CTRL_Handle handle)
 Gets the speed controller period. More...
 
static CTRL_State_e CTRL_getState (CTRL_Handle handle)
 Gets the controller state. More...
 
static float32_t CTRL_getUi (CTRL_Handle handle, const CTRL_Type_e ctrlType)
 Gets the integrator (Ui) value from the specified controller. More...
 
static float32_t CTRL_getVd_V (CTRL_Handle handle)
 Gets the direct voltage (Vd) value from the controller. More...
 
static float32_tCTRL_getVd_V_addr (CTRL_Handle handle)
 Gets the direct voltage (Vd) value memory address from the controller. More...
 
static float32_t CTRL_getVd_offset_V (CTRL_Handle handle)
 Gets the direct offset voltage (Vd_offset) value from the controller. More...
 
static float32_tCTRL_getVd_offset_V_addr (CTRL_Handle handle)
 Gets the direct offset voltage (Vd_offset) value memory address from the controller. More...
 
static void CTRL_getVdq_V (CTRL_Handle handle, MATH_Vec2 *pVdq_V)
 Gets the direct/quadrature voltage (Vdq) vector values from the controller. More...
 
static MATH_Vec2CTRL_getVdq_V_addr (CTRL_Handle handle)
 Gets the direct/quadrature voltage (Vdq) vector memory address from the controller. More...
 
static void CTRL_getVdq_offset_V (CTRL_Handle handle, MATH_Vec2 *pVdq_offset_V)
 Gets the direct/quadrature offset voltage (Vdq_offset) vector values from the controller. More...
 
static MATH_Vec2CTRL_getVdq_offset_V_addr (CTRL_Handle handle)
 Gets the direct/quadrature offset voltage (Vdq_offset) vector memory address from the controller. More...
 
void CTRL_getVersion (CTRL_Handle handle, CTRL_Version *pVersion)
 Gets the controller version number. More...
 
static float32_t CTRL_getVq_V (CTRL_Handle handle)
 Gets the quadrature voltage (Vq) value from the controller. More...
 
static float32_tCTRL_getVq_V_addr (CTRL_Handle handle)
 Gets the quadrature voltage (Vq) value memory address from the controller. More...
 
static float32_t CTRL_getVq_offset_V (CTRL_Handle handle)
 Gets the quadrature offset voltage (Vq_offset) value from the controller. More...
 
static float32_tCTRL_getVq_offset_V_addr (CTRL_Handle handle)
 Gets the quadrature offset voltage (Vq_offset) value memory address from the controller. More...
 
static int32_t CTRL_getWaitTime (CTRL_Handle handle, const CTRL_State_e state)
 Gets the wait time for a given state. More...
 
void CTRL_getWaitTimes (CTRL_Handle handle, int32_t *pWaitTimes)
 Gets the wait times from the controller. More...
 
static void CTRL_incrCounter_current (CTRL_Handle handle)
 Increments the current counter. More...
 
static void CTRL_incrCounter_isr (CTRL_Handle handle)
 Increments the isr counter. More...
 
static void CTRL_incrCounter_speed (CTRL_Handle handle)
 Increments the speed counter. More...
 
static void CTRL_incrCounter_state (CTRL_Handle handle)
 Increments the state counter. More...
 
CTRL_Handle CTRL_init (void *pMemory, const size_t numBytes)
 Initializes the controller. More...
 
static bool CTRL_isEnabled (CTRL_Handle handle)
 Determines if the controller is enabled. More...
 
static bool CTRL_isError (CTRL_Handle handle)
 Determines if there is a controller error. More...
 
static bool CTRL_isIdle (CTRL_Handle handle)
 Determines if the controller is in the idle state. More...
 
static bool CTRL_isNotIdle (CTRL_Handle handle)
 Determines if the controller is not in the idle state. More...
 
void CTRL_reset (CTRL_Handle handle)
 Resets the controller. More...
 
static void CTRL_resetCounter_current (CTRL_Handle handle)
 Resets the current counter. More...
 
static void CTRL_resetCounter_isr (CTRL_Handle handle)
 Resets the isr counter. More...
 
static void CTRL_resetCounter_speed (CTRL_Handle handle)
 Resets the speed counter. More...
 
static void CTRL_resetCounter_state (CTRL_Handle handle)
 Resets the state counter. More...
 
static void CTRL_setBWc_rps (CTRL_Handle handle, const float32_t BWc_rps)
 Sets the current controller bandwidth. More...
 
static void CTRL_setBWdelta (CTRL_Handle handle, const float32_t BWdelta)
 Sets the bandwidth scale factor used to maximize phase margin. More...
 
static void CTRL_setCtrlFreq_Hz (CTRL_Handle handle, const float32_t ctrlFreq_Hz)
 Sets the controller frequency. More...
 
static void CTRL_setCtrlPeriod_sec (CTRL_Handle handle, const float32_t ctrlPeriod_sec)
 Sets the controller execution period. More...
 
static void CTRL_setCurrentCtrlPeriod_sec (CTRL_Handle handle, const float32_t currentCtrlPeriod_sec)
 Sets the current controller period value. More...
 
static void CTRL_setErrorCode (CTRL_Handle handle, const CTRL_ErrorCode_e errorCode)
 Sets the error code in the controller. More...
 
static void CTRL_setFlag_enable (CTRL_Handle handle, const bool state)
 Sets the enable controller flag value in the controller. More...
 
static void CTRL_setFlag_enableCurrentCtrl (CTRL_Handle handle, const bool state)
 Sets the enable current controllers flag value in the controller. More...
 
static void CTRL_setFlag_enableSpeedCtrl (CTRL_Handle handle, const bool state)
 Sets the enable speed control value in the controller. More...
 
static void CTRL_setFlag_resetInt_Id (CTRL_Handle handle, const bool state)
 Sets the reset Id integrator flag value in the controller. More...
 
static void CTRL_setFlag_resetInt_Iq (CTRL_Handle handle, const bool state)
 Sets the reset Iq integrator flag value in the controller. More...
 
static void CTRL_setFlag_resetInt_spd (CTRL_Handle handle, const bool state)
 Sets the reset speed integrator flag value in the controller. More...
 
static void CTRL_setFlag_useZeroIq_ref (CTRL_Handle handle, const bool state)
 Sets the use zero Iq reference flag value in the controller. More...
 
static void CTRL_setId_A (CTRL_Handle handle, const float32_t Id_A)
 Sets the direct current (Id) value in the controller. More...
 
static void CTRL_setId_offset_A (CTRL_Handle handle, const float32_t Id_offset_A)
 Sets the direct current (Id) offset value in the controller. More...
 
static void CTRL_setId_ref_A (CTRL_Handle handle, const float32_t Id_ref_A)
 Sets the direct current (Id) reference value in the controller. More...
 
static void CTRL_setIdq_A (CTRL_Handle handle, const MATH_Vec2 *pIdq_A)
 Sets the direct/quadrature current (Idq) vector values in the controller. More...
 
static void CTRL_setIdq_offset_A (CTRL_Handle handle, const MATH_Vec2 *pIdq_offset_A)
 Sets the direct/quadrature current (Idq) offset vector values in the controller. More...
 
static void CTRL_setIdq_ref_A (CTRL_Handle handle, const MATH_Vec2 *pIdq_ref_A)
 Sets the direct/quadrature current (Idq) reference vector values in the controller. More...
 
static void CTRL_setIq_A (CTRL_Handle handle, const float32_t Iq_A)
 Sets the quadrature current (Iq) value in the controller. More...
 
static void CTRL_setIq_offset_pu (CTRL_Handle handle, const float32_t Iq_offset_A)
 Sets the quadrature current (Iq) offset value in the controller. More...
 
static void CTRL_setIq_ref_A (CTRL_Handle handle, const float32_t Iq_ref_A)
 Sets the quadrature current (Iq) reference value in the controller. More...
 
static void CTRL_setKctrl_Wb_p_kgm2 (CTRL_Handle handle, const float32_t Kctrl_Wb_p_kgm2)
 Sets the speed controller constant. More...
 
static void CTRL_setKi (CTRL_Handle handle, const CTRL_Type_e ctrlType, const float32_t Ki)
 Sets the integral gain (Ki) value for the specified controller. More...
 
static void CTRL_setKp (CTRL_Handle handle, const CTRL_Type_e ctrlType, const float32_t Kp)
 Sets the proportional gain (Kp) value for the specified controller. More...
 
static void CTRL_setGains (CTRL_Handle handle, const CTRL_Type_e ctrlType, const float32_t Kp, const float32_t Ki)
 Sets the gain values for the specified controller. More...
 
static void CTRL_setMaxVsMag_V (CTRL_Handle handle, const float32_t maxVsMag_V)
 Sets the maximum stator voltage magnitude value. More...
 
static void CTRL_setMotorParams (CTRL_Handle handle, const MOTOR_Type_e motorType, const uint16_t numPolePairs, const float32_t ratedFlux_Wb, const float32_t Ls_d_H, const float32_t Ls_q_H, const float32_t Rs_d_Ohm, const float32_t Rs_q_Ohm, const float32_t Rr_d_Ohm, const float32_t Rr_q_Ohm)
 Sets the parameters for the motor in the controller. More...
 
static void CTRL_setNumCtrlTicksPerCurrentTick (CTRL_Handle handle, const int16_t numCtrlTicksPerCurrentTick)
 Sets the number of controller clock ticks per current controller clock tick. More...
 
static void CTRL_setNumCtrlTicksPerSpeedTick (CTRL_Handle handle, const int16_t numCtrlTicksPerSpeedTick)
 Sets the number of controller clock ticks per speed controller clock tick. More...
 
static void CTRL_setNumIsrTicksPerCtrlTick (CTRL_Handle handle, const int16_t numIsrTicksPerCtrlTick)
 Sets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick. More...
 
void CTRL_setParams (CTRL_Handle handle, USER_Params *pUserParams)
 Sets the controller parameters. More...
 
static void CTRL_setSpeed_fb_Hz (CTRL_Handle handle, const float32_t speed_fb_Hz)
 Sets the feedback speed value in the controller. More...
 
static void CTRL_setSpeed_out_A (CTRL_Handle handle, const float32_t speed_out_A)
 Sets the maximum output value for the speed controller. More...
 
static void CTRL_setSpeed_outMax_A (CTRL_Handle handle, const float32_t speed_outMax_A)
 Sets the maximum output value for the speed controller. More...
 
static void CTRL_setSpeed_outMin_A (CTRL_Handle handle, const float32_t speed_outMin_A)
 Sets the minimum output value for the speed controller. More...
 
static void CTRL_setSpeed_ref_Hz (CTRL_Handle handle, const float32_t speed_ref_Hz)
 Sets the output speed reference value in the controller. More...
 
static void CTRL_setSpeedCtrlPeriod_sec (CTRL_Handle handle, const float32_t speedCtrlPeriod_sec)
 Sets the speed controller period value. More...
 
static void CTRL_setState (CTRL_Handle handle, const CTRL_State_e state)
 Sets the controller state. More...
 
static void CTRL_setUi (CTRL_Handle handle, const CTRL_Type_e ctrlType, const float32_t Ui)
 Sets the integrator (Ui) value in the specified controller. More...
 
static void CTRL_setVd_sf (CTRL_Handle handle, const float32_t Vd_sf)
 Sets the direct voltage scale factor. More...
 
static void CTRL_setVdq_V (CTRL_Handle handle, const MATH_Vec2 *pVdq_V)
 Sets the direct/quadrature voltage (Vdq) vector values in the controller. More...
 
static void CTRL_setVdq_offset_V (CTRL_Handle handle, const MATH_Vec2 *pVdq_offset_V)
 Sets the direct/quadrature offset voltage (Vdq_offset) vector values in the controller. More...
 
void CTRL_setVersion (CTRL_Handle handle, const CTRL_TargetProc_e targetProc, const uint16_t majorReleaseNumber, const uint16_t minorReleaseNumber)
 Sets the controller version. More...
 
void CTRL_setWaitTimes (CTRL_Handle handle, const int32_t *pWaitTimes)
 Sets the wait times for the controller states. More...
 
bool CTRL_updateState (CTRL_Handle handle)
 Updates the controller state. More...
 
static void CTRL_setup (CTRL_Handle handle, const float32_t speed_ref_Hz, const float32_t speed_fb_Hz, const MATH_Vec2 *pIdq_A, const MATH_Vec2 *pIdq_offset_A, const MATH_Vec2 *pVdq_offset_V, const bool flag_enableSpeedCtrl, const bool flag_enableCurrentCtrl, const bool flag_useZeroIq_ref)
 Sets up the user controller (CTRL) object. More...
 
static void CTRL_run (CTRL_Handle handle, MATH_Vec2 *pVdq_V)
 Run the controller. More...
 

Detailed Description

Macro Definition Documentation

◆ CTRL_MAJOR_RELEASE_NUMBER

#define CTRL_MAJOR_RELEASE_NUMBER   (2u)

Defines the major release number.

◆ CTRL_MINOR_RELEASE_NUMBER

#define CTRL_MINOR_RELEASE_NUMBER   (0u)

Defines the major release number.

◆ CTRL_NUM_CONTROLLERS

#define CTRL_NUM_CONTROLLERS   (2)

Defines the number of controllers.

Typedef Documentation

◆ CTRL_Version

typedef struct _CTRL_Version_ CTRL_Version

Defines the controller (CTRL) version number.

◆ CTRL_Obj

typedef struct _CTRL_Obj_ CTRL_Obj

Defines the controller (CTRL) object.

◆ CTRL_Handle

typedef struct _CTRL_Obj_* CTRL_Handle

Defines the CTRL handle.

Enumeration Type Documentation

◆ CTRL_ErrorCode_e

Enumeration for the error codes.

Enumerator
CTRL_ERRORCODE_NOERROR 

no error error code

CTRL_ERRORCODE_IDCLIP 

Id clip error code.

CTRL_ERRORCODE_ESTERROR 

estimator error code

CTRL_NUMERRORCODES 

the number of controller error codes

◆ CTRL_TargetProc_e

Enumeration for the target processors.

Enumerator
CTRL_TARGETPROC_2806X 

2806x processor

CTRL_TARGETPROC_2805X 

2805x processor

CTRL_TARGETPROC_2803X 

2803x processor

CTRL_TARGETPROC_2802X 

2802x processor

◆ CTRL_Type_e

Enumeration for the controller (CTRL) types.

Enumerator
CTRL_TYPE_PI_SPD 

PI Speed controller.

CTRL_TYPE_PI_ID 

PI Id controller.

CTRL_TYPE_PI_IQ 

PI Iq controller.

◆ CTRL_State_e

Enumeration for the controller states.

Enumerator
CTRL_STATE_ERROR 

the controller error state

CTRL_STATE_IDLE 

the controller idle state

CTRL_STATE_OFFLINE 

the controller offline state

CTRL_STATE_ONLINE 

the controller online state

CTRL_NUMSTATES 

the number of controller states

Function Documentation

◆ CTRL_checkForErrors()

static void CTRL_checkForErrors ( CTRL_Handle  handle)
inlinestatic

Checks for any controller errors and, if found, sets the controller state to the error state.

Parameters
[in]handleThe controller (CTRL) handle

◆ CTRL_computePhasor()

static void CTRL_computePhasor ( const float32_t  angle_rad,
MATH_Vec2 pPhasor 
)
inlinestatic

Computes a phasor for a given angle.

Parameters
[in]angle_radThe angle, rad
[out]pPhasorThe pointer to the phasor vector values

References _MATH_Vec2_::value.

◆ CTRL_disable()

static void CTRL_disable ( CTRL_Handle  handle)
inlinestatic

Disables the controller.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::flag_enable.

◆ CTRL_enable()

static void CTRL_enable ( CTRL_Handle  handle)
inlinestatic

Enables the controller.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::flag_enable.

◆ CTRL_getBWc_rps()

static float32_t CTRL_getBWc_rps ( CTRL_Handle  handle)
inlinestatic

Gets the current controller bandwidth.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The current controller bandwidth, rad/sec

References _CTRL_Obj_::BWc_rps.

◆ CTRL_getBWdelta()

static float32_t CTRL_getBWdelta ( CTRL_Handle  handle)
inlinestatic

Gets the bandwidth scale factor used to maximize phase margin.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The bandwidth scale factor

References _CTRL_Obj_::BWdelta.

◆ CTRL_getKctrl_Wb_p_kgm2()

static float32_t CTRL_getKctrl_Wb_p_kgm2 ( CTRL_Handle  handle)
inlinestatic

Gets the speed controller constant.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The speed controller constant, Wb/(kg*m^2)

References _CTRL_Obj_::Kctrl_Wb_p_kgm2.

◆ CTRL_getVd_sf()

static float32_t CTRL_getVd_sf ( CTRL_Handle  handle)
inlinestatic

Gets the direct voltage scale factor.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct voltage scale factor

References _CTRL_Obj_::Vd_sf.

Referenced by CTRL_computeOutputLimits_Id().

◆ CTRL_getMaxVsMag_V()

static float32_t CTRL_getMaxVsMag_V ( CTRL_Handle  handle)
inlinestatic

Gets the maximum stator voltage magnitude value.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The maximum stator voltage magnitude value, V

References _CTRL_Obj_::maxVsMag_V.

Referenced by CTRL_computeOutputLimits_Id(), and CTRL_computeOutputLimits_Iq().

◆ CTRL_computeOutputLimits_Id()

static void CTRL_computeOutputLimits_Id ( CTRL_Handle  handle,
float32_t outMin,
float32_t outMax 
)
inlinestatic

Computes the Id controller output limits.

Parameters
[in]handleThe controller (CTRL) handle
[in]outMinThe pointer to the minimum output value
[in]outMaxThe pointer to the maximum output value

References CTRL_getMaxVsMag_V(), and CTRL_getVd_sf().

Referenced by CTRL_run().

◆ CTRL_computeOutputLimits_Iq()

static void CTRL_computeOutputLimits_Iq ( CTRL_Handle  handle,
const float32_t  Vd_out_V,
float32_t outMin,
float32_t outMax 
)
inlinestatic

Computes the Iq controller output limits.

Parameters
[in]handleThe controller (CTRL) handle
[in]Vd_out_VThe Vd output voltage value, V
[in]outMinThe pointer to the minimum output value
[in]outMaxThe pointer to the maximum output value

References CTRL_getMaxVsMag_V().

Referenced by CTRL_run().

◆ CTRL_getCount_current()

static int16_t CTRL_getCount_current ( CTRL_Handle  handle)
inlinestatic

Gets the current loop count.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The current loop count

References _CTRL_Obj_::counter_current.

Referenced by CTRL_run().

◆ CTRL_getCount_isr()

static int16_t CTRL_getCount_isr ( CTRL_Handle  handle)
inlinestatic

Gets the isr count.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The isr count

References _CTRL_Obj_::counter_isr.

◆ CTRL_getCount_speed()

static int16_t CTRL_getCount_speed ( CTRL_Handle  handle)
inlinestatic

Gets the speed loop count.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The speed loop count

References _CTRL_Obj_::counter_speed.

Referenced by CTRL_run().

◆ CTRL_getCount_state()

static int32_t CTRL_getCount_state ( CTRL_Handle  handle)
inlinestatic

Gets the state count.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The state count

References _CTRL_Obj_::counter_state.

◆ CTRL_getCtrlFreq_Hz()

static float32_t CTRL_getCtrlFreq_Hz ( CTRL_Handle  handle)
inlinestatic

Gets the controller execution frequency.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The controller execution frequency, Hz

References _CTRL_Obj_::ctrlFreq_Hz.

◆ CTRL_getCurrentCtrlPeriod_sec()

static float32_t CTRL_getCurrentCtrlPeriod_sec ( CTRL_Handle  handle)
inlinestatic

Gets the current controller period.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The current controller period, sec

References _CTRL_Obj_::currentCtrlPeriod_sec.

◆ CTRL_getCtrlPeriod_sec()

static float32_t CTRL_getCtrlPeriod_sec ( CTRL_Handle  handle)
inlinestatic

Gets the controller execution period.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The controller execution period, sec

References _CTRL_Obj_::ctrlPeriod_sec.

◆ CTRL_getErrorCode()

static CTRL_ErrorCode_e CTRL_getErrorCode ( CTRL_Handle  handle)
inlinestatic

Gets the error code from the controller (CTRL) object.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The error code

References _CTRL_Obj_::errorCode.

◆ CTRL_getFlag_enable()

static bool CTRL_getFlag_enable ( CTRL_Handle  handle)
inlinestatic

Gets the enable controller flag value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The enable controller flag value

References _CTRL_Obj_::flag_enable.

◆ CTRL_getFlag_enableCurrentCtrl()

static bool CTRL_getFlag_enableCurrentCtrl ( CTRL_Handle  handle)
inlinestatic

Gets the enable current controllers flag value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The enable current controller flag value

References _CTRL_Obj_::flag_enableCurrentCtrl.

Referenced by CTRL_run().

◆ CTRL_getFlag_enableSpeedCtrl()

static bool CTRL_getFlag_enableSpeedCtrl ( CTRL_Handle  handle)
inlinestatic

Gets the enable speed control flag value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The enable speed control flag value

References _CTRL_Obj_::flag_enableSpeedCtrl.

Referenced by CTRL_run().

◆ CTRL_getFlag_resetInt_Id()

static bool CTRL_getFlag_resetInt_Id ( CTRL_Handle  handle)
inlinestatic

Gets the reset Id integrator flag value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The reset Id integrator flag value

References _CTRL_Obj_::flag_resetInt_Id.

Referenced by CTRL_setup().

◆ CTRL_getFlag_resetInt_Iq()

static bool CTRL_getFlag_resetInt_Iq ( CTRL_Handle  handle)
inlinestatic

Gets the reset Iq integrator flag value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The reset Iq integrator flag value

References _CTRL_Obj_::flag_resetInt_Iq.

Referenced by CTRL_setup().

◆ CTRL_getFlag_resetInt_spd()

static bool CTRL_getFlag_resetInt_spd ( CTRL_Handle  handle)
inlinestatic

Gets the reset speed integrator flag value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The reset speed integrator flag value

References _CTRL_Obj_::flag_resetInt_spd.

Referenced by CTRL_setup().

◆ CTRL_getFlag_useZeroIq_ref()

static bool CTRL_getFlag_useZeroIq_ref ( CTRL_Handle  handle)
inlinestatic

Gets the use zero Iq reference flag value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The use zero Iq reference flag value

References _CTRL_Obj_::flag_useZeroIq_ref.

Referenced by CTRL_run().

◆ CTRL_getId_A()

static float32_t CTRL_getId_A ( CTRL_Handle  handle)
inlinestatic

Gets the direct current (Id) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct current value, A

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

Referenced by CTRL_run().

◆ CTRL_getId_A_addr()

static float32_t* CTRL_getId_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct current (Id) memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct current memory address

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

◆ CTRL_getId_offset_A()

static float32_t CTRL_getId_offset_A ( CTRL_Handle  handle)
inlinestatic

Gets the direct offset current (Id_offset) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct current offset value, A

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

Referenced by CTRL_run().

◆ CTRL_getId_offset_A_addr()

static float32_t* CTRL_getId_offset_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct offset current (Id_offset) memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct offset current memory address

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

◆ CTRL_getId_ref_A()

static float32_t CTRL_getId_ref_A ( CTRL_Handle  handle)
inlinestatic

Gets the direct reference current (Id_ref) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct current reference value, A

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

◆ CTRL_getId_ref_A_addr()

static float32_t* CTRL_getId_ref_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct reference current (Id_ref) memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct current reference memory address

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

◆ CTRL_getIdq_A()

static void CTRL_getIdq_A ( CTRL_Handle  handle,
MATH_Vec2 pIdq_A 
)
inlinestatic

Gets the direct/quadrature current vector values from the controller.

Parameters
[in]handleThe controller (CTRL) handle
[out]pIdq_AThe vector for the direct/quadrature current vector values, A

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

◆ CTRL_getIdq_A_addr()

static MATH_Vec2* CTRL_getIdq_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct/quadrature current (Idq) vector memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct/quadrature current vector memory address

References _CTRL_Obj_::Idq_A.

◆ CTRL_getIdq_offset_A()

static void CTRL_getIdq_offset_A ( CTRL_Handle  handle,
MATH_Vec2 pIdq_offset_A 
)
inlinestatic

Gets the direct/quadrature offset current (Idq_offset) vector values from the controller.

Parameters
[in]handleThe controller (CTRL) handle
[out]pIdq_offset_AThe vector for the direct/quadrature offset current vector values, A

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

◆ CTRL_getIdq_offset_A_addr()

static MATH_Vec2* CTRL_getIdq_offset_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct/quadrature offset current (Idq_offset) vector memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct/quadrature offset current vector memory address

References _CTRL_Obj_::Idq_offset_A.

◆ CTRL_getIdq_ref_A()

static void CTRL_getIdq_ref_A ( CTRL_Handle  handle,
MATH_Vec2 pIdq_ref_A 
)
inlinestatic

Gets the direct/quadrature reference current (Idq_ref) vector values from the controller.

Parameters
[in]handleThe controller (CTRL) handle
[out]pIdq_ref_AThe vector for the direct/quadrature reference current vector values, A

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

◆ CTRL_getIdq_ref_A_addr()

static MATH_Vec2* CTRL_getIdq_ref_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct/quadrature reference current (Idq_ref) vector memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct/quadrature reference current vector memory address

References _CTRL_Obj_::Idq_ref_A.

◆ CTRL_getIq_A()

static float32_t CTRL_getIq_A ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature current (Iq) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature current value, A

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

Referenced by CTRL_run().

◆ CTRL_getIq_A_addr()

static float32_t* CTRL_getIq_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature current (Iq) memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature current memory address

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

◆ CTRL_getIq_offset_A()

static float32_t CTRL_getIq_offset_A ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature offset current (Iq_offset) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature current offset value, A

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

Referenced by CTRL_run().

◆ CTRL_getIq_offset_A_addr()

static float32_t* CTRL_getIq_offset_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature offset current (Iq_offset) memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature offset current memory address

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

◆ CTRL_getIq_ref_A()

static float32_t CTRL_getIq_ref_A ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature reference current (Iq_ref) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature reference current value, A

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

◆ CTRL_getIq_ref_A_addr()

static float32_t* CTRL_getIq_ref_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature reference current (Iq_ref) memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature reference current memory address

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

◆ CTRL_getKi()

static float32_t CTRL_getKi ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType 
)
inlinestatic

Gets the integral gain (Ki) value from the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlTypeThe controller type
Returns
The Ki value

References CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, _CTRL_Obj_::Ki_Id, _CTRL_Obj_::Ki_Iq, and _CTRL_Obj_::Ki_spd_ApHz.

Referenced by CTRL_getGains(), and CTRL_setup().

◆ CTRL_getKp()

static float32_t CTRL_getKp ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType 
)
inlinestatic

Gets the proportional gain (Kp) value from the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlTypeThe controller type
Returns
The Kp value

References CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, _CTRL_Obj_::Kp_Id_VpA, _CTRL_Obj_::Kp_Iq_VpA, and _CTRL_Obj_::Kp_spd_ApHz.

Referenced by CTRL_getGains(), and CTRL_setup().

◆ CTRL_getGains()

static void CTRL_getGains ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType,
float32_t pKp,
float32_t pKi 
)
inlinestatic

Gets the gain values for the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlTypeThe controller type
[in]pKpThe pointer for the Kp value
[in]pKiThe pointer for the Ki value

References CTRL_getKi(), and CTRL_getKp().

◆ CTRL_getMotorType()

static MOTOR_Type_e CTRL_getMotorType ( CTRL_Handle  handle)
inlinestatic

Gets the motor type.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The motor type

References _CTRL_Obj_::motorParams, and _MOTOR_Params_::type.

◆ CTRL_getNumCtrlTicksPerCurrentTick()

static int16_t CTRL_getNumCtrlTicksPerCurrentTick ( CTRL_Handle  handle)
inlinestatic

Gets the number of controller clock ticks per current controller clock tick.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The number of controller clock ticks per controller clock tick

References _CTRL_Obj_::numCtrlTicksPerCurrentTick.

Referenced by CTRL_run().

◆ CTRL_getNumCtrlTicksPerSpeedTick()

static int16_t CTRL_getNumCtrlTicksPerSpeedTick ( CTRL_Handle  handle)
inlinestatic

Gets the number of controller clock ticks per speed controller clock tick.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The number of controller clock ticks per speed clock tick

References _CTRL_Obj_::numCtrlTicksPerSpeedTick.

Referenced by CTRL_run().

◆ CTRL_getNumIsrTicksPerCtrlTick()

static int16_t CTRL_getNumIsrTicksPerCtrlTick ( CTRL_Handle  handle)
inlinestatic

Gets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The number of Interrupt Service Routine (ISR) clock ticks per controller clock tick

References _CTRL_Obj_::numIsrTicksPerCtrlTick.

◆ CTRL_getRefValue()

static float32_t CTRL_getRefValue ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType 
)
inlinestatic

Gets the reference value from the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlTypeThe controller type
Returns
The reference value

References CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, PI_getRefValue(), _CTRL_Obj_::piHandle_Id, _CTRL_Obj_::piHandle_Iq, and _CTRL_Obj_::piHandle_spd.

◆ CTRL_getSpeed_fb_Hz()

static float32_t CTRL_getSpeed_fb_Hz ( CTRL_Handle  handle)
inlinestatic

Gets the feedback speed value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The feedback speed value, Hz

References _CTRL_Obj_::speed_fb_Hz.

Referenced by CTRL_run().

◆ CTRL_getSpeed_out_A()

static float32_t CTRL_getSpeed_out_A ( CTRL_Handle  handle)
inlinestatic

Gets the output value from the speed controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The output value, A

References _CTRL_Obj_::speed_out_A.

Referenced by CTRL_run().

◆ CTRL_getSpeed_out_A_addr()

static float32_t* CTRL_getSpeed_out_A_addr ( CTRL_Handle  handle)
inlinestatic

Gets the output value memory address from the speed controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The output value memory address

References _CTRL_Obj_::speed_out_A.

Referenced by CTRL_run().

◆ CTRL_getSpeed_outMax_A()

static float32_t CTRL_getSpeed_outMax_A ( CTRL_Handle  handle)
inlinestatic

Gets the maximum value for the speed controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The maximum output value, A

References _CTRL_Obj_::speed_outMax_A.

Referenced by CTRL_run().

◆ CTRL_getSpeed_outMin_A()

static float32_t CTRL_getSpeed_outMin_A ( CTRL_Handle  handle)
inlinestatic

Gets the minimum value for the speed controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The minimum output value, A

References _CTRL_Obj_::speed_outMin_A.

Referenced by CTRL_run().

◆ CTRL_getSpeed_ref_Hz()

static float32_t CTRL_getSpeed_ref_Hz ( CTRL_Handle  handle)
inlinestatic

Gets the output speed reference value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The output speed reference value, Hz

References _CTRL_Obj_::speed_ref_Hz.

Referenced by CTRL_run().

◆ CTRL_getSpeedCtrlPeriod_sec()

static float32_t CTRL_getSpeedCtrlPeriod_sec ( CTRL_Handle  handle)
inlinestatic

Gets the speed controller period.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The speed controller period, sec

References _CTRL_Obj_::speedCtrlPeriod_sec.

◆ CTRL_getState()

static CTRL_State_e CTRL_getState ( CTRL_Handle  handle)
inlinestatic

Gets the controller state.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The controller state

References _CTRL_Obj_::state.

Referenced by CTRL_isError(), CTRL_isIdle(), and CTRL_isNotIdle().

◆ CTRL_getUi()

static float32_t CTRL_getUi ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType 
)
inlinestatic

Gets the integrator (Ui) value from the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The Ui value

References CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, _CTRL_Obj_::Ui_Id_V, _CTRL_Obj_::Ui_Iq_V, and _CTRL_Obj_::Ui_spd_A.

Referenced by CTRL_setup().

◆ CTRL_getVd_V()

static float32_t CTRL_getVd_V ( CTRL_Handle  handle)
inlinestatic

Gets the direct voltage (Vd) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct voltage value, V

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_V.

◆ CTRL_getVd_V_addr()

static float32_t* CTRL_getVd_V_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct voltage (Vd) value memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct voltage value memory address

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_V.

◆ CTRL_getVd_offset_V()

static float32_t CTRL_getVd_offset_V ( CTRL_Handle  handle)
inlinestatic

Gets the direct offset voltage (Vd_offset) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct voltage offset value, V

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_offset_V.

Referenced by CTRL_run().

◆ CTRL_getVd_offset_V_addr()

static float32_t* CTRL_getVd_offset_V_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct offset voltage (Vd_offset) value memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct offset voltage value memory address

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_offset_V.

◆ CTRL_getVdq_V()

static void CTRL_getVdq_V ( CTRL_Handle  handle,
MATH_Vec2 pVdq_V 
)
inlinestatic

Gets the direct/quadrature voltage (Vdq) vector values from the controller.

Parameters
[in]handleThe controller (CTRL) handle
[out]pVdq_The vector for the direct/quadrature voltage vector values, V

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_V.

Referenced by CTRL_run().

◆ CTRL_getVdq_V_addr()

static MATH_Vec2* CTRL_getVdq_V_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct/quadrature voltage (Vdq) vector memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct/quadrature voltage vector memory address

References _CTRL_Obj_::Vdq_V.

◆ CTRL_getVdq_offset_V()

static void CTRL_getVdq_offset_V ( CTRL_Handle  handle,
MATH_Vec2 pVdq_offset_V 
)
inlinestatic

Gets the direct/quadrature offset voltage (Vdq_offset) vector values from the controller.

Parameters
[in]handleThe controller (CTRL) handle
[out]pVdq_offset_VThe vector for the direct/quadrature offset voltage vector values, V

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_offset_V.

◆ CTRL_getVdq_offset_V_addr()

static MATH_Vec2* CTRL_getVdq_offset_V_addr ( CTRL_Handle  handle)
inlinestatic

Gets the direct/quadrature offset voltage (Vdq_offset) vector memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The direct/quadrature offset voltage vector memory address

References _CTRL_Obj_::Vdq_offset_V.

◆ CTRL_getVersion()

void CTRL_getVersion ( CTRL_Handle  handle,
CTRL_Version pVersion 
)

Gets the controller version number.

Parameters
[in]handleThe controller (CTRL) handle
[in]pVersionA pointer to the version

◆ CTRL_getVq_V()

static float32_t CTRL_getVq_V ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature voltage (Vq) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature voltage value, pu

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_V.

◆ CTRL_getVq_V_addr()

static float32_t* CTRL_getVq_V_addr ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature voltage (Vq) value memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature voltage value memory address

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_V.

◆ CTRL_getVq_offset_V()

static float32_t CTRL_getVq_offset_V ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature offset voltage (Vq_offset) value from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature voltage offset value, V

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_offset_V.

Referenced by CTRL_run().

◆ CTRL_getVq_offset_V_addr()

static float32_t* CTRL_getVq_offset_V_addr ( CTRL_Handle  handle)
inlinestatic

Gets the quadrature offset voltage (Vq_offset) value memory address from the controller.

Parameters
[in]handleThe controller (CTRL) handle
Returns
The quadrature voltage value memory address

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_offset_V.

◆ CTRL_getWaitTime()

static int32_t CTRL_getWaitTime ( CTRL_Handle  handle,
const CTRL_State_e  state 
)
inlinestatic

Gets the wait time for a given state.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe controller state
Returns
The wait time, controller clock counts

References _CTRL_Obj_::waitTimes.

◆ CTRL_getWaitTimes()

void CTRL_getWaitTimes ( CTRL_Handle  handle,
int32_t *  pWaitTimes 
)

Gets the wait times from the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]pWaitTimesA pointer to a vector for the wait times, isr clock counts

◆ CTRL_incrCounter_current()

static void CTRL_incrCounter_current ( CTRL_Handle  handle)
inlinestatic

Increments the current counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_current.

Referenced by CTRL_setup().

◆ CTRL_incrCounter_isr()

static void CTRL_incrCounter_isr ( CTRL_Handle  handle)
inlinestatic

Increments the isr counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_isr.

◆ CTRL_incrCounter_speed()

static void CTRL_incrCounter_speed ( CTRL_Handle  handle)
inlinestatic

Increments the speed counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_speed.

Referenced by CTRL_setup().

◆ CTRL_incrCounter_state()

static void CTRL_incrCounter_state ( CTRL_Handle  handle)
inlinestatic

Increments the state counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_state.

Referenced by CTRL_run().

◆ CTRL_init()

CTRL_Handle CTRL_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the controller.

Parameters
[in]pMemoryA pointer to the memory for the controller object
[in]numBytesThe number of bytes allocated for the controller object, bytes
Returns
The controller (CTRL) object handle

◆ CTRL_isEnabled()

static bool CTRL_isEnabled ( CTRL_Handle  handle)
inlinestatic

Determines if the controller is enabled.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::flag_enable.

◆ CTRL_isError()

static bool CTRL_isError ( CTRL_Handle  handle)
inlinestatic

Determines if there is a controller error.

Parameters
[in]handleThe controller (CTRL) handle
Returns
A boolean value denoting if there is a controller error (true) or not (false)

References CTRL_getState(), and CTRL_STATE_ERROR.

◆ CTRL_isIdle()

static bool CTRL_isIdle ( CTRL_Handle  handle)
inlinestatic

Determines if the controller is in the idle state.

Parameters
[in]handleThe controller (CTRL) handle
Returns
A boolean value denoting if the controller is in the idle state (true) or not (false)

References CTRL_getState(), and CTRL_STATE_IDLE.

◆ CTRL_isNotIdle()

static bool CTRL_isNotIdle ( CTRL_Handle  handle)
inlinestatic

Determines if the controller is not in the idle state.

Parameters
[in]handleThe controller (CTRL) handle
Returns
A boolean value denoting if the controller is in the idle state (false) or not (true)

References CTRL_getState(), and CTRL_STATE_IDLE.

◆ CTRL_reset()

void CTRL_reset ( CTRL_Handle  handle)

Resets the controller.

Parameters
[in]handleThe controller (CTRL) handle

◆ CTRL_resetCounter_current()

static void CTRL_resetCounter_current ( CTRL_Handle  handle)
inlinestatic

Resets the current counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_current.

Referenced by CTRL_run().

◆ CTRL_resetCounter_isr()

static void CTRL_resetCounter_isr ( CTRL_Handle  handle)
inlinestatic

Resets the isr counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_isr.

◆ CTRL_resetCounter_speed()

static void CTRL_resetCounter_speed ( CTRL_Handle  handle)
inlinestatic

Resets the speed counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_speed.

Referenced by CTRL_run().

◆ CTRL_resetCounter_state()

static void CTRL_resetCounter_state ( CTRL_Handle  handle)
inlinestatic

Resets the state counter.

Parameters
[in]handleThe controller (CTRL) handle

References _CTRL_Obj_::counter_state.

◆ CTRL_setBWc_rps()

static void CTRL_setBWc_rps ( CTRL_Handle  handle,
const float32_t  BWc_rps 
)
inlinestatic

Sets the current controller bandwidth.

Parameters
[in]handleThe controller (CTRL) handle
[in]BWc_rpsThe current controller bandwidth, rad/sec

References _CTRL_Obj_::BWc_rps.

◆ CTRL_setBWdelta()

static void CTRL_setBWdelta ( CTRL_Handle  handle,
const float32_t  BWdelta 
)
inlinestatic

Sets the bandwidth scale factor used to maximize phase margin.

Parameters
[in]handleThe controller (CTRL) handle
[in]BWdeltaThe bandwidth scale factor

References _CTRL_Obj_::BWdelta.

◆ CTRL_setCtrlFreq_Hz()

static void CTRL_setCtrlFreq_Hz ( CTRL_Handle  handle,
const float32_t  ctrlFreq_Hz 
)
inlinestatic

Sets the controller frequency.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlFreq_HzThe controller frequency, Hz

References _CTRL_Obj_::ctrlFreq_Hz.

◆ CTRL_setCtrlPeriod_sec()

static void CTRL_setCtrlPeriod_sec ( CTRL_Handle  handle,
const float32_t  ctrlPeriod_sec 
)
inlinestatic

Sets the controller execution period.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlPeriod_secThe controller execution period, sec

References _CTRL_Obj_::ctrlPeriod_sec.

◆ CTRL_setCurrentCtrlPeriod_sec()

static void CTRL_setCurrentCtrlPeriod_sec ( CTRL_Handle  handle,
const float32_t  currentCtrlPeriod_sec 
)
inlinestatic

Sets the current controller period value.

Parameters
[in]handleThe controller (CTRL) handle
[in]currentCtrlPeriod_secThe current controller period value, sec

References _CTRL_Obj_::currentCtrlPeriod_sec.

◆ CTRL_setErrorCode()

static void CTRL_setErrorCode ( CTRL_Handle  handle,
const CTRL_ErrorCode_e  errorCode 
)
inlinestatic

Sets the error code in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]errorCodeThe error code

References _CTRL_Obj_::errorCode.

◆ CTRL_setFlag_enable()

static void CTRL_setFlag_enable ( CTRL_Handle  handle,
const bool  state 
)
inlinestatic

Sets the enable controller flag value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe desired state

References _CTRL_Obj_::flag_enable.

◆ CTRL_setFlag_enableCurrentCtrl()

static void CTRL_setFlag_enableCurrentCtrl ( CTRL_Handle  handle,
const bool  state 
)
inlinestatic

Sets the enable current controllers flag value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe desired state

References _CTRL_Obj_::flag_enableCurrentCtrl.

Referenced by CTRL_setup().

◆ CTRL_setFlag_enableSpeedCtrl()

static void CTRL_setFlag_enableSpeedCtrl ( CTRL_Handle  handle,
const bool  state 
)
inlinestatic

Sets the enable speed control value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe desired state

References _CTRL_Obj_::flag_enableSpeedCtrl.

Referenced by CTRL_setup().

◆ CTRL_setFlag_resetInt_Id()

static void CTRL_setFlag_resetInt_Id ( CTRL_Handle  handle,
const bool  state 
)
inlinestatic

Sets the reset Id integrator flag value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe desired state

References _CTRL_Obj_::flag_resetInt_Id.

Referenced by CTRL_setUi(), and CTRL_setup().

◆ CTRL_setFlag_resetInt_Iq()

static void CTRL_setFlag_resetInt_Iq ( CTRL_Handle  handle,
const bool  state 
)
inlinestatic

Sets the reset Iq integrator flag value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe desired state

References _CTRL_Obj_::flag_resetInt_Iq.

Referenced by CTRL_setUi(), and CTRL_setup().

◆ CTRL_setFlag_resetInt_spd()

static void CTRL_setFlag_resetInt_spd ( CTRL_Handle  handle,
const bool  state 
)
inlinestatic

Sets the reset speed integrator flag value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe desired state

References _CTRL_Obj_::flag_resetInt_spd.

Referenced by CTRL_setUi(), and CTRL_setup().

◆ CTRL_setFlag_useZeroIq_ref()

static void CTRL_setFlag_useZeroIq_ref ( CTRL_Handle  handle,
const bool  state 
)
inlinestatic

Sets the use zero Iq reference flag value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe desired state

References _CTRL_Obj_::flag_useZeroIq_ref.

Referenced by CTRL_setup().

◆ CTRL_setId_A()

static void CTRL_setId_A ( CTRL_Handle  handle,
const float32_t  Id_A 
)
inlinestatic

Sets the direct current (Id) value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]Id_AThe direct current value, A

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

◆ CTRL_setId_offset_A()

static void CTRL_setId_offset_A ( CTRL_Handle  handle,
const float32_t  Id_offset_A 
)
inlinestatic

Sets the direct current (Id) offset value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]Id_offset_AThe direct current offset value, A

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

◆ CTRL_setId_ref_A()

static void CTRL_setId_ref_A ( CTRL_Handle  handle,
const float32_t  Id_ref_A 
)
inlinestatic

Sets the direct current (Id) reference value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]Id_ref_AThe direct current reference value, A

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

Referenced by CTRL_run().

◆ CTRL_setIdq_A()

static void CTRL_setIdq_A ( CTRL_Handle  handle,
const MATH_Vec2 pIdq_A 
)
inlinestatic

Sets the direct/quadrature current (Idq) vector values in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]pIdq_in_AThe vector of the direct/quadrature current vector values, A

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

Referenced by CTRL_setup().

◆ CTRL_setIdq_offset_A()

static void CTRL_setIdq_offset_A ( CTRL_Handle  handle,
const MATH_Vec2 pIdq_offset_A 
)
inlinestatic

Sets the direct/quadrature current (Idq) offset vector values in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]pIdq_offset_AThe vector of the direct/quadrature current offset vector values, A

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

Referenced by CTRL_setup().

◆ CTRL_setIdq_ref_A()

static void CTRL_setIdq_ref_A ( CTRL_Handle  handle,
const MATH_Vec2 pIdq_ref_A 
)
inlinestatic

Sets the direct/quadrature current (Idq) reference vector values in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]pIdq_ref_AThe vector of the direct/quadrature current reference vector values, A

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

◆ CTRL_setIq_A()

static void CTRL_setIq_A ( CTRL_Handle  handle,
const float32_t  Iq_A 
)
inlinestatic

Sets the quadrature current (Iq) value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]Id_AThe direct current value, A

References _CTRL_Obj_::Idq_A, and _MATH_Vec2_::value.

◆ CTRL_setIq_offset_pu()

static void CTRL_setIq_offset_pu ( CTRL_Handle  handle,
const float32_t  Iq_offset_A 
)
inlinestatic

Sets the quadrature current (Iq) offset value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]Iq_offset_AThe quadrature current reference value, A

References _CTRL_Obj_::Idq_offset_A, and _MATH_Vec2_::value.

◆ CTRL_setIq_ref_A()

static void CTRL_setIq_ref_A ( CTRL_Handle  handle,
const float32_t  Iq_ref_A 
)
inlinestatic

Sets the quadrature current (Iq) reference value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]Iq_ref_AThe quadrature current reference value, A

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

Referenced by CTRL_run().

◆ CTRL_setKctrl_Wb_p_kgm2()

static void CTRL_setKctrl_Wb_p_kgm2 ( CTRL_Handle  handle,
const float32_t  Kctrl_Wb_p_kgm2 
)
inlinestatic

Sets the speed controller constant.

Parameters
[in]handleThe controller (CTRL) handle
[in]Kctrl_Wb_p_kgm2The speed controller constant, Wb/(kg*m^2)

References _CTRL_Obj_::Kctrl_Wb_p_kgm2.

◆ CTRL_setKi()

static void CTRL_setKi ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType,
const float32_t  Ki 
)
inlinestatic

Sets the integral gain (Ki) value for the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlTypeThe controller type
[in]KiThe Ki value

References CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, _CTRL_Obj_::Ki_Id, _CTRL_Obj_::Ki_Iq, and _CTRL_Obj_::Ki_spd_ApHz.

Referenced by CTRL_setGains().

◆ CTRL_setKp()

static void CTRL_setKp ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType,
const float32_t  Kp 
)
inlinestatic

Sets the proportional gain (Kp) value for the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlTypeThe controller type
[in]KpThe Kp value

References CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, _CTRL_Obj_::Kp_Id_VpA, _CTRL_Obj_::Kp_Iq_VpA, and _CTRL_Obj_::Kp_spd_ApHz.

Referenced by CTRL_setGains().

◆ CTRL_setGains()

static void CTRL_setGains ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType,
const float32_t  Kp,
const float32_t  Ki 
)
inlinestatic

Sets the gain values for the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]ctrlTypeThe controller type
[in]KpThe Kp gain value, pu
[in]KiThe Ki gain value, pu

References CTRL_setKi(), and CTRL_setKp().

◆ CTRL_setMaxVsMag_V()

static void CTRL_setMaxVsMag_V ( CTRL_Handle  handle,
const float32_t  maxVsMag_V 
)
inlinestatic

Sets the maximum stator voltage magnitude value.

Parameters
[in]handleThe controller (CTRL) handle
[in]maxVsMax_VThe maximum stator voltage magnitude value, V

References _CTRL_Obj_::maxVsMag_V.

◆ CTRL_setMotorParams()

static void CTRL_setMotorParams ( CTRL_Handle  handle,
const MOTOR_Type_e  motorType,
const uint16_t  numPolePairs,
const float32_t  ratedFlux_Wb,
const float32_t  Ls_d_H,
const float32_t  Ls_q_H,
const float32_t  Rs_d_Ohm,
const float32_t  Rs_q_Ohm,
const float32_t  Rr_d_Ohm,
const float32_t  Rr_q_Ohm 
)
inlinestatic

Sets the parameters for the motor in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]motorTypeThe motor type
[in]numPolePairsThe number of motor pole pairs
[in]ratedFlux_WbThe rated flux value, Wb
[in]Ls_d_HThe direct stator inductance, Henry
[in]Ls_q_HThe quadrature stator inductance, Henry
[in]Rs_d_OhmThe direct stator resitance, Ohm
[in]Rs_q_OhmThe quadrature stator resitance, Ohm
[in]Rr_d_OhmThe direct rotor resistance, Ohm
[in]Rr_q_OhmThe quadrature rotor resistance, Ohm

References _MOTOR_Params_::Ls_d_H, _MOTOR_Params_::Ls_q_H, _CTRL_Obj_::motorParams, _MOTOR_Params_::numPolePairs, _MOTOR_Params_::ratedFlux_Wb, _MOTOR_Params_::Rr_d_Ohm, _MOTOR_Params_::Rr_q_Ohm, _MOTOR_Params_::Rs_d_Ohm, _MOTOR_Params_::Rs_q_Ohm, and _MOTOR_Params_::type.

◆ CTRL_setNumCtrlTicksPerCurrentTick()

static void CTRL_setNumCtrlTicksPerCurrentTick ( CTRL_Handle  handle,
const int16_t  numCtrlTicksPerCurrentTick 
)
inlinestatic

Sets the number of controller clock ticks per current controller clock tick.

Parameters
[in]handleThe controller (CTRL) handle
[in]numCtrlTicksPerCurrentTickThe number of controller clock ticks per current controller clock tick

References _CTRL_Obj_::numCtrlTicksPerCurrentTick.

◆ CTRL_setNumCtrlTicksPerSpeedTick()

static void CTRL_setNumCtrlTicksPerSpeedTick ( CTRL_Handle  handle,
const int16_t  numCtrlTicksPerSpeedTick 
)
inlinestatic

Sets the number of controller clock ticks per speed controller clock tick.

Parameters
[in]handleThe controller (CTRL) handle
[in]numCtrlTicksPerSpeedTickThe number of controller clock ticks per speed clock tick

References _CTRL_Obj_::numCtrlTicksPerSpeedTick.

◆ CTRL_setNumIsrTicksPerCtrlTick()

static void CTRL_setNumIsrTicksPerCtrlTick ( CTRL_Handle  handle,
const int16_t  numIsrTicksPerCtrlTick 
)
inlinestatic

Sets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick.

Parameters
[in]handleThe controller (CTRL) handle
[in]numIsrTicksPerCtrlTickThe number of Interrupt Service Routine (ISR) clock ticks per controller clock tick

References _CTRL_Obj_::numIsrTicksPerCtrlTick.

◆ CTRL_setParams()

void CTRL_setParams ( CTRL_Handle  handle,
USER_Params pUserParams 
)

Sets the controller parameters.

Parameters
[in]handleThe controller (CTRL) handle
[in]pUserParamsThe pointer to the user parameters

◆ CTRL_setSpeed_fb_Hz()

static void CTRL_setSpeed_fb_Hz ( CTRL_Handle  handle,
const float32_t  speed_fb_Hz 
)
inlinestatic

Sets the feedback speed value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]speed_fb_HzThe feedback speed value, Hz

References _CTRL_Obj_::speed_fb_Hz.

Referenced by CTRL_setup().

◆ CTRL_setSpeed_out_A()

static void CTRL_setSpeed_out_A ( CTRL_Handle  handle,
const float32_t  speed_out_A 
)
inlinestatic

Sets the maximum output value for the speed controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]speed_out_AThe output value from the speed controller

References _CTRL_Obj_::speed_out_A.

Referenced by CTRL_run().

◆ CTRL_setSpeed_outMax_A()

static void CTRL_setSpeed_outMax_A ( CTRL_Handle  handle,
const float32_t  speed_outMax_A 
)
inlinestatic

Sets the maximum output value for the speed controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]speed_outMax_AThe maximum speed value, A

References _CTRL_Obj_::speed_outMax_A.

◆ CTRL_setSpeed_outMin_A()

static void CTRL_setSpeed_outMin_A ( CTRL_Handle  handle,
const float32_t  speed_outMin_A 
)
inlinestatic

Sets the minimum output value for the speed controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]speed_outMin_AThe minimum speed value, A

References _CTRL_Obj_::speed_outMin_A.

◆ CTRL_setSpeed_ref_Hz()

static void CTRL_setSpeed_ref_Hz ( CTRL_Handle  handle,
const float32_t  speed_ref_Hz 
)
inlinestatic

Sets the output speed reference value in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]speed_ref_HzThe output speed reference value, Hz

References _CTRL_Obj_::speed_ref_Hz.

Referenced by CTRL_setup().

◆ CTRL_setSpeedCtrlPeriod_sec()

static void CTRL_setSpeedCtrlPeriod_sec ( CTRL_Handle  handle,
const float32_t  speedCtrlPeriod_sec 
)
inlinestatic

Sets the speed controller period value.

Parameters
[in]handleThe controller (CTRL) handle
[in]speedCtrlPeriod_secThe speed controller period value, sec

References _CTRL_Obj_::speedCtrlPeriod_sec.

◆ CTRL_setState()

static void CTRL_setState ( CTRL_Handle  handle,
const CTRL_State_e  state 
)
inlinestatic

Sets the controller state.

Parameters
[in]handleThe controller (CTRL) handle
[in]stateThe new state

References _CTRL_Obj_::prevState, and _CTRL_Obj_::state.

◆ CTRL_setUi()

static void CTRL_setUi ( CTRL_Handle  handle,
const CTRL_Type_e  ctrlType,
const float32_t  Ui 
)
inlinestatic

Sets the integrator (Ui) value in the specified controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]UiThe Ui value

References CTRL_setFlag_resetInt_Id(), CTRL_setFlag_resetInt_Iq(), CTRL_setFlag_resetInt_spd(), CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, _CTRL_Obj_::Ui_Id_V, _CTRL_Obj_::Ui_Iq_V, and _CTRL_Obj_::Ui_spd_A.

◆ CTRL_setVd_sf()

static void CTRL_setVd_sf ( CTRL_Handle  handle,
const float32_t  Vd_sf 
)
inlinestatic

Sets the direct voltage scale factor.

Parameters
[in]handleThe controller (CTRL) handle
[in]Vd_sfThe direct voltage scale factor

References _CTRL_Obj_::Vd_sf.

◆ CTRL_setVdq_V()

static void CTRL_setVdq_V ( CTRL_Handle  handle,
const MATH_Vec2 pVdq_V 
)
inlinestatic

Sets the direct/quadrature voltage (Vdq) vector values in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]pVdq_VThe vector of direct/quadrature voltage vector values, V

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_V.

Referenced by CTRL_run().

◆ CTRL_setVdq_offset_V()

static void CTRL_setVdq_offset_V ( CTRL_Handle  handle,
const MATH_Vec2 pVdq_offset_V 
)
inlinestatic

Sets the direct/quadrature offset voltage (Vdq_offset) vector values in the controller.

Parameters
[in]handleThe controller (CTRL) handle
[in]pVdq_offset_VThe vector of direct/quadrature offset voltage vector values, V

References _MATH_Vec2_::value, and _CTRL_Obj_::Vdq_offset_V.

Referenced by CTRL_setup().

◆ CTRL_setVersion()

void CTRL_setVersion ( CTRL_Handle  handle,
const CTRL_TargetProc_e  targetProc,
const uint16_t  majorReleaseNumber,
const uint16_t  minorReleaseNumber 
)

Sets the controller version.

Parameters
[in]handleThe controller (CTRL) handle
[in]targetProcThe target processor
[in]majorReleaseNumberThe major release number
[in]minorReleaseNumberThe minor release number

◆ CTRL_setWaitTimes()

void CTRL_setWaitTimes ( CTRL_Handle  handle,
const int32_t *  pWaitTimes 
)

Sets the wait times for the controller states.

Parameters
[in]handleThe controller (CTRL) handle
[in]pWaitTimesA pointer to a vector of wait times, controller clock counts

◆ CTRL_updateState()

bool CTRL_updateState ( CTRL_Handle  handle)

Updates the controller state.

Parameters
[in]handleThe controller (CTRL) handle
Returns
A boolean value denoting if the state has changed (true) or not (false)

◆ CTRL_setup()

static void CTRL_setup ( CTRL_Handle  handle,
const float32_t  speed_ref_Hz,
const float32_t  speed_fb_Hz,
const MATH_Vec2 pIdq_A,
const MATH_Vec2 pIdq_offset_A,
const MATH_Vec2 pVdq_offset_V,
const bool  flag_enableSpeedCtrl,
const bool  flag_enableCurrentCtrl,
const bool  flag_useZeroIq_ref 
)
inlinestatic

Sets up the user controller (CTRL) object.

Parameters
[in]handleThe controller (CTRL) handle
[in]speed_ref_HzThe reference speed value to use for the speed controller, Hz
[in]speed_fb_HzThe feedback speed value to use for the speed controller, Hz
[in]pIdq_AThe pointer to the Idq values, A
[in]pIdq_offset_AThe pointer to the Idq offset values, A
[in]pVdq_offset_VThe pointer to the Vdq offset values, V
[in]flag_enableSpeedCtrlThe flag used to enable the speed controller
[in]flag_enableCurrentCtrlThe flag used to enable the current controller
[in]flag_useZeroIq_refThe flag used to enable the zero Iq reference input

References CTRL_getFlag_resetInt_Id(), CTRL_getFlag_resetInt_Iq(), CTRL_getFlag_resetInt_spd(), CTRL_getKi(), CTRL_getKp(), CTRL_getUi(), CTRL_incrCounter_current(), CTRL_incrCounter_speed(), CTRL_setFlag_enableCurrentCtrl(), CTRL_setFlag_enableSpeedCtrl(), CTRL_setFlag_resetInt_Id(), CTRL_setFlag_resetInt_Iq(), CTRL_setFlag_resetInt_spd(), CTRL_setFlag_useZeroIq_ref(), CTRL_setIdq_A(), CTRL_setIdq_offset_A(), CTRL_setSpeed_fb_Hz(), CTRL_setSpeed_ref_Hz(), CTRL_setVdq_offset_V(), CTRL_TYPE_PI_ID, CTRL_TYPE_PI_IQ, CTRL_TYPE_PI_SPD, PI_setKi(), PI_setKp(), PI_setUi(), _CTRL_Obj_::piHandle_Id, _CTRL_Obj_::piHandle_Iq, and _CTRL_Obj_::piHandle_spd.

◆ CTRL_run()

static void CTRL_run ( CTRL_Handle  handle,
MATH_Vec2 pVdq_V 
)
inlinestatic

Copyright 2023, Texas Instruments Incorporated