Corrections FBCM et FRBHM
Corrections diverses dans FBCM, FBCM Friis, FRBHM continu. git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@59 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
parent
83c40666a2
commit
affd061634
|
@ -1121,59 +1121,63 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
|
|||
}
|
||||
|
||||
/*second version of fbcm with as parameter vector<Measurement> &m and a list of friis index*/
|
||||
Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list)const
|
||||
Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list, const float &z)const
|
||||
{
|
||||
#ifdef DEBUG_T
|
||||
cout << "//--> Server::fbcm_friis()" << endl ; fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
Point ret(0, 0, 0);
|
||||
vector<string> addr;
|
||||
//vector<string> addr;
|
||||
vector<float> dist_vect;
|
||||
vector<Point> centres;
|
||||
unsigned int i, j, ap_idx;
|
||||
float constant_term, minmax_res, minmax_max;
|
||||
float x = MINMAX_X_START, y = MINMAX_Y_START, z = MINMAX_Z_START;
|
||||
float x = MINMAX_X_START, y = MINMAX_Y_START ;
|
||||
|
||||
i = 0;
|
||||
//cout << "FBCM: ";
|
||||
for (i = 0 ; i < m.size() ; i++){cout<<"m[i].getMacAddr()"<<m[i].getMacAddr()<<endl;
|
||||
for (i = 0 ; i < m.size() ; i++){//cout<<"m[i].getMacAddr()"<<m[i].getMacAddr()<<endl;
|
||||
if (apExists(m[i].getMacAddr()))
|
||||
{
|
||||
ap_idx = apIndex(m[i].getMacAddr());
|
||||
//cout << "AP idx: " << ap_idx << " ";
|
||||
centres.push_back(access_point_list[ap_idx].getCoordinates());
|
||||
addr.push_back(m[i].getMacAddr());
|
||||
constant_term = access_point_list[ap_idx].getOutputPower() + access_point_list[ap_idx].getAntennaGain() + 2;
|
||||
constant_term += 20 * log10((300000000.0 / (float) access_point_list[ap_idx].getFrequency()) / (4*M_PI));
|
||||
for(j=0; j<friis_idx_list.size() ; j++)
|
||||
{
|
||||
dist_vect.push_back(pow(10, (constant_term - m[i].getAverage()) / (10 * friis_idx_list[j])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ap_idx = apIndex(m[i].getMacAddr());
|
||||
//cout << "AP idx: " << ap_idx << " ";
|
||||
centres.push_back(access_point_list[ap_idx].getCoordinates());
|
||||
//addr.push_back(m[i].getMacAddr());
|
||||
constant_term = access_point_list[ap_idx].getOutputPower() + access_point_list[ap_idx].getAntennaGain() + 2;
|
||||
constant_term += 20 * log10((300000000.0 / (float) access_point_list[ap_idx].getFrequency()) / (4*M_PI));
|
||||
for(j=0; j<friis_idx_list.size() ; j++)
|
||||
{
|
||||
// cout << "Distance Push_backé --->> " <<
|
||||
dist_vect.push_back(pow(10, (constant_term - m[i].getAverage()) / (10 * friis_idx_list[j])));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (j = 0 ; j < dist_vect.size() ; j++)
|
||||
cout << "dist_vect du point d'accés: " << access_point_list[j].getCoordinates() << "--->>>" << dist_vect[j] <<endl;
|
||||
|
||||
|
||||
/* Then: min-max */
|
||||
minmax_res = 1000000;
|
||||
for (x = MINMAX_X_START ; x < MINMAX_X_STOP ; x += MINMAX_STEP)
|
||||
for (y = MINMAX_Y_START ; y < MINMAX_Y_STOP ; y += MINMAX_STEP)
|
||||
for(z = MINMAX_Z_START ; z <= MINMAX_Z_STOP ; z += MINMAX_Z_STEP)
|
||||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if (abs(centres[i].distance(x, y, z) - dist_vect[i]) > minmax_max)
|
||||
minmax_max = abs(centres[i].distance(x, y, z) - dist_vect[i]) ;
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
ret.setY(y);
|
||||
ret.setZ(z);
|
||||
minmax_res = minmax_max;
|
||||
}
|
||||
}
|
||||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if (abs(centres[i].distance(x, y, z) - dist_vect[i]) > minmax_max)
|
||||
minmax_max = abs(centres[i].distance(x, y, z) - dist_vect[i]) ;
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
ret.setY(y);
|
||||
ret.setZ(z);
|
||||
minmax_res = minmax_max;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear all vectors */
|
||||
addr.clear();
|
||||
// addr.clear();
|
||||
dist_vect.clear();
|
||||
centres.clear();
|
||||
//cout << "RESULTAT DU FRBHM ---> " << ret << endl ;
|
||||
|
@ -1554,7 +1558,7 @@ void Server::makeWaypointListFromFile(const string &filename)
|
|||
input_file.open(filename.c_str());
|
||||
if (input_file.fail())
|
||||
{
|
||||
cerr << "Error opening input file « " << filename << " » !" << endl ;
|
||||
cerr << "Error opening input file « " << filename << " » !" << endl ;
|
||||
#ifdef DEBUG_T
|
||||
cout << "//<-- Server::makeWaypointListFromFile()" << endl ; fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
@ -2106,12 +2110,18 @@ vector<float> Server::computeFriisFromRefList(const Point &p, const vector<Measu
|
|||
unsigned int ap_freq;
|
||||
string ap_mac;
|
||||
|
||||
|
||||
for (unsigned int i = 0 ; i < access_point_list.size() ; i++)
|
||||
{
|
||||
cout << "La distance entre le point d'accés: " << access_point_list[i].getCoordinates()<< "et le point -->" << p.distance(access_point_list[i].getCoordinates()) << endl;
|
||||
}
|
||||
|
||||
/* Compute an index for each ref point. List stored in friis_idx_list */
|
||||
/* Compute an index for Point p. List stored in friis_idx_list */
|
||||
for (unsigned int j = 0 ; j < reference_point_list.size() ; j++)
|
||||
{
|
||||
{
|
||||
pt_coords = reference_point_list[j].getCoordinates();
|
||||
//cout << "Distance entre le point de reference" << reference_point_list[j].getCoordinates() << "et le point: "<< j << "-->" << p.distance(pt_coords) << endl;
|
||||
if (pt_coords==p)
|
||||
{
|
||||
for (unsigned int i = 0 ; i < access_point_list.size() ; i++)
|
||||
|
@ -2250,10 +2260,11 @@ void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
|
|||
//computeFriisFromRefList() ;
|
||||
selectDistances(&dst_matrix, E_previous, E_current) ; // On récupère une sous-matrice de reference_point_matrix avec les distances entre les points de E_previous et E_current.
|
||||
position = fastViterbiLike(client_id, dst_matrix) ;
|
||||
cout << "Position: " << position << endl;
|
||||
friisFromList = computeFriisFromRefList(position, vm) ;
|
||||
//fbcm_friis(vm, friisFromList) ;
|
||||
Frbhmbasique = fbcm_friis(vm, friisFromList);
|
||||
cout << "Point selectioné: " << Frbhmbasique << endl;
|
||||
Frbhmbasique = fbcm_friis(vm, friisFromList, position.getZ());
|
||||
cout << "Point selectionné final: " << Frbhmbasique << endl;
|
||||
fichier.open(filename.c_str(), std::ios::app);
|
||||
if ( !fichier ){
|
||||
cerr << "Erreur de creation du fichier" << endl;
|
||||
|
@ -2266,12 +2277,12 @@ void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
|
|||
case ALGO_CONTINU_FRBHM : /* Application de l'algorithme FRBHM continu */
|
||||
cout << "--------FRBHM CONTINU------------" << endl ;
|
||||
//computeFriisFromRefList();
|
||||
computeTopologyDistances(&dst_matrix, E_previous, E_current) ; // On calcule les distances entre les points de E_previous et E_current, en tenant compte de la topologie).
|
||||
for (unsigned int i = 0 ; i < E_current.size() ; i++)
|
||||
{
|
||||
friisFromList = computeFriisFromRefList(E_current[i], vm) ;
|
||||
E_current[i] = fbcm_friis(vm, friisFromList) ;
|
||||
E_current[i] = fbcm_friis(vm, friisFromList,E_current[i].getZ()) ;
|
||||
}
|
||||
computeTopologyDistances(&dst_matrix, E_previous, E_current) ; // On calcule les distances entre les points de E_previous et E_current, en tenant compte de la topologie).
|
||||
pointFastViterbi = fastViterbiLike(client_id, dst_matrix) ;
|
||||
fichier.open(filename.c_str(), std::ios::app);
|
||||
cout << "Point selectionné: " << pointFastViterbi << endl;
|
||||
|
|
|
@ -31,9 +31,9 @@ typedef ClientInfo::float_index float_index ;
|
|||
|
||||
|
||||
#define DEFAULT_LOGFILE "log/radar_exp.csv" // Fichier de sortie
|
||||
#define DEFAULT_REF_POINT_FILE "csv/agreg/toutes.csv" // Fichier des points de référence
|
||||
#define DEFAULT_REF_POINT_FILE "csv/agreg/1m/toutes.csv" // Fichier des points de référence
|
||||
#define DEFAULT_AP_FILE "cfg/minipc.cfg" // Fichier de configuration des AP
|
||||
#define DEFAULT_TRACKING_FILE "csv/agreg/divagation.csv" // Fichier de prérégrination
|
||||
#define DEFAULT_TRACKING_FILE "csv/agreg/divagation/divagation9.csv" // Fichier de prérégrination
|
||||
#define DEFAULT_TOPOLOGY_FILE "cfg/topo.csv"
|
||||
#define DEFAULT_WAYPOINT_FILE "cfg/waypoints.csv"
|
||||
#define DEFAULT_IP "127.0.0.1"
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
Point kPointsAverage(const vector<Point> &vp)const;
|
||||
Point fbcm(const vector<Measurement> &m, const int &client_idx)const;
|
||||
Point fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list)const;
|
||||
Point fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list, const float &z)const;
|
||||
Point interlink(const vector<Measurement> &m, const int &client_idx)const;
|
||||
|
||||
void makeReferencePointListFromFile(const string &filename);
|
||||
|
|
Loading…
Reference in New Issue