|
motorWare 功能模块点、浮点模式下的问题
[复制链接]
在motorWare 例程中,模块void updateGlobalVariables_motor(CTRL_Handle handle, ST_Handle sthandle)在fpu32和定点方式先
定义的几个float 参数:
在定点模式下为:
gMotorVars.MagnCurr_A = EST_getIdRated(obj->estHandle);
// get the rotor resistance
gMotorVars.Rr_Ohm = EST_getRr_Ohm(obj->estHandle);
// get the stator resistance
gMotorVars.Rs_Ohm = EST_getRs_Ohm(obj->estHandle);
// get the stator inductance in the direct coordinate direction
gMotorVars.Lsd_H = EST_getLs_d_H(obj->estHandle);
// get the stator inductance in the quadrature coordinate direction
gMotorVars.Lsq_H = EST_getLs_q_H(obj->estHandle);
// get the flux in V/Hz in floating point
gMotorVars.Flux_VpHz = EST_getFlux_VpHz(obj->estHandle);
浮点模式下为:
int32_t tmp;
tmp = EST_getIdRated(obj->estHandle);
gMotorVars.MagnCurr_A = *((float_t *)&tmp);
// get the rotor resistance
tmp = EST_getRr_Ohm(obj->estHandle);
gMotorVars.Rr_Ohm = *((float_t *)&tmp);
// get the stator resistance
tmp = EST_getRs_Ohm(obj->estHandle);
gMotorVars.Rs_Ohm = *((float_t *)&tmp);
// get the stator inductance in the direct coordinate direction
tmp = EST_getLs_d_H(obj->estHandle);
gMotorVars.Lsd_H = *((float_t *)&tmp);
// get the stator inductance in the quadrature coordinate direction
tmp = EST_getLs_q_H(obj->estHandle);
gMotorVars.Lsq_H = *((float_t *)&tmp);
// get the flux in V/Hz in floating point
tmp = EST_getFlux_VpHz(obj->estHandle);
gMotorVars.Flux_VpHz = *((float_t *)&tmp);
比如
tmp = EST_getIdRated(obj->estHandle);
gMotorVars.MagnCurr_A = *((float_t *)&tmp);
EST_getIdRated(obj->estHandle)、MagnCurr_A都为float_t,为这种转换的原因:
谢谢!
|
|