Tool/software: Code Composer Studio
Hey,
I am working with DRV8301 with a board Piccolo F28069 Experimenter's Kit . I have modified the already existing code in proj_lab05a.. It is basically a pi controller I designed and while running the code all the values are getting modified as desired. Here at the end of the code gmotorvars.IqRef_A should be modified. In the watch window I can see the value of this variable is around 10.00(Q-value 24). But in the oscilloscope it is around 2Amps. Here is the problem. The value which oscilloscope showing is correct. So how can I change the number format in the coding. When I try to change the format in watch window to decimal, the value I get there doesn't make any sense because its giving me a 6 or 7 digit number. I tried different format and nothing helped. here is the code
void updateIqRef(CTRL_Handle handle)
{
k++;
if(k==15) {
error=gMotorVars.VdcBus_kV-_IQ(BusVRef); //finding error
error_kp=_IQmpy(error,kp);
error_kiT=_IQmpy(error,kiT);
summation=_IQmpy((Iq_before_kaw+error_kiT+previous),D); //summation
before_sat=_IQmpy((error_kp+summation),D); //before saturation
if((before_sat >= _IQ(0)) || (before_sat <= _IQ(10))) //checking the limits for saturation
{gMotorVars.IqRef_A= before_sat ;}
if(before_sat <= _IQ(0)) { gMotorVars.IqRef_A = _IQ(0); }
if(before_sat >= _IQ(10)) { gMotorVars.IqRef_A = _IQ(10); }
previous=summation; //summation updation
Iq_before_kaw=gMotorVars.IqRef_A-before_sat; //Iq before the gain kaw
Iq_kaw=_IQmpy(Iq_before_kaw,kaw); //Iq after the gain kaw
k=0;
// _iq iq_ref = gMotorVars.IqRef_A;
_iq iq_ref = _IQmpy(gMotorVars.IqRef_A,_IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A));
// Set the Iq reference that use to come out of the PI speed control
CTRL_setIq_ref_pu(handle, iq_ref);
}
return;
for this the initialization of the variable is
_iq kp =_IQ(01);
_iq kiT =_IQ(0.001);
_iq kaw =_IQ(1) ;
_iq previous =_IQ(0);
_iq T =_IQ(0.001);
_iq D =_IQ(1);
_iq error;
_iq error_kp;
_iq error_kiT;
_iq Iq_kaw;
_iq summation;
_iq before_sat;
_iq Iq_before_kaw =0;
Here D is just a variable(value 1) which I used to multiply every lines of the code to standardize the format to 24. This was done only after I have seen a lot of senseless numbers in the watch window. If I am not doing this, until the calculation of before_sat makes sense. But then IqRef_A will be in a different format which I couldn't figure. Even after standardizing the code in q-24 format, in the watch window when I convert to decimal, it gives a value with 5 or 6 digit number which is supposed to be 2 Amps.
Thanks in advance for any help
Best regards,
Ambika