我把HVACI_Sensorless程序里面的变量做了一个归纳,在此跟大家共享,希望有用。
****************************************************************************
#define FALSE 0
#define TRUE 1
#define PI 3.14159265358979
#define ONE_THIRD 0.33333333333333 // 1/3
#define TWO_THIRD 0.66666666666667 // 2/3
#define INV_SQRT3 0.57735026918963 // 1/sqrt(3)
#define SYSTEM_FREQUENCY 60
#define ISR_FREQUENCY 10
#define RS 11.05 // Stator resistance (ohm)#define RR 6.11 // Rotor resistance (ohm)#define LS 0.316423 // Stator inductance (H)#define LR 0.316423 // Rotor inductance (H)
#define LM 0.293939 // Magnatizing inductance (H)
#define POLES 4 // Number of poles
#define BASE_VOLTAGE 236.140 // Base peak phase voltage (volt)
#define BASE_CURRENT 10 // Base peak phase current (amp)
#define BASE_TORQUE // Base torque (N.m)
#define BASE_FLUX // Base flux linkage (volt.sec/rad)
#define BASE_FREQ 120 // Base electrical frequency (Hz)****************************************************************************
VdTesting = 0.2;
VqTesting = 0.2;
IdRef = 0.1;
IqRef = 0.05;
SpeedRef = 0.3;
T = 0.0001;
offsetFlag = 0;
offsetA = 0;
offsetB = 0;
offsetC = 0;
K1 = 0.998;
K2 = 0.001999;
IsrTicker = 0;
BackTicker = 0;
Isw = 0;
TripFlagDMC = 0;
DlogCh1 = 0;
DlogCh2 = 0;
DlogCh3 = 0;
DlogCh4 = 0;
ChSel[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
TrigSel[16] = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
ACQPS[16] = {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};
SpeedLoopPrescaler = 10;
SpeedLoopCount = 1;
cap1 ={1,0};
clarke1={0,0,0,0,0};
park1 ={0,0,0,0,0,0,0};
ipark1 ={0,0,0,0,0,0,0};
pwmdac1={1000,500,0×4000,0x4000};
svgen1 ={0,0,0,0,0};
rc1 ={0,5,-1,1,0,0,0,0};
rg1 ={0,0,0,1,0,1};volt1 ={0,0,0,0,1,0,0,0,0,0};
dlog ={0UL,NULL,NULL,NULL,NULL,0,1,0,0,0UL,
0x0C0,(int (*)(int))DLOG_4CH_init,(int (*)(int))DLOG_4CH_update};//13
CpuTimer0Regs.PRD.all = 60000;
CpuTimer1Regs.PRD.all = 300000;
CpuTimer2Regs.PRD.all = 3000000;
Alpha_State_Ptr = &A0;
A_Task_Ptr = &A1;
B_Task_Ptr = &B1;
C_Task_Ptr = &C1;
pwm1 ={1000,100,0×4000,0x4000,0x4000};
pwm1.PeriodMax = 3000;
pwm1.HalfPerMax = 1500;
pwm1.Deadband = 120;
pwmdac1.PeriodMax = 500;
pwmdac1.HalfPerMax = 250;
dlog.iptr1 = &DlogCh1;
dlog.iptr2 = &DlogCh2;
dlog.iptr3 = &DlogCh3;
dlog.iptr4 = &DlogCh4;
dlog.trig_value = 0x1;
dlog.size = 0x0C8;
dlog.prescalar = 5;
ChSel[0] = 1;
ChSel[1] = 1;
ChSel[2] = 9; ChSel[3] = 3;
ChSel[4] = 15;
ChSel[5] = 14;
ChSel[6] = 12;
ChSel[7] = 7;
qep1 ={0x0,0x0,0x0,0x0,0x0,0x0,0x00020000,0x0,2,0,0×0};//11
qep1.LineEncoder = 2048;
qep1.MechScaler = 0.0001220703125;/*1/8192*/
qep1.PolePairs = 2;
qep1.CalibratedAngle = 0;
(*eQEP[m]).QDECCTL.all = 0x0000
(*eQEP[m]).QEPCTL.all = 0x821E,1000 0010 0001 1110
(*eQEP[m]).QPOSCTL.all = 0x0000 (*eQEP[m]).QUPRD = 600000; /*Unit Timer for 60Hz*/
(*eQEP[m]).QCAPCTL.all = 0x8075
(*eQEP[m]).QPOSMAX = 8192; /*4*v.LineEncoder*/
speed1 ={0,1,0,0,0,0,0,0,0,0};
speed1.K1 = 83.3333333;
speed1.K2 = 0.99686824;
speed1.K3 = 0.00313175;
speed1.BaseRpm = 3600;
speed2 ={0,0,0,260,0,0,0,1800,0};
speed2.InputSelect = 1;
speed2.BaseRpm = 3600;
speed2.SpeedScaler = 488.28125000;
rg1.StepAngleMax = 0.012;
fel_const = {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0};//16
fe1_const.Rs = 11.05;
fe1_const.Rr = 6.11;
fe1_const.Ls = 0.316423;
fe1_const.Lr = 0.316423;
fe1_const.Lm = 0.293939;
fe1_const.Ib = 10;
fe1_const.Vb = 236.140;
fe1_const.Ts = 0.0001;
fe1_const.Tr = 0.0518
fe1_const.K1 = 0.9981
fe1_const.K2 = 0.0019
fe1_const.K3 = 0.9289
fe1_const.K4 = 0.1475
fe1_const.K5 = 0.4679
fe1_const.K6 = 0.0080
fe1_const.K7 = 1.0765
fe1_const.K8 = 0.1588
fel ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0};//35
fe1.K1 = 0;
fe1.K2 = 0;
fe1.K3 = 0;
fe1.K4 = 0;
fe1.K5 = 0;
fe1.K6 = 0;
fe1.K7 = 0;
fe1.K8 = 0;
fe1.Kp = 2.8;fe1.Ki = 0.00022222;
sel_const ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0};//16
se1_const.Rr = 6.11;
se1_const.Lr = 0.316423;
se1_const.fb = 120;
se1_const.fc = 3;
se1_const.Ts = 0.0001;
se1_const.Tc = 0.0531
se1_const.Wb = 753.9822
se1_const.K1 = 0.0256
se1_const.K2 = 83.3333
se1_const.K3 = 0.9981
se1_const.K4 = 0.0019
se1 ={0,0,0,0,0.1,0,0,0.1,0,0.1, 0,0.1,0,3600,0,0,0};//17
se1.K1 = 0;
se1.K2 = 0;
se1.K3 = 0;
se1.K4 = 0;
se1.BaseRpm = 3600;
pi_spd ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12 pi_spd.Kp = 2.0;
pi_spd.Ki = 0.002;
pi_spd.Umax = 0.95;
pi_spd.Umin =-0.95;
pi_id ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_id.Kp = 1.0;
pi_id.Ki = 2.5;
pi_id.Umax = 0.3;
pi_id.Umin =-0.3;
pi_iq ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_iq.Kp = 1.0;
pi_iq.Ki = 2.5;
pi_iq.Umax = 0.8;
pi_iq.Umin =-0.8;
jianqing wang:
VdTesting = 0.2;VqTesting = 0.2;IdRef = 0.1;IqRef = 0.05;
我想知道这几个参数设置为这样的数值的具体意义。还有几个PI调节器PI参数调节方法。请各位不吝赐教。
我把HVACI_Sensorless程序里面的变量做了一个归纳,在此跟大家共享,希望有用。
****************************************************************************
#define FALSE 0
#define TRUE 1
#define PI 3.14159265358979
#define ONE_THIRD 0.33333333333333 // 1/3
#define TWO_THIRD 0.66666666666667 // 2/3
#define INV_SQRT3 0.57735026918963 // 1/sqrt(3)
#define SYSTEM_FREQUENCY 60
#define ISR_FREQUENCY 10
#define RS 11.05 // Stator resistance (ohm)#define RR 6.11 // Rotor resistance (ohm)#define LS 0.316423 // Stator inductance (H)#define LR 0.316423 // Rotor inductance (H)
#define LM 0.293939 // Magnatizing inductance (H)
#define POLES 4 // Number of poles
#define BASE_VOLTAGE 236.140 // Base peak phase voltage (volt)
#define BASE_CURRENT 10 // Base peak phase current (amp)
#define BASE_TORQUE // Base torque (N.m)
#define BASE_FLUX // Base flux linkage (volt.sec/rad)
#define BASE_FREQ 120 // Base electrical frequency (Hz)****************************************************************************
VdTesting = 0.2;
VqTesting = 0.2;
IdRef = 0.1;
IqRef = 0.05;
SpeedRef = 0.3;
T = 0.0001;
offsetFlag = 0;
offsetA = 0;
offsetB = 0;
offsetC = 0;
K1 = 0.998;
K2 = 0.001999;
IsrTicker = 0;
BackTicker = 0;
Isw = 0;
TripFlagDMC = 0;
DlogCh1 = 0;
DlogCh2 = 0;
DlogCh3 = 0;
DlogCh4 = 0;
ChSel[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
TrigSel[16] = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
ACQPS[16] = {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};
SpeedLoopPrescaler = 10;
SpeedLoopCount = 1;
cap1 ={1,0};
clarke1={0,0,0,0,0};
park1 ={0,0,0,0,0,0,0};
ipark1 ={0,0,0,0,0,0,0};
pwmdac1={1000,500,0×4000,0x4000};
svgen1 ={0,0,0,0,0};
rc1 ={0,5,-1,1,0,0,0,0};
rg1 ={0,0,0,1,0,1};volt1 ={0,0,0,0,1,0,0,0,0,0};
dlog ={0UL,NULL,NULL,NULL,NULL,0,1,0,0,0UL,
0x0C0,(int (*)(int))DLOG_4CH_init,(int (*)(int))DLOG_4CH_update};//13
CpuTimer0Regs.PRD.all = 60000;
CpuTimer1Regs.PRD.all = 300000;
CpuTimer2Regs.PRD.all = 3000000;
Alpha_State_Ptr = &A0;
A_Task_Ptr = &A1;
B_Task_Ptr = &B1;
C_Task_Ptr = &C1;
pwm1 ={1000,100,0×4000,0x4000,0x4000};
pwm1.PeriodMax = 3000;
pwm1.HalfPerMax = 1500;
pwm1.Deadband = 120;
pwmdac1.PeriodMax = 500;
pwmdac1.HalfPerMax = 250;
dlog.iptr1 = &DlogCh1;
dlog.iptr2 = &DlogCh2;
dlog.iptr3 = &DlogCh3;
dlog.iptr4 = &DlogCh4;
dlog.trig_value = 0x1;
dlog.size = 0x0C8;
dlog.prescalar = 5;
ChSel[0] = 1;
ChSel[1] = 1;
ChSel[2] = 9; ChSel[3] = 3;
ChSel[4] = 15;
ChSel[5] = 14;
ChSel[6] = 12;
ChSel[7] = 7;
qep1 ={0x0,0x0,0x0,0x0,0x0,0x0,0x00020000,0x0,2,0,0×0};//11
qep1.LineEncoder = 2048;
qep1.MechScaler = 0.0001220703125;/*1/8192*/
qep1.PolePairs = 2;
qep1.CalibratedAngle = 0;
(*eQEP[m]).QDECCTL.all = 0x0000
(*eQEP[m]).QEPCTL.all = 0x821E,1000 0010 0001 1110
(*eQEP[m]).QPOSCTL.all = 0x0000 (*eQEP[m]).QUPRD = 600000; /*Unit Timer for 60Hz*/
(*eQEP[m]).QCAPCTL.all = 0x8075
(*eQEP[m]).QPOSMAX = 8192; /*4*v.LineEncoder*/
speed1 ={0,1,0,0,0,0,0,0,0,0};
speed1.K1 = 83.3333333;
speed1.K2 = 0.99686824;
speed1.K3 = 0.00313175;
speed1.BaseRpm = 3600;
speed2 ={0,0,0,260,0,0,0,1800,0};
speed2.InputSelect = 1;
speed2.BaseRpm = 3600;
speed2.SpeedScaler = 488.28125000;
rg1.StepAngleMax = 0.012;
fel_const = {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0};//16
fe1_const.Rs = 11.05;
fe1_const.Rr = 6.11;
fe1_const.Ls = 0.316423;
fe1_const.Lr = 0.316423;
fe1_const.Lm = 0.293939;
fe1_const.Ib = 10;
fe1_const.Vb = 236.140;
fe1_const.Ts = 0.0001;
fe1_const.Tr = 0.0518
fe1_const.K1 = 0.9981
fe1_const.K2 = 0.0019
fe1_const.K3 = 0.9289
fe1_const.K4 = 0.1475
fe1_const.K5 = 0.4679
fe1_const.K6 = 0.0080
fe1_const.K7 = 1.0765
fe1_const.K8 = 0.1588
fel ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0};//35
fe1.K1 = 0;
fe1.K2 = 0;
fe1.K3 = 0;
fe1.K4 = 0;
fe1.K5 = 0;
fe1.K6 = 0;
fe1.K7 = 0;
fe1.K8 = 0;
fe1.Kp = 2.8;fe1.Ki = 0.00022222;
sel_const ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0};//16
se1_const.Rr = 6.11;
se1_const.Lr = 0.316423;
se1_const.fb = 120;
se1_const.fc = 3;
se1_const.Ts = 0.0001;
se1_const.Tc = 0.0531
se1_const.Wb = 753.9822
se1_const.K1 = 0.0256
se1_const.K2 = 83.3333
se1_const.K3 = 0.9981
se1_const.K4 = 0.0019
se1 ={0,0,0,0,0.1,0,0,0.1,0,0.1, 0,0.1,0,3600,0,0,0};//17
se1.K1 = 0;
se1.K2 = 0;
se1.K3 = 0;
se1.K4 = 0;
se1.BaseRpm = 3600;
pi_spd ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12 pi_spd.Kp = 2.0;
pi_spd.Ki = 0.002;
pi_spd.Umax = 0.95;
pi_spd.Umin =-0.95;
pi_id ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_id.Kp = 1.0;
pi_id.Ki = 2.5;
pi_id.Umax = 0.3;
pi_id.Umin =-0.3;
pi_iq ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_iq.Kp = 1.0;
pi_iq.Ki = 2.5;
pi_iq.Umax = 0.8;
pi_iq.Umin =-0.8;
Eric Ma:
回复 jianqing wang:
这些值是给d, q轴电压或电流设置的指令值,然后是标幺化的,按照 HVACI_Sensorless-Settings.H 里面的设置来标幺。
如IdRef = 0,1, 实际指令电流时 0.1 *(BASE_CURRENT 10A)= 1A
ERIC
我把HVACI_Sensorless程序里面的变量做了一个归纳,在此跟大家共享,希望有用。
****************************************************************************
#define FALSE 0
#define TRUE 1
#define PI 3.14159265358979
#define ONE_THIRD 0.33333333333333 // 1/3
#define TWO_THIRD 0.66666666666667 // 2/3
#define INV_SQRT3 0.57735026918963 // 1/sqrt(3)
#define SYSTEM_FREQUENCY 60
#define ISR_FREQUENCY 10
#define RS 11.05 // Stator resistance (ohm)#define RR 6.11 // Rotor resistance (ohm)#define LS 0.316423 // Stator inductance (H)#define LR 0.316423 // Rotor inductance (H)
#define LM 0.293939 // Magnatizing inductance (H)
#define POLES 4 // Number of poles
#define BASE_VOLTAGE 236.140 // Base peak phase voltage (volt)
#define BASE_CURRENT 10 // Base peak phase current (amp)
#define BASE_TORQUE // Base torque (N.m)
#define BASE_FLUX // Base flux linkage (volt.sec/rad)
#define BASE_FREQ 120 // Base electrical frequency (Hz)****************************************************************************
VdTesting = 0.2;
VqTesting = 0.2;
IdRef = 0.1;
IqRef = 0.05;
SpeedRef = 0.3;
T = 0.0001;
offsetFlag = 0;
offsetA = 0;
offsetB = 0;
offsetC = 0;
K1 = 0.998;
K2 = 0.001999;
IsrTicker = 0;
BackTicker = 0;
Isw = 0;
TripFlagDMC = 0;
DlogCh1 = 0;
DlogCh2 = 0;
DlogCh3 = 0;
DlogCh4 = 0;
ChSel[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
TrigSel[16] = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
ACQPS[16] = {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};
SpeedLoopPrescaler = 10;
SpeedLoopCount = 1;
cap1 ={1,0};
clarke1={0,0,0,0,0};
park1 ={0,0,0,0,0,0,0};
ipark1 ={0,0,0,0,0,0,0};
pwmdac1={1000,500,0×4000,0x4000};
svgen1 ={0,0,0,0,0};
rc1 ={0,5,-1,1,0,0,0,0};
rg1 ={0,0,0,1,0,1};volt1 ={0,0,0,0,1,0,0,0,0,0};
dlog ={0UL,NULL,NULL,NULL,NULL,0,1,0,0,0UL,
0x0C0,(int (*)(int))DLOG_4CH_init,(int (*)(int))DLOG_4CH_update};//13
CpuTimer0Regs.PRD.all = 60000;
CpuTimer1Regs.PRD.all = 300000;
CpuTimer2Regs.PRD.all = 3000000;
Alpha_State_Ptr = &A0;
A_Task_Ptr = &A1;
B_Task_Ptr = &B1;
C_Task_Ptr = &C1;
pwm1 ={1000,100,0×4000,0x4000,0x4000};
pwm1.PeriodMax = 3000;
pwm1.HalfPerMax = 1500;
pwm1.Deadband = 120;
pwmdac1.PeriodMax = 500;
pwmdac1.HalfPerMax = 250;
dlog.iptr1 = &DlogCh1;
dlog.iptr2 = &DlogCh2;
dlog.iptr3 = &DlogCh3;
dlog.iptr4 = &DlogCh4;
dlog.trig_value = 0x1;
dlog.size = 0x0C8;
dlog.prescalar = 5;
ChSel[0] = 1;
ChSel[1] = 1;
ChSel[2] = 9; ChSel[3] = 3;
ChSel[4] = 15;
ChSel[5] = 14;
ChSel[6] = 12;
ChSel[7] = 7;
qep1 ={0x0,0x0,0x0,0x0,0x0,0x0,0x00020000,0x0,2,0,0×0};//11
qep1.LineEncoder = 2048;
qep1.MechScaler = 0.0001220703125;/*1/8192*/
qep1.PolePairs = 2;
qep1.CalibratedAngle = 0;
(*eQEP[m]).QDECCTL.all = 0x0000
(*eQEP[m]).QEPCTL.all = 0x821E,1000 0010 0001 1110
(*eQEP[m]).QPOSCTL.all = 0x0000 (*eQEP[m]).QUPRD = 600000; /*Unit Timer for 60Hz*/
(*eQEP[m]).QCAPCTL.all = 0x8075
(*eQEP[m]).QPOSMAX = 8192; /*4*v.LineEncoder*/
speed1 ={0,1,0,0,0,0,0,0,0,0};
speed1.K1 = 83.3333333;
speed1.K2 = 0.99686824;
speed1.K3 = 0.00313175;
speed1.BaseRpm = 3600;
speed2 ={0,0,0,260,0,0,0,1800,0};
speed2.InputSelect = 1;
speed2.BaseRpm = 3600;
speed2.SpeedScaler = 488.28125000;
rg1.StepAngleMax = 0.012;
fel_const = {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0};//16
fe1_const.Rs = 11.05;
fe1_const.Rr = 6.11;
fe1_const.Ls = 0.316423;
fe1_const.Lr = 0.316423;
fe1_const.Lm = 0.293939;
fe1_const.Ib = 10;
fe1_const.Vb = 236.140;
fe1_const.Ts = 0.0001;
fe1_const.Tr = 0.0518
fe1_const.K1 = 0.9981
fe1_const.K2 = 0.0019
fe1_const.K3 = 0.9289
fe1_const.K4 = 0.1475
fe1_const.K5 = 0.4679
fe1_const.K6 = 0.0080
fe1_const.K7 = 1.0765
fe1_const.K8 = 0.1588
fel ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0};//35
fe1.K1 = 0;
fe1.K2 = 0;
fe1.K3 = 0;
fe1.K4 = 0;
fe1.K5 = 0;
fe1.K6 = 0;
fe1.K7 = 0;
fe1.K8 = 0;
fe1.Kp = 2.8;fe1.Ki = 0.00022222;
sel_const ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0};//16
se1_const.Rr = 6.11;
se1_const.Lr = 0.316423;
se1_const.fb = 120;
se1_const.fc = 3;
se1_const.Ts = 0.0001;
se1_const.Tc = 0.0531
se1_const.Wb = 753.9822
se1_const.K1 = 0.0256
se1_const.K2 = 83.3333
se1_const.K3 = 0.9981
se1_const.K4 = 0.0019
se1 ={0,0,0,0,0.1,0,0,0.1,0,0.1, 0,0.1,0,3600,0,0,0};//17
se1.K1 = 0;
se1.K2 = 0;
se1.K3 = 0;
se1.K4 = 0;
se1.BaseRpm = 3600;
pi_spd ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12 pi_spd.Kp = 2.0;
pi_spd.Ki = 0.002;
pi_spd.Umax = 0.95;
pi_spd.Umin =-0.95;
pi_id ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_id.Kp = 1.0;
pi_id.Ki = 2.5;
pi_id.Umax = 0.3;
pi_id.Umin =-0.3;
pi_iq ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_iq.Kp = 1.0;
pi_iq.Ki = 2.5;
pi_iq.Umax = 0.8;
pi_iq.Umin =-0.8;
jianqing wang:
回复 Eric Ma:
多谢Eric老师的回答。
最近在调电流环的PI,老是调不好。
我现在怀疑是电流采样不准的原因。观察霍尔电流传感器出来的信号脉冲毛刺比较大,仅仅是包络和示波器自带电流探头的波形相似。
请问下各位老师有没有遇到过这样的问题?如何完善?谢谢!
我把HVACI_Sensorless程序里面的变量做了一个归纳,在此跟大家共享,希望有用。
****************************************************************************
#define FALSE 0
#define TRUE 1
#define PI 3.14159265358979
#define ONE_THIRD 0.33333333333333 // 1/3
#define TWO_THIRD 0.66666666666667 // 2/3
#define INV_SQRT3 0.57735026918963 // 1/sqrt(3)
#define SYSTEM_FREQUENCY 60
#define ISR_FREQUENCY 10
#define RS 11.05 // Stator resistance (ohm)#define RR 6.11 // Rotor resistance (ohm)#define LS 0.316423 // Stator inductance (H)#define LR 0.316423 // Rotor inductance (H)
#define LM 0.293939 // Magnatizing inductance (H)
#define POLES 4 // Number of poles
#define BASE_VOLTAGE 236.140 // Base peak phase voltage (volt)
#define BASE_CURRENT 10 // Base peak phase current (amp)
#define BASE_TORQUE // Base torque (N.m)
#define BASE_FLUX // Base flux linkage (volt.sec/rad)
#define BASE_FREQ 120 // Base electrical frequency (Hz)****************************************************************************
VdTesting = 0.2;
VqTesting = 0.2;
IdRef = 0.1;
IqRef = 0.05;
SpeedRef = 0.3;
T = 0.0001;
offsetFlag = 0;
offsetA = 0;
offsetB = 0;
offsetC = 0;
K1 = 0.998;
K2 = 0.001999;
IsrTicker = 0;
BackTicker = 0;
Isw = 0;
TripFlagDMC = 0;
DlogCh1 = 0;
DlogCh2 = 0;
DlogCh3 = 0;
DlogCh4 = 0;
ChSel[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
TrigSel[16] = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
ACQPS[16] = {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};
SpeedLoopPrescaler = 10;
SpeedLoopCount = 1;
cap1 ={1,0};
clarke1={0,0,0,0,0};
park1 ={0,0,0,0,0,0,0};
ipark1 ={0,0,0,0,0,0,0};
pwmdac1={1000,500,0×4000,0x4000};
svgen1 ={0,0,0,0,0};
rc1 ={0,5,-1,1,0,0,0,0};
rg1 ={0,0,0,1,0,1};volt1 ={0,0,0,0,1,0,0,0,0,0};
dlog ={0UL,NULL,NULL,NULL,NULL,0,1,0,0,0UL,
0x0C0,(int (*)(int))DLOG_4CH_init,(int (*)(int))DLOG_4CH_update};//13
CpuTimer0Regs.PRD.all = 60000;
CpuTimer1Regs.PRD.all = 300000;
CpuTimer2Regs.PRD.all = 3000000;
Alpha_State_Ptr = &A0;
A_Task_Ptr = &A1;
B_Task_Ptr = &B1;
C_Task_Ptr = &C1;
pwm1 ={1000,100,0×4000,0x4000,0x4000};
pwm1.PeriodMax = 3000;
pwm1.HalfPerMax = 1500;
pwm1.Deadband = 120;
pwmdac1.PeriodMax = 500;
pwmdac1.HalfPerMax = 250;
dlog.iptr1 = &DlogCh1;
dlog.iptr2 = &DlogCh2;
dlog.iptr3 = &DlogCh3;
dlog.iptr4 = &DlogCh4;
dlog.trig_value = 0x1;
dlog.size = 0x0C8;
dlog.prescalar = 5;
ChSel[0] = 1;
ChSel[1] = 1;
ChSel[2] = 9; ChSel[3] = 3;
ChSel[4] = 15;
ChSel[5] = 14;
ChSel[6] = 12;
ChSel[7] = 7;
qep1 ={0x0,0x0,0x0,0x0,0x0,0x0,0x00020000,0x0,2,0,0×0};//11
qep1.LineEncoder = 2048;
qep1.MechScaler = 0.0001220703125;/*1/8192*/
qep1.PolePairs = 2;
qep1.CalibratedAngle = 0;
(*eQEP[m]).QDECCTL.all = 0x0000
(*eQEP[m]).QEPCTL.all = 0x821E,1000 0010 0001 1110
(*eQEP[m]).QPOSCTL.all = 0x0000 (*eQEP[m]).QUPRD = 600000; /*Unit Timer for 60Hz*/
(*eQEP[m]).QCAPCTL.all = 0x8075
(*eQEP[m]).QPOSMAX = 8192; /*4*v.LineEncoder*/
speed1 ={0,1,0,0,0,0,0,0,0,0};
speed1.K1 = 83.3333333;
speed1.K2 = 0.99686824;
speed1.K3 = 0.00313175;
speed1.BaseRpm = 3600;
speed2 ={0,0,0,260,0,0,0,1800,0};
speed2.InputSelect = 1;
speed2.BaseRpm = 3600;
speed2.SpeedScaler = 488.28125000;
rg1.StepAngleMax = 0.012;
fel_const = {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0};//16
fe1_const.Rs = 11.05;
fe1_const.Rr = 6.11;
fe1_const.Ls = 0.316423;
fe1_const.Lr = 0.316423;
fe1_const.Lm = 0.293939;
fe1_const.Ib = 10;
fe1_const.Vb = 236.140;
fe1_const.Ts = 0.0001;
fe1_const.Tr = 0.0518
fe1_const.K1 = 0.9981
fe1_const.K2 = 0.0019
fe1_const.K3 = 0.9289
fe1_const.K4 = 0.1475
fe1_const.K5 = 0.4679
fe1_const.K6 = 0.0080
fe1_const.K7 = 1.0765
fe1_const.K8 = 0.1588
fel ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0};//35
fe1.K1 = 0;
fe1.K2 = 0;
fe1.K3 = 0;
fe1.K4 = 0;
fe1.K5 = 0;
fe1.K6 = 0;
fe1.K7 = 0;
fe1.K8 = 0;
fe1.Kp = 2.8;fe1.Ki = 0.00022222;
sel_const ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0};//16
se1_const.Rr = 6.11;
se1_const.Lr = 0.316423;
se1_const.fb = 120;
se1_const.fc = 3;
se1_const.Ts = 0.0001;
se1_const.Tc = 0.0531
se1_const.Wb = 753.9822
se1_const.K1 = 0.0256
se1_const.K2 = 83.3333
se1_const.K3 = 0.9981
se1_const.K4 = 0.0019
se1 ={0,0,0,0,0.1,0,0,0.1,0,0.1, 0,0.1,0,3600,0,0,0};//17
se1.K1 = 0;
se1.K2 = 0;
se1.K3 = 0;
se1.K4 = 0;
se1.BaseRpm = 3600;
pi_spd ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12 pi_spd.Kp = 2.0;
pi_spd.Ki = 0.002;
pi_spd.Umax = 0.95;
pi_spd.Umin =-0.95;
pi_id ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_id.Kp = 1.0;
pi_id.Ki = 2.5;
pi_id.Umax = 0.3;
pi_id.Umin =-0.3;
pi_iq ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_iq.Kp = 1.0;
pi_iq.Ki = 2.5;
pi_iq.Umax = 0.8;
pi_iq.Umin =-0.8;
Eric Ma:
回复 jianqing wang:
你用的是自己的板子吧。
如果要确定采样问题,你可以用信号发生器输入一个电流信号给到霍尔采样,然后通过C2000采样1000个点出来分析一下。
ERIC
我把HVACI_Sensorless程序里面的变量做了一个归纳,在此跟大家共享,希望有用。
****************************************************************************
#define FALSE 0
#define TRUE 1
#define PI 3.14159265358979
#define ONE_THIRD 0.33333333333333 // 1/3
#define TWO_THIRD 0.66666666666667 // 2/3
#define INV_SQRT3 0.57735026918963 // 1/sqrt(3)
#define SYSTEM_FREQUENCY 60
#define ISR_FREQUENCY 10
#define RS 11.05 // Stator resistance (ohm)#define RR 6.11 // Rotor resistance (ohm)#define LS 0.316423 // Stator inductance (H)#define LR 0.316423 // Rotor inductance (H)
#define LM 0.293939 // Magnatizing inductance (H)
#define POLES 4 // Number of poles
#define BASE_VOLTAGE 236.140 // Base peak phase voltage (volt)
#define BASE_CURRENT 10 // Base peak phase current (amp)
#define BASE_TORQUE // Base torque (N.m)
#define BASE_FLUX // Base flux linkage (volt.sec/rad)
#define BASE_FREQ 120 // Base electrical frequency (Hz)****************************************************************************
VdTesting = 0.2;
VqTesting = 0.2;
IdRef = 0.1;
IqRef = 0.05;
SpeedRef = 0.3;
T = 0.0001;
offsetFlag = 0;
offsetA = 0;
offsetB = 0;
offsetC = 0;
K1 = 0.998;
K2 = 0.001999;
IsrTicker = 0;
BackTicker = 0;
Isw = 0;
TripFlagDMC = 0;
DlogCh1 = 0;
DlogCh2 = 0;
DlogCh3 = 0;
DlogCh4 = 0;
ChSel[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
TrigSel[16] = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
ACQPS[16] = {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};
SpeedLoopPrescaler = 10;
SpeedLoopCount = 1;
cap1 ={1,0};
clarke1={0,0,0,0,0};
park1 ={0,0,0,0,0,0,0};
ipark1 ={0,0,0,0,0,0,0};
pwmdac1={1000,500,0×4000,0x4000};
svgen1 ={0,0,0,0,0};
rc1 ={0,5,-1,1,0,0,0,0};
rg1 ={0,0,0,1,0,1};volt1 ={0,0,0,0,1,0,0,0,0,0};
dlog ={0UL,NULL,NULL,NULL,NULL,0,1,0,0,0UL,
0x0C0,(int (*)(int))DLOG_4CH_init,(int (*)(int))DLOG_4CH_update};//13
CpuTimer0Regs.PRD.all = 60000;
CpuTimer1Regs.PRD.all = 300000;
CpuTimer2Regs.PRD.all = 3000000;
Alpha_State_Ptr = &A0;
A_Task_Ptr = &A1;
B_Task_Ptr = &B1;
C_Task_Ptr = &C1;
pwm1 ={1000,100,0×4000,0x4000,0x4000};
pwm1.PeriodMax = 3000;
pwm1.HalfPerMax = 1500;
pwm1.Deadband = 120;
pwmdac1.PeriodMax = 500;
pwmdac1.HalfPerMax = 250;
dlog.iptr1 = &DlogCh1;
dlog.iptr2 = &DlogCh2;
dlog.iptr3 = &DlogCh3;
dlog.iptr4 = &DlogCh4;
dlog.trig_value = 0x1;
dlog.size = 0x0C8;
dlog.prescalar = 5;
ChSel[0] = 1;
ChSel[1] = 1;
ChSel[2] = 9; ChSel[3] = 3;
ChSel[4] = 15;
ChSel[5] = 14;
ChSel[6] = 12;
ChSel[7] = 7;
qep1 ={0x0,0x0,0x0,0x0,0x0,0x0,0x00020000,0x0,2,0,0×0};//11
qep1.LineEncoder = 2048;
qep1.MechScaler = 0.0001220703125;/*1/8192*/
qep1.PolePairs = 2;
qep1.CalibratedAngle = 0;
(*eQEP[m]).QDECCTL.all = 0x0000
(*eQEP[m]).QEPCTL.all = 0x821E,1000 0010 0001 1110
(*eQEP[m]).QPOSCTL.all = 0x0000 (*eQEP[m]).QUPRD = 600000; /*Unit Timer for 60Hz*/
(*eQEP[m]).QCAPCTL.all = 0x8075
(*eQEP[m]).QPOSMAX = 8192; /*4*v.LineEncoder*/
speed1 ={0,1,0,0,0,0,0,0,0,0};
speed1.K1 = 83.3333333;
speed1.K2 = 0.99686824;
speed1.K3 = 0.00313175;
speed1.BaseRpm = 3600;
speed2 ={0,0,0,260,0,0,0,1800,0};
speed2.InputSelect = 1;
speed2.BaseRpm = 3600;
speed2.SpeedScaler = 488.28125000;
rg1.StepAngleMax = 0.012;
fel_const = {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0};//16
fe1_const.Rs = 11.05;
fe1_const.Rr = 6.11;
fe1_const.Ls = 0.316423;
fe1_const.Lr = 0.316423;
fe1_const.Lm = 0.293939;
fe1_const.Ib = 10;
fe1_const.Vb = 236.140;
fe1_const.Ts = 0.0001;
fe1_const.Tr = 0.0518
fe1_const.K1 = 0.9981
fe1_const.K2 = 0.0019
fe1_const.K3 = 0.9289
fe1_const.K4 = 0.1475
fe1_const.K5 = 0.4679
fe1_const.K6 = 0.0080
fe1_const.K7 = 1.0765
fe1_const.K8 = 0.1588
fel ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0};//35
fe1.K1 = 0;
fe1.K2 = 0;
fe1.K3 = 0;
fe1.K4 = 0;
fe1.K5 = 0;
fe1.K6 = 0;
fe1.K7 = 0;
fe1.K8 = 0;
fe1.Kp = 2.8;fe1.Ki = 0.00022222;
sel_const ={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0};//16
se1_const.Rr = 6.11;
se1_const.Lr = 0.316423;
se1_const.fb = 120;
se1_const.fc = 3;
se1_const.Ts = 0.0001;
se1_const.Tc = 0.0531
se1_const.Wb = 753.9822
se1_const.K1 = 0.0256
se1_const.K2 = 83.3333
se1_const.K3 = 0.9981
se1_const.K4 = 0.0019
se1 ={0,0,0,0,0.1,0,0,0.1,0,0.1, 0,0.1,0,3600,0,0,0};//17
se1.K1 = 0;
se1.K2 = 0;
se1.K3 = 0;
se1.K4 = 0;
se1.BaseRpm = 3600;
pi_spd ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12 pi_spd.Kp = 2.0;
pi_spd.Ki = 0.002;
pi_spd.Umax = 0.95;
pi_spd.Umin =-0.95;
pi_id ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_id.Kp = 1.0;
pi_id.Ki = 2.5;
pi_id.Umax = 0.3;
pi_id.Umin =-0.3;
pi_iq ={0,0,0,1.0,0.0,1.0,-1.0,0.0,0.0,0.0,0.0,1.0};//12pi_iq.Kp = 1.0;
pi_iq.Ki = 2.5;
pi_iq.Umax = 0.8;
pi_iq.Umin =-0.8;
jianqing wang:
回复 Eric Ma:
是自己的板子,正打算这么干。有后续问题再请教,谢谢!