sdr2.rx_rf_bandwidth = 4000000 sdr2.rx_lo = 1998000000 sdr1.tx_lo = 2000000000 sdr1.tx_cyclic_buffer = True sdr1.tx_hardwaregain_chan0 = -30 sdr1.gain_control_mode_chan0 = "slow_attack"各个参数意义的详细介绍,这是ADALM-PLUTO设备的python程序

时间: 2023-10-16 17:09:51 浏览: 55
这些参数是ADALM-PLUTO无线电设备的Python程序中的设置,具体含义如下: - `sdr2.rx_rf_bandwidth = 4000000`: 接收端带宽为4MHz,即接收信号时所能接受的最大频率范围。 - `sdr2.rx_lo = 1998000000`: 接收端本振频率为1.998GHz,即接收时所需要的本振频率。 - `sdr1.tx_lo = 2000000000`: 发送端本振频率为2.0GHz,即发送时所需要的本振频率。 - `sdr1.tx_cyclic_buffer = True`: 发送数据时采用循环缓冲区方式,即发送数据的缓冲区会不断循环使用。 - `sdr1.tx_hardwaregain_chan0 = -30`: 发送端通道0硬件增益为-30dB,即发送时所需要的硬件增益。 - `sdr1.gain_control_mode_chan0 = "slow_attack"`: 发送端通道0增益控制模式为慢攻击,即增益变化较慢,适用于信号变化较缓慢的情况。 这些参数的设置可以根据具体的应用场景进行调整,以达到最佳的性能和效果。
相关问题

详细解释以下Python代码:import numpy as np import adi import matplotlib.pyplot as plt sample_rate = 1e6 # Hz center_freq = 915e6 # Hz num_samps = 100000 # number of samples per call to rx() sdr = adi.Pluto("ip:192.168.2.1") sdr.sample_rate = int(sample_rate) # Config Tx sdr.tx_rf_bandwidth = int(sample_rate) # filter cutoff, just set it to the same as sample rate sdr.tx_lo = int(center_freq) sdr.tx_hardwaregain_chan0 = -50 # Increase to increase tx power, valid range is -90 to 0 dB # Config Rx sdr.rx_lo = int(center_freq) sdr.rx_rf_bandwidth = int(sample_rate) sdr.rx_buffer_size = num_samps sdr.gain_control_mode_chan0 = 'manual' sdr.rx_hardwaregain_chan0 = 0.0 # dB, increase to increase the receive gain, but be careful not to saturate the ADC # Create transmit waveform (QPSK, 16 samples per symbol) num_symbols = 1000 x_int = np.random.randint(0, 4, num_symbols) # 0 to 3 x_degrees = x_int*360/4.0 + 45 # 45, 135, 225, 315 degrees x_radians = x_degrees*np.pi/180.0 # sin() and cos() takes in radians x_symbols = np.cos(x_radians) + 1j*np.sin(x_radians) # this produces our QPSK complex symbols samples = np.repeat(x_symbols, 16) # 16 samples per symbol (rectangular pulses) samples *= 2**14 # The PlutoSDR expects samples to be between -2^14 and +2^14, not -1 and +1 like some SDRs # Start the transmitter sdr.tx_cyclic_buffer = True # Enable cyclic buffers sdr.tx(samples) # start transmitting # Clear buffer just to be safe for i in range (0, 10): raw_data = sdr.rx() # Receive samples rx_samples = sdr.rx() print(rx_samples) # Stop transmitting sdr.tx_destroy_buffer() # Calculate power spectral density (frequency domain version of signal) psd = np.abs(np.fft.fftshift(np.fft.fft(rx_samples)))**2 psd_dB = 10*np.log10(psd) f = np.linspace(sample_rate/-2, sample_rate/2, len(psd)) # Plot time domain plt.figure(0) plt.plot(np.real(rx_samples[::100])) plt.plot(np.imag(rx_samples[::100])) plt.xlabel("Time") # Plot freq domain plt.figure(1) plt.plot(f/1e6, psd_dB) plt.xlabel("Frequency [MHz]") plt.ylabel("PSD") plt.show(),并分析该代码中QPSK信号的功率谱密度图的特点

这段Python代码的作用是使用ADI Pluto SDR设备生成并传输一个QPSK信号,并将接收到的信号进行功率谱密度分析。下面是对代码的注释: ``` import numpy as np import adi import matplotlib.pyplot as plt # 设置采样率、中心频率和采样点数 sample_rate = 1e6 # Hz center_freq = 915e6 # Hz num_samps = 100000 # number of samples per call to rx() # 连接ADI Pluto SDR设备 sdr = adi.Pluto("ip:192.168.2.1") sdr.sample_rate = int(sample_rate) # 配置发送端的参数 sdr.tx_rf_bandwidth = int(sample_rate) # filter cutoff, just set it to the same as sample rate sdr.tx_lo = int(center_freq) sdr.tx_hardwaregain_chan0 = -50 # Increase to increase tx power, valid range is -90 to 0 dB # 配置接收端的参数 sdr.rx_lo = int(center_freq) sdr.rx_rf_bandwidth = int(sample_rate) sdr.rx_buffer_size = num_samps sdr.gain_control_mode_chan0 = 'manual' sdr.rx_hardwaregain_chan0 = 0.0 # dB, increase to increase the receive gain, but be careful not to saturate the ADC # 创建发送的QPSK信号 num_symbols = 1000 x_int = np.random.randint(0, 4, num_symbols) # 0 to 3 x_degrees = x_int*360/4.0 + 45 # 45, 135, 225, 315 degrees x_radians = x_degrees*np.pi/180.0 # sin() and cos() takes in radians x_symbols = np.cos(x_radians) + 1j*np.sin(x_radians) # this produces our QPSK complex symbols samples = np.repeat(x_symbols, 16) # 16 samples per symbol (rectangular pulses) samples *= 2**14 # The PlutoSDR expects samples to be between -2^14 and +2^14, not -1 and +1 like some SDRs # 启动发送端并发送信号 sdr.tx_cyclic_buffer = True # Enable cyclic buffers sdr.tx(samples) # start transmitting # 接收接收端的信号 for i in range (0, 10): raw_data = sdr.rx() # Receive samples rx_samples = sdr.rx() print(rx_samples) # 停止发送端 sdr.tx_destroy_buffer() # 计算接收到的信号的功率谱密度 psd = np.abs(np.fft.fftshift(np.fft.fft(rx_samples)))**2 psd_dB = 10*np.log10(psd) f = np.linspace(sample_rate/-2, sample_rate/2, len(psd)) # 绘制时域图 plt.figure(0) plt.plot(np.real(rx_samples[::100])) plt.plot(np.imag(rx_samples[::100])) plt.xlabel("Time") # 绘制频域图 plt.figure(1) plt.plot(f/1e6, psd_dB) plt.xlabel("Frequency [MHz]") plt.ylabel("PSD") plt.show() ``` 以上代码生成了一个随机QPSK信号,通过ADI Pluto SDR设备将其传输,并使用Pluto SDR设备接收该信号。接收到的信号进行了功率谱密度分析,并绘制了频域图。 QPSK信号的功率谱密度图的特点是,其频谱表现为四个簇,每个簇对应QPSK信号的一个符号。每个簇的带宽约为基带信号的带宽,且由于使用矩形脉冲,每个簇的带宽之间有一定的重叠。此外,功率谱密度图中还可以看到一些其他频率分量,这些分量可能是由于接收信号中存在其他干扰或噪声导致的。

在下面代码中加入接收端的收到的复信号的时域图,再加一个隔直流的代码,用python import time import adi import matplotlib.pyplot as plt import numpy as np from scipy import signal # Create radio sdr = adi.Pluto() # Configure properties sdr.rx_rf_bandwidth = 4000000 sdr.rx_lo = 1900000000 sdr.tx_lo = 2000000000 sdr.tx_cyclic_buffer = True sdr.tx_hardwaregain_chan0 = -30 sdr.gain_control_mode_chan0 = "slow_attack" # Read properties print("RX LO %s" % (sdr.rx_lo)) print(sdr.sample_rate) # Create a sinewave waveform fs = int(sdr.sample_rate) N = 1024 fc = int(3000000 / (fs / N)) * (fs / N) ts = 1 / float(fs) t = np.arange(0, N * ts, ts) i = np.cos(2 * np.pi * t * fc) * 2 ** 14 q = np.sin(2 * np.pi * t * fc) * 2 ** 14 i=i+2**15 q=q+2**15 iq = i + 1j * q # Send data sdr.tx(iq) # Collect data for r in range(20): x = sdr.rx() print(x) y=abs(x) print(y) print('------------------------') plt.figure(0) plt.plot(y) f, Pxx_den = signal.periodogram(x, fs) #plt.clf() # plt.figure(1) plt.semilogy(f, Pxx_den) plt.ylim([1e-7, 1e4]) plt.xlabel("frequency [Hz]") plt.ylabel("PSD [V**2/Hz]") plt.draw() plt.pause(0.05) time.sleep(0.1) plt.show()

以下是加入接收端的收到的复信号的时域图和隔直流的代码的修改后的完整代码: ```python import time import adi import matplotlib.pyplot as plt import numpy as np from scipy import signal # Create radio sdr = adi.Pluto() # Configure properties sdr.rx_rf_bandwidth = 4000000 sdr.rx_lo = 1900000000 sdr.tx_lo = 2000000000 sdr.tx_cyclic_buffer = True sdr.tx_hardwaregain_chan0 = -30 sdr.gain_control_mode_chan0 = "slow_attack" # Read properties print("RX LO %s" % (sdr.rx_lo)) print(sdr.sample_rate) # Create a sinewave waveform fs = int(sdr.sample_rate) N = 1024 fc = int(3000000 / (fs / N)) * (fs / N) ts = 1 / float(fs) t = np.arange(0, N * ts, ts) i = np.cos(2 * np.pi * t * fc) * 2 ** 14 q = np.sin(2 * np.pi * t * fc) * 2 ** 14 i = i + 2 ** 15 q = q + 2 ** 15 iq = i + 1j * q # Send data sdr.tx(iq) # Collect data for r in range(20): x = sdr.rx() print(x) y = abs(x) y_dc = y - np.mean(y) # remove DC component print(y_dc) print('------------------------') plt.figure(0) plt.subplot(211) plt.plot(y_dc) plt.xlabel("Time [samples]") plt.ylabel("Amplitude") plt.subplot(212) f, Pxx_den = signal.periodogram(x, fs) plt.semilogy(f, Pxx_den) plt.ylim([1e-7, 1e4]) plt.xlabel("Frequency [Hz]") plt.ylabel("PSD [V**2/Hz]") plt.draw() plt.pause(0.05) time.sleep(0.1) plt.show() ``` 在这个代码中,我们加入了一个隔直流的代码,用于移除接收到的信号的DC分量。这个代码为: ```python y_dc = y - np.mean(y) # remove DC component ``` 我们在时域图上画出了处理后的信号,并在频域图上画出了信号的功率谱密度(PSD)。 注意:这个代码只能在连接了PlutoSDR设备并安装了必要的包后才能运行。

相关推荐

最新推荐

recommend-type

GNSS-SDR_manual.pdf(v0.0.13)

开源软件GNSS接收机,GNSS-SDR,2020年7月最新版本的对应手册。该软件基于GNURadio可运行于个人PC,通过USB或网线连接不同类型的RF前端进行接收。其设计允许任何类型的定制,包括信号源的可互换性,信号处理算法,与...
recommend-type

基于混合信号RF芯片AD9361的宽带SDR设计

在军用和航空航天领域,不同且不兼容无线电的大量涌现构成了一个严重问题,因为在这些领域,工作小组可能需要不同的装置,以用于机载链路、卫星通信、中继基站、紧急发射器以及特定应用目的(如无人机操作)。
recommend-type

孔雀石DSP中文说明书-未完.docx

1.一般资料3 2自组装建议。 5 3接收器的外观。控制和结构要素6 4打开和关闭接收器。 9 5个用户界面。 10 5.1主屏幕指示灯10 5.2常规菜单12 5.3 HARD菜单13 5.4时钟菜单17 5.5 LCD菜单18 5.6音频20菜单 6基本功能及其...
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

解释minorization-maximization (MM) algorithm,并给出matlab代码编写的例子

Minorization-maximization (MM) algorithm是一种常用的优化算法,用于求解非凸问题或含有约束的优化问题。该算法的基本思想是通过构造一个凸下界函数来逼近原问题,然后通过求解凸下界函数的最优解来逼近原问题的最优解。具体步骤如下: 1. 初始化参数 $\theta_0$,设 $k=0$; 2. 构造一个凸下界函数 $Q(\theta|\theta_k)$,使其满足 $Q(\theta_k|\theta_k)=f(\theta_k)$; 3. 求解 $Q(\theta|\theta_k)$ 的最优值 $\theta_{k+1}=\arg\min_\theta Q(
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

实现实时监控告警系统:Kafka与Grafana整合

![实现实时监控告警系统:Kafka与Grafana整合](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6X2pwZy9BVldpY3ladXVDbEZpY1pLWmw2bUVaWXFUcEdLT1VDdkxRSmQxZXB5R1lxaWNlUjA2c0hFek5Qc3FyRktudFF1VDMxQVl3QTRXV2lhSWFRMEFRc0I1cW1ZOGcvNjQw?x-oss-process=image/format,png) # 1.1 Kafka集群架构 Kafka集群由多个称为代理的服务器组成,这