简体   繁体   中英

getTransmissionChannel() is crashing omnet++ simulation

I have this getTransmissionChannel() defined in my simple module. For the following simulation connections it worked perfectly:

    CustomedNode1.Netport <--> LinkDefinedChannel <--> mySwitch.connectedToPort1;
    CustomedNode2.Netport <--> LinkDefinedChannel <--> mySwitch.connectedToPort2;
    CustomedNode3.Netport <--> LinkDefinedChannel <--> mySwitch.connectedToPort3;
    CustomedNode4.Netport <--> LinkDefinedChannel <--> mySwitch.connectedToPort4;
    CustomedNode5.Netport <--> LinkDefinedChannel <--> mySwitch.connectedToPort5;

Then I replaced node5 with another type of node but using the same port and the new connections generated are:

    CustomedNode1.Netport <--> LinkDefinedChannel <--> ibSwitch.connectedToPort1;
    CustomedNode2.Netport <--> LinkDefinedChannel <--> ibSwitch.connectedToPort2;
    CustomedNode3.Netport <--> LinkDefinedChannel <--> ibSwitch.connectedToPort3;
    CustomedNode4.Netport <--> LinkDefinedChannel <--> ibSwitch.connectedToPort4;
    mySwitch.connectedToPort5 <--> gatewayNode.Netport ;

Now the simulation crashes saying getTransmissionChannel() no transmission channel found.

I don't know what happened suddenly. I have just replaced with a new node with same type of net port.

getTransmissionChannel() returns the transmission. If you don't specify any channels in your links the OMNet++ tranparently replaces with cIdealChannel which basically means no channel object has been assigned to the connection.

And in your case after the node replacement the new connection mySwitch.connectedToPort5 <--> gatewayNode.Netport ; does not have any channels defined. So IDE replaces with cIdealChannel and so getTransmissionChannel() cannot find any transmission channel since there is no channel object defined for this connection.

So instead replace

mySwitch.connectedToPort5 <--> gatewayNode.Netport ;

To

mySwitch.connectedToPort5 <--> LinkDefinedChannel <--> gatewayNode.Netport ;

Now getTransmissionChannel() should be able to get the transmission channel since you are defining one channel object to this connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM