Skip to content

Commit

Permalink
build based on e3ffd48
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed May 24, 2023
1 parent a6548f0 commit 740ece9
Show file tree
Hide file tree
Showing 20 changed files with 16,406 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stable
1 change: 1 addition & 0 deletions v0.5
66 changes: 66 additions & 0 deletions v0.5.0/Examples/example_benchmark/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Benchmark for Rx link · AbstractSDRs.jl</title><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../../">AbstractSDRs.jl</a></span></div><form class="docs-search" action="../../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../../">Introduction to AbstractSDRs</a></li><li><a class="tocitem" href="../../base/">Function list</a></li><li><span class="tocitem">Examples</span><ul><li><a class="tocitem" href="../example_setup/">Set up a Radio Link and get some samples</a></li><li><a class="tocitem" href="../example_parameters/">Update parameters of the radio</a></li><li class="is-active"><a class="tocitem" href>Benchmark for Rx link</a></li><li><a class="tocitem" href="../example_mimo/">Example of MIMO use (with UHD)</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Examples</a></li><li class="is-active"><a href>Benchmark for Rx link</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Benchmark for Rx link</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/JuliaTelecom/AbstractSDRs.jl/blob/master/docs/src/Examples/example_benchmark.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Benchmark-for-Rx-link"><a class="docs-heading-anchor" href="#Benchmark-for-Rx-link">Benchmark for Rx link</a><a id="Benchmark-for-Rx-link-1"></a><a class="docs-heading-anchor-permalink" href="#Benchmark-for-Rx-link" title="Permalink"></a></h1><p>The following script allows to benchmark the effective rate from the receiver. To do so we compute the number of samples received in a given time. The timing is measured fro the timestamp obtained from the radio. </p><pre><code class="nohighlight hljs">module Benchmark
# ----------------------------------------------------
# --- Modules &amp; Utils
# ----------------------------------------------------
# --- External modules
using UHDBindings
# --- Functions
&quot;&quot;&quot;
Calculate rate based on UHD timestamp
&quot;&quot;&quot;
function getRate(tInit,tFinal,nbSamples)
sDeb = tInit.intPart + tInit.fracPart;
sFin = tFinal.intPart + tFinal.fracPart;
timing = sFin - sDeb;
return nbSamples / timing;
end
&quot;&quot;&quot;
Main call to monitor Rx rate
&quot;&quot;&quot;
function main(samplingRate)
# ----------------------------------------------------
# --- Physical layer and RF parameters
# ----------------------------------------------------
# --- Create the radio object in function
carrierFreq = 770e6;
gain = 50.0;
radio = openSDR(:uhd,carrierFreq,samplingRate,gain);
# --- Print the configuration
print(radio);
# --- Init parameters
# Get the radio size for buffer pre-allocation
nbSamples = radio.packetSize;
# We will get complex samples from recv! method
sig = zeros(Complex{Cfloat},nbSamples);
# --- Targeting 2 seconds acquisition
# Init counter increment
nS = 0;
# Max counter definition
nbBuffer = 2*samplingRate;
# --- Timestamp init
p = recv!(sig,radio);
nS += p;
timeInit = Timestamp(getTimestamp(radio)...);
while true
# --- Direct call to avoid allocation
p = recv!(sig,radio);
# --- Ensure packet is OK
err = getError(radio);
# --- Update counter
nS += p;
# --- Interruption
if nS &gt; nbBuffer
break
end
end
# --- Last timeStamp and rate
timeFinal = Timestamp(getTimestamp(radio)...);
# --- Getting effective rate
radioRate = radio.samplingRate;
effectiveRate = getRate(timeInit,timeFinal,nS);
# --- Free all and return
close(radio);
return (radioRate,effectiveRate);
end
end</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../example_parameters/">« Update parameters of the radio</a><a class="docs-footer-nextpage" href="../example_mimo/">Example of MIMO use (with UHD) »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.24 on <span class="colophon-date" title="Wednesday 24 May 2023 08:41">Wednesday 24 May 2023</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
75 changes: 75 additions & 0 deletions v0.5.0/Examples/example_mimo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Example of MIMO use (with UHD) · AbstractSDRs.jl</title><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../../">AbstractSDRs.jl</a></span></div><form class="docs-search" action="../../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../../">Introduction to AbstractSDRs</a></li><li><a class="tocitem" href="../../base/">Function list</a></li><li><span class="tocitem">Examples</span><ul><li><a class="tocitem" href="../example_setup/">Set up a Radio Link and get some samples</a></li><li><a class="tocitem" href="../example_parameters/">Update parameters of the radio</a></li><li><a class="tocitem" href="../example_benchmark/">Benchmark for Rx link</a></li><li class="is-active"><a class="tocitem" href>Example of MIMO use (with UHD)</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Examples</a></li><li class="is-active"><a href>Example of MIMO use (with UHD)</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Example of MIMO use (with UHD)</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/JuliaTelecom/AbstractSDRs.jl/blob/master/docs/src/Examples/example_mimo.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Example-of-MIMO-use-(with-UHD)"><a class="docs-heading-anchor" href="#Example-of-MIMO-use-(with-UHD)">Example of MIMO use (with UHD)</a><a id="Example-of-MIMO-use-(with-UHD)-1"></a><a class="docs-heading-anchor-permalink" href="#Example-of-MIMO-use-(with-UHD)" title="Permalink"></a></h1><p>Multiple antenna support is handled with the USRP (at least) based on the API proposed by UHD. Some extra parameters (channels, board and antennas) have to be set up according to the targeted board. The following example works for the USRP e310 and configure the radio to have its two receive antenna. The spectrum of the two channel is then depicted. For other radio support, MIMO configuration should be modified to be compliant with the driver preriquisites. </p><pre><code class="nohighlight hljs"># ----------------------------------------------------
# --- Package dependencies
# ----------------------------------------------------
using AbstractSDRs
using Plots
using FFTW


# ----------------------------------------------------
# --- Radio parameters
# ----------------------------------------------------
radioType = :uhd # We target UHDBindings here
carrierFreq = 2410e6 # Carrier frequency (ISM band)
samplingRate = 2e6 # Not high but issue with e310 stream :(
gain = 50 # In dB


# ----------------------------------------------------
# --- MIMO and board specificities
# ----------------------------------------------------
# We need to specify the channels and the board as we use a USRP =&gt; Note that the way the parameters are set is based on how it is done at UHD level. You can have a look at the mimo example provided by UHD.
# This may vary depending on the chosen hardware
# /!\ We need to specify how many antenna we want. Be sure that the configuration is handled by the hardware you have otherwise UHD will raise an error (and maybe segfault ?)
nbAntennaRx = 2
nbAntennaTx = 0
# Antenna and board config
channels = [0;1] # First channel is the first path
subdev = &quot;A:0 A:1&quot; # e310 board names
# For the antenna, we need to specify the dictionnary of the allocated antenna for both Tx and Rx. In our case we will only do full Rx mode so we only specify the :Rx key
antennas = Dict(:Rx =&gt; [&quot;TX/RX&quot;;&quot;RX2&quot;])

# ----------------------------------------------------
# --- Open radio
# ----------------------------------------------------
radio = openSDR(
radioType,
carrierFreq,
samplingRate,
gain ;
nbAntennaTx, nbAntennaRx,
channels,
antennas,
subdev)


# --- Receive a buffer
# We specify the size of each buffer
# We will have one buffer per channel so a Vector of Vector
# sigVect[1] and sigVect[2] will have the same size (of nbSamples) each for a channel
nbSamples = 4096
sigVect = recv(radio,nbSamples)


# ----------------------------------------------------
# --- Plot the spectrum
# ----------------------------------------------------
# Get the rate from the radio using the accessor
s = getSamplingRate(radio)
# X axis
xAx = ((0:nbSamples-1)./nbSamples .- 0.5) * s
# PSD
y = 10*log10.(abs2.(fftshift(fft(sigVect[1]))))
plt = plot(xAx,y,label=&quot;First Channel&quot;)
y = 10*log10.(abs2.(fftshift(fft(sigVect[2]))))
plot!(plt,xAx,y,label=&quot;Second Channel&quot;)
xlabel!(&quot;Frequency [Hz]&quot;)
ylabel!(&quot;Magnitude [dB]&quot;)
display(plt)


# ----------------------------------------------------
# --- Close radio
# ----------------------------------------------------
close(radio)</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../example_benchmark/">« Benchmark for Rx link</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.24 on <span class="colophon-date" title="Wednesday 24 May 2023 08:41">Wednesday 24 May 2023</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 740ece9

Please sign in to comment.