[ns] HELP:new application not running.
I have developed a new wireless application on directed diffusion and have followed the necessary steps to integrate it into the ns code.but on executing the command make ,it gives the following error: Makefile:195:*** command commences before first target.Stop. below i am attaching the files i have created for my application. #include "packet1_receiver.hh" #ifdef NS_DIFFUSION static class Packet1ReceiverAppClass : public TclClass { public: Packet1ReceiverAppClass() : TclClass("Application/DiffApp/Packet1Receiver") {} TclObject* create(int , const char*const* ) { return(new Packet1ReceiverApp()); } } class_packet1_receiver; int Packet1ReceiverApp::command(int argc, const char*const* argv) { if (argc == 2) { if (strcmp(argv[1], "subscribe") == 0) { run(); return TCL_OK; } } return DiffApp::command(argc, argv); } #endif // NS_DIFFUSION void Packet1ReceiverReceive::recv(NRAttrVec *data, NR::handle my_handle) { app_->recv(data, my_handle); } void Packet1ReceiverApp::recv(NRAttrVec *data, NR::handle my_handle) { NRSimpleAttribute *counterAttr = NULL; NRSimpleAttribute *timeAttr = NULL; EventTime *probe_event; long delay_seconds; long delay_useconds; float total_delay; struct timeval tmv; GetTime(&tmv); counterAttr = AppCounterAttr.find(data); timeAttr = TimeAttr.find(data); if (!counterAttr || !timeAttr){ DiffPrint(DEBUG_ALWAYS, "Received a BAD packet !\n"); PrintAttrs(data); return; } // Calculate latency probe_event = (EventTime *) timeAttr->getVal(); delay_seconds = tmv.tv_sec; delay_useconds = tmv.tv_usec; if ((delay_seconds < probe_event->seconds_) || ((delay_seconds == probe_event->seconds_) && (delay_useconds < probe_event->useconds_))){ // Time's not synchronized delay_seconds = -1; delay_useconds = 0; DiffPrint(DEBUG_ALWAYS, "Error calculating delay !\n"); } else{ delay_seconds = delay_seconds - probe_event->seconds_; if (delay_useconds < probe_event->useconds_){ delay_seconds--; delay_useconds = delay_useconds + 100; } delay_useconds = delay_useconds - probe_event->useconds_; } total_delay = (float) (1.0 * delay_seconds) + ((float) delay_useconds / 100.0); // Check if this is the first message received if (first_msg_recv_ < 0){ first_msg_recv_ = counterAttr->getVal(); } // Print output message if (last_seq_recv_ >= 0){ if (counterAttr->getVal() < last_seq_recv_){ // Multiple sources detected, disabling statistics rp = 1; last_seq_recv_ = -1; DiffPrint(DEBUG_ALWAYS, "Received data %d, total latency = %f!\n", counterAttr->getVal(), total_delay); } else{ last_seq_recv_ = counterAttr->getVal(); num_msg_recv_++; DiffPrint(DEBUG_ALWAYS, "Received data: %d, total latency = %f, %% messages received: %f !\n", last_seq_recv_, total_delay, (float) ((num_msg_recv_ * 100.00) / ((last_seq_recv_ - first_msg_recv_) + 1))); } } else{ DiffPrint(DEBUG_ALWAYS, "Received data %d, total latency = %f !\n", counterAttr->getVal(), total_delay); } } handle Packet1ReceiverApp::setupSubscription() { NRAttrVec attrs; path_ = 0; attrs.push_back(NRClassAttr.make(NRAttribute::IS, NRAttribute::INTEREST_CLASS)); attrs.push_back(LatitudeAttr.make(NRAttribute::GT, 54.78)); attrs.push_back(LongitudeAttr.make(NRAttribute::LE, 87.32)); attrs.push_back(TargetAttr.make(NRAttribute::IS, "F117A")); handle h = dr_->subscribe(&attrs, mr_); ClearAttrs(&attrs); return h; } void Packet1ReceiverApp::run() { subHandle_ = setupSubscription(); #ifndef NS_DIFFUSION // Do nothing while (1){ sleep(1000); } #endif // !NS_DIFFUSION } #ifdef NS_DIFFUSION Packet1ReceiverApp::Packet1ReceiverApp() #else Packet1ReceiverApp::Packet1ReceiverApp(int argc, char **argv) #endif // NS_DIFFUSION { last_seq_recv_ = 0; num_msg_recv_ = 0; first_msg_recv_ = -1; mr_ = new Packet1ReceiverReceive(this); #ifndef NS_DIFFUSION parseCommandLine(argc, argv); dr_ = NR::createNR(diffusion_port_); #endif // !NS_DIFFUSION } #ifndef NS_DIFFUSION int main(int argc, char **argv) { Packet1ReceiverApp *app; app = new Packet1ReceiverApp(argc, argv); app->run(); return 0; } #endif // !NS_DIFFUSION #ifndef _PACKET1_RECEIVER_HH_ #define _PACKET1_RECEIVER_HH_ #ifdef HAVE_CONFIG_H #include "config.h" #endif // HAVE_CONFIG_H #include "ping.hh" class Packet1ReceiverReceive; class Packet1ReceiverApp : public DiffApp { public: #ifdef NS_DIFFUSION Packet1ReceiverApp(); int command(int argc, const char*const* argv); #else Packet1ReceiverApp(int argc, char **argv); #endif // NS_DIFFUSION void recv(NRAttrVec *data, NR::handle my_handle); void run(); private: // NR Specific variables Packet1ReceiverReceive *mr_; handle subHandle_; // Packet1 App variables int l
[ns] HELP:Problem in using xgraph
Hi all, i am having problems in using the xgraph utility.i have configured and compiled the package.After that,i have entered the path name in the bash profile file by entering the following line*:/home/aritra/ns- allinone-2.26/xgraph-12.1.* But,it is still giving the error stating that xgraph is not found.if there is some error in the statement,please specify it. -aritra.
[ns] HELP:error in new application
Hi all, .i have created two new applications named packet1_sender.cc & packet1_receiver.cc after creating the requisite header files.but when used in a tcl program,the following error occurs: invalid command name "Application/DiffApp/Packet1Sender" while executing "Application/DiffApp/Packet1Sender create _o86 " invoked from within "catch "$className create $o $args" msg" (procedure "new" line 3) invoked from within "new Application/DiffApp/Packet1Sender" invoked from within "set src_(0) [new Application/DiffApp/Packet1Sender]" (file "simplediffusion2.tcl" line 190) please help.i am attaching the packet1 files.please have a look.thanks in advance. -aritra. #include "packet1_receiver.hh" #ifdef NS_DIFFUSION static class Packet1ReceiverAppClass : public TclClass { public: Packet1ReceiverAppClass() : TclClass("Application/DiffApp/Packet1Receiver") {} TclObject* create(int , const char*const* ) { return(new Packet1ReceiverApp()); } } class_packet1_receiver; int Packet1ReceiverApp::command(int argc, const char*const* argv) { if (argc == 2) { if (strcmp(argv[1], "subscribe") == 0) { run(); return TCL_OK; } } return DiffApp::command(argc, argv); } #endif // NS_DIFFUSION void Packet1ReceiverReceive::recv(NRAttrVec *data, NR::handle my_handle) { app_->recv(data, my_handle); } void Packet1ReceiverApp::recv(NRAttrVec *data, NR::handle my_handle) { NRSimpleAttribute *counterAttr = NULL; NRSimpleAttribute *timeAttr = NULL; EventTime *probe_event; long delay_seconds; long delay_useconds; float total_delay; struct timeval tmv; GetTime(&tmv); counterAttr = AppCounterAttr.find(data); timeAttr = TimeAttr.find(data); if (!counterAttr || !timeAttr){ DiffPrint(DEBUG_ALWAYS, "Received a BAD packet !\n"); PrintAttrs(data); return; } // Calculate latency probe_event = (EventTime *) timeAttr->getVal(); delay_seconds = tmv.tv_sec; delay_useconds = tmv.tv_usec; if ((delay_seconds < probe_event->seconds_) || ((delay_seconds == probe_event->seconds_) && (delay_useconds < probe_event->useconds_))){ // Time's not synchronized delay_seconds = -1; delay_useconds = 0; DiffPrint(DEBUG_ALWAYS, "Error calculating delay !\n"); } else{ delay_seconds = delay_seconds - probe_event->seconds_; if (delay_useconds < probe_event->useconds_){ delay_seconds--; delay_useconds = delay_useconds + 100; } delay_useconds = delay_useconds - probe_event->useconds_; } total_delay = (float) (1.0 * delay_seconds) + ((float) delay_useconds / 100.0); // Check if this is the first message received if (first_msg_recv_ < 0){ first_msg_recv_ = counterAttr->getVal(); } // Print output message if (last_seq_recv_ >= 0){ if (counterAttr->getVal() < last_seq_recv_){ // Multiple sources detected, disabling statistics rp = 1; last_seq_recv_ = -1; DiffPrint(DEBUG_ALWAYS, "Received data %d, total latency = %f!\n", counterAttr->getVal(), total_delay); } else{ last_seq_recv_ = counterAttr->getVal(); num_msg_recv_++; DiffPrint(DEBUG_ALWAYS, "Received data: %d, total latency = %f, %% messages received: %f !\n", last_seq_recv_, total_delay, (float) ((num_msg_recv_ * 100.00) / ((last_seq_recv_ - first_msg_recv_) + 1))); } } else{ DiffPrint(DEBUG_ALWAYS, "Received data %d, total latency = %f !\n", counterAttr->getVal(), total_delay); } } handle Packet1ReceiverApp::setupSubscription() { NRAttrVec attrs; path_ = 0; attrs.push_back(NRClassAttr.make(NRAttribute::IS, NRAttribute::INTEREST_CLASS)); attrs.push_back(LatitudeAttr.make(NRAttribute::GT, 54.78)); attrs.push_back(LongitudeAttr.make(NRAttribute::LE, 87.32)); attrs.push_back(TargetAttr.make(NRAttribute::IS, "F117A")); handle h = dr_->subscribe(&attrs, mr_); ClearAttrs(&attrs); return h; } void Packet1ReceiverApp::run() { subHandle_ = setupSubscription(); #ifndef NS_DIFFUSION // Do nothing while (1){ sleep(1000); } #endif // !NS_DIFFUSION } #ifdef NS_DIFFUSION Packet1ReceiverApp::Packet1ReceiverApp() #else Packet1ReceiverApp::Packet1ReceiverApp(int argc, char **argv) #endif // NS_DIFFUSION { last_seq_recv_ = 0; num_msg_recv_ = 0; first_msg_recv_ = -1; mr_ = new Packet1ReceiverReceive(this); #ifndef NS_DIFFUSION parseCommandLine(argc, argv); dr_ = NR::createNR(diffusion_port_); #endif // !NS_DIFFUSION } #ifndef NS_DIFFUSION int main(int argc, char **argv) { Packet1ReceiverApp *app; app = new Packet1ReceiverApp(argc, argv); app->run(); return 0; } #endif // !NS_DIFFUSION #include "packet1_sender.hh" #include #ifdef NS_DIFFUSION static class Packet1SenderAppClass : public TclClass { public: Packet1SenderAppClass() : TclClass("Application/DiffApp/Packet1Sender") {} TclObject* create(int ,
[ns] HELP:Error in running wireless tcl file
Hello everybody,I* *am working on wireless sensor networks and am presently studying the directed diffusion protocol.while running the "*ns-2.26/tcl/ex/diffusion/simple-diffusion.tcl*" file, it is giving the following error regarding the use of the channel variable: num_nodes is set 3 warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl can't read "chan": no such variable while executing "$node add-interface $chan $propInstance_ $llType_ $macType_ $ifqType_ $ifqlen_ $phyType_ $antType_ $inerrProc_ $outerrProc_ $FECProc_" (procedure "_o3" line 70) (Simulator create-wireless-node line 70) invoked from within "_o3 create-wireless-node 0" ("eval" body line 1) invoked from within "eval $self create-wireless-node $args" (procedure "_o3" line 14) (Simulator node line 14) invoked from within "$ns_ node $i" ("for" body line 2) invoked from within "for {set i 0} {$i < $opt(nn) } {incr i} { set node_($i) [$ns_ node $i] $node_($i) color black $node_($i) random-motion 0 ;# disable random ..." (file "simple-diffusion.tcl" line 10 please help. -your`s, aritra.
[ns] Problem regarding make.
hello all , I am facing a problem regarding the ns-2.26.i have created a new packet format and want to implement the new agent in the ns-2.26 to be used in subsequent simulations.for that, i have to modify some file contents and do a 'make depend' before doing 'make'for doing that,i went to the ns-2.26 directory and had executed the command by writing ./make clean ./make depend ./make but on executing each of these commands,its is giving an error stating:cant find make. i am in total darkness regarding this.please help!! -aritra.
[ns] how to run makefile & makedepend?
hi all, i have created a new data packet format to use it as an agent.inamed it packet1.now after creating the requisite packety.h, packet.cc files,i want to incorporate it in the ns.for this i edited the packet.h, makefile files.now it is recommended to run the makefile & makedepend files.pleasecan someone help me on how to do this??thanks in advance, -aritra.