instaspin_foc
Functions | Variables
fast_obs_pm_cal_rs_rsol_traj.c File Reference
#include "fast_obs.h"

Go to the source code of this file.

Functions

void main (void)
 
interrupt void mainISR (void)
 The main interrupt service (ISR) routine. More...
 
void setupClarke_I (CLARKE_Handle handle, const uint_least8_t numCurrentSensors)
 Sets the number of current sensors. More...
 
void setupClarke_V (CLARKE_Handle handle, const uint_least8_t numVoltageSensors)
 Sets the number of voltage sensors. More...
 
void setupControllers (void)
 Setups the controllers. More...
 
void updateGlobalVariables_motor (EST_Handle estHandle)
 Updates the global motor variables. More...
 
void updateCPUusage (void)
 Updates CPU usage. More...
 

Variables

CAL_State_e gCalState = CAL_State_Idle
 
EST_State_e gEstState = EST_State_Idle
 Global variable for the estimator state. More...
 
volatile bool gFlag_enableSys = true
 Global flag to enable/disable the system. More...
 
volatile bool gFlag_runCal = false
 
volatile bool gFlag_runOnLine = false
 
volatile bool gFlag_enableForceAngle = true
 
volatile bool gFlag_enableRsRecalc = true
 
volatile bool gFlag_enableRsOnLine = false
 
volatile bool gFlag_updateRs = false
 
float_t gFlux_Wb = 0.0
 Global variable for the rotor flux estimate, Wb. More...
 
float_t gLs_d_H = 0.0
 Global variable for the stator inductance in the direct coordinate direction, Henry. More...
 
float_t gLs_q_H = 0.0
 Global variable for the stator inductance in the quadrature coordinate direction, Henry. More...
 
float_t gRsOnLine_Ohm = 0.0
 
float_t gRs_Ohm = 0.0
 
float_t gSpeed_Hz = 0.0
 
float_t gSpeed_ref_Hz = 10.0
 
volatile float_t gSpeed_Kp = 0.01
 
volatile float_t gSpeed_Ki = 0.001
 
volatile float_t gId_ref_A = 0.0
 
float_t gId_rs_recalc_ref_A = 0.0
 
float_t gIq_ref_A = 0.0
 
uint16_t gCounter_speed = 0
 
HAL_AdcData_t gAdcData
 Defines the ADC data. More...
 
HAL_DacData_t gDacData
 Defines the DAC data. More...
 
HAL_PwmData_t gPwmData
 Defines the PWM data. More...
 
EST_InputData_t gEstInputData
 
EST_OutputData_t gEstOutputData
 
volatile float_t gRsOnLineFreq_Hz = 0.2
 
volatile float_t gRsOnLineId_mag_A = 0.5
 
volatile float_t gRsOnLinePole_Hz = 0.2
 
float_t gTorque_Nm = 0.0
 Global variable for the estimated torque, N*m. More...
 
USER_Params gUserParams
 The user parameters. More...
 
MATH_vec3 gOffsets_I_A = {0.0, 0.0, 0.0}
 
MATH_vec3 gOffsets_V_V = {0.0, 0.0, 0.0}
 
CAL_Handle calHandle
 the handle for the calibrator More...
 
CAL_Obj cal
 the calibrator object More...
 
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...
 
HAL_Handle halHandle
 the handle for the hardware abstraction layer More...
 
HAL_Obj hal
 the hardware abstraction layer object More...
 
EST_Handle estHandle
 the handle for the estimator More...
 
IPARK_Handle iparkHandle
 the handle for the inverse Park transform More...
 
IPARK_Obj ipark
 the inverse Park transform object More...
 
PARK_Handle parkHandle
 the handle for the Park object More...
 
PARK_Obj park
 the Park transform object More...
 
PI_Handle piHandle_Id
 the handle for the Id PI controller More...
 
PI_Obj pi_Id
 the Id PI controller object More...
 
PI_Handle piHandle_Iq
 the handle for the Iq PI controller More...
 
PI_Obj pi_Iq
 the Iq PI controller object More...
 
PI_Handle piHandle_spd
 the handle for the speed PI controller More...
 
PI_Obj pi_spd
 the speed PI controller object More...
 
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 trajectory More...
 
TRAJ_Obj traj_Id
 the Id trajectory object More...
 
TRAJ_Handle trajHandle_spd
 the handle for the speed trajectory More...
 
TRAJ_Obj traj_spd
 the speed trajectory object More...
 
CPU_USAGE_Handle cpu_usageHandle
 
CPU_USAGE_Obj cpu_usage
 
float_t gCpuUsagePercentageMin = 0.0
 
float_t gCpuUsagePercentageAvg = 0.0
 
float_t gCpuUsagePercentageMax = 0.0
 

Function Documentation

void main ( void  )

Definition at line 141 of file fast_obs_pm_cal_rs_rsol_traj.c.

References CAL_disable(), CAL_enable(), CAL_getOffsetValue_I(), CAL_getOffsetValue_V(), CAL_getState(), CAL_init(), CAL_setFlag_enableAdcOffset(), CAL_setParams(), CAL_updateState(), CLARKE_init(), CPU_USAGE_init(), CPU_USAGE_setParams(), EST_disable(), EST_enable(), EST_initEst(), EST_setFlag_enableForceAngle(), EST_setFlag_enableRsOnLine(), EST_setFlag_enableRsRecalc(), EST_setFlag_updateRs(), EST_setParams(), EST_setRsOnLine_beta_rad(), EST_setRsOnLineAngleDelta_rad(), EST_setRsOnLineId_mag_A(), EST_updateState(), _USER_Params_::estFreq_Hz, estHandle, gFlag_enableForceAngle, gFlag_enableRsOnLine, gFlag_enableRsRecalc, gFlag_enableSys, gFlag_runCal, gFlag_runOnLine, gFlag_updateRs, gId_ref_A, gId_rs_recalc_ref_A, gIq_ref_A, gRsOnLineFreq_Hz, gRsOnLineId_mag_A, gRsOnLinePole_Hz, gSpeed_Ki, gSpeed_Kp, gSpeed_ref_Hz, 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(), IPARK_init(), MATH_TWO_PI, _USER_Params_::maxAccel_Hzps, _USER_Params_::maxCurrent_A, _USER_Params_::maxCurrent_resEst_A, _USER_Params_::numCurrentSensors, _USER_Params_::numVoltageSensors, PARK_init(), PI_init(), PI_setGains(), PI_setUi(), setupClarke_I(), setupClarke_V(), setupControllers(), SVGEN_init(), TRAJ_init(), TRAJ_setIntValue(), TRAJ_setMaxDelta(), TRAJ_setMaxValue(), TRAJ_setMinValue(), TRAJ_setTargetValue(), updateCPUusage(), updateGlobalVariables_motor(), USER_EST_FREQ_Hz, USER_ISR_FREQ_Hz, USER_setParams(), USER_SYSTEM_FREQ_MHz, and _MATH_vec3_::value.

Variable Documentation

CAL_Obj cal

the calibrator object

Definition at line 90 of file fast_obs_pm_cal_rs_rsol_traj.c.

CAL_Handle calHandle

the handle for the calibrator

Definition at line 89 of file fast_obs_pm_cal_rs_rsol_traj.c.

CLARKE_Obj clarke_I

the current Clarke transform object

Definition at line 93 of file fast_obs_pm_cal_rs_rsol_traj.c.

CLARKE_Obj clarke_V

the voltage Clarke transform object

Definition at line 96 of file fast_obs_pm_cal_rs_rsol_traj.c.

CLARKE_Handle clarkeHandle_I

the handle for the current Clarke transform

Definition at line 92 of file fast_obs_pm_cal_rs_rsol_traj.c.

CLARKE_Handle clarkeHandle_V

the handle for the voltage Clarke transform

Definition at line 95 of file fast_obs_pm_cal_rs_rsol_traj.c.

CPU_USAGE_Obj cpu_usage

Definition at line 133 of file fast_obs_pm_cal_rs_rsol_traj.c.

CPU_USAGE_Handle cpu_usageHandle

Definition at line 132 of file fast_obs_pm_cal_rs_rsol_traj.c.

EST_Handle estHandle

the handle for the estimator

Definition at line 101 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main(), and mainISR().

CAL_State_e gCalState = CAL_State_Idle

Definition at line 21 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by updateGlobalVariables_motor().

uint16_t gCounter_speed = 0

Definition at line 63 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by mainISR().

float_t gCpuUsagePercentageAvg = 0.0

Definition at line 135 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by updateCPUusage().

float_t gCpuUsagePercentageMax = 0.0

Definition at line 136 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by updateCPUusage().

float_t gCpuUsagePercentageMin = 0.0

Definition at line 134 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by updateCPUusage().

EST_InputData_t gEstInputData

Definition at line 71 of file fast_obs_pm_cal_rs_rsol_traj.c.

EST_OutputData_t gEstOutputData

Definition at line 73 of file fast_obs_pm_cal_rs_rsol_traj.c.

volatile bool gFlag_enableForceAngle = true

Definition at line 31 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile bool gFlag_enableRsOnLine = false

Definition at line 35 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile bool gFlag_enableRsRecalc = true

Definition at line 33 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile bool gFlag_runCal = false

Definition at line 27 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile bool gFlag_runOnLine = false

Definition at line 29 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile bool gFlag_updateRs = false

Definition at line 37 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile float_t gId_ref_A = 0.0

Definition at line 57 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

float_t gId_rs_recalc_ref_A = 0.0

Definition at line 59 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main(), and mainISR().

float_t gIq_ref_A = 0.0

Definition at line 61 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main(), and mainISR().

MATH_vec3 gOffsets_I_A = {0.0, 0.0, 0.0}

Definition at line 85 of file fast_obs_pm_cal_rs_rsol_traj.c.

MATH_vec3 gOffsets_V_V = {0.0, 0.0, 0.0}

Definition at line 87 of file fast_obs_pm_cal_rs_rsol_traj.c.

float_t gRs_Ohm = 0.0

Definition at line 47 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by updateGlobalVariables_motor().

float_t gRsOnLine_Ohm = 0.0

Definition at line 45 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by updateGlobalVariables_motor().

volatile float_t gRsOnLineFreq_Hz = 0.2

Definition at line 75 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile float_t gRsOnLineId_mag_A = 0.5

Definition at line 77 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

volatile float_t gRsOnLinePole_Hz = 0.2

Definition at line 79 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

float_t gSpeed_Hz = 0.0

Definition at line 49 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by updateGlobalVariables_motor().

volatile float_t gSpeed_Ki = 0.001

Definition at line 55 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main(), and setupControllers().

volatile float_t gSpeed_Kp = 0.01

Definition at line 53 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main(), and setupControllers().

float_t gSpeed_ref_Hz = 10.0

Definition at line 51 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by main().

HAL_Obj hal

the hardware abstraction layer object

Definition at line 99 of file fast_obs_pm_cal_rs_rsol_traj.c.

IPARK_Obj ipark

the inverse Park transform object

Definition at line 104 of file fast_obs_pm_cal_rs_rsol_traj.c.

IPARK_Handle iparkHandle

the handle for the inverse Park transform

Definition at line 103 of file fast_obs_pm_cal_rs_rsol_traj.c.

PARK_Obj park

the Park transform object

Definition at line 107 of file fast_obs_pm_cal_rs_rsol_traj.c.

PARK_Handle parkHandle

the handle for the Park object

Definition at line 106 of file fast_obs_pm_cal_rs_rsol_traj.c.

PI_Obj pi_Id

the Id PI controller object

Definition at line 110 of file fast_obs_pm_cal_rs_rsol_traj.c.

PI_Obj pi_Iq

the Iq PI controller object

Definition at line 113 of file fast_obs_pm_cal_rs_rsol_traj.c.

PI_Obj pi_spd

the speed PI controller object

Definition at line 116 of file fast_obs_pm_cal_rs_rsol_traj.c.

PI_Handle piHandle_Id

the handle for the Id PI controller

Definition at line 109 of file fast_obs_pm_cal_rs_rsol_traj.c.

PI_Handle piHandle_Iq

the handle for the Iq PI controller

Definition at line 112 of file fast_obs_pm_cal_rs_rsol_traj.c.

PI_Handle piHandle_spd

the handle for the speed PI controller

Definition at line 115 of file fast_obs_pm_cal_rs_rsol_traj.c.

SVGEN_Obj svgen

the space vector generator object

Definition at line 119 of file fast_obs_pm_cal_rs_rsol_traj.c.

SVGEN_Handle svgenHandle

the handle for the space vector generator

Definition at line 118 of file fast_obs_pm_cal_rs_rsol_traj.c.

TRAJ_Obj traj_Id

the Id trajectory object

Definition at line 122 of file fast_obs_pm_cal_rs_rsol_traj.c.

TRAJ_Obj traj_spd

the speed trajectory object

Definition at line 125 of file fast_obs_pm_cal_rs_rsol_traj.c.

TRAJ_Handle trajHandle_Id

the handle for the Id trajectory

Definition at line 121 of file fast_obs_pm_cal_rs_rsol_traj.c.

TRAJ_Handle trajHandle_spd

the handle for the speed trajectory

Definition at line 124 of file fast_obs_pm_cal_rs_rsol_traj.c.

Referenced by mainISR().