Skip to content

Commit

Permalink
implement suggestion from pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
GregorRyb committed Jan 25, 2024
1 parent 1e6a3dd commit 711c46c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main/java/org/matsim/run/prepare/ParkingCapacities.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ public static void main(String[] args) throws IOException {
//skip motorways and non car links
if (l.getAllowedModes().contains(TransportMode.car) && l.getFreespeed() < 55/3.6) {
double usableLength = (l.getLength() - 10) * 0.9;
double maxCapacity = 0;
double minCapacity = 0;
int maxCapacity = 0;
int minCapacity = 0;
if (usableLength > 0) {
maxCapacity = usableLength / 6;
minCapacity = usableLength /50;
maxCapacity = (int) Math.floor(usableLength / 6);
minCapacity = (int) Math.floor(usableLength /50);
}

l.getAttributes().putAttribute("maxParkingCapacity", Math.floor(maxCapacity));
l.getAttributes().putAttribute("minParkingCapacity", Math.floor(minCapacity));
listOfParkingCapacities.add(new ParkingCapacityRecord(l.getId().toString(), (int) Math.floor(maxCapacity), (int) Math.floor(minCapacity)));
l.getAttributes().putAttribute("maxParkingCapacity",maxCapacity);
l.getAttributes().putAttribute("minParkingCapacity", minCapacity);
listOfParkingCapacities.add(new ParkingCapacityRecord(l.getId().toString(), maxCapacity, minCapacity));
}
}
writeResults(Path.of("../"), listOfParkingCapacities);
Expand All @@ -56,6 +56,4 @@ private static void writeResults(Path outputFolder, List<ParkingCapacities.Parki
}

private record ParkingCapacityRecord(String linkId, int maxCapacity, int minCapacity) { }


}

0 comments on commit 711c46c

Please sign in to comment.