How to do custom statistic in OPNET

 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值