一个模拟中的多个网络(如何配置ini)

Multiple networks in one simulation (how configure ini)

我有两个网络。例如,我在一个 .ned 文件中使用教程 Tictok1Tictok2。我如何在一次模拟中 运行 它?我在过去两天尝试在 google 中找到解决方案。

我试过这样的配置:

[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