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
1157af27
Commit
1157af27
authored
Aug 03, 2020
by
Christina
Browse files
reset AreaDensityCountingProcessor
parent
201fd4d3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Scenarios/Demos/Density_controller/scenarios/AbstractThreeCorridors.scenario
View file @
1157af27
...
...
@@ -41,32 +41,28 @@
"id" : 5,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2001,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2001
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2002,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2002
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 7,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2003,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2003
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 1000,
"countsInsteadOfDensity" : false
"measurementAreaId" : 1000
}
} ],
"isTimestamped" : false,
...
...
@@ -402,4 +398,4 @@
},
"stimulusInfos" : [ ]
}
}
\ No newline at end of file
}
Scenarios/Demos/Density_controller/scenarios/AbstractThreeCorridors_normal.scenario
View file @
1157af27
...
...
@@ -41,35 +41,31 @@
"id" : 5,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2001,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2001
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2002,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2002
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 7,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2003,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2003
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 1000,
"countsInsteadOfDensity" : false
"measurementAreaId" : 1000
}
} ],
"isTimestamped" :
fals
e,
"isTimestamped" :
tru
e,
"isWriteMetaData" : false
},
"scenario" : {
...
...
@@ -402,4 +398,4 @@
},
"stimulusInfos" : [ ]
}
}
\ No newline at end of file
}
VadereSimulator/src/org/vadere/simulator/models/strategy/RouteChoiceThreeCorridors.java
View file @
1157af27
...
...
@@ -5,6 +5,7 @@ import com.github.cschen1205.fuzzylogic.*;
import
com.github.cschen1205.fuzzylogic.memberships.*
;
import
org.vadere.simulator.control.strategy.models.navigation.INavigationModel
;
import
org.vadere.simulator.projects.dataprocessing.ProcessorManager
;
import
org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor
;
import
org.vadere.state.scenario.Pedestrian
;
import
java.util.*
;
...
...
@@ -135,15 +136,15 @@ public class RouteChoiceThreeCorridors implements INavigationModel {
private
double
getDensityFromDataProcessor
(
int
processorId
,
ProcessorManager
processorManager
)
{
double
density
=
-
1.0
;
if
(
processorManager
!=
null
)
{
TreeMap
data
=
(
TreeMap
)
processorManager
.
getProcessor
(
processorId
).
getData
();
AreaDensityCountingProcessor
a
=
(
AreaDensityCountingProcessor
)
processorManager
.
getProcessor
(
processorId
);
TreeMap
data
=
(
TreeMap
)
a
.
getData
();
double
area
=
a
.
getMeasurementArea
().
asPolygon
().
getArea
();
if
(
data
.
size
()
>
0
)
{
density
=
(
double
)
data
.
lastEntry
().
getValue
();
density
=
(
double
)
(
Integer
)
data
.
lastEntry
().
getValue
();
density
=
density
/
area
;
}
}
return
density
;
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/AreaDensityCountingProcessor.java
View file @
1157af27
package
org.vadere.simulator.projects.dataprocessing.processor
;
import
org.vadere.simulator.control.simulation.SimulationState
;
import
org.vadere.simulator.projects.dataprocessing.datakey.NoDataKey
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey
;
import
org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor
;
import
org.vadere.state.attributes.processor.AttributesProcessor
;
...
...
@@ -21,7 +20,7 @@ import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
*/
@DataProcessorClass
(
label
=
"AreaDensityCountingProcessor"
)
public
class
AreaDensityCountingProcessor
extends
AreaDataProcessor
<
Double
>
{
public
class
AreaDensityCountingProcessor
extends
AreaDataProcessor
<
Integer
>
{
public
AreaDensityCountingProcessor
()
{
super
(
"areaDensityCounting"
);
...
...
@@ -46,20 +45,14 @@ public class AreaDensityCountingProcessor extends AreaDataProcessor<Double> {
}
}
double
result
;
if
(
getAttributes
().
getCountsInsteadOfDensity
())
{
result
=
pedCount
;
}
else
{
double
measurementAreaSize
=
getMeasurementArea
().
asPolygon
().
getArea
();
result
=
pedCount
/
measurementAreaSize
;
}
this
.
putValue
(
new
TimestepKey
(
state
.
getStep
()),
result
);
this
.
putValue
(
new
TimestepKey
(
state
.
getStep
()),
pedCount
);
}
@Override
public
Attributes
AreaDensityCounting
Processor
getAttributes
()
{
public
AttributesProcessor
getAttributes
()
{
if
(
super
.
getAttributes
()
==
null
)
{
setAttributes
(
new
AttributesAreaDensityCountingProcessor
());
}
return
(
AttributesAreaDensityCountingProcessor
)
super
.
getAttributes
();
return
super
.
getAttributes
();
}
}
VadereState/src/org/vadere/state/attributes/processor/AttributesAreaDensityCountingProcessor.java
View file @
1157af27
...
...
@@ -5,26 +5,5 @@ package org.vadere.state.attributes.processor;
*/
public
class
AttributesAreaDensityCountingProcessor
extends
AttributesAreaProcessor
{
boolean
countsInsteadOfDensity
=
true
;
private
int
measurementAreaId
=
-
1
;
public
boolean
getCountsInsteadOfDensity
()
{
return
countsInsteadOfDensity
;
}
public
void
setCountsInsteadOfDensity
(
boolean
countsInsteadOfDensity
)
{
this
.
countsInsteadOfDensity
=
countsInsteadOfDensity
;
}
public
int
getMeasurementAreaId
()
{
return
this
.
measurementAreaId
;
}
public
void
setMeasurementAreaId
(
int
measurementAreaId
)
{
checkSealed
();
this
.
measurementAreaId
=
measurementAreaId
;
}
}
Write
Preview
Supports
Markdown
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