📄 test_channel.c
字号:
/* | | 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: Tester for channel model functions. | Author: Maarit Melvasalo | Date: May 1999 | | History: | May 18, 1999 Maarit Melvasalo | Tester for channel model. | |*/#include <stdlib.h> #include <math.h>#include <stdio.h>#include "config_wcdma.h"#include "channel.h"#define INPUT_SIZE 20/* * Channel configuration */double channel_impulse[4] = { 0.1, 0.4, 0.2, 0.2 };int channel_delays[4] = { 0, 1, 2, 3 };/* * Input data for I and Q. */int Inputs[INPUT_SIZE] = {-1,-1, 1, 1,-1,-1, 1, 1, -1,-1, 1, 1,-1,-1, 1, 1, -1,-1, 1, 1 };int Qnputs[INPUT_SIZE] = { 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1 };/* * Expected output vectors. */double I_out_correct[20] = {-0.1,-0.5,-0.3, 0.3,-0.1,-0.5, 0.1, 0.5, -0.1,-0.5, 0.1, 0.5,-0.1,-0.5, 0.1, 0.5, -0.1,-0.5, 0.1, 0.5 };double Q_out_correct[20] = { 0.1, 0.5, 0.3,-0.3, 0.1, 0.5,-0.1,-0.5, 0.1, 0.5,-0.1,-0.5, 0.1, 0.5,-0.1,-0.5, 0.1, 0.5,-0.1,-0.5 };/* * Output tolerance. */double tolerance = 0.00000001;/* ------------------------------------------------------------------- */int main(int argc, char *argv[]){ int nTaps = 4; int nImpulse = 1; double impulse_prob[1]; int nFrames = 1; double esno = 16; double power = 0; int nInputs = INPUT_SIZE; double I_out[INPUT_SIZE], Q_out[INPUT_SIZE]; int error_count = 0; int instance, i; instance = wcdma_channel_init( channel_impulse, channel_delays, nTaps, nImpulse, impulse_prob, nFrames, esno, power); wcdma_channel(Inputs, Qnputs, nInputs, instance, channel_impulse, channel_delays, I_out, Q_out); /* * Compare channel output to the precalculated expected output. */ for (i=0; i < INPUT_SIZE; i++) { if ( ( (I_out[i] - I_out_correct[i]) > tolerance ) || ( (Q_out[i] - Q_out_correct[i]) > tolerance ) ) { error_count++; } /* if */ } /* for */ printf("\nFound total of %d conflicting chips.\n\n", error_count); exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -