MotorWare f2806x Module API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Functions
32b/user.c File Reference
`#include <math.h>`
`#include "user.h"`
`#include "sw/modules/ctrl/src/32b/ctrl.h"`

Go to the source code of this file.

## Functions
void | USER_setParams (USER_Params *pUserParams)
void | USER_checkForErrors (USER_Params *pUserParams)
USER_ErrorCode_e | USER_getErrorCode (USER_Params *pUserParams)
void | USER_setErrorCode (USER_Params *pUserParams, const USER_ErrorCode_e errorCode)
void | USER_softwareUpdate1p6 (CTRL_Handle handle)
void | USER_calcPIgains (CTRL_Handle handle)
_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, from per unit to Nm. More...
_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. More...
_iq | USER_computeFlux_pu_to_Wb_sf (void)
| Computes the scale factor needed to convert from per unit to Wb. More...
_iq | USER_computeFlux_pu_to_VpHz_sf (void)
| Computes the scale factor needed to convert from per unit to V/Hz. More...
_iq | USER_computeFlux (CTRL_Handle handle, const _iq sf)
| Computes Flux in Wb or V/Hz depending on the scale factor sent as parameter. More...
_iq | USER_computeTorque_Nm (CTRL_Handle handle, const _iq torque_Flux_sf, const _iq torque_Ls_sf)
| Computes Torque in Nm. More...
_iq | USER_computeTorque_lbin (CTRL_Handle handle, const _iq torque_Flux_sf, const _iq torque_Ls_sf)
| Computes Torque in Nm. More...

## Function Documentation

void USER_calcPIgains | ( | CTRL_Handle | handle | ) |

Definition at line 855 of file 32b/user.c.

References _IQ, CTRL_getCtrlPeriod_sec(), CTRL_setGains(), CTRL_Type_PID_Id, CTRL_Type_PID_Iq, EST_getLs_d_H(), EST_getLs_q_H(), EST_getRs_Ohm(), _CTRL_Obj_::estHandle, PID_setKi(), _CTRL_Obj_::pidHandle_Id, and _CTRL_Obj_::pidHandle_Iq.

void USER_checkForErrors | ( | USER_Params * | pUserParams | ) |

Definition at line 198 of file 32b/user.c.

References MATH_PI, MOTOR_Type_Induction, MOTOR_Type_Pm, USER_ErrorCode_ctrlFreq_Hz_High, USER_ErrorCode_ctrlFreq_Hz_Low, USER_ErrorCode_current_sf_High, USER_ErrorCode_current_sf_Low, USER_ErrorCode_dcBusPole_rps_High, USER_ErrorCode_dcBusPole_rps_Low, USER_ErrorCode_directionPole_rps_High, USER_ErrorCode_directionPole_rps_Low, USER_ErrorCode_estFreq_Hz_Low, USER_ErrorCode_estKappa_High, USER_ErrorCode_estKappa_Low, USER_ErrorCode_fluxEstFreq_Hz_High, USER_ErrorCode_fluxEstFreq_Hz_Low, USER_ErrorCode_fluxFraction_High, USER_ErrorCode_fluxFraction_Low, USER_ErrorCode_fluxPole_rps_High, USER_ErrorCode_fluxPole_rps_Low, USER_ErrorCode_forceAngleFreq_Hz_High, USER_ErrorCode_forceAngleFreq_Hz_Low, USER_ErrorCode_IdRated_delta_High, USER_ErrorCode_IdRated_delta_Low, USER_ErrorCode_IdRated_High, USER_ErrorCode_IdRated_Low, USER_ErrorCode_IdRatedFraction_indEst_High, USER_ErrorCode_IdRatedFraction_indEst_Low, USER_ErrorCode_IdRatedFraction_ratedFlux_High, USER_ErrorCode_IdRatedFraction_ratedFlux_Low, USER_ErrorCode_indEst_speedMaxFraction_High, USER_ErrorCode_indEst_speedMaxFraction_Low, USER_ErrorCode_iqFullScaleCurrent_A_Low, USER_ErrorCode_iqFullScaleFreq_Hz_High, USER_ErrorCode_iqFullScaleFreq_Hz_Low, USER_ErrorCode_iqFullScaleVoltage_V_High, USER_ErrorCode_iqFullScaleVoltage_V_Low, USER_ErrorCode_maxAccel_est_Hzps_High, USER_ErrorCode_maxAccel_est_Hzps_Low, USER_ErrorCode_maxAccel_Hzps_High, USER_ErrorCode_maxAccel_Hzps_Low, USER_ErrorCode_maxCurrent_High, USER_ErrorCode_maxCurrent_indEst_High, USER_ErrorCode_maxCurrent_indEst_Low, USER_ErrorCode_maxCurrent_Low, USER_ErrorCode_maxCurrent_resEst_High, USER_ErrorCode_maxCurrent_resEst_Low, USER_ErrorCode_maxCurrentSlope_High, USER_ErrorCode_maxCurrentSlope_Low, USER_ErrorCode_maxCurrentSlope_powerWarp_High, USER_ErrorCode_maxCurrentSlope_powerWarp_Low, USER_ErrorCode_maxNegativeIdCurrent_a_High, USER_ErrorCode_maxNegativeIdCurrent_a_Low, USER_ErrorCode_maxVsMag_pu_High, USER_ErrorCode_maxVsMag_pu_Low, USER_ErrorCode_motor_Ls_d_High, USER_ErrorCode_motor_Ls_d_Low, USER_ErrorCode_motor_Ls_q_High, USER_ErrorCode_motor_Ls_q_Low, USER_ErrorCode_motor_numPolePairs_Low, USER_ErrorCode_motor_ratedFlux_High, USER_ErrorCode_motor_ratedFlux_Low, USER_ErrorCode_motor_Rr_High, USER_ErrorCode_motor_Rr_Low, USER_ErrorCode_motor_Rs_High, USER_ErrorCode_motor_Rs_Low, USER_ErrorCode_motor_type_Unknown, USER_ErrorCode_NoError, USER_ErrorCode_numCtrlTicksPerCurrentTick_Low, USER_ErrorCode_numCtrlTicksPerEstTick_Low, USER_ErrorCode_numCtrlTicksPerSpeedTick_Low, USER_ErrorCode_numCtrlTicksPerTrajTick_Low, USER_ErrorCode_numCurrentSensors_High, USER_ErrorCode_numCurrentSensors_Low, USER_ErrorCode_numIsrTicksPerCtrlTick_Low, USER_ErrorCode_numPwmTicksPerIsrTick_High, USER_ErrorCode_numPwmTicksPerIsrTick_Low, USER_ErrorCode_numVoltageSensors_High, USER_ErrorCode_numVoltageSensors_Low, USER_ErrorCode_offsetPole_rps_High, USER_ErrorCode_offsetPole_rps_Low, USER_ErrorCode_powerWarpGain_High, USER_ErrorCode_powerWarpGain_Low, USER_ErrorCode_pwmFreq_kHz_High, USER_ErrorCode_pwmFreq_kHz_Low, USER_ErrorCode_RoverL_estFreq_Hz_High, USER_ErrorCode_speedPole_rps_High, USER_ErrorCode_speedPole_rps_Low, USER_ErrorCode_systemFreq_MHz_High, USER_ErrorCode_systemFreq_MHz_Low, USER_ErrorCode_trajFreq_Hz_Low, USER_ErrorCode_voltage_sf_High, USER_ErrorCode_voltage_sf_Low, USER_ErrorCode_voltageFilterPole_Hz_High, USER_ErrorCode_voltageFilterPole_Hz_Low, USER_ErrorCode_zeroSpeedLimit_High, USER_ErrorCode_zeroSpeedLimit_Low, and USER_setErrorCode().

_iq USER_computeFlux | ( | CTRL_Handle | handle,
|  | const _iq | sf
| ) |  |

Computes Flux in Wb or V/Hz depending on the scale factor sent as parameter.

Definition at line 967 of file 32b/user.c.

References _IQmpy, EST_getFlux_pu(), and _CTRL_Obj_::estHandle.

_iq USER_computeFlux_pu_to_VpHz_sf | ( | void |  | ) |

Computes the scale factor needed to convert from per unit to V/Hz.

Definition at line 955 of file 32b/user.c.

References _IQ, and MOTOR_Type_Induction.

_iq USER_computeFlux_pu_to_Wb_sf | ( | void |  | ) |

Computes the scale factor needed to convert from per unit to Wb.

Definition at line 943 of file 32b/user.c.

References _IQ, MATH_PI, and MOTOR_Type_Induction.

_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.

Definition at line 930 of file 32b/user.c.

References _IQ, MATH_PI, and MOTOR_Type_Induction.

_iq USER_computeTorque_lbin | ( | CTRL_Handle | handle,
|  | const _iq | torque_Flux_sf,
|  | const _iq | torque_Ls_sf
| ) |  |

Computes Torque in Nm.

Definition at line 995 of file 32b/user.c.

References _IQ, _IQ30toIQ, _IQmpy, EST_getFlux_pu(), EST_getLs_d_pu(), EST_getLs_q_pu(), _CTRL_Obj_::estHandle, MATH_Nm_TO_lbin_SF, PID_getFbackValue(), _CTRL_Obj_::pidHandle_Id, and _CTRL_Obj_::pidHandle_Iq.

_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, from per unit to Nm.

Definition at line 918 of file 32b/user.c.

References _IQ.

_iq USER_computeTorque_Nm | ( | CTRL_Handle | handle,
|  | const _iq | torque_Flux_sf,
|  | const _iq | torque_Ls_sf
| ) |  |

Computes Torque in Nm.

Definition at line 977 of file 32b/user.c.

References _IQ30toIQ, _IQmpy, EST_getFlux_pu(), EST_getLs_d_pu(), EST_getLs_q_pu(), _CTRL_Obj_::estHandle, PID_getFbackValue(), _CTRL_Obj_::pidHandle_Id, and _CTRL_Obj_::pidHandle_Iq.

USER_ErrorCode_e USER_getErrorCode | ( | USER_Params * | pUserParams | ) |

Definition at line 819 of file 32b/user.c.

References _USER_Params_::errorCode.

void USER_setErrorCode | ( | USER_Params * | pUserParams,
|  | const USER_ErrorCode_e | errorCode
| ) |  |

Definition at line 825 of file 32b/user.c.

References _USER_Params_::errorCode.

Referenced by USER_checkForErrors().

void USER_setParams | ( | USER_Params * | pUserParams | ) |

Definition at line 58 of file 32b/user.c.

References CTRL_State_Error, CTRL_State_Idle, CTRL_State_OffLine, CTRL_State_OnLine, _USER_Params_::ctrlFreq_Hz, _USER_Params_::ctrlPeriod_sec, _USER_Params_::ctrlWaitTime, _USER_Params_::current_sf, _USER_Params_::dcBusPole_rps, _USER_Params_::directionPole_rps, EST_Flux_State_CL1, EST_Flux_State_CL2, EST_Flux_State_Done, EST_Flux_State_Error, EST_Flux_State_Fine, EST_Flux_State_Idle, EST_Ls_State_Coarse, EST_Ls_State_Done, EST_Ls_State_Error, EST_Ls_State_Fine, EST_Ls_State_Idle, EST_Ls_State_Init, EST_Ls_State_RampUp, EST_Rs_State_Coarse, EST_Rs_State_Done, EST_Rs_State_Error, EST_Rs_State_Fine, EST_Rs_State_Idle, EST_Rs_State_RampUp, EST_State_Error, EST_State_Idle, EST_State_IdRated, EST_State_LockRotor, EST_State_Ls, EST_State_MotorIdentified, EST_State_OnLine, EST_State_RampDown, EST_State_RampUp, EST_State_RatedFlux, EST_State_RatedFlux_OL, EST_State_RoverL, EST_State_Rr, EST_State_Rs, _USER_Params_::estFreq_Hz, _USER_Params_::estKappa, _USER_Params_::estWaitTime, _USER_Params_::fluxEstFreq_Hz, _USER_Params_::fluxFraction, _USER_Params_::fluxPole_rps, _USER_Params_::FluxWaitTime, _USER_Params_::forceAngleFreq_Hz, _USER_Params_::IdRated, _USER_Params_::IdRated_delta, _USER_Params_::IdRatedFraction_indEst, _USER_Params_::IdRatedFraction_ratedFlux, _USER_Params_::indEst_speedMaxFraction, _USER_Params_::iqFullScaleCurrent_A, _USER_Params_::iqFullScaleFreq_Hz, _USER_Params_::iqFullScaleVoltage_V, _USER_Params_::LsWaitTime, _USER_Params_::maxAccel_est_Hzps, _USER_Params_::maxAccel_Hzps, _USER_Params_::maxCurrent, _USER_Params_::maxCurrent_indEst, _USER_Params_::maxCurrent_resEst, _USER_Params_::maxCurrentSlope, _USER_Params_::maxCurrentSlope_powerWarp, _USER_Params_::maxNegativeIdCurrent_a, _USER_Params_::maxVsMag_pu, _USER_Params_::motor_Ls_d, _USER_Params_::motor_Ls_q, _USER_Params_::motor_numPolePairs, _USER_Params_::motor_ratedFlux, _USER_Params_::motor_Rr, _USER_Params_::motor_Rs, _USER_Params_::motor_type, _USER_Params_::numCtrlTicksPerCurrentTick, _USER_Params_::numCtrlTicksPerEstTick, _USER_Params_::numCtrlTicksPerSpeedTick, _USER_Params_::numCtrlTicksPerTrajTick, _USER_Params_::numCurrentSensors, _USER_Params_::numIsrTicksPerCtrlTick, _USER_Params_::numVoltageSensors, _USER_Params_::offsetPole_rps, _USER_Params_::powerWarpGain, _USER_Params_::pwmPeriod_usec, _USER_Params_::RoverL_estFreq_Hz, _USER_Params_::RsWaitTime, _USER_Params_::speedPole_rps, _USER_Params_::systemFreq_MHz, _USER_Params_::trajFreq_Hz, _USER_Params_::voltage_sf, _USER_Params_::voltageFilterPole_rps, and _USER_Params_::zeroSpeedLimit.

void USER_softwareUpdate1p6 | ( | CTRL_Handle | handle | ) |

Definition at line 833 of file 32b/user.c.

References _IQ30, _IQ30toF(), EST_getLs_coarse_max_pu(), EST_setLs_d_pu(), EST_setLs_q_pu(), EST_setLs_qFmt(), _CTRL_Obj_::estHandle, _MOTOR_Params_::Ls_d_H, _MOTOR_Params_::Ls_q_H, and _CTRL_Obj_::motorParams.