【发布时间】:2020-08-30 16:08:07
【问题描述】:
我有一个由 5 个节点组成的网络,以及来自 INET 框架的从 node1 到 node2 的 TCP 流量(使用 TCPBasicClientApp 和 TCPGenericSrvApp)。
我希望有一个单独的节点作为 node1 和 node2 之间延迟的监视器。如何从不同节点获取值来计算延迟? 我用过
simtime_t delay = simTime() - msg->getCreationTime();
EV << "Message delay: " <<delay<<endl;
在TCPBasicClientApp 的socketDataArrived 中计算延迟,但无法从监控节点访问值。
网络的 NED 是:
package myNetwork;
import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
import inet.node.inet.StandardHost;
import inet.node.ethernet.EtherSwitch;
import inet.node.ethernet.Eth10M;
network myNetwork
{
parameters:
@display("bgb=970,411");
submodules:
monitor: DelMonitor {
@display("p=98.6175,348.20502");
}
configurator: IPv4NetworkConfigurator {
@display("p=15,150");
}
node1: StandardHost {
@display("p=33,286");
}
node2: StandardHost {
@display("p=181,293");
}
node3: StandardHost {
@display("p=296,301");
}
node4: StandardHost {
@display("p=449,301");
}
node5: StandardHost {
@display("p=673.2775,277.59");
}
switch1: EtherSwitch {
@display("p=119.315,119.315");
}
switch2: EtherSwitch {
@display("p=239.8475,119.315");
}
switch3: EtherSwitch {
@display("p=393.2525,119.315");
}
switch4: EtherSwitch {
@display("p=551.5275,119.315");
}
switch5: EtherSwitch {
@display("p=720.76,119.315");
}
connections:
switch1.ethg++ <--> Eth10M <--> node1.ethg++;
switch2.ethg++ <--> Eth10M <--> node2.ethg++;
switch3.ethg++ <--> Eth10M <--> node3.ethg++;
switch4.ethg++ <--> Eth10M <--> node4.ethg++;
switch5.ethg++ <--> Eth10M <--> node5.ethg++;
switch1.ethg++ <--> Eth10M <--> switch2.ethg++;
switch2.ethg++ <--> Eth10M <--> switch3.ethg++;
switch3.ethg++ <--> Eth10M <--> switch4.ethg++;
switch4.ethg++ <--> Eth10M <--> switch5.ethg++;
monitor.gate <--> Eth10M <--> node1.ethg++;
}
【问题讨论】:
-
监控节点如何接入网络?
-
它作为'monitor.gate Eth10M node1.ethg++;'连接到node1 node1 是标准主机,监视器是带有输入门的简单模块。
-
您能否将整个网络的 NED 添加到您的问题中?
-
是否应该监控节点只计算和注册节点1和节点2之间的延迟?还是模拟一个真实的节点,比如node1、node2、node3、...?
-
它应该只计算延迟并基于延迟值(例如,如果它超过某个阈值)它将显示一条消息,如“最大延迟”。
标签: simulation omnet++ inet