LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2017, 06:30 AM   #1
fatma alzahra
LQ Newbie
 
Registered: Aug 2014
Posts: 26

Rep: Reputation: Disabled
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..
 
Old 06-21-2017, 07:33 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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.
 
Old 06-22-2017, 02:07 AM   #3
fatma alzahra
LQ Newbie
 
Registered: Aug 2014
Posts: 26

Original Poster
Rep: Reputation: Disabled
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...

Last edited by fatma alzahra; 06-22-2017 at 02:15 AM.
 
Old 06-22-2017, 04:28 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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/.


-
 
Old 06-23-2017, 01:40 AM   #5
fatma alzahra
LQ Newbie
 
Registered: Aug 2014
Posts: 26

Original Poster
Rep: Reputation: Disabled
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..

Last edited by fatma alzahra; 06-23-2017 at 01:44 AM.
 
Old 06-24-2017, 01:49 AM   #6
fatma alzahra
LQ Newbie
 
Registered: Aug 2014
Posts: 26

Original Poster
Rep: Reputation: Disabled
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
 
Old 06-24-2017, 03:39 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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.


-

Last edited by knudfl; 06-24-2017 at 03:43 AM.
 
  


Reply

Tags
nist-mob, ns2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How would you design a heterogeneous office network genmaicha Linux - General 2 07-24-2010 06:23 AM
Configuring users for NFS on an heterogeneous network crisostomo_enrico Solaris / OpenSolaris 2 08-24-2007 02:03 AM
LXer: Building a heterogeneous home network for Linux and Mac OS X LXer Syndicated Linux News 0 06-10-2006 04:03 AM
distri for heterogeneous academic network Samsara Linux - Distributions 2 05-07-2004 12:47 PM
Heterogeneous network logon robertoneto123 Conectiva 3 11-19-2003 01:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration