matlab_23550/Inu/def.h

483 lines
11 KiB
C
Raw Normal View History

2024-12-27 10:50:32 +03:00
/**************************************************************************
Description: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>.<EFBFBD>.
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 2021.11.08
**************************************************************************/
#ifndef DEF
#define DEF
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> (30 <20><><EFBFBD><EFBFBD>.)
#define SHIFT
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> state)
#define STATE_SHUTDOWN 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STATE_STOP 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STATE_WORK 2 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>
#define FSYSCLKOUT 200e6 //150e6 //
// prescaled version of the system clock and is used by
// all submodules within the ePWM, <20><>
// (<28><>. EPwmxRegs.TBCTL.bit.CLKDIV <20> EPwmxRegs.TBCTL.bit.HSPCLKDIV)
#define FTBCLK (FSYSCLKOUT*0.5*0.5)
//#define FTBCLK (FSYSCLKOUT*0.5*0.5*0.5*0.5)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, c
#define T_PWM 2220e-6 //F_PWM = 450 <20><>
//#define T_PWM 6000e-6 //F_PWM = 166.7 <20><>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>
#define TY (T_PWM*0.5)
// "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>", <20>
#define DT 30e-6
//#define DT 60e-6
// Time-Base Period Register, <20><>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define T1_PRD (FTBCLK*T_PWM*0.5)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>,
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 10 <20><><EFBFBD>, <20><>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define Y_LIM (T1_PRD - (DT + 10e-6)*FTBCLK)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PI2 6.283185307179586476925286766559 //pi*2
#define SQRT2 1.4142135623730950488016887242097 //sqrt(2)
#define SQRT3 1.7320508075688772935274463415059 //sqrt(3)
#define ISQRT3 0.57735026918962576450914878050196 //1./sqrt(3)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20><>
#define P_NOM (5000e3*2.)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> (ampl)
#define U_NOM (3000.*SQRT2)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>/<2F><><EFBFBD>
#define N_NOM 165.
// ... <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PP 6.
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define COS_FI 0.89
// ... <20><><EFBFBD>
#define EFF 0.962
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>*<2A>^2
#define J (87e3*0.50)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>
#define S_NOM (P_NOM/(COS_FI*EFF))
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>/<2F>
#define WM_NOM (N_NOM/60.*PI2)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20>*<2A>
#define M_NOM (P_NOM/WM_NOM)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, BA
#define S_BAZ S_NOM
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> (ampl)
#define U_BAZ U_NOM
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20> (ampl)
#define I_BAZ (S_BAZ*2./(U_BAZ*SQRT3)*0.5) //0.5 - <20>.<2E>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>/<2F><><EFBFBD>
#define N_BAZ N_NOM
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>/<2F>
#define WM_BAZ (N_BAZ/60.*PI2)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>/<2F>
#define WE_BAZ (WM_BAZ*PP)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20>*<2A>
#define M_BAZ (S_BAZ/WM_BAZ)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>
#define PSI_BAZ (U_BAZ/(WE_BAZ*SQRT3))
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>
#define L_BAZ (PSI_BAZ/I_BAZ)
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>
#define R_BAZ (U_BAZ/(I_BAZ*SQRT3))
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define U_2_Y (T1_PRD*SQRT3/U_BAZ)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>. 2048, <20>
#define UDC_SENS_MAX (U_BAZ*1.15*1.3)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>. 2048, <20> (ampl)
#define IAC_SENS_MAX (I_BAZ*1.5)
// number of pulses per rev. (from tacho, Hall, optical sensor...etc)
#define NOP 1024.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> QEP <20><> TY <20><><EFBFBD>. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. WM_BAZ
#define QEP_CNT_DEL_NOM (NOP*4.*TY*WM_BAZ/PI2)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> o.e.
#define GAIN_UDC (UDC_SENS_MAX/(2048.*U_BAZ))
#define GAIN_IAC (IAC_SENS_MAX/(2048.*I_BAZ))
#define GAIN_WM (1.0/QEP_CNT_DEL_NOM)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>, o.e.
#define WM_MIN 0.03 //0.003 //?
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define DECIM_PSI_WM_PM 2. //1. //5. //?
// for specify the PLL
#define PLLSTS_DIVSEL 2
#define PLLCR_DIV 10
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define CONTROLLER_BIAS 3.2
#define CONTROLLER_GAIN 2500.
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PAR_NUMBER 400
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define FIRST_WRITE_PAR_NUM 150
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (begin)
//-------------------------------------------------------------------------
// <20><><EFBFBD><EFBFBD><EFBFBD>
// ----------------------------
#define DI_24V_SOURCE_FAULT GpioDataRegs.GPBDAT.bit.GPIO50
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// ----------------------------
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define DO_GPIO00_SET GpioDataRegs.GPASET.bit.GPIO0 = 1
#define DO_GPIO00_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO0 = 1
#define DO_GPIO01_SET GpioDataRegs.GPASET.bit.GPIO1 = 1
#define DO_GPIO01_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO1 = 1
#define DO_GPIO02_SET GpioDataRegs.GPASET.bit.GPIO2 = 1
#define DO_GPIO02_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO2 = 1
#define DO_GPIO03_SET GpioDataRegs.GPASET.bit.GPIO3 = 1
#define DO_GPIO03_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO3 = 1
#define DO_GPIO04_SET GpioDataRegs.GPASET.bit.GPIO4 = 1
#define DO_GPIO04_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO4 = 1
#define DO_GPIO05_SET GpioDataRegs.GPASET.bit.GPIO5 = 1
#define DO_GPIO05_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO5 = 1
#define DO_GPIO06_SET GpioDataRegs.GPASET.bit.GPIO6 = 1
#define DO_GPIO06_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO6 = 1
#define DO_GPIO07_SET GpioDataRegs.GPASET.bit.GPIO7 = 1
#define DO_GPIO07_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO7 = 1
#define DO_GPIO08_SET GpioDataRegs.GPASET.bit.GPIO8 = 1
#define DO_GPIO08_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO8 = 1
#define DO_GPIO09_SET GpioDataRegs.GPASET.bit.GPIO9 = 1
#define DO_GPIO09_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO9 = 1
#define DO_GPIO10_SET GpioDataRegs.GPASET.bit.GPIO10 = 1
#define DO_GPIO10_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO10 = 1
#define DO_GPIO11_SET GpioDataRegs.GPASET.bit.GPIO11 = 1
#define DO_GPIO11_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO11 = 1
// ... <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define DO_GPIO019_SET GpioDataRegs.GPASET.bit.GPIO19 = 1
#define DO_GPIO019_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO19 = 1
#define DO_GPIO020_SET GpioDataRegs.GPASET.bit.GPIO20 = 1
#define DO_GPIO020_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO20 = 1
#define DO_GPIO022_SET GpioDataRegs.GPASET.bit.GPIO22 = 1
#define DO_GPIO022_CLEAR GpioDataRegs.GPACLEAR.bit.GPIO22 = 1
#define DO_GPIO48_SET GpioDataRegs.GPBSET.bit.GPIO48 = 1
#define DO_GPIO48_CLEAR GpioDataRegs.GPBCLEAR.bit.GPIO48 = 1
#define DO_GPIO49_SET GpioDataRegs.GPBSET.bit.GPIO49 = 1
#define DO_GPIO49_CLEAR GpioDataRegs.GPBCLEAR.bit.GPIO49 = 1
// ... <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CS EEPROM
#define CS_SET GpioDataRegs.GPBSET.bit.GPIO57 = 1
#define CS_CLEAR GpioDataRegs.GPBCLEAR.bit.GPIO57 = 1
// ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
#define LED_GREEN1_ON GpioDataRegs.GPBCLEAR.bit.GPIO59 = 1
#define LED_GREEN1_OFF GpioDataRegs.GPBSET.bit.GPIO59 = 1
#define LED_GREEN1_TOGGLE GpioDataRegs.GPBTOGGLE.bit.GPIO59 = 1
// (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
#define LED_GREEN2_ON GpioDataRegs.GPBCLEAR.bit.GPIO60 = 1
#define LED_GREEN2_OFF GpioDataRegs.GPBSET.bit.GPIO60 = 1
#define LED_GREEN2_TOGGLE GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1
// (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
#define LED_RED_ON GpioDataRegs.GPBCLEAR.bit.GPIO61 = 1
#define LED_RED_OFF GpioDataRegs.GPBSET.bit.GPIO61 = 1
#define LED_RED_TOGGLE GpioDataRegs.GPBTOGGLE.bit.GPIO61 = 1
// ... <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define DO_GPIO63_SET GpioDataRegs.GPBSET.bit.GPIO63 = 1
#define DO_GPIO63_CLEAR GpioDataRegs.GPBCLEAR.bit.GPIO63 = 1
//-------------------------------------------------------------------------
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (end)
#include "DSP2833x_Device.h"
#include "math.h"
#include "C28x_FPU_FastRTS.h"
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><>. control_current())
struct Cc {
short once;
float KpOrig;
float KiOrig;
float Kp;
float Ki;
float K1;
float K2;
float K3;
float Xyff;
float yffAux2;
float yffAux3;
float del;
float kYlim;
float yd1P;
float yd1I;
float yd1FF;
float yd1;
float yq1P;
float yq1I;
float yq1FF;
float yq1;
float y1;
float yd2P;
float yd2I;
float yd2FF;
float yd2;
float yq2P;
float yq2I;
float yq2FF;
float yq2;
float y2;
short y1LimFlag;
short y2LimFlag;
}; //Cc
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><>. control_flux())
struct Cf {
short once;
float KpOrig;
float KiOrig;
float Kp;
float Ki;
float IdLim;
float IdLimNeg;
float del;
float idP;
float idI;
float idFF;
short idLimFlag;
}; //Cf
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><>. control_speed_power())
struct Csp {
short once;
float KpOrig;
float KiOrig;
float Kp;
float Ki;
float kMeNom;
float del;
float iqP;
float iqI;
float iqFF;
float IlimIncr;
float iqLimAux;
float iqLimZi;
float IqLim;
float IqLimNeg;
float iqLim;
float iqLimNeg;
float delWmAbs;
float KizIncr;
float pmZiRampDown;
float wmLimZi;
float pmLimZi;
short iqLimFlag;
}; //Csp
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> EEPROM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
struct Eprom {
short writeRequestNumber;
short readFaultNo;
}; //Eprom
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
struct Emerg {
float udc1;
float udc2;
float iac1;
float iac2;
float me;
float wm;
float pm;
}; //Emerg
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> inverse park (<28><>. ipark())
struct Ip {
float yx1Aux;
float yy1Aux;
float yx2Aux;
float yy2Aux;
float theta;
float sinTheta;
float cosTheta;
float yx1;
float yy1;
float yx2;
float yy2;
}; //Ip
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> indirect vector control (<28><>. indirect_vector_control())
struct Ivc {
short once;
float im;
float wr;
float wsNf;
float ws;
float sinTheta;
float cosTheta;
float id1;
float iq1;
float psi;
float id2;
float iq2;
}; //Ivc
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>
struct Mst {
short pzMode;
short faultReset;
short start;
float wmZz;
float pmZz;
float wmLim;
float pmLim;
float pIncrMaxTy;
float pDecrMaxTy;
}; //Mst
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
struct Offset {
short Udc1;
short Udc2;
short Ic1;
short Ic2;
short Ia1;
short Ia2;
short Ib1;
short Ib2;
}; //Offset
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
struct Out {
float K;
float udc1;
float udc2;
float iac1;
float iac2;
float me;
float wm;
float pm;
}; //Out
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
struct Protect {
short IacMax;
short IacMin;
unsigned short Tdi24VSource;
volatile unsigned short tDI24VSource;
unsigned short TudcMin;
volatile unsigned short tUdc1Min;
volatile unsigned short tUdc2Min;
unsigned short TwmMax;
volatile unsigned short tWmMax;
float UdcMin;
float UdcMax;
float WmMax;
}; //Protect
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
struct Result {
short udc1;
short udc2;
short ic1;
short ic2;
short ia1;
short ia2;
short ib1;
short ib2;
}; //Result
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><>. reference_flux())
struct Rf {
short once;
float PsiZ;
float PsizIncr;
float psiZi;
float psiZCorr;
float psiSub;
float psiZCorr2;
float psiZ;
float KpsiSub;
float Kpsiz;
float WmNomPsi;
float YlimPsi;
float pPsiZ;
float psiZPrev1;
float psiZPrev2;
float psiZPrev3;
}; //Rf
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><>. reference_power())
struct Rp {
short once;
float pmZz;
float pmZi;
float pmZ;
float Kpmz;
float PlimIncr;
float KpIncrDecr;
volatile float pmEqv;
}; //Rp
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><>. reference_speed())
struct Rs {
short once;
float wmZz;
float wmZi;
float wmZ;
float Kwmz;
float WlimIncr;
float wzIncrNf;
float wzIncr;
float pWmZ;
float wmZPrev1;
float wmZPrev2;
float wmZPrev3;
short tPwmZ;
}; //Rs
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
struct SgmPar {
float Rs;
float Lls;
float Rr;
float Llr;
float Lm;
float Ls;
float Lr;
float SigmaLs;
float LmInv;
float LrInv;
float Tr;
float TrInv;
float Kl;
float KlInv;
}; //SgmPar
#endif //DEF