This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

馬達純量控制LEVEL2沒有速度訊號

我使用範例"HVACI_scalar"驅控馬達

但當我執行LEVEL2時,watch 裡面的QEP回授的速度訊號"Speed1.speed"值一直都是零。

把該值呼叫到Dlog 圖三,值一樣都還是0

==================================

DlogCh1 = (int16)_IQtoIQ15(svgen_mf1.Ta);
DlogCh2 = (int16)_IQtoIQ15(svgen_mf1.Tb);
DlogCh3 = (int16)_IQtoIQ15(speed1.Speed);
DlogCh4 = (int16)_IQtoIQ15(vhz1.VoltOut);

==================================

請問是QEP硬體出現問題還是CODE的部分有問題

下面是跟QEP有關的CODE

============《HVACI_scalar.c》=====================


QEP_MACRO(1,qep1)

speed1.ElecTheta = _IQ24toIQ((int32)qep1.ElecTheta);
speed1.DirectionQep = (int32)(qep1.DirectionQep);
SPEED_FR_MACRO(speed1)

===============《Speed.Fr.h》===================

#ifndef __SPEED_FR_H__
#define __SPEED_FR_H__

typedef struct {
_iq ElecTheta; // Input: Electrical angle (pu)
Uint32 DirectionQep; // Variable: Direction of rotation (Q0) - independently with global Q
_iq OldElecTheta; // History: Electrical angle at previous step (pu)
_iq Speed; // Output: Speed in per-unit (pu)
Uint32 BaseRpm; // Parameter: Base speed in rpm (Q0) - independently with global Q
_iq21 K1; // Parameter: Constant for differentiator (Q21) - independently with global Q
_iq K2; // Parameter: Constant for low-pass filter (pu)
_iq K3; // Parameter: Constant for low-pass filter (pu)
int32 SpeedRpm; // Output : Speed in rpm (Q0) - independently with global Q
_iq Tmp; //Variable: Temp variable
} SPEED_MEAS_QEP; // Data type created

/*-----------------------------------------------------------------------------
Default initalizer for the SPEED_MEAS_QEP object.
-----------------------------------------------------------------------------*/
#define SPEED_MEAS_QEP_DEFAULTS { 0, \
1, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
}

/*------------------------------------------------------------------------------
SPEED_FR Macro Definition
------------------------------------------------------------------------------*/


#define SPEED_FR_MACRO(v) \
/* Differentiator*/ \
/* Synchronous speed computation */ \
if ((v.ElecTheta < _IQ(0.9))&(v.ElecTheta > _IQ(0.1))) \
/* Q21 = Q21*(GLOBAL_Q-GLOBAL_Q)*/ \
v.Tmp = _IQmpy(v.K1,(v.ElecTheta - v.OldElecTheta)); \
else v.Tmp = _IQtoIQ21(v.Speed); \
/* Low-pass filter*/ \
/* Q21 = GLOBAL_Q*Q21 + GLOBAL_Q*Q21*/ \
v.Tmp = _IQmpy(v.K2,_IQtoIQ21(v.Speed))+_IQmpy(v.K3,v.Tmp); \
/* Saturate the output */ \
v.Tmp=_IQsat(v.Tmp,_IQ21(1),_IQ21(-1)); \
v.Speed = _IQ21toIQ(v.Tmp); \
/* Update the electrical angle */ \
v.OldElecTheta = v.ElecTheta; \
/* Change motor speed from pu value to rpm value (GLOBAL_Q -> Q0)*/ \
/* Q0 = Q0*GLOBAL_Q => _IQXmpy(), X = GLOBAL_Q*/ \
v.SpeedRpm = _IQmpy(v.BaseRpm,v.Speed);

#endif // __SPEED_FR_H__

=========================================================

有人要出現過同樣問題或知道怎麼解決的嗎??

請指教 謝謝

  • 不是很清楚你的硬件系统是什么样的,我觉得应该先查编码器的输出脉冲,查到有脉冲进入芯片后再观测寄存器数据

  • 例程的level2是有QEP信号输入,而计算出速度的,level3信号是有CAP输入,检查一下信号输入是否正确。