Skip to content

Commit

Permalink
change mode of long distance freight to truck40t
Browse files Browse the repository at this point in the history
  • Loading branch information
rewertvsp committed May 16, 2024
1 parent 7a2aa85 commit 35b9911
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/org/matsim/prepare/CreateCommercialDemand.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,15 @@ public Integer call() {
"--tripType", "TRANSIT"
);
Population population = PopulationUtils.readPopulation(longDistanceFreightPopulationName);
for (Person person : population.getPersons().values()) {
PopulationUtils.putSubpopulation(person, "longDistanceFreight");
}
log.info("Set mode to truck40t for long distance freight");
for (Person person : population.getPersons().values()) {
PopulationUtils.putSubpopulation(person, "longDistanceFreight");
person.getSelectedPlan().getPlanElements().forEach(planElement -> {
if (planElement instanceof Leg leg) {
leg.setMode("truck40t");
}
});
}
PopulationUtils.sampleDown(population, sample / 0.25);
PopulationUtils.writePopulation(population, longDistanceFreightPopulationName);
}
Expand Down

0 comments on commit 35b9911

Please sign in to comment.