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
f2de56ba
Commit
f2de56ba
authored
Feb 28, 2020
by
Marion Goedel
Browse files
Added a check to the EvacuationTimeProcessor if there are agents remaining in the simulation
parent
3eb083ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/EvacuationTimeProcessor.java
View file @
f2de56ba
...
...
@@ -16,6 +16,7 @@ import java.util.Collections;
@DataProcessorClass
()
public
class
EvacuationTimeProcessor
extends
NoDataKeyProcessor
<
Double
>
{
private
PedestrianEvacuationTimeProcessor
pedEvacTimeProc
;
private
int
numberOfAgentsInScenario
=
0
;
public
EvacuationTimeProcessor
()
{
super
(
"evacuationTime"
);
...
...
@@ -25,6 +26,7 @@ public class EvacuationTimeProcessor extends NoDataKeyProcessor<Double> {
@Override
protected
void
doUpdate
(
final
SimulationState
state
)
{
this
.
pedEvacTimeProc
.
update
(
state
);
this
.
numberOfAgentsInScenario
=
state
.
getTopography
().
getPedestrianDynamicElements
().
getElements
().
size
();
}
@Override
...
...
@@ -33,10 +35,16 @@ public class EvacuationTimeProcessor extends NoDataKeyProcessor<Double> {
double
result
=
0.0
;
if
(
this
.
pedEvacTimeProc
.
getValues
().
size
()
>
0
)
{
result
=
this
.
pedEvacTimeProc
.
getValues
().
stream
().
anyMatch
(
tevac
->
tevac
==
Double
.
NaN
)
?
Double
.
NaN
:
Collections
.
max
(
this
.
pedEvacTimeProc
.
getValues
());
// check if any agents are still in the simulation
// seems like the topography is empty after the simulation, so I saved the last value in numberOfAgentsInScenario
if
(
numberOfAgentsInScenario
==
0
){
if
(
this
.
pedEvacTimeProc
.
getValues
().
size
()
>
0
)
{
result
=
this
.
pedEvacTimeProc
.
getValues
().
stream
().
anyMatch
(
tevac
->
tevac
==
Double
.
NaN
)
?
Double
.
NaN
:
Collections
.
max
(
this
.
pedEvacTimeProc
.
getValues
());
}
}
else
{
result
=
-
1
;
}
this
.
putValue
(
NoDataKey
.
key
(),
result
);
...
...
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