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

📄 callgenerator.h

📁 Bubble Oscillation Algorithm. It is used to implement balancing load traffic, which is similar to wh
💻 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
//
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
// Simple call generator, only used for snapshot simulation.
//////////////////////////////////////////////////////////////////////

// allGenerator.h: interface for the CallGenerator class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(CallGenerator_H_INCLUDED)
#define CallGenerator_H_INCLUDED

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

#include <cmath>
#include "BaseRndGen.h"

// mean value of call arrival rate, call number per second.
const static double CALL_ARRIVAL_RATE = 5.0 / 3600.0;
// mean value of call holding time in second.
const static double CALL_HOLDING_TIME = 120.0;
// minimum value of call holding time in second.
const static double MIN_HOLDING_TIME = 1.0;

class CallGenerator:public BaseRndGen {
public:
	CallGenerator();
	virtual ~CallGenerator();

  // decide if this MS want to talking or not.
  bool talking(double currentTime);

  // Return the state of this object
  void getState(bool *isTalking, double *prevTime, double *arrivalTime, double *holdingTime);

  // Reset the state of this object
  void reset(bool isTalking, double prevTime, double arrivalTime, double holdingTime);
  
private:
  // The flag of MS's wanting to talking or not.
  bool isTalking;
  // The arrival or stop time of the previous call 
  double prevTime;

  // The time between finishing this call and starting the next call, negative exponatial distribution
  double arrivalTime;
  // The duration of the current call, negative exponatial distribution
  double holdingTime;

  // The inverse format of the integral of PDF for the random value, must be define in sub-class
  //    return value: y = invIntegralPDF(x + IntegralPDF( lower limit of y )) 
  //                  where x is the probability, a uniformly distributed random number in [0-1.0]
  double invIntegralPDF(double x) {
    return (-1.0/lambda) * log(x); // PDF(x)=lambda*exp(-lambda*x);
  }

  // The lambda parameter in the IntegralFunction.
  double lambda;
};

#endif // !defined(CallGenerator_H_INCLUDED

⌨️ 快捷键说明

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