資源簡介
可以直接使用,svpwm程序
代碼片段和文件信息
/**
===================================================================
*
*
*
*?@file??Svpwm.c
*?@brief
*?@note
*?@version?1.00
*?@author
*?@date
*
===================================================================
*/
#include?“DSP28x_Project.h“?????//?Device?Headerfile?and?Examples?Include?File
#include?
#include?“System.h“
#include?“Svpwm.h“
#define?PI 3.14159
#define?M 0.4
#define?U1??????????UB
#define?U2 ((1.73205?*?UA?-?UB)?/?2)
#define?U3 ((-1.73205?*?UA?-?UB)?/?2)
const?int?SectorTab[6]?=?{150324};
unsigned?int?Ts?=?100;
float?Angel; //Uref當前角度
float?T0T1T2;
float?RatioARatioBRatioCUAUB; //Uref在坐標的分量;
void?SvPwm(void)
{
unsigned?int?A?=?0B?=?0C?=?0N;
UA?=?M?*?sin(Angel);
UB?=?M?*?cos(Angel);
if(U1?>?0)
A?=?1;
if(U2?>?0)
B?=?1;
if(U3?>?0)
C?=?1;
N?=?4?*?C?+?2?*?B?+?A?-?1;
switch(SectorTab[N])
{
case?0: //04677640
T1?=?1.73205?*?Ts?*?(1.73205?*?UA?-?UB)?/?2;
T2?=?1.73205?*?Ts?*?UB;
T0?=?(Ts?-?T1?-?T2)?/?2;
RatioA?=?(T1?+?T2?+?T0)?/?Ts;
RatioB?=?(T2?+?T0?)?/?Ts;
RatioC?=?T0?/?Ts;
break;
case?1: //02677260
T2?=?1.73205?*?Ts?*?(1.73205?*?UA?+?UB)?/?2;
T1?=?1.73205?*?Ts?*?(-1.73205?*?UA?+?UB)?/?2;
T0?=?(Ts?-?T1?-?T2)?/?2;
RatioA?=
- 上一篇:計算機網絡 第四版 課后答案
- 下一篇:controlSUITE
評論
共有 條評論