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

📄 network.h

📁 传感器网络的可靠路由算法
💻 H
字号:

#ifndef _NETWORK_H_
#define _NETWORK_H_


#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "assert.h"
#include <vector>

#include "Routing.h"
#include "link.h"
#include "radio.h"
#include "simulation.h"

#include "fileio.h"
#include "application.h"

#include "Clique.h"
#include "PM.h"
#include "MaxClique.h"

#define MAX_NUM_NEIGHBORS  800

/*constant values*/

const int MAX =20000; 
const int MAX_NUM_NEXT_CHOICES = 200;
const double PI = 3.1415926;
const double MAXCOST = 10000;
const int INVALID_ID = -1;
const double CUT_OFF_THRESHOLD = 0.2; // link quallity threshold to cut one link off.



/* type of placement methods */
typedef enum {
  RANDOM,
  UNIFORM,
  GRID,
} PLACEMENT;



typedef enum{
ETX,
LAZY,
EQUAL,
GF_LINK,
} LINK_COST;


typedef struct item {
  int DenstinationID;
  int NextHop;
  double Delay;
  double Cost; //end-to-end cost

  double CliqueDelay;
  double CliqueCost;
} ROUTING_ITEM;

typedef struct Table {
  int NodeID;
  int numItems;
  ROUTING_ITEM routingItem[MAX_NUM_NEIGHBORS];
} ROUTING_TABLE;

/* structure for the node */
typedef struct NODE
{ 
//location information  
  double x;
  double y;
  
//Link layer control information
  int neighbor[MAX_NUM_NEIGHBORS];
  double LQI2neighbor[MAX_NUM_NEIGHBORS];
  int neighbornum;  
  
//Routing layer control information  
  ROUTING_TABLE rt;

//for deep first search
  int floodsend;
  int inqueue; 

  /* power state info*/
  int Period;
  int WakeupPoint;
  int WakeupDuration;
  
  /* for clique-based forwarding */
  CLIQUE_TYPE NextClique;

  double nexthopcost;
  double nexthopdelay;
 
  double destcost;
  double destdelay;
 
  int optimizednexthop;
  
  int distanthelper[100];
  int interhelper[100];

  int distantnum;
  int internum;

}  NODE_TYPE;


const double SEND_TIMEOUT = 5;

typedef struct network_type
{

/* application setting */
  int TRAFFIC_PATTERN;

/* network layout */
  int NUM_NODES;
  int PLACEMENT_TYPE;
  double TERRIAN_X; //network physical size
  double TERRIAN_Y; //network physical size
  int NET_ID;
  int SEED;

 /* routing settings */
  int ROUTING_TYPE;

/* Message Settings */
  int DATA_SIZE;  //average size of data packets
  int CTR_SIZE;   //average size of control packets

/* MAC/Radio settings */
  int LINK_MODEL;  /* How to model the link between nodes */
  int LINK_COST_MODEL; //How messages are transsmitted. 
  double LAMBDA;  // the size ratio between control and data packets
  int BANDWIDTH;

/* Energy Conservation Settings */
  bool PM_ENABLED;
  int PM_TYPE;
  long PM_PERIOD;
  long WAKEUP_DURATION;

/* utility */
//CURRENTLY COMPLETELY DISABLED FOR NOW 
  bool GUI_PRINTF;

} NETWORK_TYPE;

//End of File
/* functions*/
void NetworkInit(const char * filename);
void NodeInit();
void  PrintConfiguration();
#endif

⌨️ 快捷键说明

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