Commit 2c81515b authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

Merge branch 'develop' of https://gitlab.lrz.de/vadere/vadere into develop

parents 362681a0 8028c523
......@@ -154,12 +154,12 @@
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 200,
"spawnNumber" : 50,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -154,12 +154,12 @@
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 200,
"spawnNumber" : 50,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -159,7 +159,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -122,7 +122,7 @@
"startTime" : 0.0,
"endTime" : 1200.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -125,8 +125,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -31,12 +31,15 @@
"id" : 2,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianEvacuationTimeProcessor",
"attributes" : {
"pedestrianStartTimeProcessorId" : 3
"pedestrianStartTimeProcessorId" : 4
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 3
} ],
} ,{
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianStartTimeProcessor",
"id": 4
}],
"isTimestamped" : true
},
"scenario" : {
......@@ -157,7 +160,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -122,7 +122,7 @@
"startTime" : 0.0,
"endTime" : 100.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -209,8 +209,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -191,8 +191,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -762,7 +762,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -179,8 +179,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -144,7 +144,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.NoDataKey;
import org.vadere.state.attributes.processor.AttributesMaxOverlapProcessor;
import org.vadere.state.attributes.processor.AttributesNumberOverlapsProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import javax.swing.*;
import java.util.OptionalDouble;
import java.util.OptionalInt;
/**
* This processor saves the largest overlap (2*pedRadius - distance between the pedestrian's centers) for one simulation.
* The processor depends on the PedestrianOverlapDistProcessor. It only works if all pedestrians in the simulation have
* the same radius.
*
* @author Marion Gödel
*/
@DataProcessorClass()
public class MaxOverlapProcessor extends DataProcessor<NoDataKey, Double> {
private PedestrianOverlapDistProcessor pedOverlapProc;
public MaxOverlapProcessor() {
super("max_size_overlap");
setAttributes(new AttributesMaxOverlapProcessor());
}
@Override
protected void doUpdate(final SimulationState state) {
//ensure that all required DataProcessors are updated.
this.pedOverlapProc.doUpdate(state);
}
@Override
public void postLoop(final SimulationState state) {
this.pedOverlapProc.postLoop(state);
OptionalDouble maximumOverlap = this.pedOverlapProc.getValues().stream().filter(val -> val > 0).mapToDouble(val -> val.doubleValue()).max();
if(maximumOverlap.isPresent()){
this.putValue(NoDataKey.key(),maximumOverlap.getAsDouble());
/* // Uncomment if you want a info box to inform you about the maximum overlap
MaxOverlapProcessor.infoBox("Minimum distance between centers: " + maximumOverlap + " meters" , "Maximum Overlap");
*/
}else{
this.putValue(NoDataKey.key(), null);
}
}
/* // Uncomment if you want a info box to inform you about the maximum overlap
public static void infoBox(String infoMessage, String titleBar)
{
JOptionPane.showMessageDialog(null, infoMessage, titleBar, JOptionPane.INFORMATION_MESSAGE);
}
*/
@Override
public void init(final ProcessorManager manager) {
super.init(manager);
AttributesMaxOverlapProcessor att = (AttributesMaxOverlapProcessor) this.getAttributes();
this.pedOverlapProc = (PedestrianOverlapDistProcessor) manager.getProcessor(att.getPedestrianMaxOverlapProcessorId());
}
@Override
public AttributesProcessor getAttributes() {
if (super.getAttributes() == null) {
setAttributes(new AttributesMaxOverlapProcessor());
}
return super.getAttributes();
}
}
......@@ -33,7 +33,7 @@ public class NumberOverlapsProcessor extends DataProcessor<NoDataKey, Long> {
public NumberOverlapsProcessor() {
super("overlaps");
super("nr_overlaps");
setAttributes(new AttributesNumberOverlapsProcessor());
}
......
package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesMaxOverlapProcessor;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.shapes.VPoint;
import java.util.*;
import java.util.stream.Stream;
/**
* This processor gives for each pedestrian - if at least one overlap occurs in this time step - the overlap with
* the closest other pedestrian. That is 2*radius - distance (between the centers of the pedestrians). That means, if
* several overlaps occur at the same timestep, only the largest one is shown.
* At the moment, the radius needs to be equal for all pedestrians in the simulation.
*
* @author Marion Gödel
*/
@DataProcessorClass()
public class PedestrianOverlapDistProcessor extends DataProcessor<TimestepPedestrianIdKey, Double> {
public PedestrianOverlapDistProcessor() {
super("overlap_dist");
}
@Override
protected void doUpdate(final SimulationState state) {
double pedRadius = state.getTopography().getAttributesPedestrian().getRadius(); // in init there is no access to the state
Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class);
peds.forEach(p -> this.putValue(
new TimestepPedestrianIdKey(state.getStep(), p.getId()),
this.calculateOverlaps(peds, p, pedRadius)));
}
@Override
public void init(final ProcessorManager manager) {
super.init(manager);
}
private double calculateOverlaps(final Collection<Pedestrian> peds, Pedestrian ped, double pedRadius) {
VPoint pos = ped.getPosition();
Stream<Pedestrian> pedList = peds.stream().filter(p -> (!p.equals(ped)) ? p.getPosition().distance(pos) <= 2 * pedRadius: false);
List<Double> overlaps = new ArrayList<Double>();
pedList.forEach(p -> overlaps.add(2*pedRadius - p.getPosition().distance(pos)));
double overlapDist = (overlaps.isEmpty()) ? 0 : Collections.max(overlaps);
return overlapDist;
}
}
package org.vadere.state.attributes.processor;
/**
* @author Marion Gödel
*
*/
public class AttributesMaxOverlapProcessor extends AttributesProcessor {
private int pedestrianMaxOverlapProcessorId;
public int getPedestrianMaxOverlapProcessorId() {
return this.pedestrianMaxOverlapProcessorId;
}
public void getPedestrianMaxOverlapProcessorId(int pedestrianMaxOverlapProcessorId) {
checkSealed();
this.pedestrianMaxOverlapProcessorId = pedestrianMaxOverlapProcessorId;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment