instaspin_foc
|
Modules | |
Project Overview | |
Macros | |
#define | LED_BLINK_FREQ_Hz 5 |
Functions | |
void | main (void) |
interrupt void | mainISR (void) |
The main interrupt service (ISR) routine. More... | |
void | updateGlobalVariables_motor (CTRL_Handle handle) |
Updates the global motor variables. More... | |
void | updateKpKiGains (CTRL_Handle handle) |
Updates Kp and Ki gains in the controller object. More... | |
Variables | |
uint_least16_t | gCounter_updateGlobals = 0 |
A counter that is denotes when to update the global variables. More... | |
bool | Flag_Latch_softwareUpdate = true |
CTRL_Handle | ctrlHandle |
The controller handle. More... | |
HAL_Handle | halHandle |
The hal handle. More... | |
USER_Params | gUserParams |
The user parameters. More... | |
HAL_PwmData_t | gPwmData = {_IQ(0.0), _IQ(0.0), _IQ(0.0)} |
Defines the PWM data. More... | |
HAL_AdcData_t | gAdcData |
Defines the ADC data. More... | |
_iq | gMaxCurrentSlope = _IQ(0.0) |
CTRL_Obj | ctrl |
Defines the CTRL object. More... | |
uint16_t | gLEDcnt = 0 |
volatile MOTOR_Vars_t | gMotorVars = MOTOR_Vars_INIT |
_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 |
#define LED_BLINK_FREQ_Hz 5 |
Definition at line 62 of file proj_lab05g.c.
Referenced by mainISR().
void main | ( | void | ) |
Definition at line 116 of file proj_lab05g.c.
References _IQ, _IQmpy, CTRL_getFlag_enableUserMotorParams(), CTRL_getKi(), CTRL_getKp(), CTRL_getState(), CTRL_getVersion(), CTRL_initCtrl(), CTRL_isError(), CTRL_setFlag_enableCtrl(), CTRL_setFlag_enableDcBusComp(), CTRL_setFlag_enableOffset(), CTRL_setFlag_enablePowerWarp(), CTRL_setFlag_enableSpeedCtrl(), CTRL_setFlag_enableUserMotorParams(), CTRL_setMaxAccel_pu(), CTRL_setParams(), CTRL_setSpd_ref_krpm(), CTRL_updateState(), _MOTOR_Vars_t_::CtrlVersion, EST_getMaxCurrentSlope_pu(), EST_isMotorIdentified(), EST_setFlag_enableForceAngle(), EST_setFlag_enableRsRecalc(), EST_setMaxCurrentSlope_pu(), _CTRL_Obj_::estHandle, _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_enableUserParams, Flag_Latch_softwareUpdate, _MOTOR_Vars_t_::Flag_MotorIdentified, _MOTOR_Vars_t_::Flag_Run_Identify, gCounter_updateGlobals, gFlux_pu_to_VpHz_sf, gFlux_pu_to_Wb_sf, gMaxCurrentSlope, gTorque_Flux_Iq_pu_to_Nm_sf, gTorque_Ls_Id_Iq_pu_to_Nm_sf, hal, HAL_disablePwm(), HAL_enableAdcInts(), HAL_enableDebugInt(), HAL_enableDrv(), HAL_enableGlobalInts(), HAL_enablePwm(), HAL_getBias(), HAL_init(), HAL_initIntVectorTable(), HAL_readDrvData(), HAL_setBias(), HAL_setParams(), HAL_setupDrvSpi(), HAL_setupFaults(), HAL_updateAdcBias(), HAL_writeDrvData(), I_A_offset, I_B_offset, _MOTOR_Vars_t_::I_bias, I_C_offset, _MOTOR_Vars_t_::Ki_Idq, _MOTOR_Vars_t_::Ki_spd, _MOTOR_Vars_t_::Kp_Idq, _MOTOR_Vars_t_::Kp_spd, MAX_ACCEL_KRPMPS_SF, _MOTOR_Vars_t_::MaxAccel_krpmps, memCopy(), _CTRL_Version_::minor, NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE, _MOTOR_Vars_t_::SpeedRef_krpm, updateGlobalVariables_motor(), updateKpKiGains(), USER_calcPIgains(), 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_getErrorCode(), USER_setParams(), USER_softwareUpdate1p6(), _MOTOR_Vars_t_::UserErrorCode, V_A_offset, V_B_offset, _MOTOR_Vars_t_::V_bias, V_C_offset, and _MATH_vec3_::value.
interrupt void mainISR | ( | void | ) |
The main interrupt service (ISR) routine.
Definition at line 412 of file proj_lab05g.c.
References CTRL_run(), CTRL_setup(), gLEDcnt, HAL_acqAdcInt(), HAL_readAdcData(), HAL_toggleLed, HAL_writePwmData(), LED_BLINK_FREQ_Hz, and USER_ISR_FREQ_Hz.
void updateGlobalVariables_motor | ( | CTRL_Handle | handle | ) |
Updates the global motor variables.
Definition at line 446 of file proj_lab05g.c.
References _IQ, _IQmpy, CTRL_getSpd_int_ref_pu(), CTRL_getState(), _MOTOR_Vars_t_::CtrlState, _HAL_AdcData_t_::dcBus, EST_get_pu_to_krpm_sf(), EST_getFlux_VpHz(), EST_getIdRated(), EST_getLs_d_H(), EST_getLs_q_H(), EST_getRr_Ohm(), EST_getRs_Ohm(), EST_getSpeed_krpm(), EST_getState(), _CTRL_Obj_::estHandle, _MOTOR_Vars_t_::EstState, _MOTOR_Vars_t_::Flux_VpHz, _MOTOR_Vars_t_::Flux_Wb, gFlux_pu_to_Wb_sf, gTorque_Flux_Iq_pu_to_Nm_sf, gTorque_Ls_Id_Iq_pu_to_Nm_sf, _MOTOR_Vars_t_::Lsd_H, _MOTOR_Vars_t_::Lsq_H, _MOTOR_Vars_t_::MagnCurr_A, _MOTOR_Vars_t_::Rr_Ohm, _MOTOR_Vars_t_::Rs_Ohm, _MOTOR_Vars_t_::Speed_krpm, _MOTOR_Vars_t_::SpeedTraj_krpm, _MOTOR_Vars_t_::Torque_Nm, USER_computeFlux(), USER_computeTorque_Nm(), USER_IQ_FULL_SCALE_VOLTAGE_V, and _MOTOR_Vars_t_::VdcBus_kV.
Referenced by main().
void updateKpKiGains | ( | CTRL_Handle | handle | ) |
Updates Kp and Ki gains in the controller object.
Definition at line 502 of file proj_lab05g.c.
References CTRL_setKi(), CTRL_setKp(), _MOTOR_Vars_t_::CtrlState, Flag_Latch_softwareUpdate, _MOTOR_Vars_t_::Flag_MotorIdentified, _MOTOR_Vars_t_::Ki_Idq, _MOTOR_Vars_t_::Ki_spd, _MOTOR_Vars_t_::Kp_Idq, and _MOTOR_Vars_t_::Kp_spd.
Referenced by main().
CTRL_Obj ctrl |
CTRL_Handle ctrlHandle |
bool Flag_Latch_softwareUpdate = true |
Definition at line 70 of file proj_lab05g.c.
Referenced by main(), and updateKpKiGains().
HAL_AdcData_t gAdcData |
Defines the ADC data.
Definition at line 80 of file proj_lab05g.c.
uint_least16_t gCounter_updateGlobals = 0 |
A counter that is denotes when to update the global variables.
Definition at line 68 of file proj_lab05g.c.
Referenced by main().
_iq gFlux_pu_to_VpHz_sf |
Definition at line 107 of file proj_lab05g.c.
Referenced by main().
_iq gFlux_pu_to_Wb_sf |
Definition at line 105 of file proj_lab05g.c.
Referenced by main(), and updateGlobalVariables_motor().
uint16_t gLEDcnt = 0 |
Definition at line 90 of file proj_lab05g.c.
Referenced by mainISR().
Definition at line 82 of file proj_lab05g.c.
Referenced by main().
volatile MOTOR_Vars_t gMotorVars = MOTOR_Vars_INIT |
Definition at line 92 of file proj_lab05g.c.
HAL_PwmData_t gPwmData = {_IQ(0.0), _IQ(0.0), _IQ(0.0)} |
Defines the PWM data.
Definition at line 78 of file proj_lab05g.c.
_iq gTorque_Flux_Iq_pu_to_Nm_sf |
Definition at line 111 of file proj_lab05g.c.
Referenced by main(), and updateGlobalVariables_motor().
_iq gTorque_Ls_Id_Iq_pu_to_Nm_sf |
Definition at line 109 of file proj_lab05g.c.
Referenced by main(), and updateGlobalVariables_motor().
USER_Params gUserParams |
The user parameters.
Definition at line 76 of file proj_lab05g.c.
HAL_Handle halHandle |