Implement communication between the nodes for data transmission

24 views (last 30 days)
Hello all,
I need help to implement or establish the communication link of the node with its neighbours. Although I have created the link in the network based on distance (i.e. R=50m). But there is no communication taking place in the network (wireless connection between the nodes for data transmission).
Can anyone please help with the coding to establish wireless connection for data transmission?
I've attached the code of mine below.
%Code to create node manually.
BeconX=400;
BeconY=400;
%axis on;
%gcf;
hold on;
hbecon=plot(BeconX,BeconY,'s');
set(hbecon,'color','red','LineWidth',19);
%Basic part of code is to randomly place the sensor nodes in the given
%space then connecting each two nodes if the distance between them less than or equal to the communication radius.
% clear;
noOfNodes = 100;
%rand('state', 6);
figure(1);
clf;
hold on;
L = 400;
R = 50; % 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; %#ok % there is a link;
line([netXloc(i) netXloc(j)], [netYloc(i) netYloc(j)], 'LineStyle', '-');
nbr(i,j) = 1; %neighbour link;
% disp(nbr(i,j));
else
matrix(i, j) = inf;
end
end
end

Answers (1)

Walter Roberson
Walter Roberson on 6 Mar 2020
Okay, so it is wireless. But I do not see anywhere in your code where you create a connection to a device that does one of:
  • ZigBee
  • Bluetooth
  • Bluetooth Low Energy
  • audio (sound is wireless!)
  • ultrasonic
  • infrasound
  • standard radio
  • WiFi
  • software defined radio (USRP)
  • infrared transmission
  • visible light communication
  • manipulation of entangled particles
  • MASER
  • pulsed X-Ray
  • gamma-ray modulation
  • Z-Ray
  • Gambler's Intuition
Without a connection to a hardware device, you cannot send anything.
  3 Comments
Walter Roberson
Walter Roberson on 6 Mar 2020
In order to simulate transmitting data between things that you have drawn as a plot, you will need to manipulate the UserData property of the graphics object representing the nodes. Or alternatively but more obscurely, you can setappdata() for any graphics object, not just figure objects.
However, I do not recommend either of these approaches. I recommend that you create data structures representing the nodes and that you simulate moving data between the structures.
https://www.mathworks.com/matlabcentral/answers/472096-broadcasting-a-packet-in-wireless-sensor-networks
https://www.mathworks.com/matlabcentral/answers/37726-wireless-sensor-networks
Aditya Pathak
Aditya Pathak on 26 Mar 2020
Hello Sir,
I went through the links you provided, actually now I'm facing problem regarding event detection model. I want to implement the following equations in the code.
I want implement random occurence of event throughout the target area.
An event in the target field is described by its influence region :
And a binary detection model is used to detect that event in the sensor network. Every sensor node within detects .
awf

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!