matlab_23550/Inu/Src2/main/adc_tools.h

138 lines
1.9 KiB
C
Raw Normal View History

2024-12-27 10:50:32 +03:00
#ifndef ADC_TOOLS_H
#define ADC_TOOLS_H
#include "IQmathLib.h"
// #include "isr.h"
typedef struct
{
_iq iqIin_1;
_iq iqIin_2;
_iq iqIin_3;
_iq iqIin_4;
// _iq iqIin_1_rms;
// _iq iqIin_2_rms;
// _iq iqIin_3_rms;
// _iq iqIin_4_rms;
_iq iqIin;
_iq iqIa1_1;
_iq iqIb1_1;
_iq iqIc1_1;
_iq iqIa2_1;
_iq iqIb2_1;
_iq iqIc2_1;
_iq iqIa1_rms;
_iq iqIb1_rms;
_iq iqIc1_rms;
_iq iqIa2_rms;
_iq iqIb2_rms;
_iq iqIc2_rms;
_iq iqIq_zadan;
_iq iqIq_zad_from_optica;
_iq iqId1;
_iq iqIq1;
_iq iqIq1_filter;
_iq iqId2;
_iq iqIq2;
_iq iqIq2_filter;
_iq iqUd1;
_iq iqUq1;
_iq iqUd2;
_iq iqUq2;
_iq iqUq2_filter;
_iq tetta;
_iq Fsl;
_iq iqFstator;
_iq iqU_1;
_iq iqU_2;
_iq iqU_3;
_iq iqU_4;
_iq iqW1;
_iq iqWexp;
_iq iqWfir;
_iq iqWout;
_iq iqPvsi1;
_iq iqPvsi2;
_iq iqM_1;
_iq iqM_2;
_iq iqW2;
_iq iqW;
_iq iqU_1_long;
_iq iqU_2_long;
_iq iqU_3_long;
_iq iqU_4_long;
_iq iqU_1_fast;
_iq iqU_2_fast;
_iq iqU_3_fast;
_iq iqU_4_fast;
_iq iqIm_1;
_iq iqIm_2;
_iq iqIm_1_long;
_iq iqIm_2_long;
_iq iqIm;
_iq iqIbtr1_1;
_iq iqIbtr1_2;
_iq iqIbtr2_1;
_iq iqIbtr2_2;
} 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;
extern ANALOG_VALUE analog;
extern ANALOG_VALUE filter;
extern _iq iq_norm_ADC[18];
extern ANALOG_RAW_DATA rawData;
#define COUNT_ARR_ADC_BUF 2
extern int ADC_f[COUNT_ARR_ADC_BUF][16];
void log_acp(void);
void acp_Handler(void);
void init_Adc_Variables(void);
void calc_Izpt_rms(void);
unsigned int detect_protect_ACP_plus(void);
unsigned int detect_protect_ACP_minus(void);
void fillADClogs(void);
void read_adc(ANALOG_RAW_DATA *data);
#define ANALOG_RAW_DATA_DEFAULT {0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
read_adc}
#endif // ADC_TOOLS_H