您的位置:首页 > 运维架构

opnet之作者设计csma

2016-12-17 13:56 597 查看
作者设计的:

自己设计的:

状态机



HB

/* Input stream from ideal generator module */
#define IN_STRM     0

/* Output stream to bus transmitter module */
#define OUT_STRM    0

/* Conditional macros */
#define PKT_ARVL (op_intrpt_type() == OPC_INTRPT_STRM)

/* Global Variable */
extern int subm_pkts;

/* Input statistic indices */
#define CH_BUSY_STAT    0

/* Conditional macros */
#define FREE (op_stat_local_read (CH_BUSY_STAT) == 0.0)
#define PKTS_QUEUED (!op_strm_empty (IN_STRM))
#define CH_GOES_FREE (op_intrpt_type () == OPC_INTRPT_STAT)


init

/* Get the maximum packet count, */
/* set at simulation run-time */
op_ima_sim_attr_get_int32 ("max packet count", &max_packet_count);


tx_pkt

Packet * out_pkt;

/* A packet has arrived for transmission.  Acquire */
/* the packet from the input stream, send the packet */
/* and update the global submitted packet counter. */
out_pkt = op_pk_get (IN_STRM);
op_pk_send (out_pkt, OUT_STRM);
++subm_pkts;

/* Compare the total number of packets submitted with */
/* the maximum set for this simulation run.  If equal */
/* end the simulation run. */
if (subm_pkts == max_packet_count)
{
op_sim_end ("Simulation ended when max packet count reached.", "", "", "");
}


仿真结果



tags:opnet
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  opnet