Re: [ns] velocity and direction of mobile nodes
Hi Rainn, I only know how to get the velocity and direction vector, as below: MobileNode * pMNode ; speed = pMNode-speed(); dx = pMNode-dX(); dy = pMNode-dY(); I also want to know how to control the movement of mobile nodes, such as, nodes stop moving at a specific time. If anybody know, pls let me know. Thank you! Regards, Phenix -- From: Rainn rajstha2...@gmail.com Sent: Monday, March 16, 2009 12:45 PM To: ns-users@ISI.EDU Subject: [ns] velocity and direction of mobile nodes Dear all, I need to manipulate velocity and direction of mobile nodes in ns-2. Could anyone please help me out CODE to manipulate this. It's urgent . Thanks in advance. Have a good days always.
Re: [ns] how to forward packets based on probability
Hi Mubashir, Thanks for your advice. But I don't think this method denotes a rigorous probability-based mechanism. In fact, the packet may not be forwarded even with a probability of 90%. But using your method, it must be forwarded if only the probability exceeds a threshold. Any other ideas? Regards, Phenix From: Mubashir Rehmani Sent: Wednesday, February 18, 2009 3:49 PM To: Phenix Cc: ns-users Subject: Re: [ns] how to forward packets based on probability Hi Phenix, To forward a packet with certain probability, you need to include an if condition in the sendPkt() function. It should be something like this: If(probability 0.5) { Scheduler::instance().schedule(target_, p, delay); } in the SendPkt() function. Hope it helps Regards Mubashir www-rp.lip6.fr/~rehmani 2009/2/18 Phenix phenix...@hhu.edu.cn Hi guys, How to implement probabilistic-based flooding in NS-2 ? Say, upon receiving a packet, a mobile node will decide whether to forward it with a certain probability. I only know we can use the function below to send a packet in NS-2: Scheduler::instance().schedule(target_, p, delay); But how to deal with the probability? Regards, Phenix -- Mubashir Husain Rehmani
Re: [ns] how to forward packets based on probability
Hi Sidney, Phenix, Is this discussion about probability technics or about how to implement them in c++? Both. I'd like to know how can I implement probability-based mechanism in c++ more exactly. Sidney Doria UFCG / BRAZIL 2009/2/18 Phenix phenix...@hhu.edu.cn: Hi Mubashir, Thanks for your advice. But I don't think this method denotes a rigorous probability-based mechanism. In fact, the packet may not be forwarded even with a probability of 90%. But using your method, it must be forwarded if only the probability exceeds a threshold. Any other ideas? Regards, Phenix From: Mubashir Rehmani Sent: Wednesday, February 18, 2009 3:49 PM To: Phenix Cc: ns-users Subject: Re: [ns] how to forward packets based on probability Hi Phenix, To forward a packet with certain probability, you need to include an if condition in the sendPkt() function. It should be something like this: If(probability 0.5) { Scheduler::instance().schedule(target_, p, delay); } in the SendPkt() function. Hope it helps Regards Mubashir www-rp.lip6.fr/~rehmani 2009/2/18 Phenix phenix...@hhu.edu.cn Hi guys, How to implement probabilistic-based flooding in NS-2 ? Say, upon receiving a packet, a mobile node will decide whether to forward it with a certain probability. I only know we can use the function below to send a packet in NS-2: Scheduler::instance().schedule(target_, p, delay); But how to deal with the probability? Regards, Phenix -- Mubashir Husain Rehmani -- Sidney Doria Redes ad hoc móveis Doutorado em Computação UFCG Brasil Nessa jornada, o conhecimento será o seu escudo... (Mestre dos Magos no episódio do grimoire de ouro)
[ns] how to forward packets based on probability
Hi guys, How to implement probabilistic-based flooding in NS-2 ? Say, upon receiving a packet, a mobile node will decide whether to forward it with a certain probability. I only know we can use the function below to send a packet in NS-2: Scheduler::instance().schedule(target_, p, delay); But how to deal with the probability? Regards, Phenix
Re: [ns] MAC cache_ array out of range
Hi, Can anyone tell me from which c++ file this message can come out? MAC_802_11: accessing MAC cache_ array out of range Using a code browser, such as source insight, you'll easily locate where it is! In fact, the information above comes from Mac-802_11.cc, line 1963. Thanks in advance Regards, Phenix
Re: [ns] after recompiling
Hi, You can add these two statements at the beginning of proxytrace2any.cc: extern int IsLittleEndian(void); extern void ToOtherEndian(TEntry *e); It'll works well. However, I don't know the reason. If you know, please let me know. Regards, Phenix -- From: eng Rony rania_kamal...@yahoo.com Sent: Thursday, January 15, 2009 1:25 AM To: ns-users@ISI.EDU Subject: [ns] after recompiling Eng Rony hi i have to recompile ns2 after i make some changes in ns2 files by typing make in ns2 directory and appear to me some warning msgs and errors: gpsr/gpsr_neighbor.cc:393 : warning: int format, nsaddr_t arg arg 3. gpsr/gpsr.h:114: warning: 'GPSRAgent:: query_timer_' will be initialized after. gpsr/gpsr.h:101: warning: 'nsaddr_t GPSRAgent:: my_id_'. gpsr/gpsr.h:241: warning: comparison between sign and unsigned integer expression. proxytrace2any.cc:112: error: 'ISLittleEndian undeclared first use this function. proxytrace2any.cc:112: error: each undeclared identifier is reported only once for each function it appears in.. proxytrace2any.cc:120: error: 'ToOtherEndian undeclared first use this function. make[1]: *** proxeytrace2any.o [Error1]. i wait ur solutions
Re: [ns] (A naive solution) how to set different transmit range for different node
Hi All, After hacking threshold.cc, I've known the formula used to calculate receive threshold (ATTENTION: threshold.cc only generates RXThresh_, NOT Pt_). I modified TwoRayGround formula in threshold.cc, as below : Pr * d^4 * L Pt = --- Gt * Gr * (ht^2 * hr^2) Pr is replace with RXThresh_ whose value is 3.652e-10. If a distance is given, Pt can be calculated by above formula. e.g. Tx Range Pt_ 100m 0.00721383 150m 0.03652 200m 0.115421 250m 0.28179 300m 0.58432 ... ... I attached modified threshold.cc renamed threshold_Pt.cc . After compiling it, you can use like this: ./threshold_Pt -m TwoRayGround Required TxRange But unluckily, if the tx range is smaller than crossover_dist (always should be 86.1425m), the generated Pt_ value is incorrect either using Friis or TwoRay. If you know why, please let me know. I've developed a simple tcl script in order to validate transmit range with different Pt_ value. I attached this script named TxRangeTest.tcl. The routing protocol used in the script is MFlood, which is just a simple flooding algorithm. Trace format has been changed a little, like: s 1.0 1 1.00 200.00 AGT --- 0 cbr 512 [0 0 0 0] --- [1:0 0:0 32 0] [0] 0 0 r 1.004860003 0 0.00 200.00 AGT --- 0 MFlood 532 [mflood 1.0 1.00 200.00 ] The trace format of cbr packet can be referred to NS2 manual. The explain of trace format about MFlood packet is below: event = $1; curr_time = $2; curr_node_id = $3; curr_position_x = $4; curr_position_y = $5; trace_type = $6; pkt_seq = $8; pkt_type = $9; pkt_generate_time = $12; prev_hop_position_x = $13; prev_hop_position_y = $14; Finally, a AWT file is used to calculate the transmit range. # BEGIN { RecvNum = 0; final_curr_position_x = 0; final_curr_position_y = 0; final_prev_hop_position_x = 0; final_prev_hop_position_y = 0; } { event = $1; curr_time = $2; curr_node_id = $3; curr_position_x = $4; curr_position_y = $5; trace_type = $6; pkt_seq = $8; pkt_type = $9; pkt_generate_time = $12; prev_hop_position_x = $13; prev_hop_position_y = $14; if ( event == r curr_node_id == 0 trace_type == AGT ) { RecvNum++; # printf( %3d[Time : %f]N0(%.2f,%.2f) N1(%.2f,%.2f)\n, # RecvNum, # curr_time, # curr_position_x, # curr_position_y, # prev_hop_position_x, # prev_hop_position_y); final_curr_position_x = curr_position_x; final_curr_position_y = curr_position_y; final_prev_hop_position_x = prev_hop_position_x; final_prev_hop_position_y = prev_hop_position_y; } } END{ dx = final_prev_hop_position_x - final_curr_position_x ; dy = final_prev_hop_position_y - final_curr_position_y ; tx_range = sqrt(dx * dx + dy * dy) ; printf( \nNum of Recv pkts : %d \n, RecvNum); printf( \nTx Range of Node 1: %f \n, tx_range); } This is just a reference. You should do some changes according to your trace file if you use other routing protocol. Regards, Phenix -- From: kavan sheth shethka...@gmail.com Sent: Sunday, January 04, 2009 1:24 PM To: Phenix phenix...@hhu.edu.cn Subject: Re: [ns] how to set different transmit range for different node Hi Phenix, As far as I know threshold.cc generates particular transmission power(Pt_) based on the propagation model and distance specified by you. different propagation model have different equations for receiving power based on its characteristics. different equations are given in the threshold.cc. you can know more by studying this threshold.cc Kavan On 1/3/09, Phenix phenix...@hhu.edu.cn wrote: Hi Sidney, After times of trials, I've succeeded in letting different nodes own different Tx Range by configuring different value of Pt_ for each node. I get different values of Pt_ from a script: # The transimssion radio range Pt_ 6.9872e-4;# ?m Pt_ 8.5872e-4;# 40m Pt_ 1.33826e-3 ;# 50m Pt_ 7.214e-3 ;# 100m Pt_ 0.2818 ;# 250m And in my script, I have test range of 250m and 40m. It really works well. But It's a pity that I don't know how to obtain these values. The tool threshold (~ns/lidep-utils/propagation/threshold.cc) only generate RXThresh_ other than Pt_. Is there somebody knowing how to get value
Re: [ns] how to set different transmit range for different node
Hi Sidney, After times of trials, I've succeeded in letting different nodes own different Tx Range by configuring different value of Pt_ for each node. I get different values of Pt_ from a script: # The transimssion radio range Pt_ 6.9872e-4;# ?m Pt_ 8.5872e-4;# 40m Pt_ 1.33826e-3 ;# 50m Pt_ 7.214e-3 ;# 100m Pt_ 0.2818 ;# 250m And in my script, I have test range of 250m and 40m. It really works well. But It's a pity that I don't know how to obtain these values. The tool threshold (~ns/lidep-utils/propagation/threshold.cc) only generate RXThresh_ other than Pt_. Is there somebody knowing how to get value of Pt_? [Here is my test script] # == # Define options # == set val(ifqlen) 50 ;# max packet in ifq set val(nn) 2 ;# number of mobilenodes set val(rp)MFlood ;# routing protocol,DumbAgent set val(chan) Channel/WirelessChannel set val(prop) Propagation/TwoRayGround set val(netif) Phy/WirelessPhy set val(mac)Mac/802_11 set val(ifq)Queue/DropTail/PriQueue set val(ll) LL set val(ant)Antenna/OmniAntenna set val(stop) 150 # Initialize the SharedMedia interface with parameters to make # it work like the 914MHz Lucent WaveLAN DSSS radio interface Phy/WirelessPhy set CPThresh_ 10.0 Phy/WirelessPhy set CSThresh_ 1.559e-11 Phy/WirelessPhy set RXThresh_ 3.652e-10 Phy/WirelessPhy set Rb_ 2*1e6 Phy/WirelessPhy set freq_ 914e+6 Phy/WirelessPhy set L_ 1.0 # Pt_ set txpower_(0) 0.2818 ;# 250m set txpower_(1) 8.5872e-4;# 40m set txpower_(2) 7.214e-3 ;# 100m # == # Main Program # == #ns-random 0 # Initialize Global Variables set ns_ [new Simulator] set tracefd [open mflood_txRange.tr w] $ns_ trace-all $tracefd set namtrace[open mflood_txRange.nam w] $ns_ namtrace-all-wireless $namtrace 1000 500 # set up topography set topo [new Topography] $topo load_flatgrid 1000 500 # Create God create-god $val(nn) # Create the specified number of mobilenodes [$val(nn)] and attach them # to the channel. # configure node set channel [new Channel/WirelessChannel] $channel set errorProbability_ 0.0 $ns_ node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channel $channel \ -topoInstance $topo \ -agentTrace ON \ -routerTrace OFF\ -macTrace OFF \ -movementTrace OFF for {set i 0} {$i $val(nn) } {incr i} { Phy/WirelessPhy set Pt_ $txpower_($i) set node_($i) [$ns_ node] $node_($i) random-motion 0; } # Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes # # N_0 -- d --- N_2 # srcdst $node_(0) set X_ 0.0 $node_(0) set Y_ 200.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 1.0 $node_(1) set Y_ 200.0 $node_(1) set Z_ 0.0 $ns_ at 1.5 $node_(1) setdest 255.0 200.0 2.0 # Define node initial position in nam for {set i 0} {$i $val(nn)} {incr i} { $ns_ initial_node_pos $node_($i) 20 } set udp_(0) [new Agent/UDP] set udp_(1) [new Agent/UDP] $ns_ attach-agent $node_(0) $udp_(0) $ns_ attach-agent $node_(1) $udp_(1) set null_(0) [new Agent/Null] set null_(1) [new Agent/Null] $ns_ attach-agent $node_(1) $null_(0) $ns_ attach-agent $node_(0) $null_(1) $ns_ connect $udp_(0) $null_(0) $ns_ connect $udp_(1) $null_(1) for {set i 0} {$i $val(nn)} {incr i} { set cbr_($i) [new Application/Traffic/CBR] $cbr_($i) set packetSize_ 512 $cbr_($i) set interval_ 2 $cbr_($i) set random_ 1 $cbr_($i) attach-agent $udp_($i) } $ns_ at 1.0 $cbr_(0) start $ns_ at 1.1 $cbr_(1) start # Tell nodes when the simulation ends for {set i 0} {$i $val(nn) } {incr i} { $ns_ at $val(stop).0 $node_($i) reset; } $ns_ at $val(stop).0 stop $ns_ at $val(stop).01 puts \NS EXITING...\ ; $ns_ halt proc stop {} { global ns_ tracefd namtrace $ns_ flush-trace close $tracefd close $namtrace } puts Starting Simulation... $ns_ run Regards, Phenix From: Sidney Doria Sent: Saturday, January 03, 2009 12:01 AM To: Phenix Subject: Re: [ns] how to set different transmit range for different node Hi Phenix, In the TCL file, there's a loop for node creation. So, you can break this node in a manual creation, each node with specific characteristics. Sidney Doria UFCG / BRAZIL 2009/1/2 Phenix phenix...@hhu.edu.cn Hi all, I'd like how to set different transmit range for different node in MANET. eg. Three nodes,N0,N1 and N2 are in a line: (N0) (N1)(N2) |--- 200m
[ns] how to set different transmit range for different node
Hi all, I'd like how to set different transmit range for different node in MANET. eg. Three nodes,N0,N1 and N2 are in a line: (N0) (N1)(N2) |--- 200m -| ---120m---| The transmit range of N0,N1 and N2 is respectively 250m,150m,200m. So packets can be passed: N0 -- N1 --- N2 Let me know how to set different transmit range please. Thank you in advance! Regards, Phenix
Re: [ns] how to build tcl scripts for VANET
Hi sarym, As I'm a newbie to NS2, I don't know how to deal with so many mobile node with variable speed in VANET. Could you please show me a tcl example? Thanks ~ Regards, Phenix From: sarym binome Sent: Monday, December 29, 2008 5:39 PM To: phenix...@hhu.edu.cn Subject: RE: [ns] how to build tcl scripts for VANET hi we can do that as the same way as fo MANET , just you have to use an other type to mobility , because in vanet has a very high mobility good luck From: phenix...@hhu.edu.cn To: ns-users@ISI.EDU Date: Mon, 29 Dec 2008 15:23:26 +0800 Subject: [ns] how to build tcl scripts for VANET Découvrez tout ce que Windows Live a à vous apporter !
[ns] how to build tcl scripts for VANET
Hi All, I'd like to know how to build a scenario script for vehicular Ad Hoc Network (VANET)? Can somebody give me some directions? Or if someone have example TCL scripts for VANET, please let me know . Thanks in advance! Regards, Phenix
Re: [ns] DHT implementation in NS-2
Hi Shailander, Maybe you can try to use APIs in tclHash.c (ns-allinone-2.33/tcl8.4.18/generic) to implement your hash operation. Here is a example code, (I hope it will be useful but WITHOUT ANY WARRANTY since I have not tested it yet!) /** h file ***/ #ifndef NS_EVENT_PACKET_HASH_H #define NS_EVENT_PACKET_HASH_H #include config.h #include tclcl.h #include cmu-trace.h class Event_Packet_Hash_Entry { public: // key variable nsaddr_t source_; u_int16_t evt_id_; // addtional variable u_int16_t evt_index_; int evt_ttl_; bool evt_grs_; Event_Packet_Hash_Entry() { source_ = (nsaddr_t)0; evt_id_ = 0; evt_index_ = 0; evt_ttl_ = 0; evt_grs_ = false; } ~Event_Packet_Hash_Entry() { } }; class Event_Packet_Hash_Table { public: Tcl_HashTable htable; Event_Packet_Hash_Table() { Tcl_InitHashTable(htable, 2); } void ResetHash(); void PutinHash(nsaddr_t source, u_int16_t evt_id, u_int16_t evt_index, int evt_ttl); void ModifyHash(nsaddr_t source, u_int16_t evt_id, u_int16_t evt_index, int evt_ttl, bool evt_grs); Event_Packet_Hash_Entry *GetHash(nsaddr_t source, u_int16_t evt_id); }; #endif //NS_EVENT_PACKET_HASH_H /** cc file **/ #include tclcl.h #include event_packet_hash.h Event_Packet_Hash_Entry *Event_Packet_Hash_Table::GetHash(nsaddr_t source, u_int16_t evt_id) { u_int32_t key[2]; key[0] = source; key[1] = (u_int32_t) evt_id; // for dulplication check Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(htable, (char *)key); if (entryPtr == NULL ) { //printf(Hash Null\n); return NULL; } //printf(Hash Get\n); return (Event_Packet_Hash_Entry *)Tcl_GetHashValue(entryPtr); } void Event_Packet_Hash_Table::ModifyHash(nsaddr_t source, u_int16_t evt_id, u_int16_t evt_index, int evt_ttl, bool evt_grs) { unsigned int key[2]; Event_Packet_Hash_Entry *hashPtr; int newPtr; key[0] = source; key[1] = (u_int32_t) evt_id; Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(htable, (char *)key); if (entryPtr == NULL ) { return; } // Get Hash Entry hashPtr = (Event_Packet_Hash_Entry *)Tcl_GetHashValue(entryPtr); //old_num_dup = hashPtr-hop_count_; // Delete Hash Entry delete hashPtr; // Delete Hash Entry Tcl_DeleteHashEntry(entryPtr); // Re-create Hash Entry entryPtr = Tcl_CreateHashEntry(htable, (char *)key, newPtr); if (!newPtr) { return; } hashPtr = new Event_Packet_Hash_Entry; hashPtr-source_ = source; hashPtr-evt_id_ = evt_id; hashPtr-evt_index_ = evt_index; hashPtr-evt_ttl_ = evt_ttl; hashPtr-evt_grs_ = evt_grs; // binding Hash entry Table Entry Tcl_SetHashValue(entryPtr, hashPtr); } void Event_Packet_Hash_Table::PutinHash(nsaddr_t source, u_int16_t evt_id, u_int16_t evt_index, int evt_ttl) { Tcl_HashEntry *entryPtr; Event_Packet_Hash_Entry*hashPtr; unsigned int key[2]; int newPtr; key[0] = source; key[1] = (u_int32_t) evt_id; entryPtr = Tcl_CreateHashEntry(htable, (char *)key, newPtr); if (!newPtr) return; hashPtr = new Event_Packet_Hash_Entry; hashPtr-source_ = source; hashPtr-evt_id_ = evt_id; hashPtr-evt_index_ = evt_index; hashPtr-evt_ttl_ = evt_ttl; hashPtr-evt_grs_ = false; Tcl_SetHashValue(entryPtr, hashPtr); //printf(Put in Hash: Source Addr:%ld\tNum:%d\n,source_addr,pkt_num); } //--- Hash Cleaning --// void Event_Packet_Hash_Table::ResetHash() { Event_Packet_Hash_Entry *hashPtr; Tcl_HashEntry *entryPtr; Tcl_HashSearch searchPtr; entryPtr = Tcl_FirstHashEntry(htable, searchPtr); while (entryPtr != NULL) { hashPtr = (Event_Packet_Hash_Entry *)Tcl_GetHashValue(entryPtr); delete hashPtr; Tcl_DeleteHashEntry(entryPtr); entryPtr = Tcl_NextHashEntry(searchPtr); } } Regards, Phenix -- From: Shailander Srinivasa V shailander...@yahoo.com Sent: Saturday, December 20, 2008 7:21 PM To: ns-users@ISI.EDU Subject: [ns] DHT implementation in NS-2 Hi All, I am trying to implement DHT(Dynamic Hash Table) in NS-2 as a part of Location-Aware-Routing Protocol for MANETS. I am unable to find any DHT implementations in NS-2. Can anyone please guide me on how to approach towards the implementation. Thanking You in Advance Thanks with Regards, Shailander Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
[ns] puzzles on Agent and Router
Hi guys, Recently I'm rather puzzled about Agent and Router in NS-2. Take AODV for example, it is a kind of route protocol, meanwhile it's a kind of agent. Are agent and router equivalent? And also, both agent and router have respective trace switch, -agentTrace and -routerTrace. Which one should I use when evaluating my algorithm ? Wish someone can give me some explains. Thanks in advance. Regards, Phenix
Re: [ns] cygwin problem
Hi, Nour In NS-2 install script, packets or tools below are needed: packages_base=gcc gcc-g++ gawk tar gzip make patch perl w32api packages_xfree=XFree86-bin XFree86-prog XFree86-lib XFree86-etc packages_xorg=xorg-x11-bin xorg-x11-bin-dlls xorg-x11-devel xorg-x11-libs-data xorg-x11-etc So, please make sure that choose all of these items when you install cygwin. Wish you good luck! Regards, Phenix -- From: Nour [EMAIL PROTECTED] Sent: Monday, December 01, 2008 9:52 PM To: ns-users@ISI.EDU Subject: [ns] Re : cygwin problem Hello All I have problem when installing NS under Cygwin, this message appears: Package xorg-x11-bin is not present on your system. Please install it using Cygwin's setup.exe before trying to install the ns-2 distribution. Help please, how can I get this package . yours; Nour
[ns] puzzled about two kinds of flooding code
Hi, all Can anybody tell me the differences of between $NS_HOME\sensor-nets\flood-agent.cc(h) and $NS_HOME\diffusion\flooding.cc(h) ? If I'd like to apply flooding technique for Vehicle Safety Communication, which should I choose? Regards, Phenix