rece_2

2023-10-06 02:30
文章标签 rece

本文主要是介绍rece_2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

节点模型 lmz_cct_rx

这里写图片描述

进程模型 bbbccc_csma_rx

这里写图片描述

SV

这里写图片描述

TV

char node_name[128];
char module_name[128];

HB


#define IN_STRM 0
#define OUT_STRM 0#define PKT_RCVD (op_intrpt_type () == OPC_INTRPT_STRM)int subm_pkts;
int sending;
int sended;//int beacon;

INIT


rcvd_pkts = 0;sh_pack_rece_time = op_stat_reg ("Pack Rece Time", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);sh_pack_rece_num = op_stat_reg ("Pack Rece Num", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);sh_pack_delay = op_stat_reg ("Pack Delay", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);my_id = op_id_self ();
p_id = op_topo_parent(my_id);
op_ima_obj_attr_get (p_id, "name", node_name); 
op_ima_obj_attr_get (my_id, "name", module_name); 
printf("%s ",node_name);
printf("%s ",module_name);
printf("initing...\n");

PACK_ARVL

Packet* in_pkt;     
Packet* ack_pkt;    
double ete_delay;   
int node_flag;
int node_src;
double cre_time;in_pkt = op_pk_get (IN_STRM);       
op_pk_nfd_get_int32 (in_pkt, "flag", &node_flag);//csma data packet
if (node_flag == 0){op_pk_nfd_get_int32 (in_pkt, "src", &node_src);op_pk_nfd_get (in_pkt, "time", &cre_time);ete_delay = op_sim_time () - cre_time;op_pk_print (in_pkt);printf("current time is %f\n",op_sim_time ());//printf("creation time is %f\n",cre_time);//printf("delay time is %f\n",ete_delay);//op_pk_destroy (in_pkt);++rcvd_pkts;ack_pkt = op_pk_create_fmt ("aaa_csma_ca_ack");op_pk_nfd_set (ack_pkt, "dest", node_src);op_pk_print (ack_pkt);op_pk_send(ack_pkt,OUT_STRM);printf("sending ack packet...");op_stat_write (sh_pack_rece_time, 1);op_stat_write (sh_pack_rece_num, rcvd_pkts);op_stat_write (sh_pack_delay, ete_delay);}//ack packet        
if (node_flag == 1){printf("ack packet received!");op_pk_destroy (in_pkt);}//beacon packet
if (node_flag == 3){printf("beacon packet received!");op_pk_destroy (in_pkt);}       //////////////////////////////////////////////////      
if (node_flag == 4){op_pk_destroy (in_pkt);}
//////////////////////////////////////////////////
if (node_flag == 5){++rcvd_pkts;ete_delay = op_sim_time () - op_pk_creation_time_get(in_pkt);op_pk_print(in_pkt);printf("received packet number is %d\n",rcvd_pkts);printf("packet delay is %f\n",ete_delay);printf("current time is %f\n",op_sim_time ());op_stat_write (sh_pack_rece_time, 1);op_stat_write (sh_pack_rece_num, rcvd_pkts);op_stat_write (sh_pack_delay, ete_delay);op_pk_destroy (in_pkt);}

这篇关于rece_2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/152625

相关文章

StandardServer.await: Invalid command 'GET /setting/webSocket HTTP/1.1' rece

今天跑项目,无意间发现访问时会报  StandardServer.await: Invalid command 'GET /setting/webSocket HTTP/1.1' rece错误,最后得知是端口冲突,我用的是8005,而系统默认的shutdown端口也是8005,然而这个端口是老大也在的,然后我上了老大的机器,发现他的shutdown已经改成了7005.。。。害人不浅!