srsLTE/lib/include/srsran/phy/channel/fading.h

79 lines
2.7 KiB
C
Raw Normal View History

/**
2019-04-18 06:18:25 -07:00
*
* \section COPYRIGHT
2019-04-18 06:18:25 -07:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2019-04-18 06:18:25 -07:00
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
2019-04-18 06:18:25 -07:00
*
*/
2021-03-19 03:45:56 -07:00
#ifndef SRSRAN_FADING_H
#define SRSRAN_FADING_H
2019-04-18 06:18:25 -07:00
2021-03-19 03:45:56 -07:00
#include "srsran/config.h"
#include "srsran/phy/common/timestamp.h"
#include "srsran/phy/dft/dft.h"
2019-04-18 06:18:25 -07:00
#include <inttypes.h>
#include <stdint.h>
2019-04-18 06:18:25 -07:00
2021-03-19 03:45:56 -07:00
#define SRSRAN_CHANNEL_FADING_MAXTAPS 9
#define SRSRAN_CHANNEL_FADING_NTERMS 16
2019-04-18 06:18:25 -07:00
typedef enum {
2021-03-19 03:45:56 -07:00
srsran_channel_fading_model_none = 0,
srsran_channel_fading_model_epa,
srsran_channel_fading_model_eva,
srsran_channel_fading_model_etu,
} srsran_channel_fading_model_t;
2019-04-18 06:18:25 -07:00
typedef struct {
// Configuration parameters
float srate; // Sampling rate: 1.92e6, 3.84e6, ..., 23.04e6, 30.72e6
2021-03-19 03:45:56 -07:00
srsran_channel_fading_model_t model; // None, EPA, EVA, ETU
2019-04-18 06:18:25 -07:00
float doppler; // Maximum doppler: 5, 70, 300
2020-03-25 03:14:09 -07:00
// Internal tap parametrisation
uint32_t N; // FFT size
uint32_t path_delay; // Path delay
uint32_t state_len; // Length of the impulse response saved in the state
2021-03-19 03:45:56 -07:00
float coeff_alpha[SRSRAN_CHANNEL_FADING_MAXTAPS][SRSRAN_CHANNEL_FADING_NTERMS]; // Angle of arrival
float coeff_a[SRSRAN_CHANNEL_FADING_MAXTAPS][SRSRAN_CHANNEL_FADING_NTERMS]; // Random phase
float coeff_b[SRSRAN_CHANNEL_FADING_MAXTAPS][SRSRAN_CHANNEL_FADING_NTERMS]; // Random phase
cf_t* h_tap[SRSRAN_CHANNEL_FADING_MAXTAPS]; // Static tap signal in frequency domain
2019-04-18 06:18:25 -07:00
// Utils
2021-03-19 03:45:56 -07:00
srsran_dft_plan_t fft; // DFT to frequency domain
srsran_dft_plan_t ifft; // DFT to time domain
2020-03-25 03:14:09 -07:00
cf_t* temp; // Temporal buffer, length fft_size
cf_t* h_freq; // Channel frequency response, length fft_size
cf_t* y_freq; // Intermediate frequency domain buffer
float sin_table[1024]; // Table of sinus values
2019-04-18 06:18:25 -07:00
// State variables
2020-03-25 03:14:09 -07:00
cf_t* state; // To save impulse response of the filter
2021-03-19 03:45:56 -07:00
} srsran_channel_fading_t;
2019-04-18 06:18:25 -07:00
#ifdef __cplusplus
extern "C" {
#endif
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_channel_fading_init(srsran_channel_fading_t* q, double srate, const char* model, uint32_t seed);
2019-04-18 06:18:25 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API void srsran_channel_fading_free(srsran_channel_fading_t* q);
2019-04-18 06:18:25 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API double srsran_channel_fading_execute(srsran_channel_fading_t* q,
const cf_t* in,
cf_t* out,
uint32_t nof_samples,
double init_time);
2019-04-18 06:18:25 -07:00
#ifdef __cplusplus
}
#endif
2021-03-19 03:45:56 -07:00
#endif // SRSRAN_FADING_H