Dear Motorware team,
I have a question with DC Bus Compensation in Motorware. In particular I want to understand how to calculate the value "oneOverDcBus" (1/Vdc_bus) which is implemented in EST_run() function.
I found in the lab11, the code section is written:
//! \brief The main ISR that implements the motor control.
interrupt void mainISR(void)
{
// Declaration of local variables
_iq oneOverDcBus;
// acknowledge the ADC interrupt
HAL_acqAdcInt(halHandle,ADC_IntNumber_1);
// run the estimator
// The speed reference is needed so that the proper sign of the forced
// angle is calculated. When the estimator does not do motor ID as in this
// lab, only the sign of the speed reference is used
EST_run(estHandle,&Iab_pu,&Vab_pu,gAdcData.dcBus,gMotorVars.SpeedRef_pu);
// These 3 statements compensate for variations in the DC bus by adjusting the
// PWM duty cycle. The goal is to achieve the same volt-second product
// regardless of the DC bus value. To do this, we must divide the desired voltage
// values by the DC bus value. Or...it is easier to multiply by 1/(DC bus value).
oneOverDcBus = EST_getOneOverDcBus_pu(estHandle);
Vab_pu.value[0] = _IQmpy(Vab_pu.value[0], oneOverDcBus);
Vab_pu.value[1] = _IQmpy(Vab_pu.value[1], oneOverDcBus);
// Now run the space vector generator (SVGEN) module.
// There is no need to do an inverse CLARKE transform, as this is
// handled in the SVGEN_run function.
SVGEN_run(svgenHandle,&Vab_pu,&(gPwmData.Tabc));
}
According to my understanding, the oneOverDcBus = 1/VdcBus_pu, right? And this value can be calculated as following:
oneOverDcBus = _IQdiv(_IQ(1.0), _IQ12toIQ(gAdcData.dcBus));
where, gAdcData.dcBus is calculated in the HAL_readAdcData(), namely:
#define USER_VBUS_VOLTAGE_SF ((float_t)((USER_VBUS_ADC_FULL_SCALE_VOLTAGE_V)/(USER_IQ_FULL_SCALE_VOLTAGE_V)))
#define ADC_DATA_V_DCBus ADC_ResultNumber_4 //Store digital value of #V_DCbus which is read from ADC
static inline void HAL_readAdcData(HAL_Handle handle,HAL_AdcData_t *pAdcData)
{
HAL_Obj *obj = (HAL_Obj *)handle;
// read the dcBus voltage value
// notes Because the hardware gain of VdcBus channel is different from the one of Va,b,c
value = (_iq)ADC_readResult(obj->adcHandle,ADC_DATA_V_DCBus); // divide by 2^numAdcBits = 2^12
value = _IQ12mpy(value,_IQ12(USER_VBUS_VOLTAGE_SF));
pAdcData->dcBus = _IQ12toIQ(value);
return;
} // end of HAL_readAdcData() function
But when I compared the result in my method with the result which is got by EST_getOneOverDcBus_pu(), then I find the they are different. This makes me think that I am understanding wrong about oneOverDcBus = 1/VdcBus_pu.
So please help me, how did EST_run() function calculate the oneOverDcBus?
I hope I will get the answer as soon as possible!
Thanks in advance,
Mr. Tran