From 616bb46893a4860c426f28b85eec25b351013abc Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 16 May 2024 19:33:53 +0200 Subject: [PATCH] add comments --- .../prepare/commercial/DefaultDemandPerDayCalculator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/matsim/prepare/commercial/DefaultDemandPerDayCalculator.java b/src/main/java/org/matsim/prepare/commercial/DefaultDemandPerDayCalculator.java index 54d34be..2840ef5 100644 --- a/src/main/java/org/matsim/prepare/commercial/DefaultDemandPerDayCalculator.java +++ b/src/main/java/org/matsim/prepare/commercial/DefaultDemandPerDayCalculator.java @@ -32,7 +32,8 @@ public int calculateKilogramsPerDay(double tonsPerYear) { } /** - * Calculate the waste demand per day. The assumption is that waste is collected once a week and is collected in 20% of the zones on each day. + * Calculate the waste demand per day. + * The assumption is that waste is collected once a week and is collected in 20% of the zones on each day. * * @param freightDemandDataRelation the freight demand data relation * @return the waste demand per day @@ -43,12 +44,14 @@ public int calculateWasteDemandPerDay(Person freightDemandDataRelation) { String originCell = CommercialTrafficUtils.getOriginCell(freightDemandDataRelation); countZonesForWasteCollections.computeIfAbsent(destination, k -> new ArrayList<>()); zonesWithWasteCollectionsOnThisDay.computeIfAbsent(destination, k -> new ArrayList<>()); + // add 20% of the zones to the list of zones with waste collections on this day if (!countZonesForWasteCollections.get(destination).contains(originCell)){ countZonesForWasteCollections.get(destination).add(originCell); if (((countZonesForWasteCollections.get(destination).size() + 4) % 5) == 0){ zonesWithWasteCollectionsOnThisDay.get(destination).add(originCell); } } + //if zone has a waste collection on this day, calculate the demand if (zonesWithWasteCollectionsOnThisDay.get(destination).contains(originCell)){ int numberOfCollectionsPerWeek = 1; double kilogramsPerDay = 0;