forceinfo.cpp

来自「Bubble Oscillation Algorithm. It is used」· C++ 代码 · 共 63 行

CPP
63
字号
//////////////////////////////////////////////////////////////////////
//  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
//
//////////////////////////////////////////////////////////////////////

// ForceInfo.cpp: implementation of the ForceInfo class.
//
//////////////////////////////////////////////////////////////////////

#include "ForceInfo.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ForceInfo::ForceInfo() {
}

ForceInfo::~ForceInfo() {
}

//////////////////////////////////////////////////////////////////////
// Get the utility value = |repulsion| + Attraction's projection onto the radial repulsion
//////////////////////////////////////////////////////////////////////
double ForceInfo::getResultant() {
	double ang = repulsion.angle() - attraction.angle();  
	double projection = attraction.magnitude() * cos(Point::deg2Rad(ang));

	return repulsion.magnitude() + projection;
}

//////////////////////////////////////////////////////////////////////
// update the repulsion force whenever the environment changes
//////////////////////////////////////////////////////////////////////
void ForceInfo::setRepulsion(const Point &repForce) {
	repulsion.set( repForce );
}

//////////////////////////////////////////////////////////////////////
// set the attraction force.
//////////////////////////////////////////////////////////////////////
void ForceInfo::setAttraction(const Point &newAttForce) {
	attraction.set( newAttForce );
}

//////////////////////////////////////////////////////////////////////
// add one more attraction force to traffic info.
//////////////////////////////////////////////////////////////////////
void ForceInfo::addAttraction(const Point &attForce) {
	attraction += attForce;
}

⌨️ 快捷键说明

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