public static Id<Vehicle> obtainAutomaticVehicleId( Id<Person> personId, String mode, QSimConfigGroup config ) { Id<Vehicle> vehicleId ; if (config.getUsePersonIdForMissingVehicleId()) { // yyyy my strong preference would be to do away with this "car_" exception and to just // use <mode>_personId across the board. kai, may'18 switch (config.getVehiclesSource()) { case defaultVehicle: case fromVehiclesData: vehicleId = Id.createVehicleId(personId); break; case modeVehicleTypesFromVehiclesData: if(! mode.equals(TransportMode.car)) { vehicleId = Id.createVehicleId( personId.toString() + "_" + mode ); } else { vehicleId = Id.createVehicleId(personId); } break; default: throw new RuntimeException("not implemented") ; } } else { throw new IllegalStateException("Found a network route without a vehicle id."); // yyyyyy condition not really logical here. kai, jul'18 } return vehicleId; } }
if ( config.qsim().getUsePersonIdForMissingVehicleId() ) { log.log( lvl, "found qsim.usePersonIdForMissingVehicleId==true; this is only for backwards compatibility and should rather be set to false") ; && config.qsim().getUsePersonIdForMissingVehicleId() && containsModeChoice && config.qsim().getMainModes().size() > 1 )
@Override public final Id<Vehicle> getPlannedVehicleId() { NetworkRoute route = (NetworkRoute) this.getCurrentLeg().getRoute(); // if casts fail: illegal state. if (route.getVehicleId() != null) { return route.getVehicleId(); } Gbl.assertIf( scenario.getConfig().qsim().getUsePersonIdForMissingVehicleId() ); return Id.create(this.getId(), Vehicle.class); // we still assume the vehicleId is the agentId if no vehicleId is given. } @Override