📄 common.h
字号:
#ifndef _COMMON_H_
#define _COMMON_H_
/***********************************
*Copyright (C) 2004 FUTURE@NCRL SEU
*All Rights Reserved.
*FileName: _COMMON_H_
*Abstract: Used for GMC System.
*Cur.Ver : V2.0
*Author : Bin Jiang
*Date : 2004-03-25
*Modify : (1) Change the structure of detector.
(2) Improve the channel estimation.
*Per.Ver : V1.2
*Author : Bin Jiang
*Date : 2003-12-24
*Ref. : Matlab Program.
*************************************/
//Includes Files
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//Public Data Declaration
#define PI 4*atan(1)
////////////////////////////
/// SYSTEM PARAMETER ///
////////////////////////////
/* Tx and Rx */
#define TxANTENNA_NUM 4
#define RxANTENNA_NUM 8
/* The Channel */
#define PATH_NUM 6
#define Fc 3.2e9
#define VELOCITY 250
#define MAX_DELAY (PATH_NUM-1)
static int PATH_DELAY[] = {0,1,2,3,4,5};
static double PATH_GAIN[] = {0.96793818225476, 0.24313507865458, 0.06107277050964, 0.01534078635779, 0.00385343131008, 0.00096793818225};
//static double PATH_GAIN[] = {1,0,0,0,0,0};
/* The detector's structure */
/*
#define MAXSUPDOM 4
#define INTERP_FACTOR 3
static int SUP_DOM[] = {0,36,108,180,216};
//static int SUP_DOM[] = {0,32,112,192,216};
*/
#define MAXSUPDOM 5
#define INTERP_FACTOR 4
static int SUP_DOM[] = {0, 20, 80, 144, 204, 216};
/* The Frame and Slot Structure */
#define INPUT 1
#define OUTPUT 2 //3
#define CODE_SLOTNUM 8 //12
#define SLOT_LENGTH 2088
#define PILOT_LENGTH 32
#define GUARD_LENGTH 8
#define SUBSLOT_NUM 8
#define SYMBOL_SLOT 1728
#define SUBSLOT_LENGTH 256
#define SUBSLOTDATA_LENGTH 216 //(SUBSLOT_LENGTH-PILOT_LENGTH-GUARD_LENGTH)
////////////////////////////////
/// END SYSTEM PARAMETER ///
////////////////////////////////
//Type Declaration
typedef struct
{
int FRAME_SLOTNUM;
int n_CodedBitPerSlot;
int n_SymbolPerSlot;
int MODULATOR_STYLE;
}BASEBAND_PARM;
typedef struct
{
int n_InfoBit_length;
int n_CodeMemLength;
int Code_Poly[2];
int n_puncture;
}CODE_PARAMETER;
//Function Declaration
/* _COMPLEX_H_ */
typedef struct
{
double real;
double image;
}COMPLEX;
double eng_cmx(COMPLEX a);
double abs_cmx(COMPLEX a);
COMPLEX conj_cmx(COMPLEX a);
COMPLEX add_cmx(COMPLEX a, COMPLEX b);
COMPLEX sub_cmx(COMPLEX a, COMPLEX b);
COMPLEX mul_cmx(COMPLEX a, COMPLEX b);
COMPLEX div_cmx(COMPLEX a, COMPLEX b);
COMPLEX mul_cmxreal(COMPLEX a, double b);
COMPLEX div_cmxreal(COMPLEX a, double b);
/* _RANDOM_H_ */
extern long s1,s2;
double random_source();
double generate_random_source();
double generate_gaussian_source(double sigma2);
int generate_binary_source();
/* _INTERLEAVER_H_ */
double s_random_source(long *s1, long *s2);
void s_inter_generate(int N, int S, int *inter_index, long ss1, long ss2);
void s_interleave_int(int * p_block, int N, int * p_InlvTable);
void s_interleave_double(double * p_block, int N, int * p_InlvTable);
void s_deinterleave_double(double * p_block, int N, int * p_InlvTable);
/* _MAP_H_ */
static COMPLEX MapMatrix16QAM[] = {
{-0.31622776601684,-0.31622776601684},{-0.31622776601684,-0.94868329805051},{-0.31622776601684,0.31622776601684},{-0.31622776601684,0.94868329805051},
{-0.94868329805051,-0.31622776601684},{-0.94868329805051,-0.94868329805051},{-0.94868329805051,0.31622776601684},{-0.94868329805051,0.94868329805051},
{ 0.31622776601684,-0.31622776601684},{ 0.31622776601684,-0.94868329805051},{ 0.31622776601684,0.31622776601684},{ 0.31622776601684,0.94868329805051},
{ 0.94868329805051,-0.31622776601684},{ 0.94868329805051,-0.94868329805051},{ 0.94868329805051,0.31622776601684},{ 0.94868329805051,0.94868329805051}};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -