instaspin_foc
Modules | Functions | Variables
PROJ_LAB11B

Modules

 Project Overview
 

Functions

void main (void)
 
interrupt void mainISR (void)
 The main ISR that implements the motor control. More...
 
_iq angleDelayComp (const _iq fm_pu, const _iq angleUncomp_pu)
 The angleDelayComp function compensates for the delay introduced. More...
 
void runCurrentIgnore (void)
 
void runCurrentReconstruction (void)
 
void runFieldWeakening (void)
 
void runOffsetsCalculation (void)
 
void softwareUpdate1p6 (EST_Handle handle)
 Updates version 1p6 of library. More...
 
void runSetTrigger (void)
 
void setupClarke_I (CLARKE_Handle handle, const uint_least8_t numCurrentSensors)
 Setup the Clarke transform for either 2 or 3 sensors. More...
 
void setupClarke_V (CLARKE_Handle handle, const uint_least8_t numVoltageSensors)
 Setup the Clarke transform for either 2 or 3 sensors. More...
 
void updateGlobalVariables (EST_Handle handle)
 Update the global variables (gMotorVars). More...
 
void updateCPUusage (void)
 Updates CPU usage. More...
 
_iq getAbsElecAngle (const _iq angle_pu)
 Calculates the absolute electrical angle. More...
 
_iq getAbsMechAngle (_iq *pAngle_mech_poles, _iq *pAngle_z1_pu, const _iq angle_pu)
 Calculates mechanical angle from electrical angle. More...
 

Variables

CLARKE_Handle clarkeHandle_I
 the handle for the current Clarke transform More...
 
CLARKE_Obj clarke_I
 the current Clarke transform object More...
 
CLARKE_Handle clarkeHandle_V
 the handle for the voltage Clarke transform More...
 
CLARKE_Obj clarke_V
 the voltage Clarke transform object More...
 
CPU_USAGE_Handle cpu_usageHandle
 
CPU_USAGE_Obj cpu_usage
 
EST_Handle estHandle
 the handle for the estimator More...
 
FW_Handle fwHandle
 
FW_Obj fw
 
PID_Obj pid [3]
 three handles for PID controllers 0 - Speed, 1 - Id, 2 - Iq More...
 
PID_Handle pidHandle [3]
 three objects for PID controllers 0 - Speed, 1 - Id, 2 - Iq More...
 
uint16_t pidCntSpeed
 count variable to decimate the execution of the speed PID controller More...
 
IPARK_Handle iparkHandle
 the handle for the inverse Park transform More...
 
IPARK_Obj ipark
 the inverse Park transform object More...
 
FILTER_FO_Handle filterHandle [6]
 the handles for the 3-current and 3-voltage filters for offset calculation More...
 
FILTER_FO_Obj filter [6]
 the 3-current and 3-voltage filters for offset calculation More...
 
SVGENCURRENT_Obj svgencurrent
 
SVGENCURRENT_Handle svgencurrentHandle
 
SVGEN_Handle svgenHandle
 the handle for the space vector generator More...
 
SVGEN_Obj svgen
 the space vector generator object More...
 
TRAJ_Handle trajHandle_Id
 the handle for the id reference trajectory More...
 
TRAJ_Obj traj_Id
 the id reference trajectory object More...
 
TRAJ_Handle trajHandle_spd
 the handle for the speed reference trajectory More...
 
TRAJ_Obj traj_spd
 the speed reference trajectory object More...
 
HAL_Handle halHandle
 the handle for the hardware abstraction layer (HAL) More...
 
HAL_PwmData_t gPwmData = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}
 contains the three pwm values -1.0 - 0%, 1.0 - 100% More...
 
HAL_AdcData_t gAdcData
 contains three current values, three voltage values and one DC buss value More...
 
MATH_vec3 gOffsets_I_pu = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}
 contains the offsets for the current feedback More...
 
MATH_vec3 gOffsets_V_pu = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}
 contains the offsets for the voltage feedback More...
 
MATH_vec2 gIdq_ref_pu = {_IQ(0.0), _IQ(0.0)}
 contains the Id and Iq references More...
 
MATH_vec2 gVdq_out_pu = {_IQ(0.0), _IQ(0.0)}
 contains the output Vd and Vq from the current controllers More...
 
MATH_vec2 gIdq_pu = {_IQ(0.0), _IQ(0.0)}
 contains the Id and Iq measured values More...
 
USER_Params gUserParams
 The user parameters. More...
 
volatile MOTOR_Vars_t gMotorVars = MOTOR_Vars_INIT
 the global motor variables that are defined in main.h and used for display in the debugger's watch window More...
 
int16_t gCmpOffset = (int16_t)(1.0 * USER_SYSTEM_FREQ_MHz)
 
MATH_vec3 gIavg = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}
 
uint16_t gIavg_shift = 1
 
_iq gFlux_pu_to_Wb_sf
 
_iq gFlux_pu_to_VpHz_sf
 
_iq gTorque_Ls_Id_Iq_pu_to_Nm_sf
 
_iq gTorque_Flux_Iq_pu_to_Nm_sf
 
_iq gSpeed_krpm_to_pu_sf = _IQ((float_t)USER_MOTOR_NUM_POLE_PAIRS * 1000.0 / (USER_IQ_FULL_SCALE_FREQ_Hz * 60.0))
 
_iq gSpeed_hz_to_krpm_sf = _IQ(60.0 / (float_t)USER_MOTOR_NUM_POLE_PAIRS / 1000.0)
 
_iq gIs_Max_squared_pu = _IQ((USER_MOTOR_MAX_CURRENT * USER_MOTOR_MAX_CURRENT) / (USER_IQ_FULL_SCALE_CURRENT_A * USER_IQ_FULL_SCALE_CURRENT_A))
 
float_t gCpuUsagePercentageMin = 0.0
 
float_t gCpuUsagePercentageAvg = 0.0
 
float_t gCpuUsagePercentageMax = 0.0
 
uint32_t gOffsetCalcCount = 0
 
volatile bool gFlag_enableRsOnLine = false
 
volatile bool gFlag_updateRs = false
 
volatile _iq gRsOnLineFreq_Hz = _IQ(0.2)
 
volatile _iq gRsOnLineId_mag_A = _IQ(0.5)
 
volatile _iq gRsOnLinePole_Hz = _IQ(0.2)
 
VIB_COMP_Handle vib_compHandle
 
_iq vib_comp_reserved [400]
 
_iq gSpeed_fbk_out [360]
 
uint16_t gSpeed_array_index = 0
 
_iq gSpeed_max_pu = _IQ(0.0)
 
_iq gSpeed_min_pu = _IQ(1.0)
 
_iq gSpeed_delta_krpm = _IQ(0.0)
 
volatile bool gFlag_speedStatsReset = false
 
_iq gAbsAngle_elec_pu = _IQ(0.0)
 
_iq gAbsAngle_mech_pu = _IQ(0.0)
 
_iq gAngle_mech_poles = _IQ(0.0)
 
_iq gAngle_z1_pu = _IQ(0.0)
 
volatile _iq gAlpha = _IQ(0.99)
 
volatile int16_t gAdvIndexDelta = 10
 
volatile bool gFlag_enableOutput = false
 
volatile bool gFlag_enableUpdates = true
 
volatile bool gFlag_resetVibComp = false
 

Detailed Description

Function Documentation

_iq angleDelayComp ( const _iq  fm_pu,
const _iq  angleUncomp_pu 
)

The angleDelayComp function compensates for the delay introduced.

from the time when the system inputs are sampled to when the PWM voltages are applied to the motor windings.

Definition at line 887 of file proj_lab11b.c.

References _IQ, _IQabs, _IQmpy, GLOBAL_Q, USER_IQ_FULL_SCALE_FREQ_Hz, USER_NUM_PWM_TICKS_PER_ISR_TICK, and USER_PWM_FREQ_kHz.

Referenced by mainISR().

_iq getAbsElecAngle ( const _iq  angle_pu)

Calculates the absolute electrical angle.

Parameters
[in]angle_puThe electrical angle from _IQ(0.0) to _IQ(1.0) when running CW and from _IQ(-1.0) to _IQ(0.0) when running CCW
Returns
The electrical angle from _IQ(0.0) to _IQ(1.0) regardless of direction of rotation (CW or CCW)

Definition at line 1217 of file proj_lab11b.c.

References _IQ.

Referenced by mainISR().

_iq getAbsMechAngle ( _iq pAngle_mech_poles,
_iq pAngle_z1_pu,
const _iq  angle_pu 
)

Calculates mechanical angle from electrical angle.

Parameters
[in]pAngle_mech_polesThe mechanical angle from _IQ(-USER_MOTOR_NUM_POLE_PAIRS) to _IQ(USER_MOTOR_NUM_POLE_PAIRS)
[in]angle_puThe electrical angle from _IQ(0.0) to _IQ(1.0)
Returns
The mechanical angle from _IQ(0.0) to _IQ(1.0)

Definition at line 1239 of file proj_lab11b.c.

References _IQ, _IQmpy, and USER_MOTOR_NUM_POLE_PAIRS.

Referenced by mainISR().

void main ( void  )

Definition at line 224 of file proj_lab11b.c.

References _IQ, _IQmpy, CLARKE_init(), CPU_USAGE_init(), CPU_USAGE_setParams(), CTRL_init(), CTRL_setParams(), CTRL_setupEstIdleState(), CTRL_setUserMotorParams(), _USER_Params_::ctrlFreq_Hz, ctrlHandle, EST_getState(), EST_init(), EST_runPowerWarp(), EST_setAngle_pu(), EST_setEstParams(), EST_setFlag_enableForceAngle(), EST_setFlag_enableRsOnLine(), EST_setFlag_enableRsRecalc(), EST_setFlag_updateRs(), EST_setIdle(), EST_setRsOnLineAngleDelta_pu(), EST_setRsOnLineFilterParams(), EST_setRsOnLineId_mag_pu(), EST_setRsOnLineId_pu(), EST_setupEstIdleState(), EST_updateState(), _CTRL_Obj_::estHandle, estHandle, FILTER_FO_init(), FILTER_FO_setDenCoeffs(), FILTER_FO_setInitialConditions(), FILTER_FO_setNumCoeffs(), _MOTOR_Vars_t_::Flag_enableFieldWeakening, _MOTOR_Vars_t_::Flag_enableForceAngle, _MOTOR_Vars_t_::Flag_enableOffsetcalc, _MOTOR_Vars_t_::Flag_enablePowerWarp, _MOTOR_Vars_t_::Flag_enableRsRecalc, _MOTOR_Vars_t_::Flag_enableSys, _MOTOR_Vars_t_::Flag_Run_Identify, FW_clearCounter(), FW_DEC_DELTA, FW_INC_DELTA, FW_init(), FW_NUM_ISR_TICKS_PER_CTRL_TICK, FW_setDeltas(), FW_setFlag_enableFw(), FW_setMinMax(), FW_setNumIsrTicksPerFwTick(), FW_setOutput(), hal, HAL_disablePwm(), HAL_enableAdcInts(), HAL_enableDebugInt(), HAL_enableDrv(), HAL_enableGlobalInts(), HAL_enablePwm(), HAL_init(), HAL_initIntVectorTable(), HAL_readDrvData(), HAL_setParams(), HAL_setupDrvSpi(), HAL_setupFaults(), HAL_writeDrvData(), I_A_offset, I_B_offset, I_C_offset, IPARK_init(), memCopy(), _USER_Params_::offsetPole_rps, PID_init(), PID_setGains(), PID_setMinMax(), PID_setUi(), pidCntSpeed, setupClarke_I(), setupClarke_V(), softwareUpdate1p6(), _MOTOR_Vars_t_::SpeedRef_krpm, SVGEN_init(), SVGENCURRENT_init(), TRAJ_getIntValue(), TRAJ_init(), TRAJ_setIntValue(), TRAJ_setMaxDelta(), TRAJ_setMaxValue(), TRAJ_setMinValue(), TRAJ_setTargetValue(), updateCPUusage(), updateGlobalVariables(), USER_checkForErrors(), USER_computeFlux_pu_to_VpHz_sf(), USER_computeFlux_pu_to_Wb_sf(), USER_computeTorque_Flux_Iq_pu_to_Nm_sf(), USER_computeTorque_Ls_Id_Iq_pu_to_Nm_sf(), USER_EST_HANDLE_ADDRESS, USER_getErrorCode(), USER_IQ_FULL_SCALE_CURRENT_A, USER_IQ_FULL_SCALE_FREQ_Hz, USER_IQ_FULL_SCALE_VOLTAGE_V, USER_ISR_FREQ_Hz, USER_MAX_ACCEL_Hzps, USER_MAX_NEGATIVE_ID_REF_CURRENT_A, USER_MAX_VS_MAG_PU, USER_MOTOR_Ls_d, USER_MOTOR_Ls_q, USER_MOTOR_MAGNETIZING_CURRENT, USER_MOTOR_RES_EST_CURRENT, USER_MOTOR_Rs, USER_MOTOR_TYPE, USER_NUM_CURRENT_SENSORS, USER_NUM_VOLTAGE_SENSORS, USER_setParams(), USER_SYSTEM_FREQ_MHz, USER_VD_SF, _MOTOR_Vars_t_::UserErrorCode, V_A_offset, V_B_offset, V_C_offset, _MATH_vec2_::value, _MATH_vec3_::value, VIB_COMP_getSizeOfObject(), VIB_COMP_init(), VIB_COMP_reset(), VIB_COMP_setAdvIndexDelta(), VIB_COMP_setAlpha(), VIB_COMP_setFlag_enableOutput(), VIB_COMP_setFlag_enableUpdates(), and VIB_COMP_setParams().

interrupt void mainISR ( void  )

The main ISR that implements the motor control.

The main interrupt service (ISR) routine.

Definition at line 707 of file proj_lab11b.c.

References _IQ, _IQcosPU, _IQmpy, _IQsinPU, _IQsqrt, angleDelayComp(), CLARKE_run(), CPU_USAGE_run(), CPU_USAGE_updateCnts(), CTRL_computePhasor(), CTRL_getCount_isr(), CTRL_getIdq_in_addr(), CTRL_getNumIsrTicksPerCtrlTick(), CTRL_getState(), CTRL_getVdq_out_pu(), CTRL_incrCounter_isr(), CTRL_resetCounter_isr(), CTRL_runOffLine(), CTRL_runPiOnly(), CTRL_setup_user(), _HAL_AdcData_t_::dcBus, EST_doCurrentCtrl(), EST_doSpeedCtrl(), EST_getAngle_pu(), EST_getFm_pu(), EST_getIdq_pu(), EST_getOneOverDcBus_pu(), EST_getRsOnLineId_pu(), EST_run(), estHandle, _MOTOR_Vars_t_::Flag_enableOffsetcalc, _MOTOR_Vars_t_::Flag_enableRsRecalc, _MOTOR_Vars_t_::Flag_Run_Identify, getAbsElecAngle(), getAbsMechAngle(), gLEDcnt, HAL_acqAdcInt(), HAL_disablePwm(), HAL_readAdcData(), HAL_readAdcDataWithOffsets(), HAL_readTimerCnt(), HAL_toggleLed, HAL_writePwmData(), _HAL_AdcData_t_::I, IPARK_run(), IPARK_setPhasor(), Iq_Max_pu, LED_BLINK_FREQ_Hz, PARK_run(), PARK_setPhasor(), PID_getRefValue(), PID_run(), PID_run_spd(), PID_setMinMax(), pidCntSpeed, runCurrentIgnore(), runCurrentReconstruction(), runFieldWeakening(), runOffsetsCalculation(), runSetTrigger(), SVGEN_run(), _HAL_PwmData_t_::Tabc, TRAJ_getIntValue(), TRAJ_run(), trajHandle_Id, trajHandle_spd, USER_ISR_FREQ_Hz, USER_MAX_VS_MAG_PU, USER_MOTOR_TYPE, USER_NUM_CTRL_TICKS_PER_SPEED_TICK, _HAL_AdcData_t_::V, _MATH_vec3_::value, _MATH_vec2_::value, VIB_COMP_getIndex(), and VIB_COMP_run().

void runCurrentIgnore ( void  )

Definition at line 913 of file proj_lab11b.c.

References HAL_readPwmCmpA(), and HAL_readPwmCmpAM().

Referenced by mainISR().

void runCurrentReconstruction ( void  )

Definition at line 929 of file proj_lab11b.c.

References _HAL_AdcData_t_::I, and _MATH_vec3_::value.

Referenced by mainISR().

void runFieldWeakening ( void  )
void runOffsetsCalculation ( void  )
void runSetTrigger ( void  )

Definition at line 1051 of file proj_lab11b.c.

References gCmpOffset, and HAL_setTrigger().

Referenced by mainISR().

void setupClarke_I ( CLARKE_Handle  handle,
const uint_least8_t  numCurrentSensors 
)

Setup the Clarke transform for either 2 or 3 sensors.

Sets up the Clarke transform for current.

Sets the number of current sensors.

Parameters
[in]handleThe clarke (CLARKE) handle
[in]numCurrentSensorsThe number of current sensors

Definition at line 1066 of file proj_lab11b.c.

References _IQ, CLARKE_setNumSensors(), CLARKE_setScaleFactors(), MATH_ONE_OVER_SQRT_THREE, and MATH_ONE_OVER_THREE.

Referenced by main().

void setupClarke_V ( CLARKE_Handle  handle,
const uint_least8_t  numVoltageSensors 
)

Setup the Clarke transform for either 2 or 3 sensors.

Sets up the Clarke transform for voltage.

Sets the number of voltage sensors.

Parameters
[in]handleThe clarke (CLARKE) handle
[in]numVoltageSensorsThe number of voltage sensors

Definition at line 1098 of file proj_lab11b.c.

References _IQ, CLARKE_setNumSensors(), CLARKE_setScaleFactors(), MATH_ONE_OVER_SQRT_THREE, and MATH_ONE_OVER_THREE.

Referenced by main().

void softwareUpdate1p6 ( EST_Handle  handle)

Updates version 1p6 of library.

Updates version 1p6 of library.

implementation of InstaSPIN (version 1.6 of ROM) since the inductance calculation is not done correctly in ROM, so this function fixes that ROM bug.

Definition at line 1031 of file proj_lab11b.c.

References _IQ30, _IQ30toF(), EST_getLs_coarse_max_pu(), EST_setLs_d_pu(), EST_setLs_q_pu(), EST_setLs_qFmt(), USER_IQ_FULL_SCALE_CURRENT_A, USER_IQ_FULL_SCALE_VOLTAGE_V, USER_MOTOR_Ls_d, USER_MOTOR_Ls_q, and USER_VOLTAGE_FILTER_POLE_rps.

Referenced by main().

void updateCPUusage ( void  )
void updateGlobalVariables ( EST_Handle  handle)

Variable Documentation

CLARKE_Obj clarke_I

the current Clarke transform object

Definition at line 67 of file proj_lab11b.c.

CLARKE_Obj clarke_V

the voltage Clarke transform object

Definition at line 70 of file proj_lab11b.c.

CLARKE_Handle clarkeHandle_I

the handle for the current Clarke transform

Definition at line 66 of file proj_lab11b.c.

CLARKE_Handle clarkeHandle_V

the handle for the voltage Clarke transform

Definition at line 69 of file proj_lab11b.c.

CPU_USAGE_Obj cpu_usage

Definition at line 73 of file proj_lab11b.c.

CPU_USAGE_Handle cpu_usageHandle

Definition at line 72 of file proj_lab11b.c.

EST_Handle estHandle

the handle for the estimator

Definition at line 75 of file proj_lab11b.c.

Referenced by main(), and mainISR().

FILTER_FO_Obj filter[6]

the 3-current and 3-voltage filters for offset calculation

Definition at line 88 of file proj_lab11b.c.

FILTER_FO_Handle filterHandle[6]

the handles for the 3-current and 3-voltage filters for offset calculation

Definition at line 87 of file proj_lab11b.c.

FW_Obj fw

Definition at line 78 of file proj_lab11b.c.

FW_Handle fwHandle

Definition at line 77 of file proj_lab11b.c.

_iq gAbsAngle_elec_pu = _IQ(0.0)

Definition at line 204 of file proj_lab11b.c.

_iq gAbsAngle_mech_pu = _IQ(0.0)

Definition at line 206 of file proj_lab11b.c.

HAL_AdcData_t gAdcData

contains three current values, three voltage values and one DC buss value

Defines the ADC data.

Definition at line 109 of file proj_lab11b.c.

volatile int16_t gAdvIndexDelta = 10

Definition at line 214 of file proj_lab11b.c.

volatile _iq gAlpha = _IQ(0.99)

Definition at line 212 of file proj_lab11b.c.

_iq gAngle_mech_poles = _IQ(0.0)

Definition at line 208 of file proj_lab11b.c.

_iq gAngle_z1_pu = _IQ(0.0)

Definition at line 210 of file proj_lab11b.c.

int16_t gCmpOffset = (int16_t)(1.0 * USER_SYSTEM_FREQ_MHz)

Definition at line 140 of file proj_lab11b.c.

Referenced by runSetTrigger().

float_t gCpuUsagePercentageAvg = 0.0

Definition at line 170 of file proj_lab11b.c.

float_t gCpuUsagePercentageMax = 0.0

Definition at line 171 of file proj_lab11b.c.

float_t gCpuUsagePercentageMin = 0.0

Definition at line 169 of file proj_lab11b.c.

volatile bool gFlag_enableOutput = false

Definition at line 216 of file proj_lab11b.c.

volatile bool gFlag_enableRsOnLine = false

Definition at line 175 of file proj_lab11b.c.

volatile bool gFlag_enableUpdates = true

Definition at line 218 of file proj_lab11b.c.

volatile bool gFlag_resetVibComp = false

Definition at line 220 of file proj_lab11b.c.

volatile bool gFlag_speedStatsReset = false

Definition at line 202 of file proj_lab11b.c.

volatile bool gFlag_updateRs = false

Definition at line 177 of file proj_lab11b.c.

_iq gFlux_pu_to_VpHz_sf

Definition at line 157 of file proj_lab11b.c.

_iq gFlux_pu_to_Wb_sf

Definition at line 155 of file proj_lab11b.c.

MATH_vec3 gIavg = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}

Definition at line 142 of file proj_lab11b.c.

uint16_t gIavg_shift = 1

Definition at line 143 of file proj_lab11b.c.

MATH_vec2 gIdq_pu = {_IQ(0.0), _IQ(0.0)}

contains the Id and Iq measured values

Definition at line 119 of file proj_lab11b.c.

MATH_vec2 gIdq_ref_pu = {_IQ(0.0), _IQ(0.0)}

contains the Id and Iq references

Definition at line 115 of file proj_lab11b.c.

Definition at line 167 of file proj_lab11b.c.

volatile MOTOR_Vars_t gMotorVars = MOTOR_Vars_INIT

the global motor variables that are defined in main.h and used for display in the debugger's watch window

Definition at line 126 of file proj_lab11b.c.

uint32_t gOffsetCalcCount = 0

Definition at line 173 of file proj_lab11b.c.

MATH_vec3 gOffsets_I_pu = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}

contains the offsets for the current feedback

Definition at line 111 of file proj_lab11b.c.

MATH_vec3 gOffsets_V_pu = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}

contains the offsets for the voltage feedback

Definition at line 113 of file proj_lab11b.c.

HAL_PwmData_t gPwmData = {_IQ(0.0), _IQ(0.0), _IQ(0.0)}

contains the three pwm values -1.0 - 0%, 1.0 - 100%

Defines the PWM data.

Definition at line 107 of file proj_lab11b.c.

volatile _iq gRsOnLineFreq_Hz = _IQ(0.2)

Definition at line 179 of file proj_lab11b.c.

volatile _iq gRsOnLineId_mag_A = _IQ(0.5)

Definition at line 181 of file proj_lab11b.c.

volatile _iq gRsOnLinePole_Hz = _IQ(0.2)

Definition at line 183 of file proj_lab11b.c.

uint16_t gSpeed_array_index = 0

Definition at line 194 of file proj_lab11b.c.

_iq gSpeed_delta_krpm = _IQ(0.0)

Definition at line 200 of file proj_lab11b.c.

_iq gSpeed_fbk_out[360]

Definition at line 192 of file proj_lab11b.c.

_iq gSpeed_hz_to_krpm_sf = _IQ(60.0 / (float_t)USER_MOTOR_NUM_POLE_PAIRS / 1000.0)

Definition at line 165 of file proj_lab11b.c.

_iq gSpeed_krpm_to_pu_sf = _IQ((float_t)USER_MOTOR_NUM_POLE_PAIRS * 1000.0 / (USER_IQ_FULL_SCALE_FREQ_Hz * 60.0))

Definition at line 163 of file proj_lab11b.c.

_iq gSpeed_max_pu = _IQ(0.0)

Definition at line 196 of file proj_lab11b.c.

_iq gSpeed_min_pu = _IQ(1.0)

Definition at line 198 of file proj_lab11b.c.

_iq gTorque_Flux_Iq_pu_to_Nm_sf

Definition at line 161 of file proj_lab11b.c.

_iq gTorque_Ls_Id_Iq_pu_to_Nm_sf

Definition at line 159 of file proj_lab11b.c.

USER_Params gUserParams

The user parameters.

Definition at line 124 of file proj_lab11b.c.

MATH_vec2 gVdq_out_pu = {_IQ(0.0), _IQ(0.0)}

contains the output Vd and Vq from the current controllers

Definition at line 117 of file proj_lab11b.c.

HAL_Handle halHandle

the handle for the hardware abstraction layer (HAL)

The hal handle.

Definition at line 105 of file proj_lab11b.c.

IPARK_Obj ipark

the inverse Park transform object

Definition at line 85 of file proj_lab11b.c.

IPARK_Handle iparkHandle

the handle for the inverse Park transform

Definition at line 84 of file proj_lab11b.c.

PID_Obj pid[3]

three handles for PID controllers 0 - Speed, 1 - Id, 2 - Iq

Definition at line 80 of file proj_lab11b.c.

uint16_t pidCntSpeed

count variable to decimate the execution of the speed PID controller

Definition at line 82 of file proj_lab11b.c.

Referenced by main(), and mainISR().

PID_Handle pidHandle[3]

three objects for PID controllers 0 - Speed, 1 - Id, 2 - Iq

Definition at line 81 of file proj_lab11b.c.

SVGEN_Obj svgen

the space vector generator object

Definition at line 94 of file proj_lab11b.c.

SVGENCURRENT_Obj svgencurrent

Definition at line 90 of file proj_lab11b.c.

SVGENCURRENT_Handle svgencurrentHandle

Definition at line 91 of file proj_lab11b.c.

SVGEN_Handle svgenHandle

the handle for the space vector generator

Definition at line 93 of file proj_lab11b.c.

TRAJ_Obj traj_Id

the id reference trajectory object

Definition at line 97 of file proj_lab11b.c.

TRAJ_Obj traj_spd

the speed reference trajectory object

Definition at line 100 of file proj_lab11b.c.

TRAJ_Handle trajHandle_Id

the handle for the id reference trajectory

Definition at line 96 of file proj_lab11b.c.

TRAJ_Handle trajHandle_spd

the handle for the speed reference trajectory

Definition at line 99 of file proj_lab11b.c.

_iq vib_comp_reserved[400]

Definition at line 187 of file proj_lab11b.c.

VIB_COMP_Handle vib_compHandle

Definition at line 185 of file proj_lab11b.c.