网上有几篇讨论SVPWM开环测试的文章, 结果都没说具体怎么测,沃日。这篇比较靠谱:
https://blog.csdn.net/qlexcel/article/details/96740421
这里还漏了一点重要信息,我提一下:
就是测试周期的问题;我这里是1ms,角度+5度来测试的,当然,你可以直接放到PWM周期里面去试试。
基于UCOS3的代码示例:
/* 开环测试svpwm * @theta:0~2pi,弧度 */ void svpwm_test(float32_t theta) { static int already_disabled=0; if(!already_disabled){ disable_timer_interrupt(); already_disabled = 1; } g_foc.motor1.park.in_vd = 0.2f*36.0f/SQRT3; /* 大小跟udc一致?还是=udc/sqrt(3)? */ g_foc.motor1.park.in_vq = 0.0f; /* 开环是vq=0??? */ g_foc.motor1.park.theta = theta; /* 0~2pi */ /* 反park得到out_valpha out_vbeta */ ipark(&g_foc.motor1.park); /* 给svpwm */ g_foc.motor1.svpwm.udc = 36; svpwm(&g_foc.motor1.park,&g_foc.motor1.svpwm); /* 给寄存器赋值 */ assign_pwm_duty(g_foc.motor1.svpwm.duty.a, g_foc.motor1.svpwm.duty.b, g_foc.motor1.svpwm.duty.c); } void foc_task(void *parg) { float32_t degree=1,theta=DEGREE_TO_RAD(degree); wait_sensor_init_result(); delay_10ms(50); svpwm_test(theta); //degree = _SIN(PI/6); while(1){ delay_1ms(1); degree += 5; theta = DEGREE_TO_RAD(degree); svpwm_test(theta); delay_1ms(1); degree += 5; theta = DEGREE_TO_RAD(degree); svpwm_test(theta); if(theta >= DEGREE_TO_RAD(360.0f)) theta = 0; if(degree >= 360.0f) degree = 0; } }