Skip to content

Commit

Permalink
Merge pull request #4 from JuliaGNSS/ss/add-prn-to-acq-res
Browse files Browse the repository at this point in the history
Add back PRN to acquisition results
  • Loading branch information
zsoerenm authored Aug 10, 2022
2 parents bcff86f + c03a337 commit bb9a8d5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
Empty file modified .github/workflows/CompatHelper.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/TagBot.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/register.yml
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Acquisition"
uuid = "d4bbf60b-102b-5ffb-8f97-a7ea5817e69f"
authors = ["Soeren Schoenbrod <[email protected]>"]
version = "0.0.3"
version = "0.0.4"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand All @@ -13,7 +13,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
DocStringExtensions = "0.6, 0.7, 0.8"
DocStringExtensions = "0.6, 0.7, 0.8, 0.9"
FFTW = "1.0"
GNSSSignals = "0.15, 0.16"
Unitful = "0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 1.0"
Expand Down
15 changes: 14 additions & 1 deletion src/Acquisition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Acquisition

struct AcquisitionResults{S<:AbstractGNSS}
system::S
prn::Int
sampling_frequency::typeof(1.0Hz)
carrier_doppler::typeof(1.0Hz)
code_phase::Float64
Expand All @@ -25,16 +26,28 @@ module Acquisition
acq_res.dopplers, y, log_scale ? 10 * log10.(acq_res.power_bins) : acq_res.power_bins
end

"""
$(SIGNATURES)
Perform the aquisition of the satellite `sat_prn` in System `S` in signal `signal`
sampled at rate `sampling_freq`. The aquisition is performed as parallel code phase
search using the doppler frequencies `dopplers`.
"""
function acquire(S::AbstractGNSS, signal, sampling_freq, sat_prn; interm_freq = 0.0Hz, max_doppler = 7000Hz, dopplers = -max_doppler:1 / 3 / (length(signal) / sampling_freq):max_doppler)
code_period = get_code_length(S) / get_code_frequency(S)
powers = power_over_doppler_and_code(S, signal, sat_prn, dopplers, sampling_freq, interm_freq)
signal_power, noise_power, code_index, doppler_index = est_signal_noise_power(powers, sampling_freq, get_code_frequency(S))
CN0 = 10 * log10(signal_power / noise_power / code_period / 1.0Hz)
doppler = (doppler_index - 1) * step(dopplers) + first(dopplers)
code_phase = (code_index - 1) / (sampling_freq / get_code_frequency(S))
AcquisitionResults(S, sampling_freq, doppler, code_phase, CN0, powers, dopplers / 1.0Hz)
AcquisitionResults(S, sat_prn, sampling_freq, doppler, code_phase, CN0, powers, dopplers / 1.0Hz)
end

"""
$(SIGNATURES)
Performs a coarse aquisition and fine acquisition of the satellite `sat_prn` in System `S` in signal `signal`
sampled at rate `sampling_freq`. The aquisition is performed as parallel code phase
search using the doppler frequencies `dopplers`.
"""
function coarse_fine_acquire(S::AbstractGNSS, signal, sampling_freq, sat_prn; interm_freq = 0.0Hz, max_doppler = 7000Hz)
coarse_step = 1 / 3 / (length(signal) / sampling_freq)
acq_res = acquire(S, signal, sampling_freq, sat_prn; interm_freq, dopplers = -max_doppler:coarse_step:max_doppler)
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ end

@test acq_res.code_phase code_phase atol = 1e-3
@test acq_res.CN0 CN0 + 10 * log10(integration_time / 1e-3s) atol = 2
@test acq_res.prn == 1

coarse_fine_acq_res = coarse_fine_acquire(gpsl1, signal, sample_freq, 1)
@test coarse_fine_acq_res.carrier_doppler == 1000Hz

@test coarse_fine_acq_res.code_phase code_phase atol = 1e-3
@test coarse_fine_acq_res.CN0 CN0 + 10 * log10(integration_time / 1e-3s) atol = 2
@test coarse_fine_acq_res.prn == 1

#doppler_step = 2 / 3 / integration_time
#doppler_steps = -7000:doppler_step:7000
Expand Down

2 comments on commit bb9a8d5

@zsoerenm
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/66021

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.0.4 -m "<description of version>" bb9a8d5d74cb86bc965a73f362d821b3ce644cfa
git push origin v0.0.4

Please sign in to comment.