Razvalyaev
7e0063eee0
Все основные файлы подтянуты без изменений Изменены (только папка main_matlab): - заглушки для ненужных функций (main_matlab.c) - iq библиотека (IQmathLib_matlab.c) - библиотеки DSP281x
223 lines
4.7 KiB
C
223 lines
4.7 KiB
C
// Ìàêñèìàëüíàÿ äëèíà ïàðàìåòðà-âåêòîðà
|
|
#define LEN_PARAM_MATR 21
|
|
|
|
// Ìàññèâû ñ ïàðàìåòðàìè S_Function
|
|
double paramScal[NPARAMS];
|
|
double paramMatr[LEN_PARAM_MATR*2];
|
|
int paramMatrDimen;
|
|
|
|
// Èíäåêñ âõîäíîãî è âûõîäíîãî ìàññèâà, à òàêæå ìàññèâà ïàðàìåòðîâ
|
|
int nn;
|
|
// Øàã èíòåãðèðîâàíèÿ
|
|
double dt;
|
|
// Äëÿ îáðàáîòêè ïàðàìåòðîâ
|
|
int kkk, lll, mmm, dimen;
|
|
|
|
|
|
|
|
// Ïåðåìåííûå, êîòîðûå îïðåäåëåíû â controller.c (begin)
|
|
//#########################################################################
|
|
// Ïàðàìåòðû
|
|
//double ;
|
|
|
|
// Âõîäû
|
|
typedef struct
|
|
{
|
|
double udc1_ml;
|
|
double udc2_ml;
|
|
double ia1_ml;
|
|
double ib1_ml;
|
|
double ic1_ml;
|
|
double ia2_ml;
|
|
double ib2_ml;
|
|
double ic2_ml;
|
|
double wm_ml;
|
|
}UMotorMeasure;
|
|
extern UMotorMeasure motor;
|
|
|
|
// Äëÿ èìèòàöèè îáìåíà ñ ÏÓ
|
|
int j;
|
|
unsigned short paramNo;
|
|
unsigned short paramNew[PAR_NUMBER];
|
|
|
|
// Äëÿ ìîäåëèðîâàíèÿ Event Manager
|
|
// ... Time-Base Submodule, Counter-Compare Submodule è Event-Trigger Submodule
|
|
typedef struct
|
|
{
|
|
double TxCntPlus;
|
|
double TPr;
|
|
double tcntAux;
|
|
double tcntAuxPrev;
|
|
double tcnt;
|
|
double cmp1A;
|
|
double cmp1B;
|
|
}TimerSimHandle;
|
|
extern TimerSimHandle t1sim;
|
|
extern TimerSimHandle t2sim;
|
|
extern TimerSimHandle t3sim;
|
|
extern TimerSimHandle t4sim;
|
|
extern TimerSimHandle t5sim;
|
|
extern TimerSimHandle t6sim;
|
|
extern TimerSimHandle t7sim;
|
|
extern TimerSimHandle t8sim;
|
|
extern TimerSimHandle t9sim;
|
|
extern TimerSimHandle t10sim;
|
|
extern TimerSimHandle t11sim;
|
|
extern TimerSimHandle t12sim;
|
|
|
|
|
|
// ... Action-Qualifier Submodule
|
|
int ci1A;
|
|
int ci1B;
|
|
int ci2A;
|
|
int ci2B;
|
|
int ci3A;
|
|
int ci3B;
|
|
int ci4A;
|
|
int ci4B;
|
|
int ci5A;
|
|
int ci5B;
|
|
int ci6A;
|
|
int ci6B;
|
|
int ci7A;
|
|
int ci7B;
|
|
int ci8A;
|
|
int ci8B;
|
|
int ci9A;
|
|
int ci9B;
|
|
int ci10A;
|
|
int ci10B;
|
|
int ci11A;
|
|
int ci11B;
|
|
int ci12A;
|
|
int ci12B;
|
|
// ... Dead-Band Submodule
|
|
typedef struct
|
|
{
|
|
int CntDt;
|
|
int stateDt;
|
|
int cntDt;
|
|
int ciA_DT;
|
|
int ciB_DT;
|
|
}DeadBandSimHandle;
|
|
extern DeadBandSimHandle dt1sim;
|
|
extern DeadBandSimHandle dt2sim;
|
|
extern DeadBandSimHandle dt3sim;
|
|
extern DeadBandSimHandle dt4sim;
|
|
extern DeadBandSimHandle dt5sim;
|
|
extern DeadBandSimHandle dt6sim;
|
|
extern DeadBandSimHandle dt7sim;
|
|
extern DeadBandSimHandle dt8sim;
|
|
extern DeadBandSimHandle dt9sim;
|
|
extern DeadBandSimHandle dt10sim;
|
|
extern DeadBandSimHandle dt11sim;
|
|
extern DeadBandSimHandle dt12sim;
|
|
|
|
// Äëÿ ìîäåëèðîâàíèÿ eQEP
|
|
double Qposmax;
|
|
double qposcnt;
|
|
|
|
// Äëÿ ìîäåëèðîâàíèÿ ADC
|
|
int tAdc;
|
|
int Tadc;
|
|
int nAdc;
|
|
//#########################################################################
|
|
// Ïåðåìåííûå, êîòîðûå îïðåäåëåíû â controller.c (end)
|
|
|
|
|
|
|
|
|
|
// Ïåðåìåííûå, êîòîðûå îáúÿâëåíû â controller.c (begin)
|
|
//#########################################################################
|
|
// Äëÿ isr.c
|
|
//-------------------------------------------------------------------------
|
|
extern struct Offset offset;
|
|
extern volatile struct Result result;
|
|
extern volatile short state;
|
|
extern volatile short faultNo;
|
|
extern volatile struct Out out;
|
|
// Udc
|
|
extern float Kudc;
|
|
extern volatile float udc1Nf;
|
|
extern volatile float udc1;
|
|
extern volatile float udc2Nf;
|
|
extern volatile float udc2;
|
|
// Iac
|
|
extern volatile float ia1Nf;
|
|
extern volatile float ib1Nf;
|
|
extern volatile float ix1;
|
|
extern volatile float iy1;
|
|
extern volatile float iac1Nf;
|
|
extern volatile float ia2Nf;
|
|
extern volatile float ib2Nf;
|
|
extern volatile float ix2;
|
|
extern volatile float iy2;
|
|
extern volatile float iac2Nf;
|
|
// Wm
|
|
extern float Kwm;
|
|
extern volatile float wmNf;
|
|
extern volatile float wm;
|
|
extern volatile float wmAbs;
|
|
// Me
|
|
extern volatile float kMe;
|
|
extern float KmeCorr;
|
|
extern float Kme;
|
|
extern volatile float meNf;
|
|
extern volatile float me;
|
|
// Pm
|
|
extern volatile float pm;
|
|
// çàùèòû
|
|
extern struct Protect protect;
|
|
extern volatile struct Emerg emerg;
|
|
extern short csmSuccess;
|
|
// óïðàâëÿþùàÿ ëîãèêà
|
|
extern volatile short onceShutdown;
|
|
extern volatile short testParamFaultNo;
|
|
extern volatile short onceFaultReset;
|
|
extern volatile short stopPause;
|
|
extern volatile short inuWork;
|
|
// îáìåí
|
|
extern struct Mst mst;
|
|
|
|
|
|
|
|
// Äëÿ main.c
|
|
//-------------------------------------------------------------------------
|
|
extern struct Eprom eprom;
|
|
|
|
|
|
|
|
// Äëÿ upr.c
|
|
//-------------------------------------------------------------------------
|
|
extern volatile short onceUpr;
|
|
extern struct SgmPar sgmPar;
|
|
extern struct Rf rf;
|
|
extern struct Rs rs;
|
|
extern struct Rp rp;
|
|
|
|
extern float IzLim;
|
|
extern volatile float psi;
|
|
extern float idZ;
|
|
extern float iqZ;
|
|
extern float iZ;
|
|
extern float ws;
|
|
extern float sinTheta;
|
|
extern float cosTheta;
|
|
extern float id1;
|
|
extern float iq1;
|
|
extern float id2;
|
|
extern float iq2;
|
|
extern struct Cc cc;
|
|
extern struct Cf cf;
|
|
extern struct Csp csp;
|
|
extern struct Ivc ivc;
|
|
extern struct Ip ip;
|
|
|
|
|
|
|
|
// Äëÿ param.c
|
|
//-------------------------------------------------------------------------
|
|
extern unsigned short param[];
|
|
//#########################################################################
|
|
// Ïåðåìåííûå, êîòîðûå îáúÿâëåíû â controller.c (end)
|