//************************************************************************************
// 	 This software simulated ARPEES protocol for Wireless Sensor Network             *
//	 Copyright (C) 2007 by Tran Quang Vinh (vinhtq@mail.hut.edu.vn)                  *
//	 Multimedia Information NETwork Lab - MINET                                      *
//	 Dept. Electronic Information Systems, Graduate School of Enginnering            *
//	 Shibaura Institute of Technology, Japan.                                        *
//-----------------------------------------------------------------------------------*
//	 File name: NedModuls.net											             *
//	 the method of OMNET++ to implement module in the network simulation             *
//***********************************************************************************/

// Base Station
simple  BaseStation
    parameters:
		id: numeric const,
        randInit: numeric const,
        numNodes: numeric const,
        xpos: numeric const,
        ypos: numeric const;
    gates:
        in: in[];
        out: out[];
endsimple


// Sensor node
simple  SensorNode
    parameters:
		//FILE_OBJ_TRACE: string,
        id: numeric const,
        energy: numeric,
        xpos: numeric const,
        ypos: numeric const;
    gates:
        in: in[];
        out: out[];
endsimple

// ARPEES network
module ARPEES
    parameters:
        //FILE_TRACE: string,
		energy: numeric,
        numNodes: numeric,
        trRange: numeric,
		//trRangeD0: numeric,
		protocol: numeric,
		showHideRange: numeric,
		ssRange: numeric,
		kRequire: numeric,
        rounds: numeric,
        frames: numeric,
        sRand: numeric,
        xMax: numeric,
        yMax: numeric;
    submodules:
        bs: BaseStation;
            parameters:
                id = 1,
                randInit = sRand,
                xpos = xMax/2,
                ypos = yMax/2,
                numNodes = numNodes;
        node: SensorNode[numNodes];
            parameters:
				//FILE_OBJ_TRACE = FILE_TRACE,
                energy = energy,
                id = index+2,
                xpos = intuniform(10, xMax-10),
                ypos = intuniform(10, yMax-10);
    connections nocheck:
    display: "p=0,0;b=$xMax,$yMax,rect;o=DarkSeaGreen"; //DarkSeaGreen
endmodule

// build the wireless sensor network
network WSN : ARPEES
endnetwork

//***********************************************************************************/

