Search code examples
c++network-programmingns2energy

Is it possible to add afield in wireless trace format in ns2?


Actually, I want to add some functions into the energy model... I added functions in the class energy-model.h as

"inline double erel()"
"virtual void NodeReliab(...)" and a variable "double erel_;"

then declared the functions in the energy-model.cc. Afterthat, I changed a line in the cmu-trace.cc file to include erel() value in trace format as,

sprintf(pt_->buffer() + offset,
    "[hi: energy %f ei %.3f es %.3f et %.3f **erel %.3f** er %.3f] ",
    thisnode->energy_model()->energy(),
    thisnode->energy_model()->ei(),
    dthisnode->energy_model()->es(),
    thisnode->energy_model()->et(),
    thisnode->energy_model()->erel(), // <<<<<<<<<<<<<
    thisnode->energy_model()->er());

after executing make it does not display erel value in the trace file, it displays as usual. However, there is no error in make. How can I add a variable in the trace format?


Solution

  • successfully added a field in the wireless trace file format. After modification/addition of methods, classes, files, functions .... etc. the make should be executed as,

    $ make clean
    $ make 
    $ make install 
    

    then, it compiles all modified/added values/fns for ns2.35.