Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Simulating Packet Transmit Receive Between WSN Nodes in Matlab

Status
Not open for further replies.

ImperialDragon

Newbie level 2
Joined
May 20, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
13
Hello EDABoard,

I am seeking help creating Packet Transmit / Receive between nodes in a wireless sensor network in Matlab.
There is no specific code to implement. Only basic simulation.
I have grabbed this code of the internet to create the nodes.

Code:
clear;
noOfNodes = 50;
rand('state', 0);
figure(1);
clf;
hold on;
L = 1000;
R = 200; % maximum range;
netXloc = rand(1,noOfNodes)*L;
netYloc = rand(1,noOfNodes)*L;
for i = 1:noOfNodes
plot(netXloc(i), netYloc(i), '.');
text(netXloc(i), netYloc(i), num2str(i));
for j = 1:noOfNodes
distance = sqrt((netXloc(i) - netXloc(j))^2 + (netYloc(i) - netYloc(j))^2);
if distance <= R
matrix(i, j) = 1; % there is a link;
line([netXloc(i) netXloc(j)], [netYloc(i) netYloc(j)], 'LineStyle', ':');
else
matrix(i, j) = inf;
end
end
end

I found this part that claims to solve my issue, but I cannot understand anything with it? How it should be combined? The commands seems to be specific to a Matlab Toolbox???!

Code:
   %data with headers
   packet_to_transmit = packets(source_node).outputQ(1);
   packets(source_node).outputQ(1) = [];
   %bits to transmit
   clean_packet_as_signal = convert_packet_to_signal(packet_to_transmit);
   %transmission might have dirtied the bits
   noisy_packet_as_signal = add_channel_noise(clean_packet_as_signal);
   %on receiver
   received_noisy_packet_as_signal = noisy_packet_as_signal;
   cleaner_packet_as_signal = clean_noisy_packet(received_noisy_packet_as_signal);
   received_packet_unchecked = convert_signal_to_data(cleaner_packet_as_signal);
   if ~is_valid_packet_for_us(destination_node, received_packet_unchecked)
     return;     %that is, drop the packet
   end
   received_packet_checked = received_packet_unchecked;
   packets(destination_node).inputQ(end+1) = received_packet_checked;

Now I need help to continue with what I want to simualte. I have no problem with tutorials or videos that could help with my issue.

Thank you

- - - Updated - - -

Correction: No specific Protocol to Implement
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top