akiyoshi oguro
/
Vector_SVPWM_drive_F302R8
Vector SVPWM Drive SPMSM
Revision 3:cb3ad5a26986, committed 2020-11-18
- Comitter:
- oguro
- Date:
- Wed Nov 18 06:44:05 2020 +0000
- Parent:
- 2:0058dae8606d
- Commit message:
- Refine Vector SVPWM Drive
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0058dae8606d -r cb3ad5a26986 main.cpp --- a/main.cpp Sat Jun 08 03:52:20 2019 +0000 +++ b/main.cpp Wed Nov 18 06:44:05 2020 +0000 @@ -49,7 +49,7 @@ Timer uT; Timer vT; Timer wT; -//AnalogOut SWAVE(PA_4); +AnalogOut SWAVE(PA_4); Serial pc(USBTX,USBRX); @@ -158,9 +158,9 @@ while(q<50){ - mypwmA.write(0.5f); + mypwmA.write(0.0); mypwmB.write(0); - mypwmC.write(0); + mypwmC.write(0.5f); wait_ms(START); mypwmA.write(0); @@ -168,9 +168,9 @@ mypwmC.write(0.0); wait_ms(START); - mypwmA.write(0); + mypwmA.write(0.5f); mypwmB.write(0.0); - mypwmC.write(0.5f); + mypwmC.write(0.0); wait_ms(START); q++; @@ -268,7 +268,9 @@ z=0.8; //0.8 } // th=(Wz*et*1.9E-4)+iso; //1.99E-4 - th=(W*et*1.9E-4)+iso; //1.9E-4 + Vdlink=0.2; + z=0.4; + th=(W*et*1.1E-4)+iso; //1.9E-4 // th=Wo*wi*1.85E-4; } @@ -459,7 +461,7 @@ } /*****PID ω *****/ - Xin=5000*(1.05-Vr_adc)-vst; // 5500 + Xin=5500*(1.15-Vr_adc)-vst; // 5500 float a,b,c,work[2]; float kp=2.0,ki=0.5,kd=0.0; // 2.0 0.5 float dt=10.0E-6;//10E-6 @@ -480,7 +482,7 @@ vstt=vstt+(k1+2.0*k2+2.0*k3+k4)/6.0;*/ vstt=Xout; /********************************/ - if(2000>abs(vst-vstt)){ // ie 1000 + if(3500>abs(vst-vstt)){ // ie 1000 vsti=vstt; // vsti=vst; r=1; @@ -603,7 +605,8 @@ // SWAVE=sin(th); // SWAVE=vst/5000; //SWAVE=Vb; - // SWAVE=iuvw[0]; + //SWAVE=iuvw[0]; + SWAVE=du; Vector=r; i++; }