📄 basestation.h
字号:
//////////////////////////////////////////////////////////////////////
// Title: A Cooperative Negotiation Approach for Cellular Coverage Control
//
// Description: Using cooperative negotiation to dynamically control the cell size and
// shapes according to different call traffic distributions.
//
// Copyright: Copyright (c) 2002
// Company: Elec. Eng., Queen Mary, University of London
// @author Lin Du
// @version 1.0
//
//////////////////////////////////////////////////////////////////////
#if !defined(BaseStation_H_INCLUDED)
#define BaseStation_H_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Disable the warning message 4786
#pragma warning(disable:4786)
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include "Constants.h"
#include "TrafficUnit.h"
#include "BSAgent.h"
#include "TestBed.h"
#include "MAS_DF.h"
#include "Evaluator.h"
using namespace std;
// The maximum number of served MS for one BS
const static int MAX_SERVED_TU_NUMBER = (int)(AVG_CAPACITY/MIN_DEMAND) + 1;
class TrafficUnit;
class BSAgent;
class TestBed;
class MAS_DF;
typedef vector<TrafficUnit *> P_TU_V;
class BaseStation : public Point {
public:
// Average Transmitting Power of this BS, calculated according by traffic density nearby.
double avgTransPower;
// Default constructor and de-constructor.
BaseStation();
virtual ~BaseStation();
/*
* Initial the BS by X and Y in new coordinate.
*/
BaseStation(double X, double Y, double cap, int ID, int Color, MAS_DF *df);
/**
* Get information of nearby MS
*/
void findPossibleTU( TrafficUnit *tu[TU_NUMBER], double simTime);
/**
* Return the ID
*/
int getID() const;
/**
* Return the base station agent;
*/
BSAgent *getAgent() const;
/**
* Reset this base station
*/
void reset();
/**
* Read currScheme from BSAgent, and apply it to base station
*/
void applyCurrScheme();
/**
* Perform the assignment, only used for conventional allocation schemes (circular)
*/
void assignment();
/**
* save the assignment results into currentScheme, only used for the first time.
*/
void saveAssignment();
/**
* Return the physical capacity of this BS
*/
double getCapacity() const;
/**
* Return the utilization of this BS
*/
double getUtilization() const;
/**
* Return the number of the blocked MS near this BS
*/
double getBlocked();
/**
* Return the prospective load of possible TUs
*/
double getProspectiveLoad();
/**
* Return the color of this BS
*/
int getColor() const;
/**
* Receive message from communication link.
*/
void recvMsg(void *msg_buf);
/**
* Find the adjacent base stations.
*/
void findNeighbour(BaseStation *bs[BS_NUMBER]);
/**
* Return the local perceived demand of a neighbour
*/
double getNbrDemand(int nbr);
// friend class
friend class BSAgent;
/*
* friend opterators
*/
friend bool operator==(const BaseStation &bs1, const BaseStation &bs2);
friend bool operator!=(const BaseStation &bs1, const BaseStation &bs2);
friend bool operator==(const BaseStation &bs1, int ID);
friend bool operator!=(const BaseStation &bs1, int ID);
private:
int ID;
double capacity;
int Color;
double utilization;
P_TU_V possibleTU; // All the MS near this BS
double prospectiveLoad; // The local prospective load
BaseStation *Neighbour[6];
double nbrDemand[6]; // Neighbour load on local point of view.
BSAgent *agent;
};
#endif // !defined(BaseStation_H_INCLUDED)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -