如何在ns2中添加无线跟踪格式的字段?

时间:2017-11-07 11:18:15

标签: networking simulation tracing ns2 energy

我正在努力在ns2中添加现有能源格式的字段。 默认格式类似于pmps_f::pmps_f(QWidget *parent) : QMainWindow(parent), ui(new Ui::pmps_f) { ui->setupUi(this); connect(ui->startbutton,SIGNAL(clicked(bool)), this, SLOT(start())); } pmps_f::~pmps_f() { delete ui; } //public function that pulls the Patient data from the patientsetup.ui interface void pmps_f::setData(const QString &fileName, const double &weightValue, const double &heightValue, const double &lbmValue, const double &bsaValue, const QString &genderName) { ui->file->setText(fileName); ui->weight->setText(QString::number(weightValue)); ui->height->setText(QString::number(heightValue)); ui->lbm->setText(QString::number(lbmValue)); ui->bsa->setText(QString::number(bsaValue)); ui->gender->setText(genderName); } //Sedation start confirmation check void pmps_f::start() { QMessageBox msgBox; msgBox.setText("Pressing continue will start the sedation process"); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); int ret = msgBox.exec(); switch(ret) { case QMessageBox::Ok: break; case QMessageBox::Cancel: break; } } 。我想在现有格式中添加另一个字段 Erel ,例如[energy 999.899140 ei 0.100 es 0.000 et 0.000 er 0.001] erel及其值]。 我在[energy 999.899140 ei 0.100 es 0.000 et 0.000 er 0.001energy-model.cc and .f files文件中添加了 erel 的函数和计算方法。 执行cmu-trace.cc and .h后,它不会显示任何错误;即使我没有在跟踪输出中找到添加的变量。

是否有人在ns2中进行跟踪?请帮帮我。

2 个答案:

答案 0 :(得分:0)

在ns-2.35 / tcl / lib / ns- *中可能需要一些条目吗?不确定你在[file] .cc中完成的“fprint”条目可以单独使用。

E.g。 ns-lib.tcl:此处显示默认条目...

  1384  # If exists a traceAllFile_, print $str to $traceAllFile_
  1385  Simulator instproc puts-ns-traceall { str } {
  1386      $self instvar traceAllFile_
  1387      if [info exists traceAllFile_] {
  1388          puts $traceAllFile_ $str
  1389      }
  1390  }

能源:

$ grep -n energy *                                 
ns-lib.tcl:323:#                  -energyModel    "EnergyModel"
ns-lib.tcl:357:Simulator instproc energyModel  {val} { $self set energyModel_  $val }                                                             
ns-lib.tcl:607:     energyModel_ initialEnergy_ txPower_ rxPower_ \
ns-lib.tcl:736: if [info exists energyModel_] {
ns-lib.tcl:747:         $node addenergymodel [new $energyModel_ $node \
ns-lib.tcl:1292:Simulator instproc energy-color-change {level1 level2} {
ns-lib.tcl:1341:        $self instvar energyModel_ 
ns-lib.tcl:1343:        if [info exists energyModel_] {

答案 1 :(得分:0)

成功添加了无线跟踪文件格式的字段。 修改/添加方法,类,文件,函数....等 make应该被执行为, $ make clean $ make $ make install 然后,它编译所有修改/添加的值/ fns。