SPRUHJ1I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
The second method to monitor Rs Online value is using a more detailed approach, but only using fixed point math, and bit shifting. The following code example shows how an Rs Online value in Ohms but in fixed point can be calculated from the functions available in InstaSPIN-FOC. This can be calculated even inside an interrupt, since execution time is optimized by avoiding floating point math.
#define VarShift(var,nshift) (((nshift) < 0) ? ((var)>>(-(nshift))) \
: ((var)<<(nshift)))
#define USER_IQ_FULL_SCALE_VOLTAGE_V (48.0)
#define USER_IQ_FULL_SCALE_CURRENT_A (40.0)
CTRL_Obj *obj = (CTRL_Obj *)ctrlHandle;
uint_least8_t RsOnLine_qFmt = EST_getRsOnLine_qFmt(obj->estHandle);
_iq fullScaleResistance = _IQ(USER_IQ_FULL_SCALE_VOLTAGE_V \
/USER_IQ_FULL_SCALE_CURRENT_A);
_iq RsOnLine_pu = _IQ30toIQ(EST_getRsOnLine_pu(obj->estHandle));
_iq pu_to_ohms_sf = VarShift(fullScaleResistance, 30 - RsOnLine_qFmt);
_iq RsOnLine_Ohms = _IQmpy(RsOnLine_pu, pu_to_ohms_sf);