end to end delay or latency

8 次查看(过去 30 天)
rem ng
rem ng 2019-5-21
can anyone help me what matlab code has to be used to find out end to end delay packet transmission or latency from source node to destination node? or related matlab code?

回答(3 个)

Vol kan
Vol kan 2019-8-31
Dear Rem,
Have you solved your problem?
If yes, could you please kindly share your codes in here?
Best
  2 个评论
meh mehz
meh mehz 2020-8-13
Hey if you solve it can you share the answer @rem ng

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2019-8-31
In order to calculate the end-to-end time, you need a pair of timestamps -- the time that the packet is queued for transmission, and the time that the packet is dequeued and becomes ready for consumption.
If somehow you had a single datascope hooked up to the source and recipient nodes, you could potentially measure the times for physical nodes. However, that situation does not typically occur. At best you might have a scope attached to the source physical node and a different scope attached to the destination physical node, and then to accurately measure latency, you are at the mercy of the accuracy of the synchronization of times between the two scopes -- which turns out to be amazingly hard to synchronize accurately. It is a "Keeps physicists up at night worrying that humans have made serious mistakes in understanding fundamental reality" hard problem.
As you are talking about MATLAB code, then you are probably taking about simulated networks. In that case, just attach some metadata to each simulated packet giving the simulated time that the packet was simulated transmitted, and when the packet is simulated received, inject the simulated reception time. And then subtract.
  4 个评论
Kok Siong Yap
Kok Siong Yap 2021-6-20
Hi Walter,
Do you have a simple matlab code regarding attachment of metadata as you mention?
As you are talking about MATLAB code, then you are probably taking about simulated networks. In that case, just attach some metadata to each simulated packet giving the simulated time that the packet was simulated transmitted, and when the packet is simulated received, inject the simulated reception time. And then subtract.
Walter Roberson
Walter Roberson 2021-6-21
%transmitting side
[packet_to_transmit, NODEINFO(SOURCE)] = build_packet(NODEINFO(SOURCE), DEST, Protocol, SourcePort, DestPort, payload);
outidx = numel(NODES(SOURCE).OutQueue)+1;
NODES(SOURCE).OutQueue(outidx).packet = packet_to_transmit;
NODES(SOURCE).OutQueue(outidx).xmit_time = SIMULATION_TIME;
%when packet reaches the head of the virtual send queue for the node
PACKET_INFO = NODES(SOURCE).OutQueue(outidx);
PACKET_INFO.source = SOURCE;
PACKET_INFO.outidx = outidx;
%transmission is noisy
PACKET_INFO = CorruptPacket(PACKET_INFO);
%receiving side
inidx = numel(NODES(DEST).InQueue) + 1;
NODES(DEST).InQueue(inidx).packet = PACKET_INFO.packet;
NODES(DEST).InQueue(inidx).xmit_time = PACKET_INFO.xmit_time;
NODES(DEST).InQueue(inidx).receive_time = SIMULATION_TIME;
NODES(PACKET_INFO.source).OutQueue(PACKET_INFO.outidx) = []; %it moved from output queue to input queue
Here, variables in all capitals represent values that live in the simulation software, that represent global knowledge of everything that is happening.
NODES in the above excerpt is only used to hold the packets.
NODEINFO in the above is intended to represent each nodes' knowledge about its neighbours, and to include information such as TCP sequence numbers. It is output as well as input from the build_packet process because starting a new conversation can involve allocating resources, and continuing a conversation can involve changing state.
Ideally, the information in NODES should be confined to only the information needed because the simulation software is "god" to the simulation, and anything being simulated as the nodes knowing should be elsewhere. Indeed, where I show the queues as being part of NODES, they should instead be part of NODEINFO ("per-node info"), but NODES might be used to keep global statistists. For example the above sequence on the receiver side should continue with validating the packet and increasing any global received-payload total for the node... with it being valid to instead keep the received-payload-total per-node and and have the simulation controller fish through the per-node information to get the values.

请先登录,再进行评论。


Zahid Ullah Khan
Zahid Ullah Khan 2022-2-14
someone help me to do matlab code of end-to-end delay in underwater wireless communication networks my email is engr.zahidkhan09@gmail.com
  1 个评论
Walter Roberson
Walter Roberson 2022-2-14
"help me" can mean many different things. Are you looking for someone you can give your ideas to, and the person tells you whether they sound reasonable? Are you looking for someone to research papers on the topic for you and give you the references? Are you looking for someone who can look over the code you have so-far and help you debug the code you have so far? Are you looking for a tutor? Are you looking for someone to write the code for you with the intention that you would hand in the code as-if you had written it yourself? Are you looking for someone to give you an example implementation that you would study for ideas and then write your own version?

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by