Commit f104077d authored by Ulrich Kemloh's avatar Ulrich Kemloh

More detailed statistics for exits (flow curve)

parent 719f9b16
......@@ -423,13 +423,22 @@ void Simulation::PrintStatistics()
Log->Write("\nUsage of Exits");
Log->Write("==========");
for (const auto& itr : _building->GetAllTransitions()) {
for (const auto& itr : _building->GetAllTransitions())
{
Transition* goal = itr.second;
if (goal->IsExit()) {
if (goal->IsExit())
{
Log->Write(
"Exit ID [%d] used by [%d] pedestrians. Last passing time [%0.2f] s",
goal->GetID(), goal->GetDoorUsage(),
goal->GetLastPassingTime());
string statsfile=_argsParser.GetTrajectoriesFile()+"_flow_exit_id_"+goal->GetCaption()+".dat";
Log->Write("More Information in the file: %s",statsfile.c_str());
auto output= new FileHandler(statsfile.c_str());
output->Write("#Flow at exit "+goal->GetCaption()+"( ID "+to_string(goal->GetID())+" )");
output->Write("#Time (s) cummulative number of agents \n");
output->Write(goal->GetFlowCurve());
}
}
Log->Write("\n");
......
......@@ -42,7 +42,7 @@ Transition::Transition() : Crossing()
_isOpen = true;
_doorUsage=0;
_lastPassingTime=0;
_room2 = NULL;
_room2 = nullptr;
}
Transition::~Transition()
......@@ -70,8 +70,6 @@ void Transition::SetRoom2(Room* r)
_room2 = r;
}
bool Transition::IsOpen() const
{
return _isOpen;
......@@ -202,6 +200,7 @@ void Transition::IncreaseDoorUsage(int number, double time)
{
_doorUsage+=number;
_lastPassingTime=time;
_flowAtExit+=to_string(time)+" "+to_string(_doorUsage)+"\n";
}
int Transition::GetDoorUsage() const
......@@ -213,3 +212,8 @@ double Transition::GetLastPassingTime() const
{
return _lastPassingTime;
}
const std::string & Transition::GetFlowCurve() const
{
return _flowAtExit;
}
......@@ -43,6 +43,7 @@ private:
// number of agents that passed that exit
int _doorUsage;
double _lastPassingTime;
std::string _flowAtExit;
public:
......@@ -89,6 +90,12 @@ public:
*/
int GetDoorUsage() const;
/**
* @return the flow curve for this exit
*/
const std::string & GetFlowCurve() const;
/**
* @return the last time this door was crossed
*/
......
......@@ -11,7 +11,7 @@
<!-- trajectories file and format -->
<trajectories format="xml-plain" fps="8">
<file location="hybrid_hall_trajectories.xml" />
<socket hostname="127.0.0.1" port="8989" />
<socket1 hostname="127.0.0.1" port="8989" />
</trajectories>
<!-- Parameters for the hybrid (matsim) server mode -->
......@@ -72,7 +72,7 @@
<!--persons information and distribution -->
<agents operational_model_id="2">
<agents_distribution>
<group group_id="0" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" x_min="14" x_max="16" y_min="14" y_max="16" />
<group group_id="0" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" x_min="3" x_max="5" y_min="3" y_max="5" />
<group group_id="1" room_id="1" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="2" room_id="2" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="3" room_id="3" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
......@@ -84,7 +84,7 @@
</agents_distribution>
<agents_sources><!-- frequency in persons/seconds -->
<source id="1" frequency="1" agents_max="5" group_id="0" caption="source 1" />
<source id="1" frequency="1" agents_max="50" group_id="0" caption="source 1" />
<source id="2" frequency="1" agents_max="5" group_id="2" caption="source 2" />
<source id="3" frequency="1" agents_max="5" group_id="3" caption="source 3" />
<source id="4" frequency="1" agents_max="5" group_id="4" caption="source 4" />
......
......@@ -244,6 +244,7 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
for (unsigned int a = 0; a < positions.size(); a++)
{
Point pos = positions[a];
//cout<<"checking: "<<pos.toString()<<endl;
if ((bounds[0] <= pos._x) && (pos._x <= bounds[1])
&& (bounds[2] <= pos._y) && (pos._y < bounds[3]))
{
......@@ -258,7 +259,9 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
Log->Write(
"ERROR:\t AgentSourceManager Cannot distribute pedestrians in the mentioned area [%0.2f,%0.2f,%0.2f,%0.2f]",
bounds[0], bounds[1], bounds[2], bounds[3]);
Log->Write("ERROR:\t Specifying a subroom_id might help");
Log->Write(" \t Specifying a subroom_id might help");
Log->Write(" \t %d positions were available",positions.size());
exit(EXIT_FAILURE);
}
}
else
......
......@@ -228,7 +228,9 @@ Pedestrian* StartDistribution::GenerateAgent(Building* building, int* pid, vecto
{
Log->Write("ERROR:\t Cannot distribute pedestrians in the mentioned area [%0.2f,%0.2f,%0.2f,%0.2f]",
_xMin,_xMax,_yMin,_yMax);
Log->Write("ERROR:\t Specifying a subroom_id might help");
Log->Write(" \t Specifying a subroom_id might help");
Log->Write(" \t %d positions were available. Index %d ",positions.size(),index);
exit(EXIT_FAILURE);
}
}
else
......
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