Dear,
I am a bit confused with the numbering systems. The IQ numbering confuses me.
I am working on the implementation of a control strategy for a three-phase inverter for distributed generation purposes. I measure voltages and currents which I for voltage and current controller. I use the ADC to measure them but then the problem is presented.
With my previous (a freescale dsp) I did the following:
// get adc values
iA=getReg(ADCA_ADRSLT0);
// substract offsetIA=(int)iA-iA_off;
/*
Rescaling variables
@ 3.3V the following quantities are measuerd
va=407V ia=29.97A
vb=350V ib=30.36A
vc=364 V ic=30.70A
vdc,ond=466 V vdc,bov=464V
For phase voltage: reference Vref=364 V
For dc voltage reference: Vdcondref=466 V
For the current Iref=30.70 A
ia=mult(IA,27811)<<1; // multiply with 29.97/30.7*32768 en multiply with 2
ib=mult(IB,32406)<<1; // vermenigvuldigen met 30.36/30.7*32768 en dan maal 2
ic=IC<<1; // vermenigvuldigen met 2
va=VA<<1; // vermenigvuldigen met 2
vb=mult(VB,31506)<<1; // vermenigvuldigen met 350/407*32768 en dan maal 2
vc=VC<<1; // vermenigvuldigen met 364/407*32768 en dan maal 2
vdcond=mult(VDCOND,32627); //vermenigvuldigen met 464/466*32768
/* Current control */
ierra=iwa-ia;
// P controller
drat=mult(Ki,ierra)<<Ki_scale;
But when I try this with the F28335, it goes wrong. When I was searching this forum for an answer, I found an example on the PMSM sensorless example where the same steps are followed, namely:ADC Result, normalized into pu, adjust for offset, normalize to +/-1 pu, scale to 3.3V from 3V ADC input.
But there I see that the ADC Result is divided by 2^12. and then the offset is substracted. I find it very strange that the ADC result is divided by 2^12 which is the same at a bit shift by 12 bits to the right.. Therefore I am a bit confused. Can someone explain me how this division is justified? I must say that I am used working with a 16-bit processor and that the F28335 is 32-bit one.
Thanks in advance!
My apologies for the long post and the stupid? question!
Best regards,
Bart Meersman