【问题标题】:Why do I get cast error with INET configurator为什么使用 INET 配置器会出现强制转换错误
【发布时间】:2021-09-17 06:48:09
【问题描述】:

初始化我的网络时出现以下错误:

check_and_cast(): 无法将 (inet::Ipv4FlatNetworkConfigurator*)GigabitNetwork.configurator 转换为类型 'inet::Ipv4NetworkConfigurator *' -- 在模块 (inet::Ipv4NodeConfigurator) GigabitNetwork.standardHost[0].ipv4 中。配置器(id=421),在网络初始化期间

我已经尝试解决了一段时间,但没有成功。

这是我的网络:

Network GigabitNetwork
{
    parameters:
        int numHosts;
        @display("bgb=449,342");
    types:
        channel Ether1000m extends DatarateChannel
        {
            datarate = 1000Mbps;
            delay = 0.1s;
        }
submodules:
    CentralSwitch: EtherSwitch {
        @display("p=189,139");
    }
    Switch1: EtherSwitch {
        @display("p=149,198");
    }
    Switch2: EtherSwitch {
        @display("p=271,198");
    }
    Switch3: EtherSwitch {
        @display("p=258,76");
    }
    Switch4: EtherSwitch {
        @display("p=143,94");
    }
    standardHost[numHosts]: StandardHost {
        @display("p=334,38");
    }
    standardHost1[numHosts]: StandardHost {
        @display("p=342,205");
    }
    standardHost2[numHosts]: StandardHost {
        @display("p=57,256");
    }
    standardHost3[numHosts]: StandardHost {
        @display("p=42,38");
    }
    Server: StandardHost {
        @display("p=42,146;i=device/server");
    }
    configurator: Ipv4FlatNetworkConfigurator {
        @display("p=201,293");
    }
connections:
    CentralSwitch.ethg++ <--> Ether1000m <--> Server.ethg++;
    CentralSwitch.ethg++ <--> Ether1000m <--> Switch4.ethg++;
    CentralSwitch.ethg++ <--> Ether1000m <--> Switch3.ethg++;
    CentralSwitch.ethg++ <--> Ether1000m <--> Switch2.ethg++;
    CentralSwitch.ethg++ <--> Ether1000m <--> Switch1.ethg++;
    for i=0..numHosts-1 {
        standardHost1[i].ethg++ <--> Ether1000m <--> Switch2.ethg++;
        standardHost2[i].ethg++ <--> Ether1000m <--> Switch1.ethg++;
        standardHost[i].ethg++ <--> Ether1000m <--> Switch3.ethg++;
        standardHost3[i].ethg++ <--> Ether1000m <--> Switch4.ethg++;
    }
}

还有我的 INI 文件:

[General]
network = GigabitNetwork

sim-time-limit = 120s

**.numHosts = 5

*.*.numApps = 1

**.channel.throughput.statistic-recording = true
**.channel.throughput.result-recording-modes = all
**.*.vector-recording = true 
**.*.vector-recording-intervals= 0..3600

[Config Udp]
*.standardHost[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost[*].app[0].serverAddress = "Server"
*.standardHost[*].app[0].serverPort = 1000
*.standardHost[*].app[0].startTime = uniform(0s, 0.1s)

*.standardHost1[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost1[*].app[0].serverAddress = "Server"
*.standardHost1[*].app[0].serverPort = 1000
*.standardHost1[*].app[0].startTime = uniform(0s, 0.1s)

*.standardHost2[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost2[*].app[0].serverAddress = "Server"
*.standardHost2[*].app[0].serverPort = 1000
*.standardHost2[*].app[0].startTime = uniform(0s, 0.1s)

*.standardHost3[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost3[*].app[0].serverAddress = "Server"
*.standardHost3[*].app[0].serverPort = 1000
*.standardHost3[*].app[0].startTime = uniform(0s, 0.1s)

*.Server.app[0].typename = "UdpVideoStreamServer"
*.Server.app[0].localPort = 1000
*.Server.app[0].sendInterval = 0.001s
*.Server.app[0].packetLen =1400B
*.Server.app[0].videoSize = 1Gb

【问题讨论】:

    标签: casting omnet++ inet


    【解决方案1】:

    在您的 NED 中尝试更改线路
    configurator: Ipv4FlatNetworkConfigurator {

    转入:
    configurator: Ipv4NetworkConfigurator {

    【讨论】:

    • 请不要使用修复程序编辑原始问题,因为在这种情况下问题变得毫无意义。如果答案解决了您的问题,请在不更改原始问题的情况下表明答案已被接受。
    猜你喜欢
    • 2022-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    相关资源
    最近更新 更多