📄 resolver.h
字号:
/* =================================================================================
File name: RESOLVER.H (IQ version)
Originator: Digital Control Systems Group
Texas Instruments
Description:
Header file containing the data types, constants for the position and speed
based on resolver sensor. Also contains the prototypes for the
functions implemented in Speed.C
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005 Version 3.20
------------------------------------------------------------------------------*/
typedef struct {
_iq SinIn; // Input: Measured sine signal (pu)
_iq CosIn; // Input: Measured cos signal (pu)
_iq FilteredSin; // Variable: Filtered sine signal (pu)
_iq FilteredCos; // Variable: Filtered cos signal (pu)
_iq DemodSin; // Variable: Demodulated sine signal (pu)
_iq DemodCos; // Variable: Demodulated cos signal (pu)
_iq PreviousSin[18]; // History: Past sine signals (pu)
_iq PreviousCos[18]; // History: Past cos signals (pu)
_iq FilterGain[18]; // Parameter: Low-pass filter gains (FIR 17-order, Hamming Windows)
_iq OutputTheta; // Output: Motor electrical position angle (pu)
_iq FilterTheta; // Variable: FilterTheta = FilterTheta1 - FilterTheta2 (pu)
_iq FilterTheta1; // Variable: Motor mechanical angle computed by filtered sin/cos signal (pu)
_iq FilterTheta2; // Variable: Motor mechanical angle computed by filtered cos/sin signal (pu)
Uint32 DemodConst; // Variable: Downsampling by factor K
_iq SignalGain; // Parameter: Sin and cos gain (pu)
_iq SpeedGain; // Parameter: Speed calculation gain (pu)
Uint32 CounterMax; // Parameter: Maximum count for finding zero crossing (Q0)
_iq AmplifiedSin; // Variable: Amplified sine signal (pu)
_iq AmplifiedCos; // Variable: Amplified cos signal (pu)
_iq PreviousDemodSin[4]; // History: Past demodulated sine signals (pu)
_iq PreviousDemodCos[4]; // History: Past demodulated cos signals (pu)
Uint32 ThetaCounter; // Variable: Counter for finding zero crossing (Q0)
Uint32 ThetaCounterMax; // Variable: Maximum counter for finding zero crossing (Q0)
_iq ElecTheta; // Variable: Motor electrical angle before angle compensation (pu)
_iq MechTheta; // Variable: Motor mechanical angle before angle compensation (pu)
_iq Speed; // Output: Speed in per-unit (pu)
_iq OldTheta; // History: Mechanical angle at previous step (pu)
Uint32 PolePairs; // Parameter: Number of pole pairs (Q0)
Uint32 BaseRpm; // Parameter: Base speed in rpm (Q0)
_iq21 K1; // Parameter: Constant for differentiator (Q21)
int32 SpeedRpm; // Output : Motor speed in rpm (Q0)
Uint32 SignalCounter;// Variable: Sign change counter 0-3 (Q0)
_iq RefTheta; // Variable: Filtered motor mechanical angle before angle compensation (pu)
Uint32 SignFlag; // Variable: Sign change of FilterTheta (pu)
Uint32 OldSignFlag; // History: Sign change of FilterTheta at previous step (pu)
_iq CalibratedAngle; // Parameter: Mechanical angular offset between resolver's signal and phase a winding (pu)
void (*calc)(); // Pointer to the calulation function
} RESOLVER; // Data type created
typedef RESOLVER *RESOLVER_handle;
/*-----------------------------------------------------------------------------
Default initalizer for the RESOLVER object.
-----------------------------------------------------------------------------*/
#define RESOLVER_DEFAULTS { 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,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, \
{0,0,0,0}, \
{0,0,0,0}, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
0, \
(void (*)(Uint32))resolver_calc }
#define DIFF_MAX_LIMIT _IQ(0.20)
#define DIFF_MIN_LIMIT _IQ(0.05)
/*------------------------------------------------------------------------------
Prototypes for the functions in RESOLVER.C
------------------------------------------------------------------------------*/
void resolver_calc(RESOLVER_handle);
void filter_calc(RESOLVER_handle);
void demodulator_calc(RESOLVER_handle);
void position_speed_calc(RESOLVER_handle);
void angle_comp_calc(RESOLVER_handle);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -