Hi ALl,
TMS320F28xx platform is new to me and I am trying to understand PMSM3_3 codes. I get two question related to the resovler signal processing and appreciated if any light could be given:-
Q1: in resolver.h SInIn and CosIn, as well quite a number of other mid-way used parameters were remarked as Per Unit.
typedef struct {
_iq SinIn; // Input: Measured sine signal (pu)
_iq CosIn; // Input: Measured cos signal (pu)
_iq FilteredSin; // Variable: Filtered sine signal (pu)
_iq FilteredCos; // Variable: Filtered cos signal (pu)
_iq DemodSin; // Variable: Demodulated sine signal (pu)
_iq DemodCos; // Variable: Demodulated cos signal (pu)
_iq PreviousSin[18]; // History: Past sine signals (pu)
_iq PreviousCos[18]; // History: Past cos signals (pu)
.....
_iq SignalGain; // Parameter: Sin and cos gain (pu)
...
} RESOLVER; // Data type created
This means the values for these items should be falled in 0-1. However I can not figure out how these numbers were formated to the range of 0-1 :-
in PMSM3_3.c line 715, speed1.SinIn = _IQ15toIQ((int32)adc1.Ch3Out);
in function of F281X_adc04b_drv_read(ADCVALSB *p) which is in f281xabc04b.c , the adc data is processed to bipolar as below:-
DatQ15 = AdcRegs.ADCRESULT0^0x8000; // Convert raw result to Q15 (bipolar signal)
Tmp = (int32)p->Ch1Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch1Out = (int16)(Tmp>>13); // Convert Q28 to Q15
p->Ch1Out += p->Ch1Offset; // Add offset
my question is how the readingsfrom adc is convert to UP through above chains.
Q2: In resolver.c:-
void position_speed_calc(RESOLVER *v)
{
// Inputs: v->FilteredSin, v->FilteredCos
// Outputs: v->ElecTheta, v->MechTheta, v->RefTheta, v->Speed
_iq Tmp1, Tmp2, FilterGain;
// Amplify the filtered signals
v->AmplifiedSin = _IQmpy(v->SignalGain,v->FilteredSin);
v->AmplifiedCos = _IQmpy(v->SignalGain,v->FilteredCos);
// Arctan function
Tmp1 = _IQatan2PU(v->AmplifiedSin,v->AmplifiedCos);
Tmp2 = _IQatan2PU(v->AmplifiedCos,v->AmplifiedSin);
... ...
}
My question is why a SignalGain( = _IQ(100) ) was multified to FilterdSin/Cos respectively before Arctan runs?
Thanks in advance!
Robert Wang