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
221afc99
Verified
Commit
221afc99
authored
Jun 11, 2019
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transform coordinates of doors relatively to track
parent
a3fee79d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
7 deletions
+26
-7
IO/GeoFileParser.cpp
IO/GeoFileParser.cpp
+2
-1
Simulation.cpp
Simulation.cpp
+24
-6
No files found.
IO/GeoFileParser.cpp
View file @
221afc99
...
@@ -822,6 +822,7 @@ bool GeoFileParser::LoadTrainInfo(Building* building)
...
@@ -822,6 +822,7 @@ bool GeoFileParser::LoadTrainInfo(Building* building)
resTTT
=
LoadTrainTimetable
(
building
,
xRootNode
);
resTTT
=
LoadTrainTimetable
(
building
,
xRootNode
);
resType
=
LoadTrainType
(
building
,
xRootNode
);
resType
=
LoadTrainType
(
building
,
xRootNode
);
}
}
return
(
resTTT
&&
resType
);
return
(
resTTT
&&
resType
);
}
}
bool
GeoFileParser
::
LoadTrainTimetable
(
Building
*
building
,
TiXmlElement
*
xRootNode
)
bool
GeoFileParser
::
LoadTrainTimetable
(
Building
*
building
,
TiXmlElement
*
xRootNode
)
...
@@ -858,7 +859,7 @@ bool GeoFileParser::LoadTrainTimetable(Building* building, TiXmlElement * xRootN
...
@@ -858,7 +859,7 @@ bool GeoFileParser::LoadTrainTimetable(Building* building, TiXmlElement * xRootN
e
=
e
->
NextSiblingElement
(
"train"
))
{
e
=
e
->
NextSiblingElement
(
"train"
))
{
std
::
shared_ptr
<
TrainTimeTable
>
TTT
=
parseTrainTimeTableNode
(
e
);
std
::
shared_ptr
<
TrainTimeTable
>
TTT
=
parseTrainTimeTableNode
(
e
);
if
(
TTT
)
{
// todo: maybe get pointer to train
if
(
TTT
)
{
building
->
AddTrainTimeTable
(
TTT
);
building
->
AddTrainTimeTable
(
TTT
);
}
}
}
}
...
...
Simulation.cpp
View file @
221afc99
...
@@ -690,8 +690,8 @@ double Simulation::RunBody(double maxSimTime)
...
@@ -690,8 +690,8 @@ double Simulation::RunBody(double maxSimTime)
trainOutflow
[
id
]
+=
Trans
->
GetDoorUsage
();
trainOutflow
[
id
]
+=
Trans
->
GetDoorUsage
();
if
(
trainOutflow
[
id
]
>=
TrainTypes
[
type
]
->
nmax
)
if
(
trainOutflow
[
id
]
>=
TrainTypes
[
type
]
->
nmax
)
{
{
std
::
cout
<<
"INFO:
\t
closing train door "
<<
transType
.
c_str
()
<<
" at "
<<
Pedestrian
::
GetGlobalTime
()
<<
"
\n
"
;
std
::
cout
<<
"INFO:
\t
closing train door "
<<
transType
.
c_str
()
<<
" at "
<<
Pedestrian
::
GetGlobalTime
()
<<
" capacity "
<<
TrainTypes
[
type
]
->
nmax
<<
"
\n
"
;
Log
->
Write
(
"INFO:
\t
closing train door %s at t=%.2f. Flow = %.2f (Train Capacity %
.2f
)"
,
transType
.
c_str
(),
Pedestrian
::
GetGlobalTime
(),
trainOutflow
[
id
],
TrainTypes
[
type
]
->
nmax
);
Log
->
Write
(
"INFO:
\t
closing train door %s at t=%.2f. Flow = %.2f (Train Capacity %
d
)"
,
transType
.
c_str
(),
Pedestrian
::
GetGlobalTime
(),
trainOutflow
[
id
],
TrainTypes
[
type
]
->
nmax
);
Trans
->
Close
();
Trans
->
Close
();
}
}
}
}
...
@@ -754,12 +754,18 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
...
@@ -754,12 +754,18 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
int
trainId
=
tab
->
id
;
int
trainId
=
tab
->
id
;
std
::
string
trainType
=
tab
->
type
;
std
::
string
trainType
=
tab
->
type
;
Point
TrackStart
=
tab
->
pstart
;
Point
TrackStart
=
tab
->
pstart
;
Point
TrainStart
=
tab
->
tstart
;
Point
TrackEnd
=
tab
->
pend
;
Point
TrackEnd
=
tab
->
pend
;
SubRoom
*
subroom
;
SubRoom
*
subroom
;
int
room_id
,
subroom_id
;
int
room_id
,
subroom_id
;
auto
mytrack
=
building
->
GetTrackWalls
(
TrackStart
,
TrackEnd
,
room_id
,
subroom_id
);
auto
mytrack
=
building
->
GetTrackWalls
(
TrackStart
,
TrackEnd
,
room_id
,
subroom_id
);
Room
*
room
=
building
->
GetRoom
(
room_id
);
Room
*
room
=
building
->
GetRoom
(
room_id
);
subroom
=
room
->
GetSubRoom
(
subroom_id
);
//todo safety check
subroom
=
room
->
GetSubRoom
(
subroom_id
);
if
(
subroom
==
nullptr
)
{
Log
->
Write
(
"ERROR:
\t
Simulation::correctGeometry got wrong room_id|subroom_id (%d|%d). TrainId %d"
,
room_id
,
subroom_id
,
trainId
);
exit
(
EXIT_FAILURE
);
}
int
transition_id
=
10000
;
// randomly high number
int
transition_id
=
10000
;
// randomly high number
std
::
cout
<<
"enter with train "
<<
trainType
.
c_str
()
<<
"
\n
"
;
std
::
cout
<<
"enter with train "
<<
trainType
.
c_str
()
<<
"
\n
"
;
...
@@ -773,14 +779,26 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
...
@@ -773,14 +779,26 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
auto
train
=
building
->
GetTrainTypes
().
at
(
trainType
);
auto
train
=
building
->
GetTrainTypes
().
at
(
trainType
);
auto
doors
=
train
->
doors
;
auto
doors
=
train
->
doors
;
for
(
auto
&&
d
:
doors
)
{
auto
newX
=
d
.
GetPoint1
().
_x
+
TrainStart
.
_x
+
TrackStart
.
_x
;
auto
newY
=
d
.
GetPoint1
().
_y
+
TrainStart
.
_y
+
TrackStart
.
_y
;
d
.
SetPoint1
(
Point
(
newX
,
newY
));
newX
=
d
.
GetPoint2
().
_x
+
TrainStart
.
_x
+
TrackStart
.
_x
;
newY
=
d
.
GetPoint2
().
_y
+
TrainStart
.
_y
+
TrackStart
.
_y
;
d
.
SetPoint2
(
Point
(
newX
,
newY
));
}
for
(
auto
d
:
doors
)
{
Log
->
Write
(
"Train %s %d. Transformed coordinates of doors: %s -- %s"
,
trainType
.
c_str
(),
trainId
,
d
.
GetPoint1
().
toString
().
c_str
(),
d
.
GetPoint2
().
toString
().
c_str
());
}
// std::vector<std::pair<PointWall, pointWall > >
// std::vector<std::pair<PointWall, pointWall > >
auto
pws
=
building
->
GetIntersectionPoints
(
doors
,
mytrack
);
auto
pws
=
building
->
GetIntersectionPoints
(
doors
,
mytrack
);
if
(
pws
.
empty
())
if
(
pws
.
empty
())
std
::
cout
<<
"simulation::correctGeometry: pws are empty
\n
"
;
std
::
cout
<<
KRED
<<
"simulation::correctGeometry: pws are empty. Something went south with train doors
\n
"
<<
RESET
;
subroom
->
GetUID
();
auto
walls
=
subroom
->
GetAllWalls
();
auto
walls
=
subroom
->
GetAllWalls
();
//---
//---
for
(
auto
pw
:
pws
)
for
(
auto
pw
:
pws
)
{
{
...
...
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