55 #pragma CODE_SECTION(mainISR,"ramfuncs");
103 #pragma DATA_SECTION(halHandle,"rom_accessed_data");
122 #pragma DATA_SECTION(gUserParams,"rom_accessed_data");
130 extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;
133 extern uint16_t *econst_start, *econst_end, *econst_ram_load;
134 extern uint16_t *switch_start, *switch_end, *switch_ram_load;
190 #pragma DATA_SECTION(gSpeed_fbk_out,"ebss_extension");
232 memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart);
236 if(*econst_end - *econst_start)
238 memCopy((uint16_t *)&econst_start,(uint16_t *)&econst_end,(uint16_t *)&econst_ram_load);
242 if(*switch_end - *switch_start)
244 memCopy((uint16_t *)&switch_start,(uint16_t *)&switch_end,(uint16_t *)&switch_ram_load);
271 clarkeHandle_I =
CLARKE_init(&clarke_I,
sizeof(clarke_I));
272 clarkeHandle_V =
CLARKE_init(&clarke_V,
sizeof(clarke_V));
346 _iq Kp_Id =
_IQ((0.25*Ls_d*fullScaleCurrent)/(IsrPeriod_sec*fullScaleVoltage));
347 _iq Ki_Id =
_IQ(RoverLs_d*IsrPeriod_sec);
348 _iq Kp_Iq =
_IQ((0.25*Ls_q*fullScaleCurrent)/(IsrPeriod_sec*fullScaleVoltage));
349 _iq Ki_Iq =
_IQ(RoverLs_q*IsrPeriod_sec);
351 pidHandle[0] =
PID_init(&pid[0],
sizeof(pid[0]));
352 pidHandle[1] =
PID_init(&pid[1],
sizeof(pid[1]));
353 pidHandle[2] =
PID_init(&pid[2],
sizeof(pid[2]));
379 for(cnt=0;cnt<360;cnt++)
381 gSpeed_fbk_out[cnt] =
_IQ(0.0);
390 iparkHandle =
IPARK_init(&ipark,
sizeof(ipark));
399 for(cnt=0;cnt<6;cnt++)
401 filterHandle[cnt] =
FILTER_FO_init(&filter[cnt],
sizeof(filter[0]));
411 svgenHandle =
SVGEN_init(&svgen,
sizeof(svgen));
418 float_t minWidth_microseconds = 2.0;
421 SVGENCURRENT_setMinWidth(svgencurrentHandle, minWidth_counts);
422 SVGENCURRENT_setIgnoreShunt(svgencurrentHandle, use_all);
426 trajHandle_spd =
TRAJ_init(&traj_spd,
sizeof(traj_spd));
436 trajHandle_Id =
TRAJ_init(&traj_Id,
sizeof(traj_Id));
448 fwHandle =
FW_init(&fw,
sizeof(fw));
630 gFlag_enableRsOnLine =
false;
631 gFlag_updateRs =
false;
683 if(gFlag_resetVibComp)
685 gFlag_resetVibComp =
false;
689 if(gFlag_speedStatsReset)
691 gFlag_speedStatsReset =
false;
692 gSpeed_max_pu =
_IQ(0.0);
693 gSpeed_min_pu =
_IQ(1.0);
765 gAbsAngle_mech_pu =
getAbsMechAngle(&gAngle_mech_poles, &gAngle_z1_pu, gAbsAngle_elec_pu);
795 if(speed_pu > gSpeed_max_pu)
797 gSpeed_max_pu = speed_pu;
800 if(speed_pu < gSpeed_min_pu)
802 gSpeed_min_pu = speed_pu;
810 fbackValue = gIdq_pu.
value[0];
813 PID_run(pidHandle[1],refValue,fbackValue,&(gVdq_out_pu.
value[0]));
823 fbackValue = gIdq_pu.
value[1];
828 PID_run(pidHandle[2],refValue,fbackValue,&(gVdq_out_pu.
value[1]));
841 IPARK_run(iparkHandle,&gVdq_out_pu,&Vab_pu);
891 _iq angleDeltaComp_pu =
_IQmpy(angleDelta_pu, angleCompFactor);
892 uint32_t angleMask = ((uint32_t)0xFFFFFFFF >> (32 -
GLOBAL_Q));
897 angleTmp_pu = angleUncomp_pu + angleDeltaComp_pu;
901 angleComp_pu =
_IQabs(angleTmp_pu) & angleMask;
904 if(angleTmp_pu <
_IQ(0.0))
906 angleComp_pu = -angleComp_pu;
909 return(angleComp_pu);
923 SVGENCURRENT_RunIgnoreShunt(svgencurrentHandle,cmp1,cmp2,cmp3,cmpM1,cmpM2,cmpM3);
932 SVGENCURRENT_RunRegenCurrent(svgencurrentHandle, (
MATH_vec3 *)(gAdcData.
I.
value));
938 if(ignoreShuntThisCycle == ignore_ab)
943 else if(ignoreShuntThisCycle == ignore_ac)
948 else if(ignoreShuntThisCycle == ignore_bc)
971 refValue = gMotorVars.
VsRef;
973 fbackValue = gMotorVars.
Vs;
975 FW_run(fwHandle, refValue, fbackValue, &(gIdq_ref_pu.
value[0]));
996 for(cnt=0;cnt<3;cnt++)
1002 gOffsets_I_pu.
value[cnt] =
_IQ(0.0);
1003 gOffsets_V_pu.
value[cnt] =
_IQ(0.0);
1010 if(gOffsetCalcCount++ >= gUserParams.
ctrlWaitTime[CTRL_State_OffLine])
1013 gOffsetCalcCount = 0;
1015 for(cnt=0;cnt<3;cnt++)
1035 int_least8_t lShift = ceil(log(
USER_MOTOR_Ls_d/(Ls_coarse_max*fullScaleInductance))/log(2.0));
1036 uint_least8_t Ls_qFmt = 30 - lShift;
1037 float_t L_max = fullScaleInductance * pow(2.0,lShift);
1053 int16_t minwidth = SVGENCURRENT_getMinWidth(svgencurrentHandle);
1068 _iq alpha_sf,beta_sf;
1071 if(numCurrentSensors == 3)
1076 else if(numCurrentSensors == 2)
1078 alpha_sf =
_IQ(1.0);
1083 alpha_sf =
_IQ(0.0);
1100 _iq alpha_sf,beta_sf;
1103 if(numVoltageSensors == 3)
1110 alpha_sf =
_IQ(0.0);
1135 _iq Torque_Flux_Iq_Nm =
_IQmpy(
_IQmpy(Flux_pu,Iq_pu),gTorque_Flux_Iq_pu_to_Nm_sf);
1136 _iq Torque_Ls_Id_Iq_Nm =
_IQmpy(
_IQmpy(
_IQmpy(Ld_minus_Lq_pu,Id_pu),Iq_pu),gTorque_Ls_Id_Iq_pu_to_Nm_sf);
1137 _iq Torque_Nm = Torque_Flux_Iq_Nm + Torque_Ls_Id_Iq_Nm;
1173 gMotorVars.
Vd = gVdq_out_pu.
value[0];
1174 gMotorVars.
Vq = gVdq_out_pu.
value[1];
1202 gCpuUsagePercentageMin = (
float_t)minDeltaCntObserved / cpu_usage_den * 100.0;
1205 gCpuUsagePercentageAvg = (
float_t)avgDeltaCntObserved / cpu_usage_den * 100.0;
1208 gCpuUsagePercentageMax = (
float_t)maxDeltaCntObserved / cpu_usage_den * 100.0;
1222 if(angle_pu <
_IQ(0.0))
1224 angle_abs_pu = angle_pu +
_IQ(1.0);
1228 angle_abs_pu = angle_pu;
1231 return(angle_abs_pu);
1241 _iq angle_elec_delta_pu =
_IQ(0.0);
1242 _iq tmp_mech_pu =
_IQ(0.0);
1243 _iq angle_mech_out =
_IQ(0.0);
1246 angle_elec_delta_pu = angle_pu - *pAngle_z1_pu;
1249 tmp_mech_pu = *pAngle_mech_poles + angle_elec_delta_pu;
1252 if(angle_elec_delta_pu <
_IQ(-0.5))
1254 tmp_mech_pu = tmp_mech_pu +
_IQ(1.0);
1256 else if(angle_elec_delta_pu >
_IQ(0.5))
1258 tmp_mech_pu = tmp_mech_pu -
_IQ(1.0);
1272 *pAngle_mech_poles = tmp_mech_pu;
1278 if(tmp_mech_pu <
_IQ(0.0))
1280 angle_mech_out = tmp_mech_pu +
_IQ(1.0);
1284 angle_mech_out = tmp_mech_pu;
1288 *pAngle_z1_pu = angle_pu;
1291 return(angle_mech_out);
float_t EST_getFlux_VpHz(EST_Handle handle)
USER_Params gUserParams
The user parameters.
#define USER_SYSTEM_FREQ_MHz
CLOCKS & TIMERS.
float_t EST_getRsOnLine_Ohm(EST_Handle handle)
volatile bool gFlag_speedStatsReset
#define USER_NUM_CURRENT_SENSORS
Defines the number of current sensors used.
void EST_setFlag_enableForceAngle(EST_Handle handle, const bool state)
void updateGlobalVariables(EST_Handle handle)
Update the global variables (gMotorVars).
IPARK_Handle IPARK_init(void *pMemory, const size_t numBytes)
_iq EST_getLs_coarse_max_pu(EST_Handle handle)
static void TRAJ_setTargetValue(TRAJ_Handle handle, const _iq targetValue)
CLARKE_Handle clarkeHandle_V
the handle for the voltage Clarke transform
volatile int16_t gAdvIndexDelta
void HAL_enableGlobalInts(HAL_Handle handle)
void HAL_enableAdcInts(HAL_Handle handle)
static _iq PID_getRefValue(PID_Handle handle)
USER_ErrorCode_e UserErrorCode
#define USER_MAX_NEGATIVE_ID_REF_CURRENT_A
LIMITS.
uint32_t gOffsetCalcCount
static void HAL_readAdcDataWithOffsets(HAL_Handle handle, HAL_AdcData_t *pAdcData)
_iq USER_computeFlux_pu_to_VpHz_sf(void)
Computes the scale factor needed to convert from per unit to V/Hz.
static void TRAJ_setMaxDelta(TRAJ_Handle handle, const _iq maxDelta)
PID_Handle pidHandle[3]
three objects for PID controllers 0 - Speed, 1 - Id, 2 - Iq
static void PID_setUi(PID_Handle handle, const _iq Ui)
EST_Handle estHandle
the handle for the estimator
_iq EST_getSpeed_krpm(EST_Handle handle)
void EST_setRsOnLineAngleDelta_pu(EST_Handle handle, const _iq angleDelta_pu)
static uint16_t HAL_readPwmCmpAM(HAL_Handle handle, const PWM_Number_e pwmNumber)
int16_t VIB_COMP_getIndex(VIB_COMP_Handle handle)
void EST_setRsOnLineId_mag_pu(EST_Handle handle, const _iq Id_mag_pu)
FW_Handle FW_init(void *pMemory, const size_t numBytes)
static _iq TRAJ_getIntValue(TRAJ_Handle handle)
void EST_setupEstIdleState(EST_Handle handle)
static bool FW_getFlag_enableFw(FW_Handle fwHandle)
static uint32_t FW_getNumIsrTicksPerFwTick(FW_Handle fwHandle)
bool Flag_enablePowerWarp
static void HAL_writePwmData(HAL_Handle handle, HAL_PwmData_t *pPwmData)
static void FW_setOutput(FW_Handle fwHandle, const _iq output)
void runCurrentIgnore(void)
FILTER_FO_Handle filterHandle[6]
the handles for the 3-current and 3-voltage filters for offset calculation
TRAJ_Handle trajHandle_spd
the handle for the speed reference trajectory
struct _EST_Obj_ * EST_Handle
void EST_setIdle(EST_Handle handle)
void HAL_writeDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
#define USER_VD_SF
Defines the direct voltage (Vd) scale factor.
static void HAL_acqAdcInt(HAL_Handle handle, const ADC_IntNumber_e intNumber)
uint_least32_t ctrlWaitTime[CTRL_numStates]
void setupClarke_I(CLARKE_Handle handle, const uint_least8_t numCurrentSensors)
Setup the Clarke transform for either 2 or 3 sensors.
TRAJ_Obj traj_spd
the speed reference trajectory object
#define USER_IQ_FULL_SCALE_VOLTAGE_V
Defines full scale value for the IQ30 variable of Voltage inside the system.
volatile bool gFlag_updateRs
#define USER_MOTOR_NUM_POLE_PAIRS
volatile _iq gRsOnLinePole_Hz
static void FW_run(FW_Handle fwHandle, const _iq refValue, const _iq fbackValue, _iq *pOutValue)
void memCopy(uint16_t *srcStartAddr, uint16_t *srcEndAddr, uint16_t *dstAddr)
void VIB_COMP_reset(VIB_COMP_Handle handle)
bool Flag_enableForceAngle
#define USER_PWM_FREQ_kHz
Defines the Pulse Width Modulation (PWM) frequency, kHz.
static void PID_setMinMax(PID_Handle handle, const _iq outMin, const _iq outMax)
static void SVGEN_run(SVGEN_Handle handle, const MATH_vec2 *pVab, MATH_vec3 *pT)
static uint32_t CPU_USAGE_getAvgDeltaCntObserved(CPU_USAGE_Handle handle)
static _iq FILTER_FO_run(FILTER_FO_Handle handle, const _iq inputValue)
static _iq PID_getFbackValue(PID_Handle handle)
uint16_t pidCntSpeed
count variable to decimate the execution of the speed PID controller
SVGEN_Obj svgen
the space vector generator object
void VIB_COMP_setFlag_enableUpdates(VIB_COMP_Handle handle, const bool state)
interrupt void mainISR(void)
The main ISR that implements the motor control.
#define MATH_ONE_OVER_THREE
void USER_setParams(USER_Params *pUserParams)
Sets the user parameter values.
void EST_setLs_qFmt(EST_Handle handle, const uint_least8_t Ls_qFmt)
SVGENCURRENT_Handle svgencurrentHandle
#define USER_MAX_ACCEL_Hzps
Defines the starting maximum acceleration AND deceleration for the speed profiles, Hz/s.
void EST_setFlag_updateRs(EST_Handle handle, const bool state)
static _iq FILTER_FO_get_y1(FILTER_FO_Handle handle)
FILTER_FO_Handle FILTER_FO_init(void *pMemory, const size_t numBytes)
#define V_A_offset
ADC voltage offsets for A, B, and C phases.
_iq EST_getLs_d_pu(EST_Handle handle)
#define I_A_offset
ADC current offsets for A, B, and C phases.
MATH_vec2 gVdq_out_pu
contains the output Vd and Vq from the current controllers
static void CLARKE_setScaleFactors(CLARKE_Handle handle, const _iq alpha_sf, const _iq beta_sf)
Defines the structures, global initialization, and functions used in MAIN.
void setupClarke_V(CLARKE_Handle handle, const uint_least8_t numVoltageSensors)
Setup the Clarke transform for either 2 or 3 sensors.
HAL_PwmData_t gPwmData
contains the three pwm values -1.0 - 0%, 1.0 - 100%
TRAJ_Handle TRAJ_init(void *pMemory, const size_t numBytes)
CTRL_Handle CTRL_init(void *pMemory, const size_t numBytes)
void HAL_setupFaults(HAL_Handle handle)
EST_Handle EST_init(void *pMemory, const size_t numBytes)
_iq angleDelayComp(const _iq fm_pu, const _iq angleUncomp_pu)
The angleDelayComp function compensates for the delay introduced.
float_t EST_getLs_d_H(EST_Handle handle)
void EST_setFlag_enableRsRecalc(EST_Handle handle, const bool state)
void runFieldWeakening(void)
static void TRAJ_setIntValue(TRAJ_Handle handle, const _iq intValue)
volatile bool gFlag_resetVibComp
MATH_vec2 gIdq_pu
contains the Id and Iq measured values
static void PID_setGains(PID_Handle handle, const _iq Kp, const _iq Ki, const _iq Kd)
static void HAL_enablePwm(HAL_Handle handle)
#define USER_MAX_VS_MAG_PU
Defines the maximum Voltage vector (Vs) magnitude allowed. This value sets the maximum magnitude for ...
void CTRL_setParams(CTRL_Handle handle, USER_Params *pUserParams)
void runOffsetsCalculation(void)
HAL_Handle halHandle
the handle for the hardware abstraction layer (HAL)
USER_ErrorCode_e USER_getErrorCode(USER_Params *pUserParams)
Gets the error code in the user parameters.
void HAL_enableDrv(HAL_Handle handle)
void VIB_COMP_setAlpha(VIB_COMP_Handle handle, const _iq alpha)
MATH_vec3 gOffsets_V_pu
contains the offsets for the voltage feedback
void FILTER_FO_setNumCoeffs(FILTER_FO_Handle handle, const _iq b0, const _iq b1)
volatile _iq gRsOnLineId_mag_A
_iq EST_getOneOverDcBus_pu(EST_Handle handle)
_iq EST_getFlux_pu(EST_Handle handle)
void HAL_setupDrvSpi(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
float_t EST_getLs_q_H(EST_Handle handle)
#define USER_EST_HANDLE_ADDRESS
Defines the address of estimator handle.
void HAL_enableDebugInt(HAL_Handle handle)
void CTRL_setupEstIdleState(CTRL_Handle handle)
#define USER_NUM_CTRL_TICKS_PER_SPEED_TICK
Defines the number of controller clock ticks per speed controller clock tick.
CLARKE_Handle CLARKE_init(void *pMemory, const size_t numBytes)
static void FW_incCounter(FW_Handle fwHandle)
void CTRL_setUserMotorParams(CTRL_Handle handle)
SVGENCURRENT_IgnoreShunt_e
static void IPARK_run(IPARK_Handle handle, const MATH_vec2 *pInVec, MATH_vec2 *pOutVec)
#define FW_NUM_ISR_TICKS_PER_CTRL_TICK
void VIB_COMP_setAdvIndexDelta(VIB_COMP_Handle handle, const int16_t adv_index_delta)
EST_State_e EST_getState(EST_Handle handle)
bool Flag_enableOffsetcalc
float_t gCpuUsagePercentageMin
FILTER_FO_Obj filter[6]
the 3-current and 3-voltage filters for offset calculation
_iq EST_getFm_pu(EST_Handle handle)
TRAJ_Handle trajHandle_Id
the handle for the id reference trajectory
TRAJ_Obj traj_Id
the id reference trajectory object
#define MOTOR_Vars_INIT
Initialization values of global variables.
void EST_setFlag_enableRsOnLine(EST_Handle handle, const bool state)
_iq USER_computeTorque_Flux_Iq_pu_to_Nm_sf(void)
Computes the scale factor needed to convert from torque created by flux and Iq, from per unit to Nm...
CLARKE_Handle clarkeHandle_I
the handle for the current Clarke transform
float_t EST_getIdRated(EST_Handle handle)
float_t gCpuUsagePercentageMax
#define USER_MOTOR_RES_EST_CURRENT
void softwareUpdate1p6(EST_Handle handle)
Updates version 1p6 of library.
static uint32_t HAL_readTimerCnt(HAL_Handle handle, const uint_least8_t timerNumber)
_iq EST_getLs_q_pu(EST_Handle handle)
static void CLARKE_setNumSensors(CLARKE_Handle handle, const uint_least8_t numSensors)
float_t EST_getRs_Ohm(EST_Handle handle)
VIB_COMP_Handle vib_compHandle
#define USER_MOTOR_MAGNETIZING_CURRENT
CPU_USAGE_Handle cpu_usageHandle
#define USER_IQ_FULL_SCALE_FREQ_Hz
CURRENTS AND VOLTAGES.
volatile bool gFlag_enableUpdates
void CPU_USAGE_setParams(CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts, const uint32_t numDeltaCntsAvg)
static void FW_setFlag_enableFw(FW_Handle fwHandle, const bool state)
size_t VIB_COMP_getSizeOfObject(void)
#define USER_ISR_FREQ_Hz
Defines the Interrupt Service Routine (ISR) frequency, Hz.
static void IPARK_setPhasor(IPARK_Handle handle, const MATH_vec2 *pPhasor)
static void FW_clearCounter(FW_Handle fwHandle)
CPU_USAGE_Handle CPU_USAGE_init(void *pMemory, const size_t numBytes)
HAL_AdcData_t gAdcData
contains three current values, three voltage values and one DC buss value
_iq EST_getAngle_pu(EST_Handle handle)
static void HAL_disablePwm(HAL_Handle handle)
float_t EST_runPowerWarp(EST_Handle handle, const float_t Id_int_A, const float_t Iq_A)
void FILTER_FO_setInitialConditions(FILTER_FO_Handle handle, const _iq x1, const _iq y1)
static void TRAJ_setMaxValue(TRAJ_Handle handle, const _iq maxValue)
VIB_COMP_Handle VIB_COMP_init(void *pMemory, const size_t numBytes)
static void FW_setDeltas(FW_Handle fwHandle, const _iq delta_inc, const _iq delta_dec)
struct _VIB_COMP_Obj_ * VIB_COMP_Handle
volatile bool gFlag_enableRsOnLine
PID_Handle PID_init(void *pMemory, const size_t numBytes)
HAL_Handle HAL_init(void *pMemory, const size_t numBytes)
float_t gCpuUsagePercentageAvg
_iq vib_comp_reserved[400]
static void CLARKE_run(CLARKE_Handle handle, const MATH_vec3 *pInVec, MATH_vec2 *pOutVec)
void EST_setAngle_pu(EST_Handle handle, const _iq angle_pu)
static uint32_t CPU_USAGE_getMaxDeltaCntObserved(CPU_USAGE_Handle handle)
uint16_t gSpeed_array_index
static uint16_t HAL_readPwmCmpA(HAL_Handle handle, const PWM_Number_e pwmNumber)
_iq gTorque_Ls_Id_Iq_pu_to_Nm_sf
#define USER_VOLTAGE_FILTER_POLE_rps
Defines the analog voltage filter pole location, rad/s.
CLARKE_Obj clarke_I
the current Clarke transform object
#define USER_NUM_VOLTAGE_SENSORS
Defines the number of voltage (phase) sensors.
void EST_setLs_q_pu(EST_Handle handle, const _iq Ls_q_pu)
uint_least32_t ctrlFreq_Hz
#define USER_IQ_FULL_SCALE_CURRENT_A
Defines the full scale current for the IQ variables, A.
static void HAL_setTrigger(HAL_Handle handle, const SVGENCURRENT_IgnoreShunt_e ignoreShunt, const int16_t minwidth, const int16_t cmpOffset)
_iq getAbsMechAngle(_iq *pAngle_mech_poles, _iq *pAngle_z1_pu, const _iq angle_pu)
Calculates mechanical angle from electrical angle.
SVGEN_Handle svgenHandle
the handle for the space vector generator
static void PID_run_spd(PID_Handle handle, const _iq refValue, const _iq fbackValue, _iq *pOutValue)
CTRL_Handle ctrlHandle
The controller handle.
_iq EST_getRsOnLineId_pu(EST_Handle handle)
static void CPU_USAGE_updateCnts(CPU_USAGE_Handle handle, const uint32_t cnt)
volatile bool gFlag_enableOutput
void runCurrentReconstruction(void)
CLARKE_Obj clarke_V
the voltage Clarke transform object
static uint32_t CPU_USAGE_getMinDeltaCntObserved(CPU_USAGE_Handle handle)
#define MATH_ONE_OVER_SQRT_THREE
static uint32_t FW_getCounter(FW_Handle fwHandle)
_iq gTorque_Flux_Iq_pu_to_Nm_sf
static void HAL_initIntVectorTable(HAL_Handle handle)
_iq VIB_COMP_run(VIB_COMP_Handle handle, const _iq angle_mech_pu, const _iq Iq_in_pu)
void FILTER_FO_setDenCoeffs(FILTER_FO_Handle handle, const _iq a1)
IPARK_Handle iparkHandle
the handle for the inverse Park transform
SVGENCURRENT_Handle SVGENCURRENT_init(void *pMemory, const size_t numBytes)
static void FW_setNumIsrTicksPerFwTick(FW_Handle fwHandle, const uint32_t numIsrTicksPerFwTick)
_iq getAbsElecAngle(const _iq angle_pu)
Calculates the absolute electrical angle.
static uint16_t HAL_readPwmPeriod(HAL_Handle handle, const PWM_Number_e pwmNumber)
bool EST_updateState(EST_Handle handle, const _iq Id_target_pu)
float_t EST_getRr_Ohm(EST_Handle handle)
MATH_vec2 gIdq_ref_pu
contains the Id and Iq references
void HAL_setParams(HAL_Handle handle, const USER_Params *pUserParams)
static void CPU_USAGE_run(CPU_USAGE_Handle handle)
void EST_setRsOnLineId_pu(EST_Handle handle, const _iq Id_pu)
void HAL_readDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
void EST_setRsOnLineFilterParams(EST_Handle handle, const EST_RsOnLineFilterType_e filterType, const _iq filter_0_b0, const _iq filter_0_a1, const _iq filter_0_y1, const _iq filter_1_b0, const _iq filter_1_a1, const _iq filter_1_y1)
volatile _iq gRsOnLineFreq_Hz
bool Flag_enableFieldWeakening
static void TRAJ_run(TRAJ_Handle handle)
MATH_vec3 gOffsets_I_pu
contains the offsets for the current feedback
#define USER_MOTOR_MAX_CURRENT
void VIB_COMP_setParams(VIB_COMP_Handle handle, const _iq alpha, const int16_t adv_index_delta)
static void FW_setMinMax(FW_Handle fwHandle, const _iq outMin, const _iq outMax)
void EST_getIdq_pu(EST_Handle handle, MATH_vec2 *pIdq_pu)
void USER_checkForErrors(USER_Params *pUserParams)
Checks for errors in the user parameter values.
void updateCPUusage(void)
Updates CPU usage.
SVGEN_Handle SVGEN_init(void *pMemory, const size_t numBytes)
void EST_setEstParams(EST_Handle handle, USER_Params *pUserParams)
_iq USER_computeTorque_Ls_Id_Iq_pu_to_Nm_sf(void)
Computes the scale factor needed to convert from torque created by Ld, Lq, Id and Iq...
PID_Obj pid[3]
three handles for PID controllers 0 - Speed, 1 - Id, 2 - Iq
_iq USER_computeFlux_pu_to_Wb_sf(void)
Computes the scale factor needed to convert from per unit to Wb.
void EST_setLs_d_pu(EST_Handle handle, const _iq Ls_d_pu)
volatile MOTOR_Vars_t gMotorVars
the global motor variables that are defined in main.h and used for display in the debugger's watch wi...
SVGENCURRENT_Obj svgencurrent
static void PID_run(PID_Handle handle, const _iq refValue, const _iq fbackValue, _iq *pOutValue)
static void TRAJ_setMinValue(TRAJ_Handle handle, const _iq minValue)
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)
#define USER_NUM_PWM_TICKS_PER_ISR_TICK
DECIMATION.
void VIB_COMP_setFlag_enableOutput(VIB_COMP_Handle handle, const bool state)
IPARK_Obj ipark
the inverse Park transform object