LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   node on off in heterogeneous network based on mac (https://www.linuxquestions.org/questions/linux-newbie-8/node-on-off-in-heterogeneous-network-based-on-mac-4175608306/)

fatma alzahra 06-21-2017 06:30 AM

node on off in heterogeneous network based on mac
 
Hello all;
- I'm trying to make a scenario where nodes states are on / off besed on returned (mac address) or (network type) in heterogeneous network

- to make node on or off or sleep or wakeup "onoff-30-3-3-1-1-500-10.tcl" "tcl\test"or "cbr-10-1-10-20" "tcl/mobility/scene"

- like in nist-mob examples the current mac could be obtained through
Quote:

if (is_local_mac (e->linkIdentifier.macMobileTerminal))
localMac = e->linkIdentifier.macMobileTerminal;
in mih.cc

and make node on or off
Quote:

if(link_type_t == LINK_802_16 ){
EnergyModel *em = netif_->node()->energy_model();
if (em && em->sleep()) {
//em->set_node_state(EnergyModel::INROUTE);
em->set_node_sleep(1);
}
}
Quote:

Phy *p;
p=netif_;
(
(WirelessPhy *)p)->node_sleep();
the question is in multi-interface node in ns2
if (link_type_t == LINK_802_11)
make 802_11 interface on
make 802_16 interface off
make umts interface off

where to make this scenario in .cc or tcl example
Quote:

$ns_ at 14.199999999999999 "$node_(26) off"
===========
Quote:

else if (strcmp(argv[1], "on") == 0) {
energy_model()->node_on() = true;
tcl.evalf("%s set netif_(0)", name_);
const char *str = tcl.result();
tcl.evalf("%s NodeOn", str);
God::instance()->ComputeRoute();
return TCL_OK;
} else if (strcmp(argv[1], "off") == 0) {
energy_model()->node_on() = false;
tcl.evalf("%s set netif_(0)", name_);
const char *str = tcl.result();
tcl.evalf("%s NodeOff", str);
tcl.evalf("%s set ragent_", name_);
str = tcl.result();
tcl.evalf("%s reset-state", str);
God::instance()->ComputeRoute();
return TCL_OK;
} else if (strcmp(argv[1], "shutdown") == 0) {
// set node state
//Phy *p;
energy_model()->node_on() = false;

//p = ifhead().lh_first;
//if (p) ((WirelessPhy *)p)->node_off();
return TCL_OK;
} else if (strcmp(argv[1], "startup") == 0) {
energy_model()->node_on() = true;
return TCL_OK;
}
-is the code above in " mobilenode.cc" access values in tcl or what?
if yes how to make condition on node id or node mac in my tcl example "testMIH.tcl"

i search and found this
Quote:

inline void
Mac802_11::transmit(Packet *p, double timeout)
{
tx_active_ = 1;
int nid = netif_->node()->nodeid();
double now = Scheduler::instance().clock();

if (nid == my_nid && now >= my_time_start && now < my_time_end) {
mhSend_.start(timeout);
return;
}

//... original code below
}

void
Mac802_11::recv(Packet *p, Handler *h)
{
int nid = netif_->node()->nodeid();
double now = Scheduler::instance().clock();

if (nid == my_nid && now >= my_time_start && now < my_time_end) {
struct hdr_cmn *hdr = HDR_CMN(p);
hdr->error() = 1;
}

//... original code below
}
thanks in advance..

knudfl 06-21-2017 07:33 AM

Simulator name and version is missing.

I.e. if ns2, must be included in the title line / the text.
And the added patch(es) must be specified. MIH ?


Quote:

i search and found this
Found where ? A link, please.

fatma alzahra 06-22-2017 02:07 AM

Hello knudfl;
thanks for your reply ..
- the used ns2 version is "ns-2.29"
- the used MIH nist patch "ns-2.29-nist-mob-022707"

- PDF describe the work i'm trying to do "Integrate MIH with power management technique "
https://drive.google.com/file/d/0ByC...ew?usp=sharing
- the management technique include powering off the interfaces not in use in MIH while only power on the interface in use
or
- enter the un-used interface in sleep mode and wake it up through paging message from mih server

.....
search results found
1) could power on/off interface through tcl example

Quote:

$ns_ at 14.199999999999999 "$node_(26) off"
2) i need time in previous tcl command to be variable according to the current used technology "802.11 , 802.16 , umts"
how to do this through tcl??????

3) the other method i found is to do this through .cc file by code in #1

how to access data in tcl through .cc to make node on/off
Quote:

bsUMTS: tcl=_o30; id=1; addr=0.0.1
iface0(UMTS): tcl=_o72; id=2; addr=0.0.2
router0: tcl=_o96; id=3; addr=1.0.0
router1: tcl=_o104; id=4; addr=2.0.0
iface2: tcl=_o112; id=5; addr=2.0.2
lan created between router1 and iface2
multiFaceNode: tcl=_o218; id=7; addr=4.0.0
bstation802: tcl=_o236; id=8; addr=3.0.0
bss_id for bstation 1=6
iface1: tcl=_o264; id=9; addr=3.0.1
https://stackoverflow.com/questions/...-from-cc-files

couldn't make use of above url....
i read "Linkage Between OTcl and CCC in NS2" chapter in ns manual but didn't know from where to start...


Quote:

"mac/smac" sleep/wakeup cycle merely similar to my work but with multiple technology "802.11 , 802.16 , umts" instead of "802.15"
i really appreciate your help...
again thank you knudfl...

knudfl 06-22-2017 04:28 AM

OK, nist-mob it is. Same as NS-MIH-MULTI-CRITERIA →

NS-MIH-MULTI-CRITERIA/scripts
The scripts are included in the nist examples, nist-examples-2016-2.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing

? May be the scripts/ folder has something you can use ?
The tcl simulations are multiMN.tcl, umts-80211-80216.tcl .
There are two bash scripts to run different simulation commands :
ABCpref.sh, distance.sh . ← Please read the scripts, the commands.


About »»how to access value in tcl script from .cc files««
( https://stackoverflow.com/questions/...-from-cc-files )
.... So far concerns the executable 'ns' there are no files.cc .
All c++ functions and otcl functions (tcl/lib/ns-*.tcl) are compiled into 'ns'.
So actually ns-2.xx can be deleted when built, and 'make install' has copied ns to /usr/local/bin/.


-

fatma alzahra 06-23-2017 01:40 AM

thanks knudfl;
all work related to nist-mob i have done successfully and i need to merge (power saving) with such scenarios .. i checked examples in attached url but non achieve this point..
"umts-80211-80216.tcl" resulted trace not have energy indication how to trace energy in this example

- the way to achieve this is by energy-model class in ns2 and all search results i have in #1 , #3 but i missed linkage c++ and otcl
https://askubuntu.com/questions/6875...o-sleep-in-ns2

netif 1 wifi on
netif 2 wimax off
netif 3 umts off

when current connected interface is wifi shutdown all other interfaces to save battery consumption but i need it to be done automatically and not made on/off in tcl example...

Q2) when i re-compile ns2 after any change
ns-allinone-2.29/ns-2.29$
./configure
make clean
make
make install <<<< give me error
Quote:

for d in /usr/local/man/man1; do \
if [ ! -d $d ]; then \
mkdir -p $d ;\
fi;\
done
/usr/bin/install -c -m 755 ns /usr/local/bin
/usr/bin/install -c -m 644 ns.1 /usr/local/man/man1
so i change directory to ns-allinone-2.29$ ./install
and worked ok
does (./install) in main directory compensate for (make install) in ns-2.29 directory
thanks in advance ..
i really appreciate your help..

fatma alzahra 06-24-2017 01:49 AM

Hello All;
after merging energy model commands in tcl example with any nist-mob example in attached examples "testMIH.tcl"
the resulted trace looks like
Quote:

s -t 468.800083958 -Hs 6 -Hd -2 -Ni 6 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma e7 -Md ffffffff -Ms 4 -Mt 0
s -t 468.900083958 -Hs 6 -Hd -2 -Ni 6 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma e7 -Md ffffffff -Ms 4 -Mt 0
N -t 468.900084 -n 12582913 -e 530.615834
s -t 469.000083958 -Hs 6 -Hd -2 -Ni 6 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma e7 -Md ffffffff -Ms 4 -Mt 0
N -t 469.000084 -n 12582913 -e 530.515834
s -t 469.100083958 -Hs 6 -Hd -2 -Ni 6 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma e7 -Md ffffffff -Ms 4 -Mt 0
N -t 469.100084 -n 12582913 -e 530.415834
s -t 469.200083958 -Hs 6 -Hd -2 -Ni 6 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma e7 -Md ffffffff -Ms 4 -Mt 0
N -t 469.200084 -n 12582913 -e 530.315834
s -t 469.300083958 -Hs 6 -Hd -2 -Ni 6 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma e7 -Md ffffffff -Ms 4 -Mt 0
N -t 469.300084 -n 12582913 -e 530.215834
s -t 469.400083958 -Hs 6 -Hd -2 -Ni 6 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma e7 -Md ffffffff -Ms 4 -Mt 0
N -t 469.400084 -n 12582913 -e 530.115834
here node no -n 12582913 what does this mean even i have multiple no of nodes and the only -n 12582913 is this
have mac 0 1 2 3 4
thanks

knudfl 06-24-2017 03:39 AM

Re #5.
Quote:

attached examples "testMIH.tcl"
? Attached where ?


Missing information : OS Name, version, architecture : $ uname -m

Note: Code, output, error output → Must be in CODE Tags ... not Quote Tags
http://www.linuxquestions.org/questi....php?do=bbcode
Like [code]code text[/code]
.... Please edit your posts.


-


All times are GMT -5. The time now is 06:02 PM.