Commit 6c8fe559 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Add new stair types

- Escalator:
        <escalator_upstairs mu="1" sigma="0.0" />
        <escalator_downstairs mu="0.5" sigma="0.0" />

- Idle escalator
        <v0_idle_escalator_upstairs mu="1.5" sigma="0.0" />
        <v0_idle_escalator_downstairs mu="0.8" sigma="0.0" />

Todo: We need to introduce a new property to pedestrians. Some pedestrians
      walk in escalators and some stand. Therefore we should have for
      the first type
      v0 = v0 + escalator_upstairs; or
      v0 = v0 + escalator_downstairs;
      and for the second
      v0 = escalator_upstairs; or
      v0 = escalator_downstairs;
parent 359db3cd
......@@ -692,7 +692,7 @@ void ArgumentParser::ParseAgentParameters(TiXmlElement* operativModel)
agentParameters->InitV0(mu,sigma);
agentParameters->InitV0DownStairs(mu,sigma);
agentParameters->InitV0UpStairs(mu,sigma);
Log->Write("INFO: \tdesired velocity mu=%f , sigma=%f",mu,sigma);
Log->Write("INFO: \tdesired speed mu=%f , sigma=%f",mu,sigma);
}
if (xAgentPara->FirstChild("v0_upstairs"))
......@@ -700,7 +700,7 @@ void ArgumentParser::ParseAgentParameters(TiXmlElement* operativModel)
double mu = xmltof(xAgentPara->FirstChildElement("v0_upstairs")->Attribute("mu"),pV0Mu);
double sigma = xmltof(xAgentPara->FirstChildElement("v0_upstairs")->Attribute("sigma"),pV0Sigma);
agentParameters->InitV0DownStairs(mu,sigma);
Log->Write("INFO: \tdesired velocity upstairs mu=%f , sigma=%f",mu,sigma);
Log->Write("INFO: \tdesired speed upstairs mu=%f , sigma=%f",mu,sigma);
}
if (xAgentPara->FirstChild("v0_downstairs"))
......@@ -708,9 +708,38 @@ void ArgumentParser::ParseAgentParameters(TiXmlElement* operativModel)
double mu = xmltof(xAgentPara->FirstChildElement("v0_downstairs")->Attribute("mu"),pV0Mu);
double sigma = xmltof(xAgentPara->FirstChildElement("v0_downstairs")->Attribute("sigma"),pV0Sigma);
agentParameters->InitV0UpStairs(mu,sigma);
Log->Write("INFO: \tdesired velocity downstairs mu=%f , sigma=%f",mu,sigma);
Log->Write("INFO: \tdesired speed downstairs mu=%f , sigma=%f",mu,sigma);
}//------------------------------------------------------------------------
if (xAgentPara->FirstChild("escalator_upstairs"))
{
double mu = xmltof(xAgentPara->FirstChildElement("escalator_upstairs")->Attribute("mu"), pV0Mu);
double sigma = xmltof(xAgentPara->FirstChildElement("escalator_upstairs")->Attribute("sigma"), pV0Sigma);
agentParameters->InitEscalatorUpStairs(mu, sigma);
Log->Write("INFO: \tspeed of escalator upstairs mu=%f , sigma=%f", mu, sigma);
}
if (xAgentPara->FirstChild("escalator_downstairs"))
{
double mu = xmltof(xAgentPara->FirstChildElement("escalator_downstairs")->Attribute("mu"), pV0Mu);
double sigma = xmltof(xAgentPara->FirstChildElement("escalator_downstairs")->Attribute("sigma"),pV0Sigma);
agentParameters->InitEscalatorDownStairs(mu,sigma);
Log->Write("INFO: \tspeed of escalator downstairs mu=%f , sigma=%f", mu, sigma);
}
if (xAgentPara->FirstChild("v0_idle_escalator_upstairs"))
{
double mu = xmltof(xAgentPara->FirstChildElement("v0_idle_escalator_upstairs")->Attribute("mu"),pV0Mu);
double sigma = xmltof(xAgentPara->FirstChildElement("v0_idle_escalator_upstairs")->Attribute("sigma"),pV0Sigma);
agentParameters->InitV0IdleEscalatorUpStairs(mu, sigma);
Log->Write("INFO: \tdesired speed idle escalator upstairs mu=%f , sigma=%f", mu, sigma);
}
if (xAgentPara->FirstChild("v0_idle_escalator_downstairs"))
{
double mu = xmltof(xAgentPara->FirstChildElement("v0_idle_escalator_downstairs")->Attribute("mu"),pV0Mu);
double sigma = xmltof(xAgentPara->FirstChildElement("v0_idle_escalator_downstairs")->Attribute("sigma"),pV0Sigma);
agentParameters->InitV0IdleEscalatorDownStairs(mu,sigma);
Log->Write("INFO: \tdesired speed idle escalator downstairs mu=%f , sigma=%f", mu, sigma);
}
//------------------------------------------------------------------------
//bmax
if (xAgentPara->FirstChild("bmax"))
{
......
......@@ -491,9 +491,9 @@ bool Building::LoadGeometry(const std::string &geometryfile)
SubRoom* subroom = NULL;
if (type == "stair") {
if (type == "stair" || type == "escalator" || type == "idle_escalator") {
if(xSubRoom->FirstChildElement("up")==NULL) {
Log->Write("ERROR:\t the attribute <up> and <down> are missing for the stair");
Log->Write("ERROR:\t the attribute <up> and <down> are missing for the " + type);
Log->Write("ERROR:\t check your geometry file");
return false;
}
......
......@@ -40,7 +40,7 @@
using namespace std;
#define MAX_AGENT_COUNT 1000000
#define MAX_AGENT_COUNT 0 // 1000000
LCGrid::LCGrid(double boundaries[4], double cellsize, int nPeds)
{
......
......@@ -64,6 +64,26 @@ void AgentsParameters::InitV0DownStairs(double mean, double stdv)
_V0DownStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitEscalatorUpStairs(double mean, double stdv)
{
_EscalatorUpStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitEscalatorDownStairs(double mean, double stdv)
{
_EscalatorDownStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitV0IdleEscalatorUpStairs(double mean, double stdv)
{
_V0IdleEscalatorUpStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitV0IdleEscalatorDownStairs(double mean, double stdv)
{
_V0IdleEscalatorDownStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitBmax(double mean, double stdv)
{
_Bmax= std::normal_distribution<double>(mean,stdv);
......@@ -104,6 +124,28 @@ double AgentsParameters::GetV0DownStairs()
return _V0DownStairs(_generator);
}
double AgentsParameters::GetEscalatorUpStairs()
{
return _EscalatorUpStairs(_generator);
}
double AgentsParameters::GetEscalatorDownStairs()
{
return _EscalatorDownStairs(_generator);
}
double AgentsParameters::GetV0IdleEscalatorUpStairs()
{
return _V0IdleEscalatorUpStairs(_generator);
}
double AgentsParameters::GetV0IdleEscalatorDownStairs()
{
return _V0IdleEscalatorDownStairs(_generator);
}
double AgentsParameters::GetBmax()
{
return _Bmax(_generator);
......
......@@ -77,6 +77,34 @@ public:
*/
void InitV0DownStairs(double mean, double stv);
/**
* Initialize the speed distribution of escalators upstairs
* @param mean, mean value
* @param stv, standard deviation
*/
void InitEscalatorUpStairs(double mean, double stv);
/**
* Initialize the speed distribution of escalators downstairs
* @param mean, mean value
* @param stv, standard deviation
*/
void InitEscalatorDownStairs(double mean, double stv);
/**
* Initialize the desired speed distribution walking idle escalators upstairs
* @param mean, mean value
* @param stv, standard deviation
*/
void InitV0IdleEscalatorUpStairs(double mean, double stv);
/**
* Initialize the desired speed distribution walking idle escalators downstairs
* @param mean, mean value
* @param stv, standard deviation
*/
void InitV0IdleEscalatorDownStairs(double mean, double stv);
/**
* Initialize the maximal value if the major axis
* @param mean, mean value
......@@ -127,6 +155,26 @@ public:
*/
double GetV0DownStairs();
/**
* @return a random number following the distribution
*/
double GetEscalatorUpStairs();
/**
* @return a random number following the distribution
*/
double GetEscalatorDownStairs();
/**
* @return a random number following the distribution
*/
double GetV0IdleEscalatorUpStairs();
/**
* @return a random number following the distribution
*/
double GetV0IdleEscalatorDownStairs();
/**
* @return a random number following the distribution
*/
......@@ -164,6 +212,10 @@ private:
std::normal_distribution<double> _V0;
std::normal_distribution<double> _V0UpStairs;
std::normal_distribution<double> _V0DownStairs;
std::normal_distribution<double> _EscalatorUpStairs;
std::normal_distribution<double> _EscalatorDownStairs;
std::normal_distribution<double> _V0IdleEscalatorUpStairs;
std::normal_distribution<double> _V0IdleEscalatorDownStairs;
std::normal_distribution<double> _Bmax;
std::normal_distribution<double> _Bmin;
std::normal_distribution<double> _Atau;
......
......@@ -85,6 +85,10 @@ Pedestrian::Pedestrian()
_spotlight = false;
_V0UpStairs=0.0;
_V0DownStairs=0.0;
_EscalatorUpStairs=0.0;
_EscalatorDownStairs=0.0;
_V0IdleEscalatorUpStairs=0.0;
_V0IdleEscalatorDownStairs=0.0;
_distToBlockade=0.0;
_routingStrategy=ROUTING_GLOBAL_SHORTEST;
......@@ -197,11 +201,15 @@ void Pedestrian::SetV(const Point& v)
}
}
void Pedestrian::SetV0Norm(double v0,double v0UpStairs, double v0DownStairs)
void Pedestrian::SetV0Norm(double v0, double v0UpStairs, double v0DownStairs, double escalatorUp, double escalatorDown, double v0IdleEscalatorUp, double v0IdleEscalatorDown)
{
_ellipse.SetV0(v0);
_ellipse.SetV0(v0);
_V0DownStairs=v0DownStairs;
_V0UpStairs=v0UpStairs;
_EscalatorUpStairs=escalatorUp;
_EscalatorDownStairs=escalatorDown;
_V0IdleEscalatorUpStairs=v0IdleEscalatorUp;
_V0IdleEscalatorDownStairs=v0IdleEscalatorDown;
}
void Pedestrian::Setdt(double dt)
......@@ -401,13 +409,26 @@ double Pedestrian::GetV0Norm() const
{
// printf("z=%f, f=%f, v0=%f, v0d=%f, ret=%f\n", ped_elevation, f, _ellipse.GetV0(), _V0DownStairs, (1-f)*_V0DownStairs + f*_ellipse.GetV0());
// getc(stdin);
return (1-f)*_V0DownStairs + f*_ellipse.GetV0();
double speed_down = _V0DownStairs;
if(sub->GetType() == "escalator"){
speed_down = _EscalatorDownStairs;
}
else if(sub->GetType() == "idle_escalator"){
speed_down = _V0IdleEscalatorDownStairs;
}
return (1-f)*speed_down + f*_ellipse.GetV0();
}
//we are walking upstairs
else
{
return (1-f)*_ellipse.GetV0() + f*_V0UpStairs;
{
double speed_up = _V0UpStairs;
if(sub->GetType() == "escalator"){
speed_up = _EscalatorUpStairs;
}
else if(sub->GetType() == "idle_escalator"){
speed_up = _V0IdleEscalatorUpStairs;
}
return (1-f)*_ellipse.GetV0() + f*speed_up;
}
}
// orthogonal projection on the stair
......
......@@ -70,7 +70,10 @@ private:
//double _V0;
double _V0UpStairs;
double _V0DownStairs;
double _EscalatorUpStairs;
double _EscalatorDownStairs;
double _V0IdleEscalatorUpStairs;
double _V0IdleEscalatorDownStairs;
//location parameters
std::string _roomCaption;
int _roomID;
......@@ -160,7 +163,7 @@ public:
void SetPos(const Point& pos, bool initial=false); // setzt x und y-Koordinaten
void SetCellPos(int cp);
void SetV(const Point& v); // setzt x und y-Koordinaten der Geschwindigkeit
void SetV0Norm(double v0,double v0UpStairs, double v0DownStairs);
void SetV0Norm(double v0, double v0UpStairs, double v0DownStairs, double escalatorUp, double escalatorDown, double v0IdleEscalatorUp, double v0IdleEscalatorDown);
void SetSmoothTurning(); // activate the smooth turning with a delay of 2 sec
void SetPhiPed();
void SetFinalDestination(int UID);
......
......@@ -203,9 +203,13 @@ Pedestrian* StartDistribution::GenerateAgent(Building* building, int* pid, vecto
ped->SetEllipse(E);
ped->SetTau(_groupParameters->GetTau());
ped->SetV0Norm(_groupParameters->GetV0(),
_groupParameters->GetV0DownStairs(),
_groupParameters->GetV0UpStairs());
_groupParameters->GetV0UpStairs(),
_groupParameters->GetV0DownStairs(),
_groupParameters->GetEscalatorUpStairs(),
_groupParameters->GetEscalatorDownStairs(),
_groupParameters->GetV0IdleEscalatorUpStairs(),
_groupParameters->GetV0IdleEscalatorDownStairs()
);
// first default Position
int index = -1;
......
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