⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 costants.h

📁 OMNET++仿真三色算法的源码,三色算法是无线传感器中一个典型的分簇算法
💻 H
字号:
/* ------ constants used in the simulator  ------ */#ifndef COSTANTSZ_H#define COSTANTSZ_H#define MOVE 2#define DATA 3
/* 定义显示格式 */

#define displayS "p=%d,%d;b=12,12,oval;o=%s,,1"
/* ------ message priorities ------ */#define P_MOVE 4#define P_DATA  3
/////////////////////定义控制数据包的大小 /////////////////////

#define CTRL_PKT_SIZE  512//////////////////////////////////////////////////////////////////////////
//HERE WE ADD SOME CONSTANTS OF THE APP


#define IDLE 1
#define CAND 2
#define HEAD 3
#define I_BAND  4 //IN THE CLUSTER'S O_BAND
#define O_BAND 5
#define LOCK  6

//#define HEAD 2
#define MEM  7
#define UNCLUSTERED 0

//the node in different state has different color

#define IDLE_COLOR  "yellow"
#define CAND_COLOR  "white"
#define HEAD_COLOR  "red"
#define IBAND_COLOR "green"
#define OBAND_COLOR "blue"

//Define the node's role

#define C_HEAD  3
#define ROUTER  2
#define NODE    1


//Define the messages 

#define MSG_CAND  10
#define MSG_CONFLICT 11
#define MSG_HEAD  12
#define MSG_JOIN  13
#define MSG_I_JOIN 14
#define MSG_O_JOIN 15
#define MSG_HELLO  16 
#define MSG_DATA 17
#define MSG_START 18 
#define MSG_END 19

// the cluster is formed ,then sometimes the head will send hello msg

/* ------ message priorities ------ */
#define  P_RREP 1
#define  P_RREQ 2
#define  P_RERR 5
#define  P_RREP_ACK 0
#define  P_SEND_HELLO 6
#define  P_FLUSH  11
#define  P_DELETE 8
#define  P_ESP_ACK 9
#define  P_BLK_LIST 10
#define  P_HELLO 7

/* 我添加了部分优先级 */
#define  P_CAND 12
#define  P_JOIN 13
#define  P_CONFLICT 14
#define  P_HEAD  15
#define  P_HELLO 7


//define the Hello msg time constants

#define HELLO_TIMEOUT 100
#define IDLE_TIMEOUT  1000
#define CAND_TIMEOUT  500
#define TIMEOUT  10

///////////////////////////////////////////////////////////////////////////* ------ time costants ------ */
/*should include queueing delays, interrupt processing times and transfer  times*/#define NODE_TRAVERSAL_TIME 30e-03/* ------ other costants ------ */#define BROADCAST -1//#define DEBUG a #ifdef DEBUG	#define d(x) ev<<((parentModule()->id()-2)/5)<<","<<name()<<":"<<x<<"\n"#endif#ifndef DEBUG	#define d(x) /* x .*/#endif#define dd(x) ev<<((parentModule()->id()-2)/5)<<","<<name()<<":"<<x<<"\n"#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -