1041 uint32_t electricalAngle);
1193 const _iq Kp,
const _iq Ki,
const _iq Kd);
1421 const uint_least16_t numPolePairs,
1792 bool result =
false;
1851 _iq angleCompFactor =
_IQ(1.0 + (
float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK * (
float_t)USER_NUM_ISR_TICKS_PER_CTRL_TICK * ((
float_t)USER_NUM_CTRL_TICKS_PER_EST_TICK - 0.5));
1852 _iq angleDeltaComp_pu =
_IQmpy(angleDelta_pu, angleCompFactor);
1853 uint32_t angleMask = ((uint32_t)0xFFFFFFFF >> (32 -
GLOBAL_Q));
1858 angleTmp_pu = angleUncomp_pu + angleDeltaComp_pu;
1862 angleComp_pu =
_IQabs(angleTmp_pu) & angleMask;
1867 angleComp_pu = -angleComp_pu;
1870 return(angleComp_pu);
1925 _iq outMin = -outMax;
2014 refValue =
_IQ(0.0);
2066 uint32_t electricalAngle)
2092 angle_pu = electricalAngle;
2112 _iq outMin = -outMax;
2237 #endif // extern "C"
2240 #endif // end of _CTRL_H_ definition
bool EST_isError(EST_Handle handle)
Determines if there is an estimator error.
_iq maxVsMag_pu
the maximum voltage vector that is allowed, pu
void CTRL_getGains(CTRL_Handle handle, const CTRL_Type_e ctrlType, _iq *pKp, _iq *pKi, _iq *pKd)
Gets the gain values for the specified controller.
Defines the controller (CTRL) version number.
CTRL_ErrorCode_e errorCode
the error code for the controller
the controller error state
void CTRL_incrCounter_isr(CTRL_Handle handle)
Increments the isr counter.
MATH_vec2 * CTRL_getIab_in_addr(CTRL_Handle handle)
Gets the alpha/beta current input vector memory address from the controller.
_iq CTRL_getIq_ref_pu(CTRL_Handle handle)
Gets the quadrature current (Iq) reference value from the controller.
static _iq PID_getRefValue(PID_Handle handle)
Gets the reference value in the PID controller.
void CTRL_setupEstOnLineState(CTRL_Handle handle)
Sets up the controller and trajectory generator for the estimator online state.
IPARK_Handle iparkHandle
the handle for the inverse Park transform
Contains the public interface to the types definitions.
void CTRL_getIdq_ref_pu(CTRL_Handle handle, MATH_vec2 *pIdq_ref_pu)
Gets the direct/quadrature current reference vector values from the controller.
bool CTRL_getFlag_enableDcBusComp(CTRL_Handle handle)
Gets the enable DC bus compensation flag value from the estimator.
MATH_vec2 Vab_in
the Vab input values
MATH_vec2 Idq_ref
the Idq reference values, pu
uint_least16_t numCtrlTicksPerSpeedTick
Defines the number of controller clock ticks per speed controller clock tick.
_iq Kd_Id
the desired Kd_Id value
float_t RoverL
the R/L value
void CTRL_getIab_filt_pu(CTRL_Handle handle, MATH_vec2 *pIab_filt_pu)
Gets the alpha/beta filtered current vector values from the controller.
_iq Ki_Iq
the desired Ki_Iq value
CLARKE_Handle clarkeHandle_I
the handle for the current Clarke transform
void CTRL_resetCounter_state(CTRL_Handle handle)
Resets the state counter.
_iq maxDelta
the maximum delta value for the trajectory generator
MOTOR_Type_e type
Defines the motor type.
float_t ratedFlux_VpHz
Defines the rated flux, V/Hz.
static void PID_setUi(PID_Handle handle, const _iq Ui)
Sets the integrator start value in the PID controller.
void CTRL_setupClarke_V(CTRL_Handle handle, uint_least8_t numVoltageSensors)
Sets the number of voltage sensors.
void EST_setId_ref_pu(EST_Handle handle, const _iq Id_ref_pu)
Sets the direct current (Id) reference value in the estimator in per unit (pu), IQ24.
static void PARK_setPhasor(PARK_Handle handle, const MATH_vec2 *pPhasor)
Sets the cosine/sine phasor for the inverse Park transform.
void CTRL_setEstParams(EST_Handle estHandle, USER_Params *pUserParams)
Sets the default estimator parameters.
CTRL_ErrorCode_e CTRL_getErrorCode(CTRL_Handle handle)
Gets the error code from the controller (CTRL) object.
void EST_setIq_ref_pu(EST_Handle handle, const _iq Iq_ref_pu)
Sets the quadrature current (Iq) reference value in the estimator in per unit (pu), IQ24.
_iq CTRL_getUi(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the integrator (Ui) value from the specified controller.
void CTRL_setMotorParams(CTRL_Handle handle, const MOTOR_Type_e motorType, const uint_least16_t numPolePairs, const float_t ratedFlux, const float_t Ls_d, const float_t Ls_q, const float_t Rr, const float_t Rs)
Sets the parameters for the motor in the controller.
static _iq TRAJ_getIntValue(TRAJ_Handle handle)
Gets the intermediate value for the trajectory.
void CTRL_setIab_in_pu(CTRL_Handle handle, const MATH_vec2 *pIab_in_pu)
Sets the alpha/beta current (Iab) input vector values in the controller.
_iq Ki_Id
the desired Ki_Id value
_iq spd_ref
the speed reference, pu
void CTRL_getVdq_out_pu(CTRL_Handle handle, MATH_vec2 *pVdq_out_pu)
Gets the direct/quadrature voltage output vector values from the controller.
uint_least16_t numCtrlTicksPerTrajTick
Defines the number of controller clock ticks per trajectory clock tick.
Defines a two element vector.
_iq CTRL_getTrajPeriod_sec(CTRL_Handle handle)
Gets the trajectory execution period.
Contains the public interface to the offset (OFFSET) module routines.
_iq CTRL_getKd(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the derivative gain (Kd) value from the specified controller.
float_t CTRL_getLhf(CTRL_Handle handle)
Gets the high frequency inductance (Lhf) value from the controller.
_iq angle_pu
the angle value, pu
_iq Kp_spd
the desired Kp_spd value
_iq spd_max
the maximum speed, pu
void CTRL_incrCounter_current(CTRL_Handle handle)
Increments the current counter.
struct _EST_Obj_ * EST_Handle
Defines the estimator (EST) handle.
TRAJ_Handle trajHandle_Id
the handle for the Id trajectory generator
_iq CTRL_getId_in_pu(CTRL_Handle handle)
Gets the direct current input value from the controller.
uint_least16_t CTRL_getNumCtrlTicksPerTrajTick(CTRL_Handle handle)
Gets the number of controller clock ticks per trajectory clock tick.
bool CTRL_isError(CTRL_Handle handle)
Determines if there is a controller error.
Contains the public interface to the Proportional-Integral-Derivative (PID) controller module routine...
float_t CTRL_getCtrlPeriod_sec(CTRL_Handle handle)
Gets the controller execution period.
_iq * CTRL_getVd_out_addr(CTRL_Handle handle)
Gets the direct voltage output value memory address from the controller.
uint_least16_t CTRL_getNumIsrTicksPerCtrlTick(CTRL_Handle handle)
Gets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick...
TRAJ_Handle trajHandle_spd
the handle for the speed trajectory generator
void CTRL_setVab_in_pu(CTRL_Handle handle, const MATH_vec2 *pVab_in_pu)
Sets the alpha/beta voltage input vector values in the controller.
void CTRL_setSpd_max_pu(CTRL_Handle handle, const _iq maxSpd_pu)
Sets the maximum speed value in the controller.
_iq CTRL_getSpd_out_pu(CTRL_Handle handle)
Gets the output speed value from the controller.
MATH_vec2 Vab_out
the Vab output values
PID_Handle pidHandle_Id
the handle for the Id PID controller
CTRL_ErrorCode_e
Enumeration for the error codes.
float_t ctrlPeriod_sec
Defines the controller period, sec.
EST_Handle CTRL_getEstHandle(CTRL_Handle handle)
Gets the estimator handle for a given controller.
Defines the controller (CTRL) object.
void CTRL_setTrajPeriod_sec(CTRL_Handle handle, const _iq trajPeriod_sec)
Sets the trajectory execution period.
void CTRL_setMagCurrent_pu(CTRL_Handle handle, const _iq magCurrent_pu)
Sets the magnetizing current value in the controller.
Defines a structure for the user parameters.
_iq Kp_Id
the desired Kp_Id value
uint_least16_t CTRL_getCount_traj(CTRL_Handle handle)
Gets the trajectory loop count.
_iq CTRL_getSpd_ref_pu(CTRL_Handle handle)
Gets the output speed reference value from the controller.
_iq CTRL_angleDelayComp(CTRL_Handle handle, const _iq angle_pu)
Runs angle delay compensation.
Contains the public interface to the estimator (EST) module routines.
EST_Handle estHandle
the handle for the parameter estimator
void CTRL_getTrajStep(CTRL_Handle handle)
Gets the trajectory step size.
void CTRL_setKi(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Ki)
Sets the integral gain (Ki) value for the specified controller.
static void PID_setMinMax(PID_Handle handle, const _iq outMin, const _iq outMax)
Sets the minimum and maximum output value allowed in the PID controller.
static void SVGEN_run(SVGEN_Handle handle, const MATH_vec2 *pVab, MATH_vec3 *pT)
Implements a SVM that saturates at the level of MaxModulation.
void CTRL_setFlag_enableCtrl(CTRL_Handle handle, const bool state)
Sets the enable controller flag value in the estimator.
Defines the structures for the CTRL object.
void CTRL_setFlag_enableSpeedCtrl(CTRL_Handle handle, const bool state)
Sets the enable speed control value in the estimator.
void CTRL_getIab_in_pu(CTRL_Handle handle, MATH_vec2 *pIab_in_pu)
Gets the alpha/beta current input vector values from the controller.
float_t CTRL_getMotorRatedFlux(CTRL_Handle handle)
Gets the motor rated flux from the controller.
bool flag_enableDcBusComp
a flag to enable the DC bus compensation in the controller
uint_least32_t CTRL_getWaitTime(CTRL_Handle handle, const CTRL_State_e ctrlState)
Gets the wait time for a given state.
void CTRL_runTraj(CTRL_Handle handle)
Runs the trajectory.
void CTRL_setIdq_ref_pu(CTRL_Handle handle, const MATH_vec2 *pIdq_ref_pu)
Sets the direct/quadrature current (Idq) reference vector values in the controller.
MATH_vec2 * CTRL_getVab_out_addr(CTRL_Handle handle)
Gets the alpha/beta voltage output vector memory address from the controller.
MATH_vec2 * CTRL_getIdq_in_addr(CTRL_Handle handle)
Gets the direct/quadrature current input vector memory address from the controller.
bool CTRL_doSpeedCtrl(CTRL_Handle handle)
Determines if the speed controller should be executed.
_iq Kd_Iq
the desired Kd_Iq value
void CTRL_resetCounter_current(CTRL_Handle handle)
Resets the current counter.
uint_least16_t CTRL_getCount_isr(CTRL_Handle handle)
Gets the isr count.
bool flag_enableOffset
a flag to enable offset estimation after idle state
TRAJ_Handle trajHandle_spdMax
the handle for the maximum speed trajectory generator
void CTRL_setGains(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Kp, const _iq Ki, const _iq Kd)
Sets the gain values for the specified controller.
_iq Ui_spd
the desired Ui_spd value
float_t CTRL_getRhf(CTRL_Handle handle)
Gets the high frequency resistance (Rhf) value from the controller.
void CTRL_setupTraj(CTRL_Handle handle)
Sets up the trajectory (TRAJ) object.
void CTRL_setMaxAccel_pu(CTRL_Handle handle, const _iq maxAccel_pu)
Sets the maximum acceleration of the speed controller.
void CTRL_setState(CTRL_Handle handle, const CTRL_State_e state)
Sets the controller state.
_iq CTRL_getIq_in_pu(CTRL_Handle handle)
Gets the quadrature current input value from the controller.
static void TRAJ_setIntValue(TRAJ_Handle handle, const _iq intValue)
Sets the intermediate value for the trajectory.
uint_least16_t numPolePairs
Defines the number of pole pairs.
MATH_vec3 Tabc
the PWM time-durations for each motor phase
_iq * CTRL_getVq_out_addr(CTRL_Handle handle)
Gets the quadrature voltage output value memory address from the controller.
MOTOR_Type_e
Enumeration for the motor types.
uint_least32_t counter_state
the state counter
void CTRL_setParams(CTRL_Handle handle, USER_Params *pUserParams)
Sets the controller parameters.
bool CTRL_getFlag_enableSpeedCtrl(CTRL_Handle handle)
Gets the enable speed control flag value from the controller.
void CTRL_getIdq_in_pu(CTRL_Handle handle, MATH_vec2 *pIdq_in_pu)
Gets the direct/quadrature current input vector values from the controller.
void CTRL_setWaitTimes(CTRL_Handle handle, const uint_least32_t *pWaitTimes)
Sets the wait times for the controller states.
bool CTRL_useZeroIq_ref(CTRL_Handle handle)
Determines if a zero Iq current reference should be used in the controller.
_iq CTRL_getSpd_max_pu(CTRL_Handle handle)
Gets the maximum speed value from the controller.
CTRL_State_e state
the current state of the controller
void CTRL_setVdq_out_pu(CTRL_Handle handle, const MATH_vec2 *pVdq_out_pu)
Sets the direct/quadrature voltage output vector values in the controller.
uint_least16_t counter_isr
the isr counter
void CTRL_incrCounter_speed(CTRL_Handle handle)
Increments the speed counter.
void CTRL_resetCounter_isr(CTRL_Handle handle)
Resets the isr counter.
_iq Kd_spd
the desired Kd_spd value
bool EST_doSpeedCtrl(EST_Handle handle)
Determines if speed control should be performed during motor identification.
_iq * CTRL_getSpd_out_addr(CTRL_Handle handle)
Gets the output speed memory address from the controller.
void CTRL_setNumCtrlTicksPerTrajTick(CTRL_Handle handle, const uint_least16_t numCtrlTicksPerTrajTick)
Sets the number of controller clock ticks per trajectory clock tick.
MATH_vec2 Idq_in
the Idq input values
bool flag_enablePowerWarp
a flag to enable PowerWarp
PID_Handle pidHandle_spd
the handle for the speed PID controller
_iq trajPeriod_sec
Defines the trajectory period, sec.
void CTRL_setIdq_in_pu(CTRL_Handle handle, const MATH_vec2 *pIdq_in_pu)
Sets the direct/quadrature current (Idq) input vector values in the controller.
void HAL_runOffsetEst(HAL_Handle handle, const HAL_AdcData_t *pAdcData)
Runs offset estimation.
_iq EST_getOneOverDcBus_pu(EST_Handle handle)
Gets the inverse of the DC bus voltage in per unit (pu), IQ24.
void CTRL_setSpd_out_pu(CTRL_Handle handle, const _iq spd_out_pu)
Sets the output speed value in the controller.
bool CTRL_getFlag_enableUserMotorParams(CTRL_Handle handle)
Gets the enable user motor parameters flag value from the controller.
void CTRL_incrCounter_state(CTRL_Handle handle)
Increments the state counter.
void CTRL_setupEstIdleState(CTRL_Handle handle)
Sets up the controller and trajectory generator for the estimator idle state.
CTRL_State_e prevState
the previous state of the controller
CTRL_State_e CTRL_getState(CTRL_Handle handle)
Gets the controller state.
void CTRL_setUserMotorParams(CTRL_Handle handle)
Sets the controller and estimator with motor parameters from the user.h file.
void CTRL_setLhf(CTRL_Handle handle, const float_t Lhf)
Sets the high frequency inductance (Lhf) value in the controller.
void CTRL_setCtrlPeriod_sec(CTRL_Handle handle, const float_t ctrlPeriod_sec)
Sets the controller execution period.
static void IPARK_run(IPARK_Handle handle, const MATH_vec2 *pInVec, MATH_vec2 *pOutVec)
Runs the inverse Park transform module.
uint_least32_t CTRL_getCtrlFreq(CTRL_Handle handle)
Gets the controller execution frequency.
_iq Kp_Iq
the desired Kp_Iq value
PARK_Handle parkHandle
the handle for the Park object
_iq CTRL_getMaximumSpeed_pu(CTRL_Handle handle)
Gets the maximum speed value from the controller.
MATH_vec2 Iab_filt
the Iab filtered values
bool CTRL_doCurrentCtrl(CTRL_Handle handle)
Determines if the current controllers should be run.
_iq EST_getFm_pu(EST_Handle handle)
Gets the mechanical frequency of the motor in per unit (pu), IQ24.
uint_least16_t counter_current
the isr counter
MATH_vec2 Vdq_out
the Vdq output values
uint_least32_t waitTimes[CTRL_numStates]
an array of wait times for each state, estimator clock counts
bool EST_useZeroIq_ref(EST_Handle handle)
Determines if a zero Iq current reference should be used in the controller.
void CTRL_setNumCtrlTicksPerCurrentTick(CTRL_Handle handle, const uint_least16_t numCtrlTicksPerCurrentTick)
Sets the number of controller clock ticks per current controller clock tick.
_iq CTRL_getKp(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the proportional gain (Kp) value from the specified controller.
void CTRL_setup(CTRL_Handle handle)
Sets up the controller (CTRL) object and all of the subordinate objects.
void CTRL_getVab_out_pu(CTRL_Handle handle, MATH_vec2 *pVab_out_pu)
Gets the alpha/beta voltage output vector values from the controller.
void CTRL_setSpd_ref_pu(CTRL_Handle handle, const _iq spd_ref_pu)
Sets the output speed reference value in the controller.
_iq CTRL_getVd_out_pu(CTRL_Handle handle)
Gets the direct voltage output value from the controller.
CTRL_State_e
Enumeration for the controller states.
_iq spd_out
the speed output value
CLARKE_Handle clarkeHandle_V
the handle for the voltage Clarke transform
MATH_vec2 * CTRL_getVdq_out_addr(CTRL_Handle handle)
Gets the direct/quadrature voltage output vector memory address from the controller.
void CTRL_setTrajFreq_Hz(CTRL_Handle handle, const uint_least32_t trajFreq_Hz)
Sets the trajectory execution frequency.
_iq CTRL_getMaxVsMag_pu(CTRL_Handle handle)
Gets the maximum voltage vector.
uint_least16_t counter_traj
the traj counter
void CTRL_runOffLine(CTRL_Handle handle, HAL_Handle halHandle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData)
Runs the offline controller.
MOTOR_Params motorParams
the motor parameters
void CTRL_setSpdMax(CTRL_Handle handle, const _iq spdMax)
Sets maximum speed controller output.
uint_least16_t counter_speed
the speed counter
void CTRL_setErrorCode(CTRL_Handle handle, const CTRL_ErrorCode_e errorCode)
Sets the error code in the controller.
CTRL_Handle CTRL_initCtrl(const uint_least8_t estNumber, void *pMemory, const size_t numBytes)
Initializes a specified controller.
MATH_vec2 * CTRL_getIab_filt_addr(CTRL_Handle handle)
Gets the alpha/beta filtered current vector memory address from the controller.
void CTRL_setVab_out_pu(CTRL_Handle handle, const MATH_vec2 *pVab_out_pu)
Sets the alpha/beta current output vector values in the controller.
void CTRL_setMaxVsMag_pu(CTRL_Handle handle, const _iq maxVsMag)
Sets the maximum voltage vector in the controller.
Contains the public interface to the encoder module routines.
float_t Ls_q_H
Defines the quadrature stator inductance, H.
_iq CTRL_getId_ref_pu(CTRL_Handle handle)
Gets the direct current (Id) reference value from the controller.
void CTRL_resetCounter_traj(CTRL_Handle handle)
Resets the trajectory counter.
bool EST_doCurrentCtrl(EST_Handle handle)
Determines if current control should be performed during motor identification.
PID_Handle pidHandle_Iq
the handle for the Iq PID controller
_iq IdRated
the Id rated current, pu
_iq CTRL_getIdRated_pu(CTRL_Handle handle)
Gets the Id rated current value from the controller.
void CTRL_setFlag_enablePowerWarp(CTRL_Handle handle, const bool state)
Sets the PowerWarp enable flag value in the estimator.
static void IPARK_setPhasor(IPARK_Handle handle, const MATH_vec2 *pPhasor)
Sets the cosine/sine phasor for the inverse Park transform.
Contains public interface to various functions related to the trajectory (TRAJ) object.
bool CTRL_updateState(CTRL_Handle handle)
Updates the controller state.
void CTRL_setIab_filt_pu(CTRL_Handle handle, const MATH_vec2 *pIab_filt_pu)
Sets the alpha/beta filtered current vector values in the controller.
_iq EST_getAngle_pu(EST_Handle handle)
Gets the angle value from the estimator in per unit (pu), IQ24.
CTRL_Type_e
Enumeration for the controller (CTRL) types.
_iq CTRL_getKi(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the integral gain (Ki) value from the specified controller.
void CTRL_getWaitTimes(CTRL_Handle handle, uint_least32_t *pWaitTimes)
Gets the wait times from the estimator.
bool CTRL_getFlag_enableCtrl(CTRL_Handle handle)
Gets the enable controller flag value from the estimator.
float_t Ls_d_H
Defines the direct stator inductance, H.
bool flag_enableCtrl
a flag to enable the controller
void CTRL_setRhf(CTRL_Handle handle, const float_t Rhf)
Sets the high frequency resistance (Rhf) value in the controller.
_iq Ui_Iq
the desired Ui_Iq value
void CTRL_setFlag_enableOffset(CTRL_Handle handle, const bool state)
Sets the enable offset flag value in the estimator.
static void CLARKE_run(CLARKE_Handle handle, const MATH_vec3 *pInVec, MATH_vec2 *pOutVec)
Runs the Clarke transform module for three inputs.
uint_least32_t ctrlFreq_Hz
Defines the controller frequency, Hz.
float_t Rs_Ohm
Defines the stator resistance, Ohm.
static void PARK_run(PARK_Handle handle, const MATH_vec2 *pInVec, MATH_vec2 *pOutVec)
Runs the Park transform module.
void CTRL_setFlag_enableDcBusComp(CTRL_Handle handle, const bool state)
Sets the enable DC bus compensation flag value in the estimator.
uint_least16_t CTRL_getCount_speed(CTRL_Handle handle)
Gets the speed loop count.
void CTRL_setFlag_enableUserMotorParams(CTRL_Handle handle, const bool state)
Sets the enable user motor parameters flag value in the estimator.
void CTRL_setKd(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Kd)
Sets the derivative gain (Kd) value for the specified controller.
_iq CTRL_getMagCurrent_pu(CTRL_Handle handle)
Gets the magnetizing current value from the controller.
uint_least16_t CTRL_getCount_current(CTRL_Handle handle)
Gets the current loop count.
Contains the public interface to the Park transform module routines.
void CTRL_setIdRated_pu(CTRL_Handle handle, const _iq IdRated_pu)
Sets the Id rated current value in the controller.
bool flag_enableUserMotorParams
a flag to use known motor parameters from user.h file
void CTRL_setIq_ref_pu(CTRL_Handle handle, const _iq IqRef_pu)
Sets the quadrature current (Iq) reference value in the controller.
static void PID_run_spd(PID_Handle handle, const _iq refValue, const _iq fbackValue, _iq *pOutValue)
Runs the PID controller for speed.
void CTRL_setCtrlFreq_Hz(CTRL_Handle handle, const uint_least32_t ctrlFreq_Hz)
Sets the controller frequency.
MATH_vec3 V
the voltage values
uint_least32_t trajFreq_Hz
Defines the trajectory frequency, Hz.
void CTRL_resetCounter_speed(CTRL_Handle handle)
Resets the speed counter.
uint_least32_t CTRL_getTrajFreq(CTRL_Handle handle)
Gets the trajectory execution frequency.
_iq CTRL_getSpd_int_ref_pu(CTRL_Handle handle)
Gets the output speed intermediate reference value from the controller.
float_t Rr_Ohm
Defines the rotor resistance, Ohm.
void CTRL_setId_ref_pu(CTRL_Handle handle, const _iq Id_ref_pu)
Sets the direct current (Id) reference value in the controller.
Contains the public interface to the Clarke transform (CLARKE) module routines.
void CTRL_checkForErrors(CTRL_Handle handle)
Checks for any controller errors and, if found, sets the controller state to the error state...
void CTRL_getVab_in_pu(CTRL_Handle handle, MATH_vec2 *pVab_in_pu)
Gets the alpha/beta voltage input vector values from the controller.
MATH_vec3 I
the current values
Contains the public interface to the inverse Park transform (IPARK) module routines.
void CTRL_setMaximumSpeed_pu(CTRL_Handle handle, const _iq maxSpeed_pu)
Sets the maximum speed value in the controller.
uint_least16_t CTRL_getNumCtrlTicksPerSpeedTick(CTRL_Handle handle)
Gets the number of controller clock ticks per speed controller clock tick.
Contains the public interface to the Space Vector Generator (SVGEN) module routines.
void CTRL_setNumCtrlTicksPerSpeedTick(CTRL_Handle handle, const uint_least16_t numCtrlTicksPerSpeedTick)
Sets the number of controller clock ticks per speed controller clock tick.
void CTRL_getVersion(CTRL_Handle handle, CTRL_Version *pVersion)
Gets the controller version number.
float_t CTRL_getRoverL(CTRL_Handle handle)
Gets the R/L value from the controller.
MATH_vec2 Iab_in
the Iab input values
uint_least16_t numCtrlTicksPerCurrentTick
Defines the number of controller clock ticks per current controller clock tick.
uint_least32_t CTRL_getCount_state(CTRL_Handle handle)
Gets the state count.
void CTRL_setupEst(CTRL_Handle handle)
Sets up the estimator (CTRL) object.
void CTRL_computePhasor(const _iq angle_pu, MATH_vec2 *pPhasor)
Computes a phasor for a given angle.
void EST_updateId_ref_pu(EST_Handle handle, _iq *pId_ref_pu)
Updates the Id reference value used for online stator resistance estimation in per unit (pu)...
uint_least16_t numIsrTicksPerCtrlTick
Defines the number of isr clock ticks per controller clock tick.
MOTOR_Type_e CTRL_getMotorType(CTRL_Handle handle)
Gets the motor type from the controller.
_iq CTRL_getRefValue_pu(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the reference value from the specified controller.
void CTRL_setRoverL(CTRL_Handle handle, const float_t RoverL)
Sets the R/L value in the controller.
void CTRL_run(CTRL_Handle handle, HAL_Handle halHandle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData, uint32_t electricalAngle)
Runs the controller.
_iq Ki_spd
the desired Ki_spd value
TRAJ_Obj traj_spd
the speed trajectory generator object
bool CTRL_getFlag_enablePowerWarp(CTRL_Handle handle)
Gets the PowerWarp enable flag value from the estimator.
void CTRL_runOnLine_User(CTRL_Handle handle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData, uint32_t electricalAngle)
Runs the online user controller.
void CTRL_incrCounter_traj(CTRL_Handle handle)
Increments the trajectory counter.
void CTRL_setUi(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Ui)
Sets the integrator (Ui) value in the specified controller.
_iq Ui_Id
the desired Ui_Id value
bool flag_enableSpeedCtrl
a flag to enable the speed controller
_iq CTRL_getVq_out_pu(CTRL_Handle handle)
Gets the quadrature voltage output value from the controller.
uint_least16_t CTRL_getNumCtrlTicksPerCurrentTick(CTRL_Handle handle)
Gets the number of controller clock ticks per current controller clock tick.
void CTRL_setNumIsrTicksPerCtrlTick(CTRL_Handle handle, const uint_least16_t numIsrTicksPerCtrlTick)
Sets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick...
void CTRL_setSpd_ref_krpm(CTRL_Handle handle, const _iq spd_ref_krpm)
Sets the output speed reference value in the controller.
static void PID_setKp(PID_Handle handle, const _iq Kp)
Sets the proportional gain in the PID controller.
void CTRL_setupClarke_I(CTRL_Handle handle, uint_least8_t numCurrentSensors)
Sets the number of current sensors.
void CTRL_setKp(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Kp)
Sets the proportional gain (Kp) value for the specified controller.
float float_t
Defines the portable data type for 32 bit, signed floating-point data.
void CTRL_setupCtrl(CTRL_Handle handle)
Sets up the controllers.
Defines the hardware abstraction layer (HAL) data.
void CTRL_runOnLine(CTRL_Handle handle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData)
Runs the online controller.
MATH_vec2 * CTRL_getVab_in_addr(CTRL_Handle handle)
Gets the alpha/beta voltage input vector memory address from the controller.
static void PID_run(PID_Handle handle, const _iq refValue, const _iq fbackValue, _iq *pOutValue)
Runs the PID controller.
void EST_run(EST_Handle handle, const MATH_vec2 *pIab_pu, const MATH_vec2 *pVab_pu, const _iq dcBus_pu, const _iq speed_ref_pu)
Runs the estimator.
SVGEN_Handle svgenHandle
the handle for the space vector generator
bool CTRL_getFlag_enableOffset(CTRL_Handle handle)
Gets the enable offset flag value from the controller.