Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
GNSSSignals = "52c80523-2a4e-5c38-8979-05588f836870"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
Expand Down
41 changes: 41 additions & 0 deletions src/Acquisition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DocStringExtensions,

import Unitful: s, Hz

using PrecompileTools

export acquire,
plot_acquisition_results,
coarse_fine_acquire,
Expand Down Expand Up @@ -35,4 +37,43 @@ include("plot.jl")
include("calc_powers.jl")
include("est_signal_noise_power.jl")
include("acquire.jl")


@setup_workload begin
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
# precompile file and potentially make loading faster.
rate = 2.048e6

#common real data
data_i8 = rand(Int8,Int(round(rate*0.01)))
data_i16 = rand(Int16,Int(round(rate*0.01)))
data_f32 = rand(Float32,Int(round(rate*0.01)))
data_f64 = rand(Float64,Int(round(rate*0.01)))
Comment on lines +48 to +51

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've actually never tested acquisition with real valued data. Does that actually work?
If yes, I think we should add automatic test first. Otherwise just remove those.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen it work with Int8 and Int16 IF data from NordNav frontend, CYGNSS and TDS-1 missions.
It need to be at an intermediate frequency of course, you can't have real-valued baseband / zero-IF signal

The downconvert! function will promote any non-ComplexF32 data into ComplexF32 though

Will add the tests



#common complex data
data_ci8 = rand(Complex{Int8},Int(round(rate*0.01)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the same as in my previous comment. There isn't an automatic test for Int8. So either remove that or add an automatic test?

data_ci16 = rand(Complex{Int16},Int(round(rate*0.01)))
data_cf32 = rand(Complex{Float32},Int(round(rate*0.01)))
data_cf64 = rand(Complex{Float64},Int(round(rate*0.01)))
Comment on lines +56 to +58

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine if we just hard code the number of samples to something like a 1000:

Suggested change
data_ci16 = rand(Complex{Int16},Int(round(rate*0.01)))
data_cf32 = rand(Complex{Float32},Int(round(rate*0.01)))
data_cf64 = rand(Complex{Float64},Int(round(rate*0.01)))
signal_types = (Int16, Float32, Float64)
signals = map(T -> rand(Complex{T}, 1000), signal_types)

We probably also need different sample_rates types, interm_freq types and max_doppler types

samplerates = (10000Hz, 10000.0Hz, 1000u"kHz", 1000.0u"kHz", 10u"MHz", 10.0u"MHz")
interm_freqs = (100Hz, 100.0Hz, 100u"kHz", 100.0u"kHz", 1u"MHz", 1.0u"MHz")
max_dopplers = (1000Hz, 1000.0Hz, 1u"kHz", 1.0u"kHz")

The GPSL1 should be initialized before @compile_workload because it isn't part of Acquisition.jl .

systems = (GPSL1(), GPSL5(), GalileoE1B())



@compile_workload begin
# all calls in this block will be precompiled, regardless of whether
# they belong to your package or not (on Julia 1.8 and higher)
#TODO add support for other GNSS constellations
samplerate = rate*Hz
acquire(GPSL1(),data_ci8[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_ci16[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_cf32[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_cf64[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_i8[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_i16[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_f32[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_f64[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
Comment on lines +65 to +73

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
samplerate = rate*Hz
acquire(GPSL1(),data_ci8[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_ci16[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_cf32[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_cf64[1:2048], samplerate, 1:32; interm_freq=0*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_i8[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_i16[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_f32[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
acquire(GPSL1(),data_f64[1:2048], samplerate, 1:32; interm_freq=10*Hz, max_doppler=10e3*Hz);
foreach(systems) do system
foreach(signals) do signal
foreach(samplerates) do samplerate
foreach(interm_freqs) do interm_freq
foreach(max_dopplers) do max_doppler
acquire(system, signal, samplerate, 1:1; interm_freq, max_doppler)
end
end
end
end
end

(It is enough to acquire a single satellite)

I haven't tested the code, though ;)
You can delete the comments, IMHO

end
end



end