Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
b33810e8
Commit
b33810e8
authored
May 20, 2019
by
Benedikt Zoennchen
Browse files
fix issue
#242
.
parent
4575db5e
Pipeline
#114918
failed with stages
in 70 minutes and 6 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/models/osm/OSMBehaviorController.java
View file @
b33810e8
...
...
@@ -46,11 +46,13 @@ public class OSMBehaviorController {
VPoint
currentPosition
=
pedestrian
.
getPosition
();
VPoint
nextPosition
=
pedestrian
.
getNextPosition
();
// start time
double
timeOfNextStep
=
pedestrian
.
getTimeOfNextStep
();
// end time
double
entTimeOfStep
=
pedestrian
.
getTimeOfNextStep
()
+
pedestrian
.
getDurationNextStep
();
double
endTimeOfStep
=
pedestrian
.
getTimeOfNextStep
();
// start time
double
timeOfNextStep
=
pedestrian
.
getTimeOfNextStep
()
-
pedestrian
.
getDurationNextStep
();
assert
endTimeOfStep
>
timeOfNextStep
&&
endTimeOfStep
>=
0.0
;
if
(
nextPosition
.
equals
(
currentPosition
))
{
pedestrian
.
setTimeCredit
(
0
);
...
...
@@ -73,7 +75,7 @@ public class OSMBehaviorController {
* strides and foot steps have no influence on the simulation itself, i.e. they are saved to analyse trajectories
*/
pedestrian
.
getStrides
().
add
(
Pair
.
of
(
currentPosition
.
distance
(
nextPosition
),
timeOfNextStep
));
pedestrian
.
getFootSteps
().
add
(
new
FootStep
(
currentPosition
,
nextPosition
,
timeOfNextStep
,
en
t
TimeOfStep
));
pedestrian
.
getFootSteps
().
add
(
new
FootStep
(
currentPosition
,
nextPosition
,
timeOfNextStep
,
en
d
TimeOfStep
));
}
public
void
wait
(
PedestrianOSM
pedestrian
)
{
...
...
VadereSimulator/src/org/vadere/simulator/models/osm/updateScheme/UpdateSchemeEventDriven.java
View file @
b33810e8
...
...
@@ -40,27 +40,28 @@ public class UpdateSchemeEventDriven implements UpdateSchemeOSM {
// event driven update ignores time credits!
while
(
pedestrianEventsQueue
.
peek
().
getTimeOfNextStep
()
<
currentTimeInSec
)
{
PedestrianOSM
ped
=
pedestrianEventsQueue
.
poll
();
update
(
ped
,
currentTimeInSec
);
update
(
ped
,
timeStepInSec
,
currentTimeInSec
);
//System.out.println(ped.getId());
pedestrianEventsQueue
.
add
(
ped
);
}
}
}
protected
void
update
(
@NotNull
final
PedestrianOSM
pedestrian
,
final
double
currentTimeInSec
)
{
protected
void
update
(
@NotNull
final
PedestrianOSM
pedestrian
,
final
double
timeStepInSec
,
final
double
currentTimeInSec
)
{
Event
mostImportantEvent
=
pedestrian
.
getMostImportantEvent
();
if
(
mostImportantEvent
instanceof
ElapsedTimeEvent
)
{
VPoint
oldPosition
=
pedestrian
.
getPosition
();
double
stepDuration
=
pedestrian
.
getDurationNextStep
();
// for the first step after creation, timeOfNextStep has to be initialized
/*
if (pedestrian.getTimeOfNextStep() == 0) {
pedestrian.setTimeOfNextStep(currentTimeInSec);
}
*/
if
(
pedestrian
.
getTimeOfNextStep
()
==
0
)
{
pedestrian
.
setTimeOfNextStep
(
currentTimeInSec
-
timeStepInSec
);
}
// this can cause problems if the pedestrian desired speed is 0 (see speed adjuster)
pedestrian
.
updateNextPosition
();
double
stepDuration
=
pedestrian
.
getDurationNextStep
();
osmBehaviorController
.
makeStep
(
pedestrian
,
topography
,
stepDuration
);
pedestrian
.
setTimeOfNextStep
(
pedestrian
.
getTimeOfNextStep
()
+
stepDuration
);
}
else
if
(
mostImportantEvent
instanceof
WaitEvent
||
mostImportantEvent
instanceof
WaitInAreaEvent
)
{
...
...
VadereSimulator/src/org/vadere/simulator/models/osm/updateScheme/UpdateSchemeEventDrivenParallel.java
View file @
b33810e8
...
...
@@ -141,7 +141,7 @@ public class UpdateSchemeEventDrivenParallel extends UpdateSchemeEventDriven {
parallelUpdatablePeds
.
stream
().
forEach
(
ped
->
{
//logger.info(ped.getTimeOfNextStep());
//System.out.println(ped.getId());
update
(
ped
,
currentTimeInSec
);
update
(
ped
,
timeStepInSec
,
currentTimeInSec
);
});
...
...
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