问答

汇集网友智慧,解决技术难题

21ic问答首页 - LKS08x_FOC_SensorLessV4.27.1程序问题咨询

LKS08x_FOC_SensorLessV4.27.1程序问题咨询

hfwangzc2022-11-21
各位大神,你好!如下AdcSampleCal函数中CurrentPerUnitGAIN参数,初始化赋值的地方,一直没有找到,还请各位帮忙,回复下,谢谢。。。
*******************************************************************************
函数名称:    void AdcSampleCal(stru_FOC_CtrProcDef *this)
功能描述:    电流采样
输入参数:    stru_FOC_CtrProcDef *this 结构体指针
输出参数:    无
返 回 值:    无
其它说明:    1.电流采样,采集AB两相电流
修改日期      版本号          修改人            修改内容
-----------------------------------------------------------------------------
2020/8/5      V1.0            Wencai.Zhao Howlet Li          创建
*******************************************************************************/
void AdcSampleCal(stru_FOC_CurrLoopDef *this)
{
    stru_CurrPhaseUVW t_StatCurrUV;

#if (CURRENT_SAMPLE_TYPE == CURRENT_SAMPLE_1SHUNT)
    t_StatCurrUV = SVPWM_1ShuntGetPhaseCurrent(this); /* 读取ADC采样到的相电流值 */
#else

#if (CURRENT_SAMPLE_TYPE == CURRENT_SAMPLE_2SHUNT)
    t_StatCurrUV = SVPWM_2ShuntGetPhaseCurrent(this); /* 读取ADC采样到的相电流值 */
#else
#if ((CURRENT_SAMPLE_TYPE == CURRENT_SAMPLE_3SHUNT)||(CURRENT_SAMPLE_TYPE == CURRENT_SAMPLE_MOSFET))
    t_StatCurrUV = SVPWM_3ShuntGetPhaseCurrent(this); /* 读取ADC采样到的相电流值 */
#endif
#endif
#endif

    /* 电流标幺化处理 */
                        this->mStatCurrUVW.nPhaseU = _IQ15mpy(t_StatCurrUV.nPhaseU, struFluxOB_Param.CurrentPerUnitGAIN);
                        this->mStatCurrUVW.nPhaseV = _IQ15mpy(t_StatCurrUV.nPhaseV, struFluxOB_Param.CurrentPerUnitGAIN);
                        this->mStatCurrUVW.nPhaseW = -(this->mStatCurrUVW.nPhaseU + this->mStatCurrUVW.nPhaseV);
    /* clark变换 */
          if(struFOC_CtrProc.bMotorDirtionCtrlPhase == CW)
                {
       this->mStatCurrAlfaBeta.nBeta = _IQ15mpy(18919, (this->mStatCurrUVW.nPhaseV - this->mStatCurrUVW.nPhaseW));
    }else{
                         this->mStatCurrAlfaBeta.nBeta = _IQ15mpy(18919, (this->mStatCurrUVW.nPhaseW - this->mStatCurrUVW.nPhaseV));
                }
                this->mStatCurrAlfaBeta.nAlph = this->mStatCurrUVW.nPhaseU;

回答 +关注 5
972人浏览 0人回答问题 分享 举报
0 个回答

您需要登录后才可以回复 登录 | 注册