<?xml version="1.0"?>
<!--
###################################################
# Dynamic Channel Model
###################################################
 -->
<block>
	<name>Dynamic Channel Model</name>
	<key>channels_dynamic_channel_model</key>
	<import>from gnuradio import channels</import>
	<make>channels.dynamic_channel_model( $samp_rate, $sro_stdev, $sro_maxdev, $cfo_stdev, $cfo_maxdev, $N, $fD, $LOS, $K, $delays, $mags, $ntaps, $noise_amp, $seed )</make>

    <callback>set_samp_rate($samp_rate)</callback>
    <callback>set_sro_dev_std($sro_stdev)</callback>
    <callback>set_sro_dev_max($sro_maxdev)</callback>
    <callback>set_cfo_dev_std($cfo_stdev)</callback>
    <callback>set_cfo_dev_max($cfo_maxdev)</callback>
    <callback>set_noise_amp($noise_amp)</callback>
    <callback>set_doppler_freq($fD)</callback>
    <callback>set_K($K)</callback>

    <param>
        <name>Sample Rate Hz</name>
        <key>samp_rate</key>
        <value>samp_rate</value>
        <type>real</type>
    </param>
    <param>
        <name>CFO Standard Deviation Hz per sample</name>
        <key>cfo_stdev</key>
        <value>0.01</value>
        <type>real</type>
    </param>
    <param>
        <name>Max CFO Bound Hz</name>
        <key>cfo_maxdev</key>
        <value>1e3</value>
        <type>real</type>
    </param>

    <param>
        <name>SRO Standard Deviation Hz per sample</name>
        <key>sro_stdev</key>
        <value>0.01</value>
        <type>real</type>
    </param>
    <param>
        <name>Max SRO Bound Hz</name>
        <key>sro_maxdev</key>
        <value>1e3</value>
        <type>real</type>
    </param>

    <param>
        <name>White Noise Amplitude</name>
        <key>noise_amp</key>
        <value>1.0</value>
        <type>real</type>
    </param>

	<param>
		<name>Num Sinusoids (SoS model)</name>
		<key>N</key>
		<value>8</value>
		<type>int</type>
	</param>
	<param>
		<name>Max Doppler Freq (Hz)</name>
		<key>fD</key>
		<value>2.0</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>
    The dynamic channel model is a hier block consisting of the following effects:
        - Dynamic Frequency Selective Fading Channel
        - Dynamic Center Frequency Offset Model
        - Dynamic Sample Rate Offset Model
        - Additive White Gaussian Noise

    The desired power delay profile and max doppler frequency may be provided to achieve the desired Ricean or Rayleigh fading scenario.   For center frequency and sample rate offset models, a gaussian random walk process is conducted for each.   The single sample step variance and maximum deviation for these two processes is specified and may be modified to simulate various desired stability effects.  Lastly AWGN is added to simulate a typical receiver/thermal noise floor after propagation, and the variance may be modified here as desired.
    </doc>
</block>
