networking - 一次模拟中的多个网络(如何配置 ini)
问题描述
我有两个网络。例如,我使用教程Tictok1
和Tictok2
在一个.ned
文件中。如何在一个模拟中运行它?最近两天我尝试在谷歌中找到解决方案。
我尝试过这样的配置:
[General]
network = Tictoc1,Tictoc2
或者
[General]
network = Tictoc1;Tictoc2
tictoc1.ned 文件:
simple Txc1
{
gates:
input in;
output out;
}
simple Txc2
{
parameters:
@display("i=block/routing"); // add a default icon
gates:
input in;
output out;
}
network Tictoc1
{
submodules:
tic: Txc1;
toc: Txc1;
connections:
tic.out --> { delay = 100ms; } --> toc.in;
tic.in <-- { delay = 100ms; } <-- toc.out;
}
network Tictoc2
{
submodules:
tic: Txc2 {
parameters:
@display("i=,cyan"); // do not change the icon (first arg of i=) just colorize it
}
toc: Txc2 {
parameters:
@display("i=,gold"); // here too
}
connections:
tic.out --> { delay = 100ms; } --> toc.in;
tic.in <-- { delay = 100ms; } <-- toc.out;
}
我想现在有可能做到这一点以及如何做到这一点。我当然可以:
[General]
[Config Tictoc1]
network = Tictoc1
[Config Tictoc2]
network = Tictoc2
但这将开始单独的模拟。我需要这个二合一。
解决方案
在 OMNeT++ 中,无法同时使用多个网络。
但是,您可以将每个网络视为一个复合模块来实现您的目标。在tictoc1.ned
刚刚的变化中:
network Tictoc1
进入module Tictoc1
network Tictoc2
进入module Tictoc2
并在末尾添加tictoc1.ned
:
network TicTocNet {
submodules:
network1: Tictoc1;
network2: Tictoc2;
}
套装中omnetpp.ini
:
[General]
[Config TicTocNet]
network = TicTocNet
推荐阅读
- selenium - 如何使用 Selenium 单击扩展按钮
- c# - Microsoft graph:无效的批处理负载格式
- xml - 如果另一个子元素重复,XSLT 如何附加一个子元素
- .net - Angular 8 Interface + .Net Core Web API 项目的最佳实践是什么?
- c++ - 如何在软件代码中使用 ofstream 创建文件
- python - VK-Api 键盘无论我做什么 Python 都不起作用
- node.js - Angular 和 Node js Twitter 登录
- python-3.x - 使用 nlargest 找到比赛的获胜者
- python - 从模块访问全局变量?
- jenkins - 找不到任何解决方案来更改詹金斯管道中键的值