Skip to content
Extraits de code Groupes Projets
Valider f0ed51ae rédigé par Félix Willaumez's avatar Félix Willaumez
Parcourir les fichiers

clean chaine telecom

parent b75c1389
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 75 ajouts et 14848 suppressions
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
Ce diff est replié.
...@@ -72,7 +72,7 @@ blocks: ...@@ -72,7 +72,7 @@ blocks:
id: variable id: variable
parameters: parameters:
comment: '' comment: ''
value: '0.1' value: '0.001'
states: states:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
import numpy as np import numpy as np
from gnuradio import gr from gnuradio import gr
from .utils import timeit
@timeit
def demodulate(y, B, R, Fdev): def demodulate(y, B, R, Fdev):
""" """
Non-coherent demodulator. Non-coherent demodulator.
......
...@@ -22,8 +22,9 @@ import numpy as np ...@@ -22,8 +22,9 @@ import numpy as np
from scipy import signal as signal from scipy import signal as signal
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from gnuradio import gr from gnuradio import gr
from .utils import timeit
@timeit
def cfo_estimation(y, B, R, Fdev): def cfo_estimation(y, B, R, Fdev):
""" """
Estimates CFO using Moose algorithm, on first samples of preamble. Estimates CFO using Moose algorithm, on first samples of preamble.
...@@ -64,28 +65,26 @@ def old_sto_estimation(y, B, R, Fdev): ...@@ -64,28 +65,26 @@ def old_sto_estimation(y, B, R, Fdev):
return np.mod(save_i + 1, R) return np.mod(save_i + 1, R)
@timeit
def sto_estimation(y,B,R,Fdev): def sto_estimation(y,B,R,Fdev):
""" """
New method New method
""" """
phase_function = np.unwrap(np.angle(y)) phase_function = np.unwrap(np.angle(y))
filtered_phase = np.convolve(phase_function,signal.triang(3),mode="same" ) #filtered_phase = np.convolve(phase_function,signal.triang(3),mode="same" )
phase_derivative_1_filtered = filtered_phase[2:] - filtered_phase[:-2] #calcul de la dérivée première au 1er ordre (méthode centrée -> pas valide pour premier et dernier sample) phase_derivative_1_filtered = phase_function[2:] - phase_function[:-2] #calcul de la dérivée première au 1er ordre (méthode centrée -> pas valide pour premier et dernier sample)
sum_der_saved = np.inf
save_i = 0 sum_array = np.zeros(R)
for i in range(0, R): for i in range(0, R):
sum_der = np.sum(np.abs(phase_derivative_1_filtered[i::R])) # Sum every R samples. We take abs b.c. maxima don't exactly have nul derivative sum_der = np.sum(np.abs(phase_derivative_1_filtered[i::R])) # Sum every R samples. We take abs b.c. maxima don't exactly have nul derivative
if sum_der < sum_der_saved: sum_array[i] = sum_der
sum_der_saved = sum_der new_estimate = np.mod(np.argmin(sum_array) + 1 , R)
save_i = i
new_estimate = np.mod(save_i + 1 , R)
old_estimate = old_sto_estimation(y,B,R,Fdev) #to disable to gain in performance. Used only to compare to the old sto comuptation
#old_estimate = old_sto_estimation(y,B,R,Fdev) #to disable to gain in performance. Used only to compare to the old sto comuptation
#plt.subplot(2,1,1) #plt.subplot(2,1,1)
#plt.stem(phase_function) #plt.stem(phase_function)
...@@ -96,7 +95,7 @@ def sto_estimation(y,B,R,Fdev): ...@@ -96,7 +95,7 @@ def sto_estimation(y,B,R,Fdev):
#plt.stem(filtered_phase[1:]) #plt.stem(filtered_phase[1:])
#plt.title(f"filtered phase new estimate = {new_estimate}, old estimate = {old_estimate}") #plt.title(f"filtered phase new estimate = {new_estimate}, old estimate = {old_estimate}")
#plt.show() #plt.show()
print(f"new sto estimate = {new_estimate}, old sto estimate = {old_estimate}") #print(f"new sto estimate = {new_estimate}") #, old sto estimate = {old_estimate}
return new_estimate return new_estimate
......
Ce diff est replié.
Ce diff est replié.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter