Download OMNeT++ User Manual
Transcript
OMNeT++ Manual – The NED Language parameters: processingDelay = rteProcessingDelay, buffersize = rteBuffersize; gatesizes: input[numOfPorts+1], output[numOfPorts+1]; portIf: DataLink[numOfPorts] parameters: retryCount = 5, windowSize = 2; connections: for i=0..numOfPorts-1 do routing.output[i] --> portIf[i].fromHigherLayer; routing.input[i] <-- portIf[i].toHigherLayer; portIf[i].toPort --> outputPorts[i]; portIf[i].fromPort <-- inputPorts[i]; endfor; routing.output[numOfPorts] --> localUser.input; routing.input[numOfPorts] <-- localUser.output; endmodule Example 2: Chain For example, one can create a chain of modules like this: module Chain parameters: count: const; submodules: node : Node [count] gatesizes: in[2], out[2]; gatesizes if index==0 || index==count-1: in[1], out[1]; connections: for i = 0..count-2 do node[i].out[i!=0 ? 1 : 0] --> node[i+1].in[0]; node[i].in[i!=0 ? 1 : 0] <-- node[i+1].out[0]; endfor; endmodule Example 3: Binary Tree One can use conditional connections to build a binary tree. The following NED code loops through all possible node pairs, and creates the connections needed for a binary tree. simple BinaryTreeNode gates: in: fromupper; out: downleft; out: downright; endsimple 44