-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
May 24, 2023
1 parent
a6548f0
commit 740ece9
Showing
20 changed files
with
16,406 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.4.1 | ||
v0.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 & Utils | ||
# ---------------------------------------------------- | ||
# --- External modules | ||
using UHDBindings | ||
# --- Functions | ||
""" | ||
Calculate rate based on UHD timestamp | ||
""" | ||
function getRate(tInit,tFinal,nbSamples) | ||
sDeb = tInit.intPart + tInit.fracPart; | ||
sFin = tFinal.intPart + tFinal.fracPart; | ||
timing = sFin - sDeb; | ||
return nbSamples / timing; | ||
end | ||
""" | ||
Main call to monitor Rx rate | ||
""" | ||
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 > 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => 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 = "A:0 A:1" # 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 => ["TX/RX";"RX2"]) | ||
|
||
# ---------------------------------------------------- | ||
# --- 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="First Channel") | ||
y = 10*log10.(abs2.(fftshift(fft(sigVect[2])))) | ||
plot!(plt,xAx,y,label="Second Channel") | ||
xlabel!("Frequency [Hz]") | ||
ylabel!("Magnitude [dB]") | ||
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> |
Oops, something went wrong.