Skip to content

Commit

Permalink
changes due to small scale comemrcial traffic demand generation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed Aug 28, 2024
1 parent 5170064 commit bbd3e35
Showing 1 changed file with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,7 @@ public Integer call() throws Exception {

for (Person person : population.getPersons().values()) {
if (PopulationUtils.getSubpopulation(person).equals("freight")) {
// rename freight subpop to longDistanceFreight
person.getAttributes().removeAttribute("subpopulation");
person.getAttributes().putAttribute("subpopulation", FREIGHT);

// rename each leg mode freight to longDistanceFreight
for (Plan plan : person.getPlans()) {
for (Leg leg : TripStructureUtils.getLegs(plan)) {
if (leg.getMode().equals("freight")) {
leg.setMode(FREIGHT);
}
}
}
adaptFreightPerson(person);
} else if (PopulationUtils.getSubpopulation(person).equals(FREIGHT)) {
for (Plan plan : person.getPlans()) {
for (Leg leg : TripStructureUtils.getLegs(plan)) {
Expand All @@ -68,7 +57,6 @@ public Integer call() throws Exception {
}
}
}

}

if (PopulationUtils.getSubpopulation(person).contains("commercialPersonTraffic") ||
Expand Down Expand Up @@ -112,6 +100,21 @@ public Integer call() throws Exception {
return 0;
}

private static void adaptFreightPerson(Person person) {
// rename freight subpop to longDistanceFreight
person.getAttributes().removeAttribute("subpopulation");
person.getAttributes().putAttribute("subpopulation", FREIGHT);

// rename each leg mode freight to longDistanceFreight
for (Plan plan : person.getPlans()) {
for (Leg leg : TripStructureUtils.getLegs(plan)) {
if (leg.getMode().equals("freight")) {
leg.setMode(FREIGHT);
}
}
}
}

private static @NotNull Population removeSmallScaleCommercialTrafficFromPopulation(Population population) {
Population newPop = PopulationUtils.createPopulation(ConfigUtils.createConfig());

Expand Down

0 comments on commit bbd3e35

Please sign in to comment.