Commit 53ff3e2d authored by Arne Graf's avatar Arne Graf

fixed anti jitter speed up

parent d0e99ec6
......@@ -808,9 +808,18 @@ bool ArgumentParser::ParseGradientModel(TiXmlElement* xGradient) // @todo: chang
string c = xModelPara->FirstChildElement("force_wall")->Attribute("c");
pcWall = atof(c.c_str());
}
Log->Write("INFO: \tfrep_wall mu=%s, a=%0.2f, b=%0.2f c=%0.2f",nu.c_str(),paWall,pbWall,pcWall);
}
if (xModelPara->FirstChild("anti_clipping"))
{
if (!xModelPara->FirstChildElement("anti_clipping")->Attribute("slow_down_distance"))
pSlowDownDistance = .2; //default value
else {
string slow_down_distance = xModelPara->FirstChildElement("anti_clipping")->Attribute("slow_down_distance");
pSlowDownDistance = atof(slow_down_distance.c_str());
}
Log->Write("INFO: \tAnti Clipping: SlowDown Distance=%0.2f",pSlowDownDistance);
}
//Parsing the agent parameters
ParseAgentParameters(xGradient);
......
......@@ -99,6 +99,7 @@ private:
double pDeltaH;
double pWallAvoidDistance;
bool pUseWallAvoidance;
double pSlowDownDistance;
int pLog;
int pPort;
int _embedMesh;
......
......@@ -155,7 +155,7 @@ void GradientModel::ComputeNextTimeStep(double current, double deltaT, Building*
double normVi = ped->GetV().ScalarProduct(ped->GetV()); //squared
double HighVel = (ped->GetV0Norm() + delta) * (ped->GetV0Norm() + delta); //(v0+delta)^2
if (normVi > HighVel && ped->GetV0Norm() > 0) {
if (normVi > HighVel && ped->GetV0Norm() > 0) { //@todo: ar.graf disabled check
fprintf(stderr, "GradientModel::calculateForce_LC() WARNING: actual velocity (%f) of iped %d "
"is bigger than desired velocity (%f) at time: %fs\n",
sqrt(normVi), ped->GetID(), ped->GetV0Norm(), current);
......@@ -204,9 +204,9 @@ void GradientModel::ComputeNextTimeStep(double current, double deltaT, Building*
//result_acc.push_back(acc);
result_acc.push_back(repPed); //only orientation is of interest
// if (p == 6) {
// printf("%f \n", repPed.Norm());
// }
//if (ped->GetID() == 48) {
// printf("%f \n", repPed.Norm());
//}
}
// update
......@@ -230,13 +230,14 @@ void GradientModel::ComputeNextTimeStep(double current, double deltaT, Building*
}
movDirection = (movDirection + toTarget);
movDirection = (movDirection + toTarget); //*1.2);
movDirection = (movDirection.Norm() > 1.) ? movDirection.Normalized() : movDirection;
//anti jitter //_V0 = _V0 + (new_v0 - _V0)*( 1 - exp(-t/_tau) );
Point diff = (ped->GetV() - movDirection) * (.35/ped->GetTau());
//printf("high: %f\n", diff.Norm());
movDirection += diff;
Point oldMov = (ped->GetV().Norm() > 1.)? ped->GetV().Normalized() : ped->GetV();
Point diff = ( oldMov - movDirection) * (.2); // .8 also 80% alte Richtung, 20% neue Richtung
movDirection = ped->GetV() - diff;
movDirection = (movDirection.Norm() > 1.) ? movDirection.Normalized() : movDirection;
//slowdown near wall mechanics:
Point dir2Wall = dynamic_cast<DirectionFloorfield*>(_direction)->GetDir2Wall(ped);
......@@ -250,14 +251,13 @@ void GradientModel::ComputeNextTimeStep(double current, double deltaT, Building*
movDirection = movDirection * (antiClippingFactor * ped->GetV0Norm() * deltaT);
//movDirection.SetX(antiClippingFactor * movDirection.GetX() * ped->GetV0Norm() * deltaT);
//movDirection.SetY(antiClippingFactor * movDirection.GetY() * ped->GetV0Norm() * deltaT);
//if(ped->GetID() == 48) { // Mohcine
// fprintf(stderr, "%f %f %f %f %f %f %f \n", movDirection.GetX(), movDirection.GetY(), ped->GetV().GetX(), ped->GetV().GetY(), ped->GetPos().GetX(), ped->GetPos().GetY(), current);
//}
//----------------- update new pos and new vel -----------------
//Point v_neu = ped->GetV() + vToAdd;
//printf("v_neu=[%f, %f], v=[%f, %f], toAdd=[%f, %f]\n", v_neu.GetX(), v_neu.GetY(), ped->GetV().GetX(), ped->GetV().GetY(), vToAdd.GetX(), vToAdd.GetY());
//Point pos_neu = ped->GetPos() + v_neu * deltaT;
Point pos_neu = ped->GetPos() + movDirection;
//---------------------------------------------------------------
......
......@@ -898,6 +898,6 @@ void FloorfieldViaFM::testoutput(const char* filename1, const char* filename2, c
file.close();
file2.close();
std::cerr << "INFO: \tFile closed: " << filename1 << std::endl;
//std::cerr << "INFO: \tFile closed: " << filename1 << std::endl;
}
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