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
074edae7
Verified
Commit
074edae7
authored
Jun 02, 2019
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Regulate flow through trains
parent
ad48141e
Pipeline
#21049
passed with stages
in 9 minutes and 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
Simulation.cpp
Simulation.cpp
+30
-3
No files found.
Simulation.cpp
View file @
074edae7
...
...
@@ -52,6 +52,7 @@ Trajectories* outputTXT;
// todo: add these variables to class simulation
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
TrainType
>
>
TrainTypes
;
std
::
map
<
int
,
std
::
shared_ptr
<
TrainTimeTable
>
>
TrainTimeTables
;
std
::
map
<
int
,
double
>
trainOutflow
;
//--------
Simulation
::
Simulation
(
Configuration
*
args
)
:
_config
(
args
)
...
...
@@ -658,6 +659,12 @@ double Simulation::RunBody(double maxSimTime)
}
#endif
//init train trainOutfloww
for
(
auto
tab
:
TrainTimeTables
)
{
trainOutflow
[
tab
.
first
]
=
0
;
}
// regulate flow
for
(
auto
&
itr
:
_building
->
GetAllTransitions
())
{
Transition
*
Trans
=
itr
.
second
;
...
...
@@ -671,6 +678,25 @@ double Simulation::RunBody(double maxSimTime)
}
}
// normal transition
}
//-----------
// regulate train doorusag
std
::
string
transType
=
Trans
->
GetType
();
if
(
Trans
->
IsOpen
()
&&
transType
.
rfind
(
"Train"
,
0
)
==
0
)
{
std
::
vector
<
std
::
string
>
strs
;
boost
::
split
(
strs
,
transType
,
boost
::
is_any_of
(
"_"
),
boost
::
token_compress_on
);
int
id
=
atoi
(
strs
[
1
].
c_str
());
std
::
string
type
=
Trans
->
GetCaption
();
trainOutflow
[
id
]
+=
Trans
->
GetDoorUsage
();
if
(
trainOutflow
[
id
]
>=
TrainTypes
[
type
]
->
nmax
)
{
std
::
cout
<<
"INFO:
\t
closing train door "
<<
transType
.
c_str
()
<<
" at "
<<
Pedestrian
::
GetGlobalTime
()
<<
"
\n
"
;
Log
->
Write
(
"INFO:
\t
closing train door %s at t=%.2f"
,
transType
.
c_str
(),
Pedestrian
::
GetGlobalTime
());
Trans
->
Close
();
}
}
//-----------
}
// Transitions
if
(
frameNr
%
1000
==
0
)
{
...
...
@@ -735,7 +761,7 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
auto
mytrack
=
building
->
GetTrackWalls
(
TrackStart
,
TrackEnd
,
room_id
,
subroom_id
);
Room
*
room
=
building
->
GetRoom
(
room_id
);
subroom
=
room
->
GetSubRoom
(
subroom_id
);
//todo safety check
int
transition_id
=
10000
;
int
transition_id
=
10000
;
// randomly high number
std
::
cout
<<
"enter with train "
<<
trainType
.
c_str
()
<<
"
\n
"
;
std
::
cout
<<
KBLU
<<
"Enter correctGeometry: Building Has "
<<
building
->
GetAllTransitions
().
size
()
<<
" Transitions
\n
"
<<
RESET
;
...
...
@@ -775,10 +801,11 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
std
::
cout
<<
"EQUAL
\n
"
;
Transition
*
e
=
new
Transition
();
e
->
SetID
(
transition_id
++
);
e
->
SetCaption
(
"tempDoor"
);
e
->
SetCaption
(
trainType
);
e
->
SetPoint1
(
p1
);
e
->
SetPoint2
(
p2
);
e
->
SetType
(
"train_door"
);
std
::
string
transType
=
"Train_"
+
std
::
to_string
(
tab
->
id
)
+
"_"
+
std
::
to_string
(
tab
->
tin
)
+
"_"
+
std
::
to_string
(
tab
->
tout
);
e
->
SetType
(
transType
);
room
->
AddTransitionID
(
e
->
GetUniqueID
());
// danger area
e
->
SetRoom1
(
room
);
e
->
SetSubRoom1
(
subroom
);
...
...
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