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

📄 trafficunit.h

📁 Bubble Oscillation Algorithm. It is used to implement balancing load traffic, which is similar to wh
💻 H
字号:
//////////////////////////////////////////////////////////////////////
//  Title:        Geographic Load Balancing for Cellular Networks 
//		          by emulating the behavior of air bubbles 
//
//  Description:  This project is for dynamically balancing the traffic load 
//                  over a cellular network with fully adaptive antennas by 
//		    emulating the behaviours of a bubble array. Since 
//                  we assume fully adaptive base station antenna in this  
//                  version, antenna agent and simulator are not needed. 
//
//  Copyright:    Copyright (c) 2003
//  Company:      Elec. Eng. Dept., Queen Mary, University of London
//  @author       Lin Du (lin.du@elec.qmul.ac.uk)
//  @version      1.0
//
//////////////////////////////////////////////////////////////////////

#if !defined(TrafficUnit_H_INCLUDED)
#define TrafficUnit_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include <map>

using namespace std;

#include "Constants.h"
#include "Point.h"
#include "BaseStation.h"
#include "CallGenerator.h"

class BaseStation;

// class used to describ the subscription status
class Subscription {
public:
	bool isSubscribed;
	BaseStation *p_BS;
	Subscription() {
	  isSubscribed = false;
	  p_BS = NULL;
	}
};

class TrafficUnit : public Point{
public:
  /*
   * Constructors 
   */
  TrafficUnit();
  TrafficUnit(Point &loc, int ID);
  TrafficUnit(Point &loc, double dem, int ID);
  TrafficUnit(double X, double Y, int ID);
  TrafficUnit(double X, double Y, double dem, int ID);
  virtual ~TrafficUnit();

  int getID() const;
  
  // Change traffic unit's location.
  void move( double X, double Y );
  void move( Point &loc );

  // Return and set the demand of this mobile
  double getDemand() const;
  void setDemand(double dem);

  // Set the cell base station and serve/share status
  void assigned( BaseStation *bs );
  // clear the cell base station and serve/share status
  void drop( BaseStation *bs );

  /**
   * The BS providing service for this traffic unit.
   *    NULL_BS if this TU is blocked.
   */
  BaseStation *getServedBS(int index) const;

  // Return the call generator, used for saving and reseting state
  CallGenerator *getCallGenerator();

	// Check is this MS is talking or standing.
  bool isTalking(double currentTime);

  // Check is this TU has been served. INCLUDES SHARED!!!
  bool isServed() const;
  bool isServed(int index) const;

  // Check is this TU has been served by specific BS. INCLUDES SHARED!!!
  bool isServed(const BaseStation *bs) const;

  // Reset the subscription status
  void reset();

  friend bool operator==(const TrafficUnit &ms1, const TrafficUnit &ms2);
  friend bool operator!=(const TrafficUnit &ms1, const TrafficUnit &ms2);
  friend bool operator==(const TrafficUnit &ms1, int ID);
  friend bool operator!=(const TrafficUnit &ms1, int ID);
	friend class ForceInfo;

private:
  int ID;
  // Demand of this TU
  double demand;
  // Call generator, used to decide if this TU want to talk or not.
  CallGenerator callGen;
	Subscription status[MAX_SHARE_NUM];
};

#endif //!defined(TrafficUnit_H_INCLUDED)

⌨️ 快捷键说明

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