// This sinewave lookup table has 171 entries. (1024 points per
// electrical cycle -- 1024*(60/360) = 171)
// The table covers 60 degrees of the sine function.
int sinetable[] __attribute__((far,section(".const,r")))=
{0,201,401,602,803,1003,1204,1404,1605,1805,
2005,2206,2406,2606,2806,3006,3205,3405,3605,3804,4003,4202,4401,4600,
4799,4997,5195,5393,5591,5789,5986,6183,6380,6577,6773,6970,7166,7361,
7557,7752,7947,8141,8335,8529,8723,8916,9109,9302,9494,9686,9877,10068,
10259,10449,10639,10829,11018,11207,11395,11583,11771,11958,12144,
12331,12516,12701,12886,13070,13254,13437,13620,13802,13984,14165,
14346,14526,14706,14885,15063,15241,15419,15595,15772,15947,16122,
16297,16470,16643,16816,16988,17159,17330,17500,17669,17838,18006,
18173,18340,18506,18671,18835,18999,19162,19325,19487,19647,19808,
19967,20126,20284,20441,20598,20753,20908,21062,21216,21368,21520,
21671,21821,21970,22119,22266,22413,22559,22704,22848,22992,23134,
23276,23417,23557,23696,23834,23971,24107,24243,24377,24511,24644,
24776,24906,25036,25165,25293,25420,25547,25672,25796,25919,26042,
26163,26283,26403,26521,26638,26755,26870,26984,27098,27210,27321,
27431,27541,27649,27756,27862,27967,28071,28174,28276,28377};
// Scale t1 to by the volts variable.
t1 = ((long)t1*(long)volts) >> 15;
// Scale t1 for the duty cycle range.
t1 = ((long)t1*(long)tpwm) >> 15;
What exactly is space vector pwm? I am not able to understand the timing calculations of space vector pwm. Please help.
// PhaseInc is a value added to the Phase variable to generate the sine
// voltages. 1 electrical degree corresponds to a PhaseInc value of 184,
// since the pointer to the sine table is a 16bit value, where 360 Elec
// Degrees represents 65535 in the pointer.
// __builtin_divud(Long Value, Int Value) is a function of the compiler
// to do Long over Integer divisions.
PhaseInc = __builtin_divud(512000UL, Period); // Phase increment is used
// by the PWM isr (SVM)
#define PHASE_ZERO 57344
#define PHASE_ONE ((PHASE_ZERO + 65536/6) % 65536)
I don't understand the number 512000.
// PhaseInc is a value added to the Phase variable to generate the sine
// voltages. 1 electrical degree corresponds to a PhaseInc value of 184,
// since the pointer to the sine table is a 16bit value, where 360 Elec
Have you seen my calculations am i in the right direction? I will get little confidence to proceed further. Please advise.
#define PHASE_ZERO 57344
#define PHASE_ONE ((PHASE_ZERO + 65536/6) % 65536)
phase = PhaseValues[1];
phase = PHASE_ONE
#define PHASE_ZERO 57344
#define PHASE_ONE ((PHASE_ZERO + 65536/6) % 65536)
Hence
phase = ((57344 + 65536/6) % 65536);
phase = 2730;
#define MAXPERIOD 31250 // For 60 min rpm and 10 poles motor
div(512000,period) gives me 16.
if(angle < VECTOR2)
angle = phase+phaseinc = 2730 + 16 = 2746
VECTOR2 is 0x2aaa is 10922
angle < 10922
Hence
angle2 = angle - VECTOR1 = 2746 - 0;
angle1 = SIXTY_DEG - angle2; // Calculate second angle referenced to
angle1 = 10922 - 2746
angle1 = 8176
t1 = sinetable[(unsigned char)(angle1 >> 6)]; // Look up values from
t2 = sinetable[(unsigned char)(angle2 >> 6)];
// Scale t1 to by the volts variable.
t1 = ((long)t1*(long)volts) >> 15;
// Scale t1 for the duty cycle range.
t1 = ((long)t1*(long)tpwm) >> 15;
half_t0 = (tpwm - t1 - t2) >> 1; // Calculate half_t0 null time from
// period and t1,t2
// Calculate duty cycles for Sector 1 (0 - 59 degrees)
PDC1 = t1 + t2 + half_t0;
PDC2 = t2 + half_t0;
PDC3 = half_t0;
#define PHASE_ZERO 0
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?