Capsim Block Documentation
This star models multipath fading channels for mobile radio applications.
Port | Type | Name | |
---|---|---|---|
0 | float | inPhaseIn | |
1 | float | quadPhaseIn |
Port | Type | Name | |
---|---|---|---|
0 | float | inPhase | |
1 | float | quadPhase |
int numberOfSamples; int i,j; float fd, lambda; double er,ei; float arg; float t; float env; float tsin,tcos; int samples; float norm; |
---|
inbufs = NO_INPUT_BUFFERS(); /* * extract the exponent in npts=2**fftexp */ fftexp = (int) (log((float)npts)/log(2.0)+0.5); fftl = 1 << fftexp; if (fftl > npts ) { fftl = fftl/2; fftexp -= 1; } fprintf(stdout,"JKFADECAP_FFT:npts=%d fftl=%d\n",npts,fftl); cfg=cap_fft_alloc(fftl,0,NULL,NULL); cfginv=cap_fft_alloc(fftl,1,NULL,NULL); if (n_delays == 0 ) { fprintf(stderr,"jkfade: number of delays must be >= 1 \n"); return(1); } if (n_delays != n_powers) { fprintf(stderr,"jkfade: number of delays dont match powers \n"); return(2); } if ((fftBuffer_P = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL) { fprintf(stderr,"jkfade: can't allocate work space \n"); return(3); } if ((inputBuffer_P = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL) { fprintf(stderr,"jkfade: can't allocate work space \n"); return(4); } if ((outputBuffer_P = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL) { fprintf(stderr,"jkfade: can't allocate work space \n"); return(5); } /* * calculate maximum doppler shift */ lambda= 3.e8/fc; fd= v/lambda; wd=2*PI*fd; inSampleCount=0; samplesOutput=0; |
---|
/* * input the samples. Collect fftl number of samples before processing */ for (numberOfSamples = MIN_AVAIL(); numberOfSamples > 0; --numberOfSamples) { IT_IN(0); IT_IN(1); /* * store samples in inputBuffer_P */ inputBuffer_P[inSampleCount].r = inPhaseIn(0); inputBuffer_P[inSampleCount].i = quadPhaseIn(0); /* * keep track of the number of samples inputted up this point */ inSampleCount++; #if 1 if(inSampleCount == fftl) { /* * fftl number of samples collected. * Compute fading channel amplitude. * Compute n_delays, the number of multipaths, independent amplitudes. * This is done by changing the phase by an offset. See Jakes(1974). */ for(j=0; j< n_delays; j++) { for(samples=0; samples < inSampleCount; samples++) { t=(float)samples/fs; /* * Compute complex mobile fading channel amplitude */ er=0.0; ei=0.0; for(i=0; i |
---|
/* * free up allocated space */ free((cap_fft_cpx*)fftBuffer_P); free((cap_fft_cpx*)inputBuffer_P); free((cap_fft_cpx*)outputBuffer_P); |
---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks) Copyright (C) 1989-2017 Silicon DSP Corporation This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.silicondsp.com Silicon DSP Corporation Las Vegas, Nevada */ |
---|
/* jkfade.s */ /*********************************************************************** jkfade() ************************************************************************ This star models multipath fading channels for mobile radio applications. The star accepts a complex baseband equivalent input and produces complex baseband equivalent samples. The method is based on William C. Jakes, "Microwave Mobile Communications," John Wiley & Sons, 1974 in particular pp. 13-65. Multipath is modeled using the technique presented by Nader Farahati, "A Software Multipath Fading Channel Simulator", Technophone Limited, July 1989. Nader Farahati is now with Scientific Generics, Cambridge U.K. Each multipath is associated with a time delay. The time delays are incorporated by transforming the problem into the frequency domain. This star first reads all samples, u(t), at its input. It then multiplies the complex input samples by the complex fading channel amplitude with doppler shift for path i, ri(t), and transforms them into the frequency domain, Yi(f). The various delays are incorporated by multiplying the frequency domain data, Yi(f), by exp{-2PIj(fc+f)ti} where fc is the carrier frequency, f is the frequency, and ti is the time delay of the ith multipath. The various multipaths with independent fading channel amplitudes are added in the frequency domain and transformed back into the time domain. The star then outputs the complex data as two channels ( in-phase and quad-phase) in 128 sample chunks. This helps in limiting the size of buffers. Note that other doppler spectrums and Rician distributions will be supported later. The star can easily be changed. Programmer: Sasan Ardalan Date: Dec. 27, 1990 Modified: Jeyhan Karaoguz (Time reversal and some other bugs) Date: June 28, 1991 */ |
---|