opnet之核心函数二

op_topo_object_count (objmtype)

/*Determine the number of mobile nodes*/
numnodes = op_topo_object_count(OPC_OBJTYPE_NDMOB);

可以获得指定对象类型对象的个数。
比如可以获得移动节点的个数。
配合op_topo_object (objmtype, index)可以为同一种类型的对象进行循环操作。

/* Loop through the bus transmitter channels and abort all transmissions. */
/* Obtain the number of bus transmitter channels in the model. */
txch_count = op_topo_object_count (OPC_OBJTYPE_BUTXCH); 
/* Loop through the channels and abort the transmission. */
for (i = 0; i < txch_count; i++)
    {
    ch_id = op_topo_object (OPC_OBJTYPE_BUTXCH, i);
    op_ima_obj_command (ch_id, "abort");
    } 

lmz:

既可以获得节点层的对象也可以获得子网层的对象。

op_ima_sim_attr_get (attr_type, attr_name, value_ptr)

获取仿真属性的值

/*Read in the simulation attributes*/
op_ima_sim_attr_get(OPC_IMA_DOUBLE, "SIFS", &sifs);
op_ima_sim_attr_get(OPC_IMA_
  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值