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

📄 testbed.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(TestBed_H_INCLUDED)
#define TestBed_H_INCLUDED

// Disable the warning message
#pragma warning(disable:4786)

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

#include <cstdlib>
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>

#include "Constants.h"
#include "TrafficUnit.h"
#include "MAS_DF.h"
#include "MAS_AMS.h"

class BaseStation;
class TrafficUnit;
class MAS_DF;
class MAS_AMS;

class TestBed {
public:
  MAS_DF  *df;
  MAS_AMS *ams;

	/**
	 * Constructor and de-constructor
	 */
  TestBed();
  // Read BS scenario file, and setup all the objects.
  TestBed(char *BSScenarioFile, MAS_AMS *ams, MAS_DF *df);
	virtual ~TestBed();

  /**
	 * Read TU scenario file.
	 */
	void ReadMSScenario(char* TrafficScenarioFile);

  // Advance the simulting time (update the internal state of call generator)
  void advanceSimTime(int timeUnitNum, bool updateCallStatus);

	/**
   * simulating, now only used for evaluating the results of different approach.
   */
  void simulate(const bool doAssignment);

	// reset the subscription status of the network
	void reset();

  //  Output the current result into a macro file for gnuplot
  void writeGPResult( char *FileName );
  //  Output the macro file for matlab
  void writeMatlabResult( char *FileName );

	/**
	 * Return system capacity calculated with fitness.
   *  Note: need to call simulate first
	 */
	double getSystemCapacity() const;

  /**
   * Return total blocked TU.
   *  Note: need to call simulate first
   */
  double getBlockedNum() const;

	/*
	 * Return the number of the served TU by n BSs
	 */
	double getSharedNum(int n) const;

  // Return current simulting time in second
  double getTime() const;

  // transform the angle to BS neighbour index (0-5)
  static int ang2index( int ang ) {
    return ((ang + 30) % 360) / 60 ;
  }

	// friend class
  friend class MAS_AMS;
  friend class MAS_DF;

private:
  // Simulting time.
  double simTime;

	BaseStation *bs[BS_NUMBER];
	TrafficUnit *tu[TU_NUMBER];
	// system characteristic 
	double systemCapacity;
  double blockedTU;
	double sharedTU[MAX_SHARE_NUM];

  // Check the distance from TU to nearest BS, if the distance is less than 1 unit in agent's view, 
  //    add 1 to it. The purpose is to avoid any TU too close to BS.
  void checkMSDistance(Point &TU_loc);

};

#endif //!defined(TestBed_H_INCLUDED)

⌨️ 快捷键说明

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