private void writeVehicleTypes(Map<Id<VehicleType>, VehicleType> vts) throws UncheckedIOException { for (VehicleType vt : vts.values()) { atts.clear(); atts.add(this.createTuple(VehicleSchemaV1Names.ID, vt.getId().toString())); this.writeStartTag(VehicleSchemaV1Names.VEHICLETYPE, atts); if (vt.getDescription() != null) { this.writeStartTag(VehicleSchemaV1Names.DESCRIPTION, null); this.writeContent(vt.getDescription(), true); this.writeEndTag(VehicleSchemaV1Names.DESCRIPTION); if (vt.getCapacity() != null) { this.writeCapacity(vt.getCapacity()); if (!Double.isNaN(vt.getLength())){ atts.clear(); atts.add(this.createTuple(VehicleSchemaV1Names.METER, Double.toString(vt.getLength()))); this.writeStartTag(VehicleSchemaV1Names.LENGTH, atts, true); if (!Double.isNaN(vt.getWidth())){ atts.clear(); atts.add(this.createTuple(VehicleSchemaV1Names.METER, Double.toString(vt.getWidth()))); this.writeStartTag(VehicleSchemaV1Names.WIDTH, atts, true); if (!Double.isNaN(vt.getMaximumVelocity()) && !Double.isInfinite(vt.getMaximumVelocity())){ atts.clear(); atts.add(this.createTuple(VehicleSchemaV1Names.METERPERSECOND, Double.toString(vt.getMaximumVelocity()))); this.writeStartTag(VehicleSchemaV1Names.MAXIMUMVELOCITY, atts, true); if (vt.getEngineInformation() != null) { this.writeEngineInformation(vt.getEngineInformation());
@Override public void setCapacity(VehicleCapacity capacity) { vType.setCapacity(capacity); }
this.currentVehType.setLength(Double.parseDouble(atts.getValue(VehicleSchemaV1Names.METER))); this.currentVehType.setWidth(Double.parseDouble(atts.getValue(VehicleSchemaV1Names.METER))); log.warn("The vehicle type's maximum velocity is set to 1.0 meter per second, is this really intended? vehicletype = " + this.currentVehType.getId().toString()); this.currentVehType.setMaximumVelocity(val); this.currentVehType.setAccessTime(Double.parseDouble(atts.getValue(VehicleSchemaV1Names.SECONDSPERPERSON))); this.currentVehType.setEgressTime(Double.parseDouble(atts.getValue(VehicleSchemaV1Names.SECONDSPERPERSON))); this.currentVehType.setDoorOperationMode(this.parseDoorOperationMode(atts.getValue(VehicleSchemaV1Names.MODE))); this.currentVehType.setPcuEquivalents(Double.parseDouble(atts.getValue(VehicleSchemaV1Names.PCE)));
/*package*/ ComplexTransitStopHandler(Vehicle vehicle) { this.personEntersTime = vehicle.getType().getAccessTime(); this.personLeavesTime = vehicle.getType().getEgressTime(); this.doorOperationMode = vehicle.getType().getDoorOperationMode(); }
public static void setHbefaVehicleDescription( final VehicleType vt, final String hbefaVehicleDescription ) { // yyyy maybe this should use the vehicle information tuple (see below)? // yyyy replace this by using Attributes. kai, oct'18 vt.setDescription( vt.getDescription() + " " + EmissionSpecificationMarker.BEGIN_EMISSIONS.toString()+ hbefaVehicleDescription + EmissionSpecificationMarker.END_EMISSIONS.toString() ); }
private int getVehicleCapacity(Id<Vehicle> vehicleId) { VehicleType type = vehicles.get(vehicleId).getType(); VehicleCapacity capacity = vehicleTypes.get(type.getId()).getCapacity(); return capacity.getSeats() + capacity.getStandingRoom(); }
capacity.setSeats(this.pConfig.getPaxPerVehicle()); // 2018-11 the driver no longer takes one seat capacity.setStandingRoom(0); vehType.setCapacity(capacity); vehType.setPcuEquivalents(this.pConfig.getPassengerCarEquivalents()); vehType.setMaximumVelocity(this.pConfig.getVehicleMaximumVelocity()); vehType.setAccessTime(this.pConfig.getDelayPerBoardingPassenger()); vehType.setEgressTime(this.pConfig.getDelayPerAlightingPassenger()); vehType.setDoorOperationMode(this.pConfig.getDoorOperationMode()); vehicles.addVehicleType( vehType);
private void storeVehicleTypeInfo(SimpleNetwork net) { net.scenario.getConfig().qsim().setVehiclesSource(QSimConfigGroup.VehiclesSource.modeVehicleTypesFromVehiclesData); Vehicles vehicles = net.scenario.getVehicles(); VehicleType car = VehicleUtils.getFactory().createVehicleType(Id.create("car", VehicleType.class)); car.setMaximumVelocity(20); car.setPcuEquivalents(1.0); vehicles.addVehicleType(car); VehicleType bike = VehicleUtils.getFactory().createVehicleType(Id.create("bike", VehicleType.class)); bike.setMaximumVelocity(5); bike.setPcuEquivalents(0.25); vehicles.addVehicleType(bike); }
@Override public Id<VehicleType> getId() { return vType.getId(); }
if(vehicle.getType().getDescription()==null) { // emission specification is in vehicle type id vehicle.getType().setDescription(EmissionSpecificationMarker.BEGIN_EMISSIONS +vehicle.getType().getId().toString()+ EmissionSpecificationMarker.END_EMISSIONS); } else if( vehicle.getType().getDescription().contains(EmissionSpecificationMarker.BEGIN_EMISSIONS.toString()) ) { String vehicleDescription = vehicle.getType().getDescription() + EmissionSpecificationMarker.BEGIN_EMISSIONS + vehicle.getType().getId().toString()+ EmissionSpecificationMarker.END_EMISSIONS; vehicle.getType().setDescription(vehicleDescription); (vehicle.getType() == null && vehicle.getType().getDescription() == null) // if both are null together; no vehicle type information. ) { throw new RuntimeException("Vehicle type description for vehicle " + vehicle + " is missing. " + String vehicleDescription = vehicle.getType().getDescription();
bike.setMaximumVelocity(5); bike.setPcuEquivalents(0.25); car.setMaximumVelocity(20); car.setPcuEquivalents(1.0); case modeVehicleTypesFromVehiclesData: if(! scenario.getVehicles().getVehicleTypes().containsKey(vehTypes[i].getId())) { scenario.getVehicles().addVehicleType(vehTypes[i]); case fromVehiclesData: if(! scenario.getVehicles().getVehicleTypes().containsKey(vehTypes[i].getId())) { scenario.getVehicles().addVehicleType(vehTypes[i]);
@Override public VehicleCapacity getCapacity() { return vType.getCapacity(); }
@Override public void endTag(final String name, final String content, final Stack<String> context) { if (VehicleSchemaV1Names.DESCRIPTION.equalsIgnoreCase(name) && (content.trim().length() > 0)){ this.currentVehType.setDescription(content.trim()); } else if (VehicleSchemaV1Names.ENGINEINFORMATION.equalsIgnoreCase(name)){ EngineInformation currentEngineInfo = this.builder.createEngineInformation(this.currentFuelType, this.currentGasConsumption); this.currentVehType.setEngineInformation(currentEngineInfo); this.currentFuelType = null; this.currentGasConsumption = Double.NaN; } else if (VehicleSchemaV1Names.FUELTYPE.equalsIgnoreCase(name)){ this.currentFuelType = this.parseFuelType(content.trim()); } else if (VehicleSchemaV1Names.FREIGHTCAPACITY.equalsIgnoreCase(name)){ this.currentCapacity.setFreightCapacity(this.currentFreightCap); this.currentFreightCap = null; } else if (VehicleSchemaV1Names.CAPACITY.equalsIgnoreCase(name)) { this.currentVehType.setCapacity(this.currentCapacity); this.currentCapacity = null; } else if (VehicleSchemaV1Names.VEHICLETYPE.equalsIgnoreCase(name)){ this.vehicles.addVehicleType(this.currentVehType); this.currentVehType = null; } }
AbstractTransitDriverAgent driver = new TransitDriverAgentImpl(new SingletonUmlaufBuilderImpl(Collections.singleton(tLine)).build().get(0), TransportMode.car, tracker, trEngine.getInternalInterface()); VehicleType vehType = new VehicleTypeImpl(Id.create("T1", VehicleType.class)); vehType.setCapacity(new VehicleCapacityImpl()); vehType.getCapacity().setSeats(5); driver.setVehicle(new TransitQVehicle(new VehicleImpl(Id.create("V1", Vehicle.class), vehType)));
public void testSizeInEquivalents() { VehicleType carType = new VehicleTypeImpl(Id.create("carType", VehicleType.class)); VehicleType busType = new VehicleTypeImpl(Id.create("busType", VehicleType.class)); busType.setPcuEquivalents(2.5); VehicleCapacity capacity = new VehicleCapacityImpl(); capacity.setSeats(Integer.valueOf(5)); carType.setCapacity(capacity); busType.setCapacity(capacity); Vehicle car = new VehicleImpl(Id.create(1976, Vehicle.class), carType); Vehicle bus = new VehicleImpl(Id.create(1976, Vehicle.class), busType); TransitQVehicle veh = new TransitQVehicle(car); assertEquals(1.0, veh.getSizeInEquivalents(), MatsimTestCase.EPSILON); veh = new TransitQVehicle(bus); assertEquals(2.5, veh.getSizeInEquivalents(), MatsimTestCase.EPSILON); } }
private static VehicleType createTruckType() { VehicleType truckType = VehicleUtils.getFactory().createVehicleType(Id.create("truckType", VehicleType.class)); truckType.setLength(15.); VehicleCapacity vehicleCapacity = new VehicleCapacityImpl(); vehicleCapacity.setSeats(1); truckType.setCapacity(vehicleCapacity); return truckType; }
@Override public double getMaximumVelocity() { return vType.getMaximumVelocity(); }
@Override public void setPcuEquivalents(double pcuEquivalents) { vType.setPcuEquivalents(pcuEquivalents); }
@Override public void setMaximumVelocity(double meterPerSecond) { vType.setMaximumVelocity(meterPerSecond); }
@Override public double getLength() { return vType.getLength(); }