2023-05-30 09:22 AM
I noticed the following bug in the MCSDK generated software, please confirm if it is correct
__weak void MCI_SetCurrentReferences(MCI_Handle_t *pHandle, qd_t Iqdref)
{
pHandle->Iqdref.q = Iqdref.q;
pHandle->Iqdref.d = Iqdref.d;
}
but it shall be
pHandle->pFOCVars->Iqdref.q = Iqdref.q;
pHandle->pFOCVars->Iqdref.d = Iqdref.d;
since it is used in
inline uint16_t FOC_CurrControllerM1(void)
{
Vqd.q = PI_Controller(pPIDIq[M1], (int32_t)(FOCVars[M1].Iqdref.q) - Iqd.q);
Vqd.d = PI_Controller(pPIDId[M1], (int32_t)(FOCVars[M1].Iqdref.d) - Iqd.d);
}
Is my understanding correct?
2023-05-30 09:53 PM
My mistake i think it is done somewhere else
case MCI_CMD_SETCURRENTREFERENCES:
{
pHandle->pFOCVars->bDriveInput = EXTERNAL;
pHandle->pFOCVars->Iqdref = pHandle->Iqdref;
commandHasBeenExecuted = true;
break;
}
Lot of confusion, but one small clarification in MCI_SetCurrentReferences is it required to set MCM_TORQUE_MODE?
void MCI_SetCurrentReferences(MCI_Handle_t *pHandle, qd_t Iqdref)
{
pHandle->LastModalitySetByUser = MCM_TORQUE_MODE;
}