matlab_23550/Inu/controller.h

243 lines
5.2 KiB
C
Raw Normal View History

#include "DSP281x_Device.h"
#include "wrapper_inu.h"
#include "def.h"
#include "edrk_main.h"
#include "vector.h"
#include "vector_control.h"
#include "adc_tools.h"
#include "uf_alg_ing.h"
#include "v_rotor.h"
#include "v_rotor_22220.h"
#include "v_pwm24_v2.h"
#include "control_station.h"
#include "control_station_project.h"
#include "CAN_Setup.h"
#include "RS_Functions.h"
#include "master_slave.h"
#include <params.h>
#include <params_alg.h>
#include <params_norma.h>
#include <params_pwm24.h>
#include <params_temper_p.h>
#include <project.h>
#ifndef __WRAPPER_CONTROLLER_H
#define __WRAPPER_CONTROLLER_H
2024-12-27 10:50:32 +03:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define LEN_PARAM_MATR 21
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> S_Function
double paramScal[NPARAMS];
double paramMatr[LEN_PARAM_MATR*2];
int paramMatrDimen;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> controller.c (begin)
//#########################################################################
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//double ;
// <20><><EFBFBD><EFBFBD><EFBFBD>
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;
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>
int j;
unsigned short paramNo;
unsigned short paramNew[PAR_NUMBER];
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Event Manager
// ... Time-Base Submodule, Counter-Compare Submodule <20> Event-Trigger Submodule
typedef struct
{
double TxCntPlus;
double TPr;
double tcntAux;
double tcntAuxPrev;
double tcnt;
double cmp1A;
double cmp1B;
}TimerSimHandle;
extern TimerSimHandle t1sim;
2024-12-27 10:50:32 +03:00
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;
2024-12-27 10:50:32 +03:00
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;
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> eQEP
double Qposmax;
double qposcnt;
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ADC
int tAdc;
int Tadc;
int nAdc;
//#########################################################################
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> controller.c (end)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> controller.c (begin)
//#########################################################################
// <20><><EFBFBD> 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;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern struct Protect protect;
extern volatile struct Emerg emerg;
extern short csmSuccess;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern volatile short onceShutdown;
extern volatile short testParamFaultNo;
extern volatile short onceFaultReset;
extern volatile short stopPause;
extern volatile short inuWork;
// <20><><EFBFBD><EFBFBD><EFBFBD>
extern struct Mst mst;
// <20><><EFBFBD> main.c
//-------------------------------------------------------------------------
extern struct Eprom eprom;
// <20><><EFBFBD> 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;
// <20><><EFBFBD> param.c
//-------------------------------------------------------------------------
extern unsigned short param[];
//#########################################################################
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> controller.c (end)
#endif //__WRAPPER_CONTROLLER_H