Commit 7c16ba28 authored by Ulrich Kemloh's avatar Ulrich Kemloh

parameter calibration for the quickestpath and Gompertz

parent 1be445a5
This diff is collapsed.
......@@ -10,8 +10,8 @@
<geometry>bateau.xml</geometry>
<!-- trajectories file and format -->
<trajectories format="xml-plain" embed_mesh="false" fps="8">
<file location="trajectories.xml" />
<!--<socket hostname="127.0.0.1" port="8989"/> -->
<!-- <file location="trajectories.xml" /> -->
<socket hostname="127.0.0.1" port="8989"/>
</trajectories>
<!-- where to store the logs -->
<logfile>log.txt</logfile>
......@@ -70,8 +70,8 @@
<group group_id="5" room_id="0" subroom_id="0" number="0" goal_id="" router_id="1" route_id="" motivation=""/>
<group group_id="0" room_id="0" subroom_id="0" number="0" goal_id="" router_id="1" route_id="" />
<group group_id="1" room_id="0" subroom_id="1" number="0" goal_id="" router_id="2" route_id="" patience="5"/>
<group group_id="2" room_id="0" number="500" goal_id="-1" router_id="2" patience="5"/>
<group group_id="3" room_id="1" subroom_id="1" number="20" goal_id="-1" router_id="2" patience="5"/>
<group group_id="2" room_id="0" number="1" goal_id="-1" router_id="2" patience="40"/>
<group group_id="3" room_id="1" subroom_id="1" number="10" goal_id="-1" router_id="2" patience="20"/>
</agents_distribution>
</agents>
......
......@@ -976,8 +976,14 @@ void GompertzModel::CalculateForceLC(double time, double tip1, Building* buildin
pos_neu = ped->GetPos();
}
//--------------------------------------- apparently this depends on the chosen model Issue 9 -----
// Jam is based on the current velocity
if ( v_neu.Norm() >= J_EPS_V){
//Jam is based on the current velocity
// if ( v_neu.Norm() >= J_EPS_V){
// ped->ResetTimeInJam();
// }else{
// ped->UpdateTimeInJam();
// }
if ( v_neu.Norm() >= ped->GetV0Norm()*0.5){
ped->ResetTimeInJam();
}else{
ped->UpdateTimeInJam();
......
......@@ -70,6 +70,7 @@ Pedestrian::Pedestrian() {
_V0=Point(0,0);
_lastPosition=Point(0,0);
_lastCellPosition=-1;
_recordingTime=5; //seconds
_knownDoors = map<int, NavLineState>();
......@@ -127,6 +128,12 @@ void Pedestrian::SetExitLine(const NavLine* l) {
void Pedestrian::SetPos(const Point& pos) {
_ellipse.SetCenter(pos);
//save the last values for the records
_lastPositions.push(pos);
unsigned int max_size= _recordingTime/_deltaT;
if(_lastPositions.size()> max_size)
_lastPositions.pop();
}
void Pedestrian::SetCellPos(int cp){
......@@ -135,6 +142,12 @@ void Pedestrian::SetCellPos(int cp){
void Pedestrian::SetV(const Point& v) {
_ellipse.SetV(v);
//save the last values for the records
_lastVelocites.push(v);
unsigned int max_size= _recordingTime/_deltaT;
if(_lastVelocites.size()> max_size)
_lastVelocites.pop();
}
void Pedestrian::SetV0Norm(double v0) {
......@@ -482,6 +495,20 @@ void Pedestrian::ResetRerouting(){
_timeBeforeRerouting=-1.00;
}
void Pedestrian::SetRecordingTime(double timeInSec){
_recordingTime=timeInSec;
}
double Pedestrian::GetRecordingTime() const{
return _recordingTime;
}
double Pedestrian::GetAverageVelecityOverRecordingTime() const {
//just few position were saved
if (_lastPositions.size()<2) return _ellipse.GetV().Norm();
return fabs ( (_lastPositions.back()-_lastPositions.front()).Norm() / _recordingTime );
}
double Pedestrian::GetDistanceToNextTarget() const {
return (_navLine->DistTo(GetPos()));
}
......@@ -605,7 +632,6 @@ Router* Pedestrian::GetRouter() const {
return _router;
}
//TODO: you can save some comp time if you catch this early in the configuration
int Pedestrian::FindRoute() {
if( ! _router) {
Log->Write("ERROR:\t one or more routers does not exit! Check your router_ids");
......
......@@ -29,6 +29,7 @@
#define _PEDESTRIAN_H
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <time.h>
......@@ -52,15 +53,15 @@ private:
double _mass; // Mass: 1
double _tau; // Reaction time: 0.5
double _deltaT; // step size
std::string _gender;
std::string _roomCaption;
std::string _roomCaption;
int _roomID;
int _subRoomID;
int _exitIndex; // current exit
int _group;
NavLine* _navLine; // current exit line
std::map<int, int>_mentalMap; // map the actual room to a destination
std::vector<int> _destHistory;
......@@ -78,10 +79,21 @@ private:
//routing parameters
double _reroutingThreshold; // new orientation after 10 seconds
double _timeBeforeRerouting; // a new orientation starts after this time
double _timeInJam; // actual time im Jam
double _patienceTime; // time after which the ped feels to be in jam
/// new orientation after 10 seconds
double _reroutingThreshold;
/// a new orientation starts after this time
double _timeBeforeRerouting;
/// actual time im Jam
double _timeInJam;
/// time after which the ped feels to be in jam
double _patienceTime;
/// data from the last <_recordingTime> seconds will be kept
double _recordingTime;
/// store the last positions
std::queue <Point> _lastPositions;
/// store the last velocities
std::queue <Point> _lastVelocites;
int _desiredFinalDestination;
int _oldRoomID;
......@@ -98,16 +110,14 @@ private:
// the current time in the simulation
static double _globalTime;
static bool _enableSpotlight;
bool _spotlight;
/// the router responsible for this pedestrian
Router* _router;
/// a pointer to the complete building
Building * _building;
/// the shape of this pdestrian
/// the shape of this pedestrian
JEllipse _ellipse;
......@@ -295,8 +305,23 @@ public:
*/
void ResetRerouting();
/**
* Set/Get the time period for which the data of the pedestrian should be kept.
* The results are used by the quickest path router
*/
void SetRecordingTime(double timeInSec);
/**
* Set/Get the time period for which the data of the pedestrian should be kept
* The results are used by the quickest path router
*/
double GetRecordingTime() const;
/**
* @return the average velocity over the recording period
*/
double GetAverageVelecityOverRecordingTime() const;
//void SetMaxOberservationTime(double time);
double GetAge() const;
void SetAge(double age);
std::string GetGender() const;
......
......@@ -83,7 +83,7 @@ int QuickestPathRouter::FindExit(Pedestrian* ped){
if(isCongested(ped)==true){
Redirect(ped);
ped->ResetTimeInJam();
//ped->SetSpotlight(true);
ped->SetSpotlight(true);
}
//cout<<"I am feeling like in Jam next: "<<ped->GetID()<<endl;
//ped->RerouteIn(2.50); // seconds
......@@ -516,7 +516,7 @@ void QuickestPathRouter::Init(Building* building){
GlobalRouter::Init(building);
// activate the spotlight for tracking some pedestrians
//Pedestrian::ActivateSpotlightSystem(true);
Pedestrian::ActivateSpotlightSystem(true);
// pBuilding=building;
//TODO: reduce graph is missbehaving
......
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