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
ac82b7f0
Commit
ac82b7f0
authored
May 12, 2015
by
Ulrich Kemloh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust incoming pedestrian velocity according to the Weidman FD
parent
fd7c8519
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
35 deletions
+32
-35
pedestrian/AgentsSourcesManager.cpp
pedestrian/AgentsSourcesManager.cpp
+32
-35
No files found.
pedestrian/AgentsSourcesManager.cpp
View file @
ac82b7f0
...
@@ -166,7 +166,7 @@ void AgentsSourcesManager::ComputeBestPositionVoronoi(AgentsSource* src,
...
@@ -166,7 +166,7 @@ void AgentsSourcesManager::ComputeBestPositionVoronoi(AgentsSource* src,
vector
<
Pedestrian
*>
peds
;
vector
<
Pedestrian
*>
peds
;
_building
->
GetPedestrians
(
roomID
,
subroomID
,
peds
);
_building
->
GetPedestrians
(
roomID
,
subroomID
,
peds
);
//filter the points that are not in the boundaries
//filter the points that are not
with
in the boundaries
for
(
auto
&&
iter
=
peds
.
begin
();
iter
!=
peds
.
end
();)
for
(
auto
&&
iter
=
peds
.
begin
();
iter
!=
peds
.
end
();)
{
{
const
Point
&
pos
=
(
*
iter
)
->
GetPos
();
const
Point
&
pos
=
(
*
iter
)
->
GetPos
();
...
@@ -281,17 +281,11 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
...
@@ -281,17 +281,11 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
vector
<
Point
>
positions
=
PedDistributor
::
PossiblePositions
(
*
subroom
);
vector
<
Point
>
positions
=
PedDistributor
::
PossiblePositions
(
*
subroom
);
double
bounds
[
4
]
=
{
0
,
0
,
0
,
0
};
double
bounds
[
4
]
=
{
0
,
0
,
0
,
0
};
dist
->
Getbounds
(
bounds
);
dist
->
Getbounds
(
bounds
);
//int roomID = dist->GetRoomId();
//int subroomID = dist->GetSubroomID();
// first default Position
for
(
auto
&
ped
:
peds
)
for
(
auto
&
ped
:
peds
)
{
{
//ped->Dump(ped->GetID()); continue;
int
index
=
-
1
;
int
index
=
-
1
;
AdjustVelocityUsingWeidmann
(
ped
);
//in the case a range was specified
//in the case a range was specified
for
(
unsigned
int
a
=
0
;
a
<
positions
.
size
();
a
++
)
for
(
unsigned
int
a
=
0
;
a
<
positions
.
size
();
a
++
)
{
{
...
@@ -312,59 +306,62 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
...
@@ -312,59 +306,62 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
bounds
[
0
],
bounds
[
1
],
bounds
[
2
],
bounds
[
3
]);
bounds
[
0
],
bounds
[
1
],
bounds
[
2
],
bounds
[
3
]);
Log
->
Write
(
"ERROR:
\t
Specifying a subroom_id might help"
);
Log
->
Write
(
"ERROR:
\t
Specifying a subroom_id might help"
);
}
}
}
else
}
else
{
{
const
Point
&
pos
=
positions
[
index
];
const
Point
&
pos
=
positions
[
index
];
ped
->
SetPos
(
pos
,
true
);
//true for the initial position
ped
->
SetPos
(
pos
,
true
);
//true for the initial position
positions
.
erase
(
positions
.
begin
()
+
index
);
positions
.
erase
(
positions
.
begin
()
+
index
);
// const Point& start_pos = Point(_startX, _startY);
//at this point we have a position
// if ((std::isnan(start_pos._x) == 0) && (std::isnan(start_pos._y) == 0))
AdjustVelocityUsingWeidmann
(
ped
);
// {
// if (_building->GetRoom(ped->GetRoomID())->GetSubRoom(ped->GetSubRoomID())->IsInSubRoom(
// start_pos) == false)
// {
// Log->Write(
// "ERROR: \t cannot distribute pedestrian %d in Room %d at fixed position %s",
// *pid, GetRoomId(), start_pos.toString().c_str());
// Log->Write(
// "ERROR: \t Make sure that the position is inside the geometry and belongs to the specified room / subroom");
// exit(EXIT_FAILURE);
// }
//
// ped->SetPos(start_pos, true); //true for the initial position
// Log->Write("INFO: \t fixed position for ped %d in Room %d %s", *pid, GetRoomId(),
// start_pos.toString().c_str());
// }
}
}
}
}
}
}
void
AgentsSourcesManager
::
AdjustVelocityUsingWeidmann
(
Pedestrian
*
ped
)
const
void
AgentsSourcesManager
::
AdjustVelocityUsingWeidmann
(
Pedestrian
*
ped
)
const
{
{
//get the density
//get the density
vector
<
Pedestrian
*>
neighbours
;
vector
<
Pedestrian
*>
neighbours
;
_building
->
GetGrid
()
->
GetNeighbourhood
(
ped
,
neighbours
);
_building
->
GetGrid
()
->
GetNeighbourhood
(
ped
,
neighbours
);
//pers per m2
//
density in
pers per m2
double
density
=
1.0
;
double
density
=
1.0
;
//radius corresponding to a surface of 1m2
//radius corresponding to a surface of 1m2
double
radius_square
=
0.564
*
0.564
;
//double radius_square=0.564*0.564;
for
(
const
auto
&
p
:
neighbours
)
for
(
const
auto
&
p
:
neighbours
)
{
{
if
(
(
ped
->
GetPos
()
-
p
->
GetPos
()).
NormSquare
()
<
radius_square
)
if
(
(
ped
->
GetPos
()
-
p
->
GetPos
()).
NormSquare
()
<
=
1.0
)
density
+=
1.0
;
density
+=
1.0
;
}
}
density
=
density
/
M_PI
;
//get the velocity
//get the velocity
double
density_max
=
5.4
;
double
density_max
=
5.4
;
double
speed
=
1.34
*
(
1
-
exp
(
-
1.913
*
(
1.0
/
density
-
1.0
/
density_max
)));
//speed from taken from weidmann FD
double
speed
=
1.34
*
(
1
-
exp
(
-
1.913
*
(
1.0
/
density
-
1.0
/
density_max
)));
if
(
speed
>=
ped
->
GetV0Norm
())
{
speed
=
ped
->
GetV0Norm
();
}
//set the velocity vector
//set the velocity vector
if
(
ped
->
FindRoute
()
!=-
1
)
if
(
ped
->
FindRoute
()
!=-
1
)
{
{
//get the next destination point
Point
v
=
(
ped
->
GetExitLine
()
->
ShortestPoint
(
ped
->
GetPos
())
-
ped
->
GetPos
()).
Normalized
();
v
=
v
*
speed
;
ped
->
SetV
(
v
);
cout
<<
"density: "
<<
density
<<
endl
;
}
else
{
Log
->
Write
(
"ERROR:
\t
no route could be found for agent [%d] going to [%d]"
,
ped
->
GetID
(),
ped
->
GetFinalDestination
());
//cout<<"density: "<<density<<endl;
//cout<<"find:route"<<ped->FindRoute()<<endl;
//that will be most probably be fixed in the next computation step.
// so do not abort
}
}
}
}
...
...
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