如何使用MATLAB中的“preamble”和“basebandRx”在unetstack中传输基带信号?

问题描述 投票:0回答:1

我参考了这篇博文,“Using MATLAB with UnetStack3”([https://blog.unetstack.net/using-matlab-with-unetstack3][1]),并在传输部分添加了序言:

% load the baseband signal
% signal.txt contains interleaved real and imaginary values in a single column
% with values normalized between +1 and ‐1
x = load('signal.txt');

% open the modem gateway
modem = org.arl.fjage.remote.Gateway('192.168.0.42', 1100);

% subscribe to the agent providing baseband service
bb = modem.agentForService(org.arl.unet.Services.BASEBAND);

% create the message with relevant attributes to be sent to the modem
msg = org.arl.unet.bb.TxBasebandSignalReq();
msg.setPreamble(3); % add preamble
msg.setSignal(x);
msg.setRecipient(bb);

% send the message to modem
rsp = modem.request(msg, 1000);

% check if the message was successfully sent
if isjava(rsp) && rsp.getPerformative() == org.arl.fjage.Performative.AGREE
    cls = org.arl.unet.phy.TxFrameNtf().getClass();
    % receive the notification message
    ntf = modem.receive(cls, 5000);
end

看起来效果不错,但是如何修改接收端代码:

% subscribe to the agent providing the baseband service
agent = modem.agentForService(org.arl.unet.Services.BASEBAND);
modem.subscribe(agent);

% create the message with relevant attributes to be sent to the modem
req = org.arl.unet.bb.RecordBasebandSignalReq();
req.setRecipient(agent);

% send the message to the modem and wait for the response
rsp = modem.request(req, 5000);

% check if the message was successfully sent
if isjava(rsp) && rsp.getPerformative() == org.arl.fjage.Performative.AGREE
    % receive the notification message containing the signal
    cls = org.arl.unet.bb.RxBasebandSignalNtf().getClass();
    ntf = modem.receive(cls, 5000);
end

% plot the recorded signal
plot(ntf.getSignal())

为了开启basebandRx能力,检测前导码,捕获指定长度的信号? [1]:https://blog.unetstack.net/using-matlab-with-unetstack3

unetstack
1个回答
0
投票

如果您附加前导码并且在接收调制解调器上配置了相同的前导码(示例中的参数

phy[3].preamble
phy[3].threshold
phy[3].basebandRx
phy[3].basebandExtra
),则每当调制解调器检测到带有该序言的信号。要接收通知,您可以将代码示例中的
RxBasebandSignalNtf
替换为
request()
,然后查找返回的消息是否为
receive()
您可以预先设置调制解调器上的参数,或者使用 MATLAB 通过 

RxBasebandSignalNtf

设置调制解调器上的参数。

这一切都记录在

Unet 手册第 16.4 节中

以及代码示例。

© www.soinside.com 2019 - 2024. All rights reserved.