Skip to content

Commit

Permalink
optimized receiving function for plot
Browse files Browse the repository at this point in the history
  • Loading branch information
VBeleca committed Apr 30, 2024
1 parent 5c33e63 commit 47b1399
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/talise/config_talise.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
talise_address = "ip:192.168.2.1"
lo_freq = 1000000000 - 245760#700000000#int(4.1e9)
lo_freq = 1020000000 - 245760#700000000#int(4.1e9)
tx_sine_baseband_freq = 245760# 245760 # 245.760 kHz
amplitude_discrete = 2**14
sample_rate = 245760000 # Hz
Expand Down
Binary file modified examples/talise/gain_cal_val.pkl
Binary file not shown.
Binary file modified examples/talise/phase_cal_val.pkl
Binary file not shown.
31 changes: 17 additions & 14 deletions examples/talise/talise_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,38 +518,41 @@ def do_cal_phase(my_talise):
if func == "plot":
do_plot = True
# Vrify cal coeff
my_talise.load_phase_cal()
my_talise.load_gain_cal()
# my_talise.load_phase_cal()
# my_talise.load_gain_cal()
talise_init(my_talise)
print("ch0-1ch ph: " + str(my_talise.pcal[0]))
print("ch0-2ch ph: " + str(my_talise.pcal[1]))
print("ch0-3ch ph: " + str(my_talise.pcal[2]))
# Performing Beamforming
plt.ion()
print("Starting, use control-c to stop")

half_lambda = 1
quarter_lambda = 2
phase_cal = [0, my_talise.pcal[0], my_talise.pcal[1], my_talise.pcal[2]]
elem_spacing = (3e8/(config.lo_freq + config.tx_sine_baseband_freq))/(2*half_lambda)
print("Element spacing of: " + str(elem_spacing) + " meters")
signal_freq = config.lo_freq #+ config.tx_sine_baseband_freq

try:
while True:
half_lambda = 1
quarter_lambda = 2
powers = [] # main DOA result
angle_of_arrivals = []
phase_cal = [0, my_talise.pcal[0], my_talise.pcal[1], my_talise.pcal[2]]
elem_spacing = (3e8/(config.lo_freq + config.tx_sine_baseband_freq))/(2*half_lambda)
print("Element spacing of: " + str(elem_spacing) + " meters")
signal_freq = config.lo_freq #+ config.tx_sine_baseband_freq

# Receive samples

# TODO: try to call my_talise.rx() function outside of the below for
for phase in np.arange(-180/half_lambda, 180/half_lambda, 2): # sweep over angle
rx_samples = my_talise.rx()
receive_samples = my_talise.rx()

for phase in np.arange(-180/half_lambda, 180/half_lambda, 5): # sweep over angle
rx_samples = list(receive_samples) # use list() to copy content and not the address
# Apply Gain coefficients
arrays_adjusted = adjust_gain(my_talise, rx_samples[0], rx_samples[1], rx_samples[2], rx_samples[3])
rx_samples[0] = arrays_adjusted[0]
rx_samples[1] = arrays_adjusted[1]
rx_samples[2] = arrays_adjusted[2]
rx_samples[3] = arrays_adjusted[3]
# set phase difference between the adjacent channels of devices
for i in range(4):
# /2 because lambda/4 = d
for i in range(my_talise.num_elements):
channel_phase = ((phase * i) + phase_cal[i]) % 360.0 # Analog Devices had this forced to be a multiple of phase_step_size (2.8125 or 360/2**6bits) but it doesn't seem nessesary
# print("cal coefficent for " + str(i) + " channel: " + str(phase_cal[i]))
channel_phase_rad = np.deg2rad(channel_phase)
Expand Down

0 comments on commit 47b1399

Please sign in to comment.