help me in rectifying the ned code...

42 views
Skip to first unread message

Sonia Lamba

unread,
Jul 24, 2014, 9:57:04 AM7/24/14
to omn...@googlegroups.com
Hello there,
Although the parameter num_station has defined a default value of 10...but only one station is created instead of 10...Is there exist a problem in the for loop... 

simple AccessPoint

{

    parameters:

    gates:

        input in;

        output out;

}

 

simple Freespace

{

    parameters:

    gates:

        output out[];

        input in[];

        output APout;

        input APin;

        output Aout;

        input Ain;

}

 

simple Station

{

    gates:

        output out[];

        input in[];

        input Cin[];

}

 

simple Attacker

{

    gates:

        input in;

        output out;

}

 

simple Clock

{

    gates:

        output out[];

}

 

 

//module IEEE

 

network wirelessLAN

{

    parameters:

        //num_station=input(10,"Number of mobile stations:");

    submodules:

        nodes[num_station]: IEEE {

            @display("p=65,51");

        }

}

   // parameters:

    //int num_station=default(10);

 

module IEEE

{

    parameters:

        int num_station = default(10);

 

    submodules:

        ap: AccessPoint {

            parameters:

                @display("p=134,101;i=access_point02;b=80,75");

        }

 

 

        freespace: Freespace {

 

            parameters:

                @display("p=293,231;i=cloud_1;b=103,49");

 

            gates:

                in[num_station];

                out[num_station];

 

 

        }

 

 

        sta[num_station]: Station {

            parameters:

                @display("p=106,317,r,50; i=pda1; b=25,36");

            gates:

                in[num_station];

                out[num_station];

                Cin[num_station];

        }

 

 

        attacker: Attacker {

            parameters:

                @display("p=541,116;i=hacker05;b=139,105");

 

        }

 

        clk[num_station]: Clock {

            parameters:

                @display("p=56,378,r,100;i=cogwheel2_s;b=50,40");

            gates:

                out[num_station];

 

 

        }

    connections:

        for i=0..num_station-1

        {

            sta[i].out[i] --> {  datarate = 11000000Mbps; } --> freespace.in[i];

            freespace.out[i] --> sta[i].in[i];

            clk[i].out[i] --> sta[i].Cin[i];

 

        }

 

        ap.out --> {  datarate = 11000000Mbps; } --> freespace.APin;

        freespace.APout --> ap.in;

        freespace.APout --> attacker.in;// @display("m=m,95,63,47,28");

        attacker.out --> {  datarate = 11000000Mbps; } --> freespace.Ain; //display "m=m,47,28,95,63";

 

           //  @display("p=2,4; b=638,464");

}

 

I need your help...please help me... 

 

 

 

 

 

 

 



Michael Kirsche

unread,
Jul 25, 2014, 4:41:09 AM7/25/14
to omn...@googlegroups.com
You should restructure your NED files...

Different nodes (attacker, access point, ..) should go into separate NED files.
The num_station parameter and the actual connections are then defined in the network.ned file!
In your case the num_station parameter is useless in your IEEE definition, because you want to create multiple instances of those IEEE nodes in the network (where you would need the num_station parameter).

So restructure your NED files, put different nodes into different NED files, put the interconnection of nodes into the network. Connections of layers of a single node are defined in the node, interconnections between nodes in the network.

Michael Kirsche

unread,
Jul 25, 2014, 4:44:03 AM7/25/14
to omn...@googlegroups.com
And stop posting requests twice under two different accounts... that's just spaming and blocking the list!

            &n

...

Sonia Lamba

unread,
Jul 25, 2014, 10:30:25 AM7/25/14
to omn...@googlegroups.com
Thanx for the reply sir...
when creating different seperate ".ned" files...I'm getting an error when importing one file into another...

"network.ned"

File: nd.ned

//module IEEE


import "network.ned"; // Syntax error, unexpected STRINGCONSTANT, expecting NAME or DOUBLEASTERISK OR '*'


network wirelessLAN

{

    parameters:

        //num_station=input(10,"Number of mobile stations:");

    submodules:

        nodes[num_station]: IEEE {

            @display("p=65,51");

        }

}

   

module IEEE

<p
...

Michael Kirsche

unread,
Jul 27, 2014, 2:13:49 PM7/27/14
to omn...@googlegroups.com
That does not work!
Again, this is a NED file, which uses a different syntax than C/C++ for many things.

Import works e.g. like this:
import inet.battery.IBattery;
(Import of a Battery module from INET)

You should first go through the OMNeT manual's chapter on NED, then through the OMNeT tutorials to get a basic understanding of NED files, their syntax and usage in OMNeT simulations!
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-he
...
Reply all
Reply to author
Forward
0 new messages