Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
b862d46e
Commit
b862d46e
authored
Dec 04, 2018
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Show statistics of crossings"
parent
796ad04a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
95 additions
and
55 deletions
+95
-55
CMakeLists.txt
CMakeLists.txt
+2
-1
Simulation.cpp
Simulation.cpp
+26
-0
geometry/Building.cpp
geometry/Building.cpp
+10
-0
geometry/Building.h
geometry/Building.h
+2
-0
geometry/Crossing.cpp
geometry/Crossing.cpp
+24
-0
geometry/Crossing.h
geometry/Crossing.h
+26
-0
geometry/Transition.cpp
geometry/Transition.cpp
+0
-23
geometry/Transition.h
geometry/Transition.h
+2
-28
pedestrian/PedDistributor.cpp
pedestrian/PedDistributor.cpp
+2
-2
pedestrian/Pedestrian.cpp
pedestrian/Pedestrian.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
b862d46e
...
...
@@ -605,7 +605,8 @@ set_property(TARGET core PROPERTY CXX_STANDARD_REQUIRED ON)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
target_link_libraries
(
core thirdParty stdc++fs
)
# link to lib filesystem
else
()
message
(
WARNING
"I don't know how to link filesystem with
${
CMAKE_CXX_COMPILER_ID
}
"
)
target_link_libraries
(
core thirdParty
)
#message(WARNING "I don't know how to link filesystem with ${CMAKE_CXX_COMPILER_ID}")
endif
()
...
...
Simulation.cpp
View file @
b862d46e
...
...
@@ -413,6 +413,28 @@ void Simulation::PrintStatistics()
output
->
Write
(
goal
->
GetFlowCurve
());
}
}
Log
->
Write
(
"
\n
Usage of Crossings"
);
Log
->
Write
(
"=========="
);
for
(
const
auto
&
itr
:
_building
->
GetAllCrossings
())
{
Crossing
*
goal
=
itr
.
second
;
if
(
goal
->
GetDoorUsage
())
{
Log
->
Write
(
"
\n
Crossing ID [%d] in Room ID [%d] used by [%d] pedestrians. Last passing time [%0.2f] s"
,
goal
->
GetID
(),
itr
.
first
/
1000
,
goal
->
GetDoorUsage
(),
goal
->
GetLastPassingTime
());
string
statsfile
=
_config
->
GetTrajectoriesFile
()
+
"_flow_crossing_id_"
+
to_string
(
itr
.
first
/
1000
)
+
"_"
+
to_string
(
itr
.
first
%
1000
)
+
".dat"
;
Log
->
Write
(
"More Information in the file: %s"
,
statsfile
.
c_str
());
auto
output
=
new
FileHandler
(
statsfile
.
c_str
());
output
->
Write
(
"#Flow at crossing "
+
goal
->
GetCaption
()
+
"( ID "
+
to_string
(
goal
->
GetID
())
+
" ) in Room ( ID "
+
to_string
(
itr
.
first
/
1000
)
+
" )"
);
output
->
Write
(
"#Time (s) cummulative number of agents
\n
"
);
output
->
Write
(
goal
->
GetFlowCurve
());
}
}
Log
->
Write
(
"
\n
"
);
}
...
...
@@ -649,6 +671,10 @@ void Simulation::UpdateFlowAtDoors(const Pedestrian& ped) const
//#pragma omp critical
trans
->
IncreaseDoorUsage
(
1
,
ped
.
GetGlobalTime
());
}
Crossing
*
cross
=
_building
->
GetCrossingByUID
(
ped
.
GetExitIndex
());
if
(
cross
)
{
cross
->
IncreaseDoorUsage
(
1
,
ped
.
GetGlobalTime
());
}
}
}
...
...
geometry/Building.cpp
View file @
b862d46e
...
...
@@ -1302,6 +1302,16 @@ Transition* Building::GetTransitionByUID(int uid) const
return
nullptr
;
}
Crossing
*
Building
::
GetCrossingByUID
(
int
uid
)
const
{
for
(
auto
&&
cross
:
_crossings
)
{
if
(
cross
.
second
->
GetUniqueID
()
==
uid
)
return
cross
.
second
;
}
return
nullptr
;
}
bool
Building
::
SaveGeometry
(
const
std
::
string
&
filename
)
const
{
std
::
stringstream
geometry
;
...
...
geometry/Building.h
View file @
b862d46e
...
...
@@ -173,6 +173,8 @@ public:
*/
Transition
*
GetTransitionByUID
(
int
uid
)
const
;
Crossing
*
GetCrossingByUID
(
int
uid
)
const
;
//TOD0: rename later to GetGoal
Goal
*
GetFinalGoal
(
int
id
)
const
;
...
...
geometry/Crossing.cpp
View file @
b862d46e
...
...
@@ -36,6 +36,8 @@ Crossing::Crossing()
{
_id
=
-
1
;
_isOpen
=
true
;
_doorUsage
=
0
;
_lastPassingTime
=
0
;
}
Crossing
::~
Crossing
()
...
...
@@ -172,3 +174,25 @@ int Crossing::CommonSubroomWith(Crossing* other, SubRoom* &subroom) {
}
return
result
;
}
void
Crossing
::
IncreaseDoorUsage
(
int
number
,
double
time
)
{
_doorUsage
+=
number
;
_lastPassingTime
=
time
;
_flowAtExit
+=
to_string
(
time
)
+
" "
+
to_string
(
_doorUsage
)
+
"
\n
"
;
}
int
Crossing
::
GetDoorUsage
()
const
{
return
_doorUsage
;
}
double
Crossing
::
GetLastPassingTime
()
const
{
return
_lastPassingTime
;
}
const
std
::
string
&
Crossing
::
GetFlowCurve
()
const
{
return
_flowAtExit
;
}
\ No newline at end of file
geometry/Crossing.h
View file @
b862d46e
...
...
@@ -45,6 +45,9 @@ private:
//SubRoom* _subRoom1;
//SubRoom* _subRoom2;
bool
_isOpen
;
int
_doorUsage
;
double
_lastPassingTime
;
std
::
string
_flowAtExit
;
public:
// last ped that passed was in room {1,2} that many ticks
...
...
@@ -139,6 +142,29 @@ public:
* @param subroom returns one of the common subrooms
*/
virtual
int
CommonSubroomWith
(
Crossing
*
other
,
SubRoom
*
&
subroom
);
/**
* Increment the number of persons that used that crossing
* @param number, how many person have passed the crossing
* @param time, at which time
*/
void
IncreaseDoorUsage
(
int
number
,
double
time
);
/**
* @return the number of pedestrians that used that crossing.
*/
int
GetDoorUsage
()
const
;
/**
* @return the flow curve for this crossing
*/
const
std
::
string
&
GetFlowCurve
()
const
;
/**
* @return the last time this crossing was crossed
*/
double
GetLastPassingTime
()
const
;
};
#endif
/* _CROSSING_H */
...
...
geometry/Transition.cpp
View file @
b862d46e
...
...
@@ -38,8 +38,6 @@ using namespace std;
Transition
::
Transition
()
:
Crossing
()
{
_isOpen
=
true
;
_doorUsage
=
0
;
_lastPassingTime
=
0
;
_room2
=
nullptr
;
// _lastTickTime1 = 0;
// _lastTickTime2 = 0;
...
...
@@ -190,24 +188,3 @@ string Transition::GetDescription() const
return
geometry
;
}
void
Transition
::
IncreaseDoorUsage
(
int
number
,
double
time
)
{
_doorUsage
+=
number
;
_lastPassingTime
=
time
;
_flowAtExit
+=
to_string
(
time
)
+
" "
+
to_string
(
_doorUsage
)
+
"
\n
"
;
}
int
Transition
::
GetDoorUsage
()
const
{
return
_doorUsage
;
}
double
Transition
::
GetLastPassingTime
()
const
{
return
_lastPassingTime
;
}
const
std
::
string
&
Transition
::
GetFlowCurve
()
const
{
return
_flowAtExit
;
}
geometry/Transition.h
View file @
b862d46e
...
...
@@ -40,10 +40,7 @@ private:
bool
_isOpen
;
std
::
string
_type
;
// number of agents that passed that exit
int
_doorUsage
;
double
_lastPassingTime
;
std
::
string
_flowAtExit
;
public:
/**
* Cosntructor
...
...
@@ -65,30 +62,7 @@ public:
* The first one is set in the crossing class.
*/
void
SetRoom2
(
Room
*
ID
);
/**
* Increment the number of persons that used that exit
* @param number, how many person have passed the door
* @param time, at which time
*/
void
IncreaseDoorUsage
(
int
number
,
double
time
);
/**
* @return the number of pedestrians that used that exit.
*/
int
GetDoorUsage
()
const
;
/**
* @return the flow curve for this exit
*/
const
std
::
string
&
GetFlowCurve
()
const
;
/**
* @return the last time this door was crossed
*/
double
GetLastPassingTime
()
const
;
/**
* Set/Get the type of the transition
*/
...
...
pedestrian/PedDistributor.cpp
View file @
b862d46e
...
...
@@ -121,8 +121,8 @@ bool PedDistributor::Distribute(Building *building) const {
{
if
(
fs
::
is_regular_file
(
p
))
{
std
::
string
basename
=
p
.
stem
();
//
std
::
string
extention
=
p
.
extension
();
std
::
string
basename
=
p
.
stem
()
.
string
()
;
//
std
::
string
extention
=
p
.
extension
()
.
string
()
;
auto
tmpPositions
=
GetPositionsFromFile
(
p
.
string
(),
dist
->
GetAgentsNumber
(),
unit
);
//check if positions are
//empty. May happen if file
...
...
pedestrian/Pedestrian.cpp
View file @
b862d46e
...
...
@@ -1239,7 +1239,7 @@ bool Pedestrian::Relocate(std::function<void(const Pedestrian&)> flowupdater) {
//the agent left the old room
//actualize the egress time for that room
#pragma omp critical(SetEgressTime)
allRooms
.
at
(
GetRoomID
()
)
->
SetEgressTime
(
GetGlobalTime
());
//set Egresstime to old room //@todo: ar.graf : GetRoomID() yields NEW room
allRooms
.
at
(
oldRoomID
)
->
SetEgressTime
(
GetGlobalTime
());
//set Egresstime to old room //@todo: ar.graf : GetRoomID() yields NEW room
}
status
=
true
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment