Commit 1b80e0d3 authored by Sebastian Hörl's avatar Sebastian Hörl
Browse files

Merge branch 'conditional-flow-eficiency' into 'master'

Make advanced flow efficiency calculator dependent on whether AVs are used

See merge request !6
parents 096c7c95 779569c0
......@@ -42,9 +42,9 @@ public class RunASTRA2018002 {
// Adjust config (they need to stay in the correct order!)
SwissModeChoiceConfigurator.configure(config);
FlowEfficiencyConfigurator.configure(config);
SharedAVConfigurator.configure(config);
PrivateAVConfigurator.configure(config);
FlowEfficiencyConfigurator.configure(config);
cmd.applyConfiguration(config);
// Load scenario
......
......@@ -7,6 +7,9 @@ import org.matsim.core.config.groups.QSimConfigGroup.VehiclesSource;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;
import ch.ethz.matsim.projects.astra_2018_002.private_av.PrivateAVConfigGroup;
import ch.ethz.matsim.projects.astra_2018_002.shared_av.SharedAVConfigGroup;
public class FlowEfficiencyConfigurator {
static final public Id<VehicleType> CONVENTIONAL_VEHICLE_TYPE_ID = Id.create("car", VehicleType.class);
static final public Id<VehicleType> PRIVATE_AV_VEHICLE_TYPE_ID = Id.create("private_av", VehicleType.class);
......@@ -19,16 +22,21 @@ public class FlowEfficiencyConfigurator {
// Load vehicles by vehicle type
config.qsim().setVehiclesSource(VehiclesSource.modeVehicleTypesFromVehiclesData);
// TODO: Do we need those?
// config.travelTimeCalculator().setAnalyzedModes("car,private_av");
// config.travelTimeCalculator().setSeparateModes(true);
// Set the calculator instance (not the best design, but works)
PrivateAVConfigGroup privateConfig = (PrivateAVConfigGroup) config.getModules()
.get(PrivateAVConfigGroup.GROUP_NAME);
SharedAVConfigGroup sharedConfig = (SharedAVConfigGroup) config.getModules()
.get(SharedAVConfigGroup.GROUP_NAME);
if (privateConfig.getUsePrivateAVs() || sharedConfig.getUseSharedAVs()) {
// With the AvFlowEfficiencyCalculator we can distinguish between HLS
//and other roads in combination with vehicle types
// and other roads in combination with vehicle types
FlowEfficiencyCalculator calculator = new AvFlowEfficiencyCalculator();
FlowEfficiencyCalculator.INSTANCE.set(calculator);
} else {
// Set the calculator instance (not the best design, but works)
FlowEfficiencyCalculator calculator = new StaticFlowEfficiencyCalculator();
FlowEfficiencyCalculator.INSTANCE.set(calculator);
}
}
static public void defineVehicleTypes(Scenario scenario) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment