<?xml version="1.0"?>
<!--
###################################################
##Frequency Selective Fading Model
###################################################
 -->
<block>
	<name>Frequency Selective Fading Model</name>
	<key>channels_selective_fading_model</key>
	<import>from gnuradio import channels</import>
	<make>channels.selective_fading_model( $N, $fDTs, $LOS, $K, $seed, $delays, $mags, $ntaps )</make>
    <callback>set_fDTs($fDTs)</callback>
    <callback>set_K($K)</callback>
	<param>
		<name>Num Sinusoids (SoS model)</name>
		<key>N</key>
		<value>8</value>
		<type>int</type>
	</param>
	<param>
		<name>Normalized Max Doppler (fD*Ts)</name>
		<key>fDTs</key>
		<value>10.0/samp_rate</value>
		<type>real</type>
	</param>
	<param>
		<name>LOS Model</name>
		<key>LOS</key>
        <type>enum</type>
        <option>
            <name>Rayleigh/NLOS</name>
            <key>False</key>
            <opt>hide_K:all</opt>
        </option>
        <option>
            <name>Rician/LOS</name>
            <key>True</key>
            <opt>hide_K:</opt>
        </option>
	</param>
	<param>
		<name>Rician factor (K)</name>
		<key>K</key>
		<value>4.0</value>
		<type>real</type>
        <hide>$LOS.hide_K</hide>
	</param>
	<param>
		<name>Seed</name>
		<key>seed</key>
		<value>0</value>
		<type>int</type>
	</param>
    <param>
        <name>PDP Delays (samp)</name>
        <key>delays</key>
        <value>0.0,0.1,1.3</value>
        <type>real_vector</type>
    </param>
    <param>
        <name>PDP Magnitudes</name>
        <key>mags</key>
        <value>1,0.99,0.97</value>
        <type>real_vector</type>
    </param>
	<param>
		<name>Num Taps</name>
		<key>ntaps</key>
		<value>8</value>
		<type>int</type>
	</param>
	<sink>
		<name>in</name>
		<type>complex</type>
	</sink>
	<source>
		<name>out</name>
		<type>complex</type>
	</source>
    <doc>
    int d_N=8;          // number of sinusoids used to simulate gain on each ray
    float d_fDTs=0.01   // normalized maximum doppler frequency (f_doppler / f_samprate)
    float d_K=4;        // Rician factor (ratio of the specular power to the scattered power)
    bool d_LOS=true;    // LOS path exists? chooses Rician (LOS) vs Rayleigh (NLOS) model.
    int seed=0;         // noise seed
    int ntaps;          // Number of FIR taps to use in selective fading model

      These two vectors comprise the Power Delay Profile of the signal
    float_vector delays   // Time delay in the fir filter (in samples) for each arriving WSSUS Ray
    float_vector mags     // Magnitude corresponding to each WSSUS Ray

    If using a LOS model, the first delay and mag should correspond with the LOS component

  References:

  The flat-fading portion of the algorithm implements the following
   Compact Rayleigh and Rician fading simulator based on random walk processes
   A. Alimohammad S.F. Fard B.F. Cockburn C. Schlegel
   26th November 2008

  The frequency selective extension of the block roughly implements
   A Low-Complexity Hardware Implementation of Discrete-Time
   Frequency-Selective Rayleigh Fading Channels
   F. Ren and Y. Zheng
   24-27 May 2009

  Implementation by Tim O'Shea
    </doc>
</block>
