Commit c42bb3e9 authored by jben's avatar jben

status

parent 06b284af
......@@ -130,23 +130,44 @@ int main(int argc, char* argv[])
abort();
}
model m_model(mode,d_VplatKMH,d_masse,d_Cr,d_SCx,d_rho_air,d_vent_from,d_vent_VKMH);
double d_total_dist=0;
std::list<unsigned long long> l_id;
std::list<double> l_distances;
database D_db(s_db);
{ // to destroy database object
database D_db(s_db);
std::list<unsigned long long> l_id=D_db.find_nodes(l_points);
l_id=D_db.find_nodes(l_points);
//for(std::list<unsigned long long>::iterator it=l_id.begin();it!=l_id.end();it++)
//{
// printf("%llu\n",*it);
//}
model m_model(mode,d_VplatKMH,d_masse,d_Cr,d_SCx,d_rho_air,d_vent_from,d_vent_VKMH);
unsigned long long previous=0;
// calcul des distances pour le status
for(std::list<unsigned long long>::iterator it_id=l_id.begin();it_id!=l_id.end();it_id++)
{
if(it_id==l_id.begin())
{
previous=*it_id;
continue;
}
double d_d=m_model.dist_node(D_db.get_node(*it_id),D_db.get_node(previous));
l_distances.push_back(d_d);
d_total_dist+=d_d;
previous=*it_id;
}
}
unsigned long long previous=0;
etat_cycliste e_courant;
int troncon=0;
double d_status_offset=0;
std::list<double>::iterator it_dist=l_distances.begin();
printf("#troncon\tnode_id\tlon\tlat\theight\tway_from\tway_from_rev\tvitesse\tdistance\tdeniv\tenergie\ttps\n");
for(std::list<unsigned long long>::iterator it_id=l_id.begin();it_id!=l_id.end();it_id++)
{
......@@ -156,13 +177,17 @@ int main(int argc, char* argv[])
continue;
}
double d_status_echelle=(*it_dist++)/d_total_dist;
route r_route(s_db,m_model,previous,*it_id);
r_route.set_status(d_status_echelle,d_status_offset);
r_route.set_etat_init(e_courant);
r_route.go();
e_courant=r_route.get_etat_final();
d_status_offset+=d_status_echelle;
std::list<instant> & lI_result = r_route.get_result();
......
......@@ -41,7 +41,8 @@ void route::go()
if(d_nstatus>d_status)
{
d_status=d_nstatus;
printf("### status %.3f\n",d_nstatus);
double d_realstatus = d_status*d_status*d_status_echelle+d_status_offset;
printf("### status %.3f\n",d_realstatus);
}
// Si on vient de geler le noeud de fin, on s'arrete la.
......
......@@ -26,6 +26,9 @@ class route
etat_cycliste e_init;
etat_cycliste e_final;
double d_status_echelle;
double d_status_offset;
public:
route(const std::string & s_db, const model & m_model_i, const unsigned long long & ull_id_1, const unsigned long long & ull_id_2) :
m_model(m_model_i),
......@@ -34,7 +37,9 @@ class route
d_deniv(0),
d_energie(0),
ull_depart(ull_id_1),
ull_arrivee(ull_id_2)
ull_arrivee(ull_id_2),
d_status_echelle(1),
d_status_offset(0)
{}
std::list<instant> & get_result() { return lI_result;}
......@@ -43,6 +48,10 @@ class route
double get_energie() { return d_energie; }
etat_cycliste get_etat_final() { return e_final; }
void set_etat_init(const etat_cycliste & e_init_i) {e_init=e_init_i;}
void set_status(const double & d_status_echelle_i, const double & d_status_offset_i) {
d_status_echelle=d_status_echelle_i;
d_status_offset=d_status_offset_i;
}
void go();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment