446 lines
13 KiB
C
446 lines
13 KiB
C
|
#ifndef _ADC_TOOLS
|
|||
|
#define _ADC_TOOLS
|
|||
|
|
|||
|
#include "IQmathLib.h"
|
|||
|
#include "xp_project.h"
|
|||
|
|
|||
|
#define COUNT_DETECT_ZERO 3000
|
|||
|
|
|||
|
#define COUNT_ARR_ADC_BUF_FAST_POINT 10
|
|||
|
|
|||
|
#define NORMA_ACP 3000.0
|
|||
|
#define NORMA_ACP_RMS 2127.66
|
|||
|
|
|||
|
#define NORMA_ACP_TEMPER_MILL_AMP 100.0 //
|
|||
|
|
|||
|
#ifndef PROJECT_SHIP
|
|||
|
#error <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PROJECT_SHIP <20> predifine Name
|
|||
|
#else
|
|||
|
|
|||
|
|
|||
|
#if (PROJECT_SHIP == 1)
|
|||
|
#define NORMA_ACP_TEMPER 100.0 // <20><><EFBFBD> 23550.1
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
#if (PROJECT_SHIP == 2)
|
|||
|
#define NORMA_ACP_TEMPER 200.0 // <20><><EFBFBD> 23550.3
|
|||
|
#endif
|
|||
|
|
|||
|
#if (PROJECT_SHIP== 3)
|
|||
|
#define NORMA_ACP_TEMPER 200.0 // <20><><EFBFBD> 23550.3
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
#define DELTA_ACP_TEMPER 0.0 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> pt100 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0.0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> SG3013
|
|||
|
|
|||
|
#define NORMA_ACP_P 100.0
|
|||
|
#define ADC_READ_FROM_PARALLEL_BUS 1
|
|||
|
|
|||
|
#define DEFAULT_ZERO_ADC 2048
|
|||
|
|
|||
|
#ifndef USE_INTERNAL_ADC
|
|||
|
#define USE_INTERNAL_ADC 0
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
#if (USE_INTERNAL_ADC==1)
|
|||
|
#define COUNT_ARR_ADC_BUF (C_adc_number+1)
|
|||
|
#else
|
|||
|
#define COUNT_ARR_ADC_BUF C_adc_number
|
|||
|
#endif
|
|||
|
|
|||
|
#define COUNT_ARR_ADC_BUF_EXTERNAL C_adc_number
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// 23550.3
|
|||
|
|
|||
|
#if(C_adc_number>=1)
|
|||
|
#define R_ADC_DEFAULT_0 { 271, 271, 876, 876, 876, 876, 876, 876, 249, 249, 301, 301, 301, 301, 301, 301 }
|
|||
|
#define K_LEM_ADC_DEFAULT_0 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 8400, 8400, 8400, 8400, 5000, 5000 }
|
|||
|
#define NORMA_ADC_DEFAULT_0 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
|
|||
|
#endif
|
|||
|
|
|||
|
#if(C_adc_number>=2)
|
|||
|
#define R_ADC_DEFAULT_1 { 1, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190 }
|
|||
|
#define K_LEM_ADC_DEFAULT_1 { 1, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1 }
|
|||
|
#define NORMA_ADC_DEFAULT_1 { NORMA_ACP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_P, NORMA_ACP }
|
|||
|
#endif
|
|||
|
|
|||
|
#if(C_adc_number>=3)
|
|||
|
#define R_ADC_DEFAULT_2 { 271, 271, 887, 887, 887, 887, 887, 887, 250, 250, 3125, 3125, 3125, 3125, 309, 309 }
|
|||
|
#define K_LEM_ADC_DEFAULT_2 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 60000, 60000, 60000, 60000, 5000, 5000 }
|
|||
|
#define NORMA_ADC_DEFAULT_2 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
|
|||
|
#endif
|
|||
|
|
|||
|
// 23550.1
|
|||
|
|
|||
|
//#if(C_adc_number>=1)
|
|||
|
//#define R_ADC_DEFAULT_0 { 271, 271, 887, 887, 887, 887, 887, 887, 250, 250, 312, 312, 312, 312, 309, 309 }
|
|||
|
//#define K_LEM_ADC_DEFAULT_0 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 8400, 8400, 8400, 8400, 5000, 5000 }
|
|||
|
//#define NORMA_ADC_DEFAULT_0 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
|
|||
|
//#endif
|
|||
|
//
|
|||
|
//#if(C_adc_number>=2)
|
|||
|
//#define R_ADC_DEFAULT_1 { 1, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190 }
|
|||
|
//#define K_LEM_ADC_DEFAULT_1 { 1, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1 }
|
|||
|
//#define NORMA_ADC_DEFAULT_1 { NORMA_ACP, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_P, NORMA_ACP }
|
|||
|
//#endif
|
|||
|
//
|
|||
|
//#if(C_adc_number>=3)
|
|||
|
//#define R_ADC_DEFAULT_2 { 271, 271, 887, 887, 887, 887, 887, 887, 250, 250, 3125, 3125, 3125, 3125, 309, 309 }
|
|||
|
//#define K_LEM_ADC_DEFAULT_2 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 60000, 60000, 60000, 60000, 5000, 5000 }
|
|||
|
//#define NORMA_ADC_DEFAULT_2 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
|
|||
|
//#endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#if (USE_INTERNAL_ADC==1)
|
|||
|
#define R_ADC_DEFAULT_INTERNAL { 100,100,100,100,100,100,100,100,1248,1248,1248,100,100,100,100,100 }
|
|||
|
#define K_LEM_ADC_DEFAULT_INTERNAL { 30,30,30,30,10,10,10,10,621,621,621,100,10,10,10,10 }
|
|||
|
#define NORMA_ADC_DEFAULT_INTERNAL { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
//awa3
|
|||
|
//14 <20><><EFBFBD><EFBFBD><EFBFBD> out1
|
|||
|
0 - 11 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//15 <20><><EFBFBD><EFBFBD><EFBFBD> out2
|
|||
|
0 - 11 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//8 <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0 - 20 <EFBFBD><EFBFBD> | 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0V - 1.5V / 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//9 <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0 - 20 <EFBFBD><EFBFBD> | 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0V - 1.5V / 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//10 <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0 - 20 <EFBFBD><EFBFBD> | 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0V - 1.5V / 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//11 <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0 - 20 <EFBFBD><EFBFBD> | 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0V - 1.5V / 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 200 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//12 <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
4 - 20 <EFBFBD><EFBFBD> | 0 <EFBFBD><EFBFBD><EFBFBD> - 10 <EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0.3V - 1.5V / 0 <EFBFBD><EFBFBD><EFBFBD> - 10 <EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//13 <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
4 - 20 <EFBFBD><EFBFBD> | 0 <EFBFBD><EFBFBD><EFBFBD> - 10 <EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
0.3V - 1.5V / 0 <EFBFBD><EFBFBD><EFBFBD> - 10 <EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
typedef union
|
|||
|
{
|
|||
|
|
|||
|
struct
|
|||
|
{
|
|||
|
unsigned int c0_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c1_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c2_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c3_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c4_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c5_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c6_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c7_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c8_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c9_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c10_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c11_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c12_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c13_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c14_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
unsigned int c15_plus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ */
|
|||
|
} bit; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
unsigned long all; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
|||
|
} ERR_ADC_PLUS_PROTECT;
|
|||
|
|
|||
|
|
|||
|
typedef union
|
|||
|
{
|
|||
|
|
|||
|
struct
|
|||
|
{
|
|||
|
unsigned int c0_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c1_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c2_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c3_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c4_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c5_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c6_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c7_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c8_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c9_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c10_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c11_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c12_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c13_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c14_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
unsigned int c15_minus : 1; /* 0 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- */
|
|||
|
|
|||
|
} bit; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
unsigned int all; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
|||
|
} ERR_ADC_MINUS_PROTECT;
|
|||
|
|
|||
|
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
ERR_ADC_PLUS_PROTECT plus;
|
|||
|
ERR_ADC_MINUS_PROTECT minus;
|
|||
|
} ERR_ADC_PROTECT;
|
|||
|
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> */
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
_iq iqU_1;
|
|||
|
_iq iqU_2;
|
|||
|
|
|||
|
_iq iqU_1_fast;
|
|||
|
_iq iqU_2_fast;
|
|||
|
|
|||
|
_iq iqU_1_long;
|
|||
|
_iq iqU_2_long;
|
|||
|
|
|||
|
_iq iqIu_1;
|
|||
|
_iq iqIv_1;
|
|||
|
_iq iqIw_1;
|
|||
|
|
|||
|
_iq iqIu_2;
|
|||
|
_iq iqIv_2;
|
|||
|
_iq iqIw_2;
|
|||
|
|
|||
|
_iq iqIu_1_rms;
|
|||
|
_iq iqIv_1_rms;
|
|||
|
_iq iqIw_1_rms;
|
|||
|
|
|||
|
_iq iqIu_2_rms;
|
|||
|
_iq iqIv_2_rms;
|
|||
|
_iq iqIw_2_rms;
|
|||
|
|
|||
|
_iq iqIu;
|
|||
|
_iq iqIv;
|
|||
|
_iq iqIw;
|
|||
|
|
|||
|
_iq iqIin_1;
|
|||
|
_iq iqIin_2;
|
|||
|
|
|||
|
_iq iqUin_A1B1;
|
|||
|
_iq iqUin_B1C1;
|
|||
|
_iq iqUin_C1A1;
|
|||
|
|
|||
|
_iq iqUin_A2B2;
|
|||
|
_iq iqUin_B2C2;
|
|||
|
_iq iqUin_C2A2;
|
|||
|
|
|||
|
_iq iqUin_A1B1_rms;
|
|||
|
_iq iqUin_B1C1_rms;
|
|||
|
_iq iqUin_C1A1_rms;
|
|||
|
|
|||
|
_iq iqUin_A2B2_rms;
|
|||
|
_iq iqUin_B2C2_rms;
|
|||
|
_iq iqUin_C2A2_rms;
|
|||
|
|
|||
|
_iq iqUin_m1;
|
|||
|
_iq iqUin_m2;
|
|||
|
|
|||
|
_iq iqIbreak_1;
|
|||
|
_iq iqIbreak_2;
|
|||
|
|
|||
|
_iq T_U01;
|
|||
|
_iq T_U02;
|
|||
|
_iq T_U03;
|
|||
|
_iq T_U04;
|
|||
|
_iq T_U05;
|
|||
|
_iq T_U06;
|
|||
|
_iq T_U07;
|
|||
|
|
|||
|
_iq T_Water_external;
|
|||
|
_iq T_Water_internal;
|
|||
|
|
|||
|
_iq T_Air_01;
|
|||
|
_iq T_Air_02;
|
|||
|
_iq T_Air_03;
|
|||
|
_iq T_Air_04;
|
|||
|
|
|||
|
_iq P_Water_internal;
|
|||
|
|
|||
|
|
|||
|
_iq iqI_vozbud;
|
|||
|
|
|||
|
_iq iqIin_sum;
|
|||
|
|
|||
|
_iq iqIm_1;
|
|||
|
_iq iqIm_2;
|
|||
|
|
|||
|
_iq iqIm;
|
|||
|
|
|||
|
|
|||
|
_iq iqM;
|
|||
|
|
|||
|
_iq PowerScalar;
|
|||
|
_iq PowerScalarFilter2;
|
|||
|
_iq PowerFOC;
|
|||
|
|
|||
|
_iq iqU_1_imit;
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
_iq iqUzpt_1_2; //uzpt1 bs2
|
|||
|
_iq iqUzpt_2_2; //uzpt2 bs2
|
|||
|
_iq iqUzpt_1_2_fast; //uzpt1 bs2
|
|||
|
_iq iqUzpt_2_2_fast; //uzpt2 bs2
|
|||
|
_iq iqUzpt_1_2_long; //uzpt1 bs2
|
|||
|
_iq iqUzpt_2_2_long; //uzpt2 bs2
|
|||
|
_iq iqIin_1_1; //Iin AF1 BS1
|
|||
|
_iq iqIin_2_1; //Iin AF2 BS1
|
|||
|
_iq iqIin_3_1; //Iin AF3 BS1
|
|||
|
_iq iqIin_4_1; //Iin AF4 BS1
|
|||
|
_iq iqIin_5_1; //Iin AF5 BS1
|
|||
|
_iq iqIin_6_1; //Iin AF6 BS1
|
|||
|
_iq iqIin_1_2; //Iin AF1 BS2
|
|||
|
_iq iqIin_2_2; //Iin AF2 BS2
|
|||
|
_iq iqIin_3_2; //Iin AF3 BS2
|
|||
|
_iq iqIin_4_2; //Iin AF4 BS2
|
|||
|
_iq iqIin_5_2; //Iin AF5 BS2
|
|||
|
_iq iqIin_6_2; //Iin AF6 BS2
|
|||
|
_iq iqUin_AB; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AB
|
|||
|
_iq iqUin_BC; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BC
|
|||
|
_iq iqUin_CA; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CA
|
|||
|
_iq iqUin_AB_sf; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AB
|
|||
|
_iq iqUin_BC_sf; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BC
|
|||
|
_iq iqUin_CA_sf; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CA
|
|||
|
_iq iqT_WATER_in; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><>
|
|||
|
_iq iqT_WATER_out; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
|||
|
_iq iqT_AIR_in_up; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> (<28><><EFBFBD><EFBFBD>)
|
|||
|
_iq iqT_AIR_in_down;// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> (<28><><EFBFBD>)
|
|||
|
_iq iqP_WATER_in; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><>
|
|||
|
_iq iqP_WATER_out; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
|||
|
|
|||
|
_iq iqT_BK1_BK12; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BK1_BK12
|
|||
|
_iq iqT_BK13_BK24; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BK13_BK24
|
|||
|
|
|||
|
_iq iqUin_m1; //<2F><><EFBFBD><EFBFBD><EFBFBD><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><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
_iq iqIu_1_1; //Iu AF1 BS1
|
|||
|
_iq iqIu_1_2; //Iu AF2 BS1
|
|||
|
_iq iqIv_1_1; //Iv AF3 BS1
|
|||
|
_iq iqIv_1_2; //Iv AF4 BS1
|
|||
|
_iq iqIw_1_1; //Iw AF5 BS1
|
|||
|
_iq iqIw_1_2; //Iw AF6 BS1
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_iq iqIu_2_1; //Iu AF1 BS2
|
|||
|
_iq iqIu_2_2; //Iu AF2 BS2
|
|||
|
_iq iqIv_2_1; //Iv AF3 BS2
|
|||
|
_iq iqIv_2_2; //Iv AF4 BS2
|
|||
|
_iq iqIw_2_1; //Iw AF5 BS2
|
|||
|
_iq iqIw_2_2; //Iw AF6 BS2
|
|||
|
|
|||
|
_iq iqIm_1;
|
|||
|
_iq iqIm_2;
|
|||
|
|
|||
|
_iq iqWexp;
|
|||
|
_iq iqWout;
|
|||
|
|
|||
|
_iq iqM;
|
|||
|
*/
|
|||
|
} ANALOG_VALUE;
|
|||
|
|
|||
|
typedef struct {
|
|||
|
float U1_1;
|
|||
|
float U1_2;
|
|||
|
float Izpt1_1;
|
|||
|
float Izpt1_2;
|
|||
|
float Ia1;
|
|||
|
float Ib1;
|
|||
|
float Ic1;
|
|||
|
float U2_1;
|
|||
|
float U2_2;
|
|||
|
float Izpt2_1;
|
|||
|
float Izpt2_2;
|
|||
|
float Ia2;
|
|||
|
float Ib2;
|
|||
|
float Ic2;
|
|||
|
|
|||
|
void (*read_adc)();
|
|||
|
} ANALOG_RAW_DATA;
|
|||
|
|
|||
|
#define ANALOG_VALUE_DEFAULT {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}
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> */
|
|||
|
|
|||
|
|
|||
|
#define ERR_LEVEL_ADC_PLUS 3950 //+1270A //2950 // +650A //3467 // 3367 //3367 //3267 // 0xfff-0x29c
|
|||
|
#define ERR_LEVEL_ADC_MINUS 150 //-1270A //1150 //-650A // 267 //367
|
|||
|
|
|||
|
#define ERR_LEVEL_ADC_PLUS_6 3800 //3783 //3623~1150 // 3462 ~ 1050 A // 3320 ~ 960A //3680 //3267 // 0xfff-0x29c
|
|||
|
#define ERR_LEVEL_ADC_MINUS_6 1000 //267 //367
|
|||
|
|
|||
|
#define MIN_DETECT_UD_ZERO 2300
|
|||
|
|
|||
|
|
|||
|
#define level_err_ADC_PLUS_default {ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,\
|
|||
|
ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,\
|
|||
|
ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,\
|
|||
|
ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS}
|
|||
|
|
|||
|
#define level_err_ADC_MINUS_default {ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,\
|
|||
|
ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,\
|
|||
|
ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,\
|
|||
|
ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS}
|
|||
|
|
|||
|
|
|||
|
extern ANALOG_VALUE analog;
|
|||
|
extern ANALOG_VALUE filter;
|
|||
|
extern ANALOG_VALUE analog_zero;
|
|||
|
extern ANALOG_RAW_DATA rawData;
|
|||
|
extern _iq iq_norm_ADC[COUNT_ARR_ADC_BUF][16];
|
|||
|
|
|||
|
//void calc_norm_ADC(int fast);
|
|||
|
void calc_norm_ADC_0(int run_norma);
|
|||
|
void calc_norm_ADC_1(int run_norma);
|
|||
|
void Init_Adc_Variables(void);
|
|||
|
void norma_adc_nc(int nc);
|
|||
|
void init_Adc_Variables(void);
|
|||
|
void detect_zero_analog(int nc);
|
|||
|
|
|||
|
|
|||
|
extern int ADC_f[COUNT_ARR_ADC_BUF][16];
|
|||
|
extern int zero_ADC[COUNT_ARR_ADC_BUF][16];
|
|||
|
|
|||
|
extern ERR_ADC_PROTECT err_adc_protect[COUNT_ARR_ADC_BUF], mask_err_adc_protect[COUNT_ARR_ADC_BUF];
|
|||
|
|
|||
|
extern unsigned int const R_ADC[COUNT_ARR_ADC_BUF][16];
|
|||
|
extern unsigned int const K_LEM_ADC[COUNT_ARR_ADC_BUF][16];
|
|||
|
extern float K_NORMA_ADC[COUNT_ARR_ADC_BUF][16];
|
|||
|
|
|||
|
//void norma_all_adc(void);
|
|||
|
|
|||
|
|
|||
|
void detect_zero_analog(int nc);
|
|||
|
|
|||
|
|
|||
|
#if (USE_INTERNAL_ADC==1)
|
|||
|
|
|||
|
void Init_Internal_Adc(void);
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
#endif // end _ADC_TOOLS
|