From 8b8c6c790b3f04a2b154c84c4f213f1504032293 Mon Sep 17 00:00:00 2001 From: Georg Date: Wed, 8 Jan 2025 12:06:44 +0100 Subject: [PATCH] feat(app): provide getHaltingVehicles from LaneAreaDetectors (#454) * feat: Make getHaltingVehicles from lastLaneAreaInfo accessible --- .../ambassador/simulation/tmc/LaneAreaDetector.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fed/mosaic-application/src/main/java/org/eclipse/mosaic/fed/application/ambassador/simulation/tmc/LaneAreaDetector.java b/fed/mosaic-application/src/main/java/org/eclipse/mosaic/fed/application/ambassador/simulation/tmc/LaneAreaDetector.java index d529bbf9b..8584e849c 100644 --- a/fed/mosaic-application/src/main/java/org/eclipse/mosaic/fed/application/ambassador/simulation/tmc/LaneAreaDetector.java +++ b/fed/mosaic-application/src/main/java/org/eclipse/mosaic/fed/application/ambassador/simulation/tmc/LaneAreaDetector.java @@ -53,10 +53,14 @@ public double getLength() { } @SuppressWarnings("unused") - public int getAmountOfVehiclesOnSegment() { + public int getNumberOfVehicles() { return lastLaneAreaInfo == null ? 0 : Math.max(0, lastLaneAreaInfo.getVehicleCount()); } + public int getNumberOfHaltingVehicles() { + return lastLaneAreaInfo == null ? 0 : Math.max(0, lastLaneAreaInfo.getHaltingVehicles()); + } + public double getMeanSpeed() { return lastLaneAreaInfo == null || lastLaneAreaInfo.getVehicleCount() == 0 ? -1d : lastLaneAreaInfo.getMeanSpeed(); }