Advertisement
Advertisement
| 05.05.2008 at 01:27PM PDT, ID: 23377675 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: |
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <math.h>
#include <string.h>
#include <omnetpp.h>
#include <fstream.h>
#include "packet_m.h"
#define TIMER_CONNECTION_REQUEST -1
#define PKT_FORWARD 0
#define PKT_FAIL 1
#define PKT_SUCCES 2
#define TIMER_CONN_RELEASE 3
#define interarrival 1
#define candidate_pathnumber 4
#define windowsize 20
#define min_BW 0.1
#define max_BW 2
class Doarc01 : public cSimpleModule
{
protected:
static int connection[100][100];
static int newarray[100][100];
static int pos[100];
static double RejCon;
static int ConnCounter,numoflinks;
static double totalBlockedBandwidth;
static double connectionRequest;
static double BP;
static double totalCarriedBandwidth,meanServiceTime;//windowsize
static double credit1[100][100],credit2[100][100],credit3[100][100],credit4[100][100],credit5[100][100];
static double residualBandwidth[100][100];
int pinX1[33];
int pinY1[33];
int NumNode;
int dimx;
int dimy;
int edgeDgree ;
double alpha;
double beta;
int Kscail;
int set[500],pathestimate[500],visited[100],predecessor[100],path[100],candidatepath[20][20];
int destination;
int final_index;
class network32
{
int window1[windowsize];
int window2[windowsize];
int window3[windowsize];
int window4[windowsize];
public:
network32()
{
for(int i=0;i<windowsize;i++)
{
window1[i]=0;
window2[i]=0;
window3[i]=0;
window4[i]=0;
}
}
void shift(int value)
{
if(final_index==0)
{
for(int q=0;q<windowsize-1;q++)
{
window1[i]=window1[i+1];
window1[windowsize]=value;
}
}
else if(final_index==1)
{
for(int q=0;q<windowsize-1;q++)
{
window2[i]=window2[i+1];
window2[windowsize]=value;
}
}
else if(final_index==2)
{
for(int q=0;q<windowsize-1;q++)
{
window3[i]=window3[i+1];
window3[windowsize]=value;
}
}
else if(final_index==3)
{
for(int q=0;q<windowsize-1;q++)
{
window4[i]=window4[i+1];
window4[windowsize]=value;
}
}
};
cMessage *generateConReq;
public:
Doarc01()
{
virtual void initialize();
virtual void handleMessage(cMessage *msg);
void random_node();
void sort(int pinXY[100][2]);
void randomEdge();
int dijkstra(int source, int destination);
void printpath(int x,int i,int p[],int b[],int cc);
int minimum(int a[],int m[]);
void Generate();
void candidatePath1(int source, int destination);
void load();
int calMinHop();
int dijkstra2(int source, int destination);
//////////////////////////////////////////////////////////////////////////////////////////////////////
int Doarc01::connection[100][100]=0;
int Doarc01::newarray[100][100]=0;
int Doarc01::pos[100]=0;
int Doarc01::ConnCounter=0;
int Doarc01::numoflinks=0;
double Doarc01::credit1[100][100]=5;
double Doarc01::credit2[100][100]=5;
double Doarc01::credit3[100][100]=5;
double Doarc01::credit4[100][100]=5;
double Doarc01::credit5[100][100]=5;
double Doarc01::residualBandwidth[100][100]=150;
double Doarc01::RejCon=0;
double Doarc01::BP=0;
double Doarc01::totalBlockedBandwidth=0;
double Doarc01::totalCarriedBandwidth=0;
double Doarc01::meanServiceTime=83.468;
//////////////////////////////////////////////////////////////////////////////////////////////////////
}
};
Define_Module(Doarc01);
Doarc01::Doarc01()
{
for(int i=1;i<100;i++)
for(int j=1;j<100;j++)
{
Doarc01::connection[i][j]=0;
Doarc01::newarray[i][j]=0;
Doarc01::credit1[i][j]=5;
Doarc01::credit2[i][j]=5;
Doarc01::credit3[i][j]=5;
Doarc01::credit4[i][j]=5;
Doarc01::credit5[i][j]=5;
Doarc01::residualBandwidth[i][j]=150;
}
for( i=0;i<100;i++)
Doarc01::pos[i]=0;
}
|