Thread 中讨论的其他器件:controlSUITE
工具与软件:
您好!
我正在浏览 controlSUITE 中的 PM_Sensorless 项目。 在构建级别2的代码中、我注意到相电压计算(需要 PWM 占空比信息(由空间矢量 PWM 生成模块给出)是在 SVGEN_DQ 计算完成之前完成的。 因此、我假设它使用存储在 T_a、T_b 和 T_c 变量中的旧值、初始化时这些值为零。
在相电压计算之前进行空间矢量计算难道不是更好吗? 为什么这样做呢?
我已用粗体设置了相关代码的格式。
// =============================== LEVEL 2 ======================================// Level 2 verifies the analog-to-digital conversion, offset compensation, // clarke/park transformations (CLARKE/PARK), phase voltage calculations // ============================================================================== #if (BUILDLEVEL==LEVEL2) // ------------------------------------------------------------------------------// Connect inputs of the RMP module and call the ramp control macro// ------------------------------------------------------------------------------ rc1.TargetValue = SpeedRef; RC_MACRO(rc1)// ------------------------------------------------------------------------------// Connect inputs of the RAMP GEN module and call the ramp generator macro// ------------------------------------------------------------------------------ rg1.Freq = rc1.SetpointValue; RG_MACRO(rg1) // ------------------------------------------------------------------------------// Measure phase currents, subtract the offset and normalize from (-0.5,+0.5) to (-1,+1). // Connect inputs of the CLARKE module and call the clarke transformation macro// ------------------------------------------------------------------------------ #ifdef F2806x_DEVICE_H clarke1.As=-(((AdcResult.ADCRESULT0)*0.00024414-cal_offset_A)*2); // Phase A curr. clarke1.Bs=-(((AdcResult.ADCRESULT1)*0.00024414-cal_offset_B)*2); // Phase B curr. #endif // ((ADCmeas(q12)/2^12)-0.5)*2 #ifdef DSP2803x_DEVICE_H clarke1.As=-(_IQ15toIQ((AdcResult.ADCRESULT1<<3)-cal_offset_A)<<1); clarke1.Bs=-(_IQ15toIQ((AdcResult.ADCRESULT2<<3)-cal_offset_B)<<1); #endif CLARKE_MACRO(clarke1) // ------------------------------------------------------------------------------// Connect inputs of the PARK module and call the park trans. macro// ------------------------------------------------------------------------------ park1.Alpha = clarke1.Alpha; park1.Beta = clarke1.Beta; park1.Angle = rg1.Out; park1.Sine = _IQsinPU(park1.Angle); park1.Cosine = _IQcosPU(park1.Angle); PARK_MACRO(park1) // ------------------------------------------------------------------------------// Connect inputs of the INV_PARK module and call the inverse park trans. macro// ------------------------------------------------------------------------------ ipark1.Ds = VdTesting; ipark1.Qs = VqTesting; ipark1.Sine=park1.Sine; ipark1.Cosine=park1.Cosine; IPARK_MACRO(ipark1) // ------------------------------------------------------------------------------// Connect inputs of the VOLT_CALC module and call the phase voltage calc. macro// ------------------------------------------------------------------------------ #ifdef F2806x_DEVICE_H volt1.DcBusVolt = ((AdcResult.ADCRESULT2)*0.00024414); // DC Bus voltage meas. #endif // (ADCmeas(q12)/2^12) #ifdef DSP2803x_DEVICE_H volt1.DcBusVolt = _IQ15toIQ((AdcResult.ADCRESULT3<<3)); // DC Bus voltage meas. #endif volt1.MfuncV1 = svgen_dq1.Ta; volt1.MfuncV2 = svgen_dq1.Tb; volt1.MfuncV3 = svgen_dq1.Tc; VOLT_MACRO(volt1) // ------------------------------------------------------------------------------// Connect inputs of the SVGEN_DQ module and call the space-vector gen. macro// ------------------------------------------------------------------------------ svgen_dq1.Ualpha = ipark1.Alpha; svgen_dq1.Ubeta = ipark1.Beta; SVGEN_MACRO(svgen_dq1) // ------------------------------------------------------------------------------// Connect inputs of the PWM_DRV module and call the PWM signal generation macro// ------------------------------------------------------------------------------ pwm1.MfuncC1 = _IQtoQ15(svgen_dq1.Ta); pwm1.MfuncC2 = _IQtoQ15(svgen_dq1.Tb); pwm1.MfuncC3 = _IQtoQ15(svgen_dq1.Tc); PWM_MACRO(pwm1) // Calculate the new PWM compare values EPwm1Regs.CMPA.half.CMPA=pwm1.PWM1out; // PWM 1A - PhaseA EPwm2Regs.CMPA.half.CMPA=pwm1.PWM2out; // PWM 2A - PhaseB EPwm3Regs.CMPA.half.CMPA=pwm1.PWM3out; // PWM 3A - PhaseC // ------------------------------------------------------------------------------// Connect inputs of the PWCCMDAC module // ------------------------------------------------------------------------------ PwmDacCh1 = _IQtoQ15(clarke1.As); PwmDacCh2 = _IQtoQ15(clarke1.Bs); PwmDacCh3 = _IQtoQ15(volt1.Valpha); // ------------------------------------------------------------------------------// Connect inputs of the DATALOG module // ------------------------------------------------------------------------------ DlogCh1 = _IQtoQ15(volt1.Valpha); DlogCh2 = _IQtoQ15(clarke1.Alpha); DlogCh3 = _IQtoQ15(volt1.Vbeta ); DlogCh4 = _IQtoQ15(clarke1.Beta);
谢谢你
此致