⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 antnetworknode.ned

📁 use swarm intelligence to simulate network routings in omnet
💻 NED
字号:
//-------------------------------
// File: antNetworkNode.ned
// This is a simple simulation program whose purpose is just
// to understand how antNet algorithm works
//-------------------------------

import
    "antGenerator.ned",
    "antNest.ned",
    "antSink.ned",
    "dataGenerator.ned",
    "dataSink.ned",
    "genericRouter.ned",
    "genericNetworkNode.ned";


//
// Building block of the antNet algorithm. The interface of this
// module conforms to the interface of genericNetworkNode and hence
// in this way we could implement different routing algorithms.
// We could say that OSPFNetworkNode will implement OSPF....
//
module antNetworkNode

    parameters:
        address : numeric const,
        numStations : numeric const,
        nGates : numeric const,
        dataRate : numeric const,
        log : bool,
        statPath : string,
        dBPath : string;

    gates:
        in: in[];
        out: out[];


    submodules:

        dGen: dataGenerator;
            parameters:
                address = address,
                numStations = numStations,
                logResults = log,
                iaTime = input,
                numMessages = input,
                messageLength = input,
                sleepTimeAtStart = input,
                startTime = input,
                endTime = input,
                hotSpot = input,
                hotmpia = input,
                statModulePath = statPath;

            display: "p=212,64;i=block/source,#ffff00";
        aGen: antGenerator;
            parameters:
                address = address,
                numStations = numStations,
                logResults = log,
                iaTime = input,
                messageLength = input,
                sleepTimeAtStart = input,
                converganceTime = input,
                statModulePath = statPath;


            display: "p=134,120;i=block/source,#8080ff";
        dSink: dataSink;
            parameters:
                sleepTimeAtStart = input,
                logResults = log,
                throughputInterval = input,
                routingDBPath = dBPath,
                statModulePath = statPath;


            display: "p=270,64;i=block/sink,#ffff00";
        aSink: antSink;
            parameters:
                logResults = log,
                sleepTimeAtStart = input,
                statModulePath = statPath;


            display: "p=72,120;i=block/sink,#8080ff";
        router: Router;
            parameters:
                address = address,
                numStations = numStations,
                dataRate = dataRate,
                logResults = log,
                messageLength = input,
                queueSize = input,
                probabilisticRouting = input,
                startTime = input,
                endTime = input,
                qWeightFactor = input,
                contextSwitchTime = input,
                agentProcTime = input,
                converganceTime = input,
                statModulePath = statPath;

            gatesizes:
                in[nGates],
                out[nGates];

            display: "p=192,264;i=block/routing";
        aNest: antNest;
            parameters:
                logResults = log,
                expMeanCoefficient = input,
                windowSizeCoefficient = input,
                zetaConfidenceLevel = input,
                explorationProbablity = input,
                rescalingPower = input,
                queueWeight = input,
                forkProbability = input,
                maxHopsCoefficient = input,
                ageLimit = input,
                squashFunctionCoefficient = input,
                probabilisticRouting = input,
                statModulePath = statPath;
            display: "p=96,192;i=block/square";
    connections:

        dGen.toAntGen --> aGen.fromDataGen;
        dGen.toRouter --> router.fromDataGen;

        aGen.toAntNest --> aNest.fromAntGen;
        aGen.toRouter --> router.fromAntGen;

        aNest.toAntSink --> aSink.fromAntNest;
        aNest.toRouter --> router.fromAntNest;

        router.toAntNest --> aNest.fromRouter;
        router.toDataSink --> dSink.fromRouter;


                                                // connecting all input ports of the router node to the
                                                // input ports of the networknode and vice versa

        for i=0..nGates-1 do
            in[i] --> router.in[i];
            out[i] <-- router.out[i];
        endfor;

endmodule



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -