Commit 4784f45f authored by Ulrich Kemloh's avatar Ulrich Kemloh

option to display statistics about the evacuation (Issue #62).

Add <show_statistics>true<show_statistics>
to your input file and following output will be written to the log.

Rooms Egress Time:
==================
id	caption	egress time (s)
0	hall	197.49

Exit Usage
==========
Exit ID [0] used by [20] pedestrians. Last passing time [197.49] s
parent 327f7b25
Following persons have contributed to JuPedSim:
JuPedSim contributors:
Andrea Portz
David Haensel
......
......@@ -464,15 +464,18 @@ void Simulation::UpdateRoutesAndLocations()
void Simulation::PrintStatistics()
{
Log->Write("\nROOMS EGRESS TIME:");
Log->Write("\nRooms Egress Time:");
Log->Write("==================");
Log->Write("id\tcaption\tegress time (s)");
for(const auto& room:_building->GetAllRooms())
{
if(room->GetCaption()!="outside")
Log->Write("%d\t%s\t%.2f",room->GetID(),room->GetCaption().c_str(),room->GetEgressTime());
}
Log->Write("\nEXIT USAGE:");
Log->Write("\nUsage of Exits");
Log->Write("==========");
for (const auto& itr : _building->GetAllTransitions()) {
Transition* goal = itr.second;
if (goal->IsExit()) {
......@@ -482,4 +485,6 @@ void Simulation::PrintStatistics()
goal->GetLastPassingTime());
}
}
Log->Write("\n");
}
......@@ -124,12 +124,12 @@ ArgumentParser::ArgumentParser()
_hpcFlag = 0;
_agentsParameters= std::map<int, AgentsParameters*>();
p_routingengine = std::shared_ptr<RoutingEngine>(new RoutingEngine());
_showStatistics=false;
}
bool ArgumentParser::ParseArgs(int argc, char **argv)
{
//special case of the default configuration ini.xml
if (argc == 1)
{
Log->Write(
......@@ -303,7 +303,14 @@ bool ArgumentParser::ParseIniFile(string inifile)
pLog = 2;
Log->Write("INFO: \tlogfile <" + (pErrorLogFile) + ">");
}
//display statistics
if (xMainNode->FirstChild("show_statistics"))
{
string value = xMainNode->FirstChild("show_statistics")->FirstChild()->Value();
if(value=="true")
_showStatistics=true;
Log->Write("INFO: \tShow statistics: %s",value.c_str());
}
//trajectories
TiXmlNode* xTrajectories = xMainNode->FirstChild("trajectories");
if (xTrajectories)
......@@ -1109,6 +1116,10 @@ int ArgumentParser::GetHPCFlag() const
{
return _hpcFlag;
}
bool ArgumentParser::ShowStatistics()const
{
return _showStatistics;
}
bool ArgumentParser::ParseLinkedCells(const TiXmlNode &linkedCellNode)
{
......
......@@ -101,6 +101,7 @@ private:
FileFormat pFormat;
vector<pair<int, RoutingStrategy> > pRoutingStrategies;
bool _profilingFlag;
bool _showStatistics;
int _hpcFlag; //Flag fuer die HPC-Archtitektur (0=CPU, 1=GPU, 2=XeonPhi)
std::map<int, AgentsParameters*> _agentsParameters;
......@@ -207,6 +208,7 @@ public:
const string& GetProjectRootDir() const;
bool GetProfileFlag();
int GetHPCFlag() const;
bool ShowStatistics()const;
vector<pair<int, RoutingStrategy> > GetRoutingStrategy() const;
const FileFormat& GetFileFormat() const;
......
......@@ -73,7 +73,6 @@
#define CBA_THRESHOLD 0.15
#define OBSTRUCTION 4
// Length of array
#define CLENGTH 1000
......
......@@ -16,6 +16,9 @@ xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_ini_core.xsd">
</trajectories>
<!-- where to store the logs -->
<!--<logfile>outputfiles/log.txt</logfile> -->
<!-- display some statistics about the evacuation process -->
<show_statistics>true</show_statistics>
<!-- traffic information: e.g closed doors or smoked rooms -->
......@@ -30,7 +33,7 @@ xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_ini_core.xsd">
<!--persons information and distribution -->
<agents operational_model_id="2">
<agents_distribution>
<group group_id="0" agent_parameter_id="1" room_id="0" subroom_id="0" number="2000" goal_id="-1" router_id="1" />
<group group_id="0" agent_parameter_id="1" room_id="0" subroom_id="0" number="20" goal_id="-1" router_id="1" />
</agents_distribution>
</agents>
......
......@@ -57,7 +57,10 @@ int main(int argc, char **argv)
time(&endtime);
// some output
double execTime = difftime(endtime, starttime);
if(args->ShowStatistics())
{
sim.PrintStatistics();
}
if (sim.GetPedsNumber())
{
......@@ -65,6 +68,7 @@ int main(int argc, char **argv)
sim.GetPedsNumber(), args->GetMaxOpenMPThreads());
}
double execTime = difftime(endtime, starttime);
Log->Write("\nExec Time [s] : %.2f", execTime);
Log->Write("Evac Time [s] : %d", evacTime);
Log->Write("Realtime Factor : %.2f X", evacTime / execTime);
......@@ -72,7 +76,6 @@ int main(int argc, char **argv)
Log->Write("Warnings : %d", Log->GetWarnings());
Log->Write("Errors : %d", Log->GetErrors());
// sim.PrintStatistics();
if (NULL == dynamic_cast<STDIOHandler*>(Log))
{
printf("\nExec Time [s] : %4.2f\n", execTime);
......
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