How to do custom statistic in OPNET

来源:互联网 发布:mac暂存盘已满怎么办 编辑:程序博客网 时间:2024/04/30 08:23

 Nowadays, I'm doing a little much simulation in opnet.

Here, I find a way to do the custom statistic in OPNET, because I should statistic a value that the opnet does not provided by default.

There are 4 steps to do the custom statistic.

  1. In the Process Model where you should culculate the statistic, define a Stathandle in the State Variable. Here we define a Stathandle "avg_delay_gsh".
  2. Still in Process Model, define a "Global Statistic" by clicking Interface Menu, and choose the Global Statistics Menu Item. Here, we define it as "Average Delay".
  3. in the Enter Execs of the Init State, write the following code:
    avg_delay_gsh=op_stat_reg("Average Delay",OPC_STAT_INDEX_NONE,OPC_STAT_GLOBAL);
  4. In somewhere you should culculate the statistic value, write the following code:
    op_stat_write(avg_delay_gsh,delay);

Now, you have write the statistic value to your simulation system, in the graph tool, you can draw a plot of the statistic Average Delay now.

原创粉丝点击