Commit ad2d8105 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

In "FundamentalDiagramBProcessor.java", use "VTrajectory" correctly.

parent b038fd09
Pipeline #114776 passed with stages
in 188 minutes and 44 seconds
...@@ -19,6 +19,7 @@ import org.vadere.util.logging.Logger; ...@@ -19,6 +19,7 @@ import org.vadere.util.logging.Logger;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* <p>This processor computes the fundamental diagram by computing an (average) velocity and the density for each * <p>This processor computes the fundamental diagram by computing an (average) velocity and the density for each
...@@ -108,7 +109,8 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey, ...@@ -108,7 +109,8 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey,
private double density(@NotNull final PedestrianIdKey key, @NotNull final Map<PedestrianIdKey, VTrajectory> cutTrajectoryMap) { private double density(@NotNull final PedestrianIdKey key, @NotNull final Map<PedestrianIdKey, VTrajectory> cutTrajectoryMap) {
VTrajectory pedTrajectory = cutTrajectoryMap.get(key); VTrajectory pedTrajectory = cutTrajectoryMap.get(key);
double duration = pedTrajectory.duration(); Optional<Double> duration = pedTrajectory.duration();
double densityIntegral = cutTrajectoryMap.values() double densityIntegral = cutTrajectoryMap.values()
.stream() .stream()
.map(trajectory -> trajectory.cut(pedTrajectory.getStartTime().get(), pedTrajectory.getEndTime().get())) .map(trajectory -> trajectory.cut(pedTrajectory.getStartTime().get(), pedTrajectory.getEndTime().get()))
...@@ -118,8 +120,9 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey, ...@@ -118,8 +120,9 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey,
.mapToDouble(trajectory -> (trajectory.getEndTime().get() - trajectory.getStartTime().get())) .mapToDouble(trajectory -> (trajectory.getEndTime().get() - trajectory.getStartTime().get()))
.sum(); .sum();
densityIntegral /= duration; densityIntegral /= duration.get();
densityIntegral /= measurementAreaVRec.getArea(); densityIntegral /= measurementAreaVRec.getArea();
return densityIntegral; return densityIntegral;
/*List<Triple<Double, Double, Integer>> integralValues = new LinkedList<>(); /*List<Triple<Double, Double, Integer>> integralValues = new LinkedList<>();
......
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