📄 channel.h
字号:
/* | | Copyright disclaimer: | This software was developed at the National Institute of Standards | and Technology by employees of the Federal Government in the course | of their official duties. Pursuant to title 17 Section 105 of the | United States Code this software is not subject to copyright | protection and is in the public domain. | | We would appreciate acknowledgement if the software is used. |*//* | Project: WCDMA simulation environment | Module: | Author: | Date: | | History: |*/ #ifndef CHANNEL_H#define CHANNEL_H#include <stdlib.h> #include <math.h>#include <stdio.h>#include "config_wcdma.h"#include "rake.h"/* Define the random coefficient for noise generator scaling/**/#ifndef NOISE_MAX_RANDOM#define NOISE_MAX_RANDOM MAX_RANDOM/2#endif /*#ifndef MAX_CHANNELS#define MAX_CHANNELS 10 #endif /* maximum number of available simultaneous channels *//*#define MAX_CHANNEL_IMPULSES 20 /*number of channel impulses /**//* #define MAX_RANDOM 32767.0/**/enum{ CONST = 1, RANDOM, INTERPOL};struct channel_matrix_type{ int mode; /* = CONSTANT - RANDOM - INTERPOL*/ int n_taps; /* Number of taps in channel/**/ int n_impulses; /* Number of channel impulses/**/ double cur_channel[MAX_CHANNEL_TAPS]; /* Current channel_amplitudes/**/ int cur_delays[MAX_CHANNEL_TAPS]; /* Current channel amplitudes /**/ int max_memory; double amplitudes[MAX_CHANNEL_IMPULSES][MAX_CHANNEL_TAPS]; /* Amplitude matrix*/ int delays[MAX_CHANNEL_IMPULSES][MAX_CHANNEL_TAPS]; /* Delay matrix*/ int max[MAX_CHANNEL_IMPULSES]; /* Maximum "in between" values INTERPOL only*/ int use[MAX_CHANNEL_IMPULSES]; /* Current in between index INTERPOL only*/ int cur_impulse; /* Current base impulse INTERPOL only*/ double noise_std; /* Signal to noise ratio coefficient*/ double cumul_prob[MAX_CHANNEL_IMPULSES]; /* sumulative probabilities for RANDOM only*/ int *I_prev_chips ; /* Previous chips from I-branch*/ int *Q_prev_chips ; /* Previous chips from Q-branch*/};typedef struct channel_matrix_type channel_matrix;struct channel_matrix_type_double{ int mode; /* = CONSTANT - RANDOM - INTERPOL*/ int n_taps; /* Number of taps in channel/**/ int n_impulses; /* Number of channel impulses/**/ double cur_channel[MAX_CHANNEL_TAPS]; /* Current channel_amplitudes/**/ int cur_delays[MAX_CHANNEL_TAPS]; /* Current channel amplitudes /**/ int max_memory; double amplitudes[MAX_CHANNEL_IMPULSES][MAX_CHANNEL_TAPS]; /* Amplitude matrix*/ int delays[MAX_CHANNEL_TAPS][MAX_CHANNEL_TAPS]; /* Delay matrix*/ int max[MAX_CHANNEL_IMPULSES]; /* Maximum "in between" values INTERPOL only*/ int use[MAX_CHANNEL_IMPULSES]; /* Current in between index INTERPOL only*/ int cur_impulse; /* Current base impulse INTERPOL only*/ double noise_std; /* Signal to noise ratio coefficient*/ double cumul_prob[MAX_CHANNEL_IMPULSES]; /* sumulative probabilities for RANDOM only*/ double *I_prev_chips ; /* Previous chips from I-branch*/ double *Q_prev_chips ; /* Previous chips from Q-branch*/};typedef struct channel_matrix_type_double channel_matrix_double;/*****************************************************/int wcdma_channel_init( double channel_impulse[],/* IN: Channel impulse vector*/ int channel_delays[], /* Delay taps */ int nTaps, /* channel impulse vector size */ int nImpulse, /* IN: number of channel impulse vectors = 1 for Constant channel /**/ double impulse_prob[], /* IN: Channel impulse vector probabilities*/ int nFrames, /* IN: Total number of frames send during = 0 for Random channel /**/ double esno, /* IN: SNR/**/ double power, /* IN: Power/**/ int nCode /* IN: Length of the scrambling code/**/ ); int wcdma_channel( int Inputs[], /* IN: input chip vector */ int Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: input vector size */ int instance, /* IN: */ double channel[], /* OUT: Channel impulse vector*/ int delays[], /* OUT: Delays of channel taps*/ double Iout[], /* OUT: output bit vector */ double Qout[]); /* OUT: output bit vector */int wcdma_channel_conv( int Inputs[], /* IN: input chip vector */ int Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: input vector size */ int instance, /* IN: indicates the channel instance used*/ double Iout[], /* OUT: output bit vector */ double Qout[] /* OUT: output bit vector */ ); int wcdma_channel_conv_nonoise( int Inputs[], /* IN: input chip vector */ int Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: input vector size */ int instance, /* IN: indicates the channel instance used*/ double Iout[], /* OUT: output bit vector */ double Qout[] /* OUT: output bit vector */ ); int wcdma_channel_impulse( double impulse_cumul[], /* IN: Cumulative probalities*/ int nImpulse); /* OUT: currently used channel impulse */int wcdma_update_memory_chips( int Inputs[], /* IN: input chip vector */ int Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: length input chip vector */ channel_matrix *data /* IN/OUT channel data /**/ );int wcdma_channel_free(int instance);void channel_print(int instance); /* Print fuction for testing purpose/**//*****************************************************/int wcdma_channel_init_double( double channel_impulse[],/* IN: Channel impulse vector*/ int channel_delays[], /* Delay taps */ int nTaps, /* channel impulse vector size */ int nImpulse, /* IN: number of channel impulse vectors = 1 for Constant channel /**/ double impulse_prob[], /* IN: Channel impulse vector probabilities*/ int nFrames, /* IN: Total number of frames send during = 0 for Random channel /**/ double esno, /* IN: SNR/**/ double power, /* IN: Power/**/ int nCode /* IN: Length of the scrambling code/**/ ); int wcdma_channel_double( double Inputs[], /* IN: input chip vector */ double Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: input vector size */ int instance, /* IN: channel instance*/ double channel[], /* OUT: Channel impulse vector*/ int delays[], /* OUT: Delays of channel taps*/ double Iout[], /* OUT: output bit vector */ double Qout[]); /* OUT: output bit vector */int wcdma_channel_conv_double( double Inputs[], /* IN: input chip vector */ double Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: input vector size */ int instance, /* IN: indicates the channel instance used*/ double Iout[], /* OUT: output bit vector */ double Qout[] /* OUT: output bit vector */ ); int wcdma_channel_conv_nonoise_double( double Inputs[], /* IN: input chip vector */ double Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: input vector size */ int instance, /* IN: indicates the channel instance used*/ double Iout[], /* OUT: output bit vector */ double Qout[] /* OUT: output bit vector */ ); int wcdma_channel_impulse_double( double impulse_cumul[], /* IN: Cumulative probalities*/ int nImpulse); /* OUT: currently used channel impulse */int wcdma_update_memory_chips_double( double Inputs[], /* IN: input chip vector */ double Qnputs[], /* IN: input chip vector */ int nInputs, /* IN: length input chip vector */ channel_matrix_double *data /* IN/OUT channel data /**/ );int wcdma_channel_free_double(int instance);void channel_print_double(int instance); /* Print fuction for testing purpose/**/#endif /* -------------------------------------------------------------------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -