21 package org.matsim.vehicles;
23 import java.util.HashMap;
26 import org.apache.logging.log4j.LogManager;
27 import org.apache.logging.log4j.Logger;
50 private static final String
EGRESSTIME =
"egressTimeInSecondsPerPerson";
51 private static final String
ACCESSTIME =
"accessTimeInSecondsPerPerson";
73 return new VehiclesFactoryImpl();
77 return new VehiclesImpl();
86 return defaultVehicleType;
138 return personVehicles != null && personVehicles.
getVehicle(mode) != null;
150 if (personVehicles == null) {
151 throw new RuntimeException(
"Could not retrieve vehicle id from person: " + person.getId().toString() +
152 ". \nIf you are not using config.qsim().getVehicleSource() with 'defaultVehicle' or 'modeVehicleTypesFromVehiclesData' you have to provide " +
153 "a vehicle for each mode for each person. Attach a PersonVehicles instance (containing a map of mode:String -> id:Id<Vehicle>) with key 'vehicles' as person attribute to each person." +
154 "\n VehicleUtils.insertVehicleIdIntoAttributes does this for you.");
156 return personVehicles.getModeVehicles();
165 return personVehicles != null ? personVehicles.getModeVehicleTypes() : null;
176 if (!vehicleIds.containsKey(mode)) {
177 throw new RuntimeException(
"Could not retrieve vehicle id from person: " + person.getId().toString() +
" for mode: " + mode +
178 ". \nIf you are not using config.qsim().getVehicleSource() with 'defaultVehicle' or 'modeVehicleTypesFromVehiclesData' you have to provide " +
179 "a vehicle for each mode for each person. Attach a PersonVehicles instance (containing a map of mode:String -> id:Id<Vehicle>) with key 'vehicles' as person attribute to each person." +
180 "\n VehicleUtils.insertVehicleIdIntoAttributes does this for you." 183 return vehicleIds.get(mode);
211 Map<String, Id<Vehicle>> modeToVehicleCopy =
new HashMap<>(modeToVehicle);
218 personVehicles.addModeVehicleList(modeToVehicleCopy);
238 Map<String, Id<VehicleType>> modeToTypesCopy =
new HashMap<>(modeToVehicleType);
245 personVehiclesTypes.putModeVehicleTypes(modeToTypesCopy);
253 if ( attribute==null ) {
257 }
else if (attribute instanceof String) {
258 String modeString = (String) attribute;
264 throw new IllegalArgumentException(
"VehicleType " + vehicleType.
getId().toString() +
" : Door operation mode " + modeString +
"is not supported");
268 throw new RuntimeException(
"Type of " + attribute +
"is not supported here");
278 if ( attribute==null ) {
281 return (
double) attribute;
291 if ( attribute==null ) {
294 return (
double) attribute ;
393 return new VehicleImpl(
id , type );
431 log.info(
"adding scenario element for allvehicles container" );
432 map =
new VehiclesImpl();
441 if ( vehicle==null ) {
444 log.info(
"vehicleId={} not in allVehicles; trying standard vehicles container ...", vehicleId);
445 if ( tryStdCnt==0 ) {
451 if ( vehicle==null ) {
454 log.info(
"vehicleId={} not in allVehicles; trying transit vehicles container ...", vehicleId);
455 if ( tryTrnCnt==0 ) {
461 if ( vehicle==null ) {
462 log.info(
"unable to find vehicle for vehicleId={}; will return null", vehicleId);
static Double getEnergyCapacity(EngineInformation engineInformation)
static final String HBEFA_VEHICLE_CATEGORY_
Attributes getAttributes()
final EngineInformation getEngineInformation()
static boolean hasVehicleId(Person person, String mode)
static String getHbefaTechnology(EngineInformation ei)
static void setDoorOperationMode(VehicleType vehicleType, VehicleType.DoorOperationMode mode)
final VehicleType setDescription(String desc)
static Id< Vehicle > createVehicleId(final long key)
final String getDescription()
Vehicles getTransitVehicles()
static Id< Link > createLinkId(final long key)
static VehicleType createVehicleType(Id< VehicleType > typeId)
static final String HBEFA_EMISSIONS_CONCEPT
static final String VEHICLE_ATTRIBUTE_KEY
static Vehicle findVehicle(Id< Vehicle > vehicleId, Scenario scenario)
static final String VEHICLE_TYPES_ATTRIBUTE_KEY
static Id< Link > getInitialLinkId(Vehicle vehicle)
void addScenarioElement(String name, Object o)
static final String FUEL_TYPE
static Double getCostsPerSecondWaiting(CostInformation costInformation)
static void setInitialLinkId(Vehicle vehicle, Id< Link > initialLinkId)
static void copyFromTo(VehicleType in, VehicleType out)
final double getMaximumVelocity()
static Double getFuelConsumption(VehicleType vehicleType)
static final String HBEFA_TECHNOLOGY
static void setEgressTime(VehicleType vehicleType, double egressTime)
static< T extends Attributable > void copyAttributesFromTo(T from, T to)
static Vehicles getOrCreateAllvehicles(Scenario scenario)
static Map< String, Id< VehicleType > > getVehicleTypes(Person person)
static Double getEnergyConsumptionKWhPerMeter(EngineInformation engineInformation)
static Double getFuelConsumptionLitersPerMeter(EngineInformation engineInformation)
final double getFlowEfficiencyFactor()
static void setEnergyConsumptionKWhPerMeter(EngineInformation engineInformation, double energyConsumptionKWhPerMeter)
static void setHbefaSizeClass(EngineInformation engineInformation, String hbefaSizeClass)
final VehicleType setLength(double length)
void writeFile(String filename)
final VehicleType setWidth(double width)
static final String FUTURE_SUPPRESSED
final double getPcuEquivalents()
Integer getStandingRoom()
Object getScenarioElement(String name)
static void setHbefaTechnology(EngineInformation engineInformation, String hbefaTechnology)
static double getAccessTime(VehicleType vehicleType)
static void setCostsPerSecondWaiting(CostInformation costInformation, double costsPerSecond)
static void insertVehicleTypesIntoPersonAttributes(Person person, Map< String, Id< VehicleType >> modeToVehicleType)
static< T > Id< T > create(final long key, final Class< T > type)
final VehicleCapacity getCapacity()
static Map< String, Id< Vehicle > > getVehicleIds(Person person)
static double getEgressTime(VehicleType vehicleType)
static Vehicle createVehicle(Id< Vehicle > id, VehicleType type)
static final String ENERGYCAPACITY
static final String HBEFA_SIZE_CLASS
VehicleType createVehicleType(Id< VehicleType > type)
static String getHbefaSizeClass(EngineInformation ei)
Object getAttribute(final String attribute)
static Double getCostsPerSecondInService(CostInformation costInformation)
static void insertVehicleIdsIntoPersonAttributes(Person person, Map< String, Id< Vehicle >> modeToVehicle)
static Id< Vehicle > getVehicleId(Person person, String mode)
static final String EGRESSTIME
static void setCostsPerSecondInService(CostInformation costInformation, double costsPerSecond)
static void insertVehicleTypesIntoAttributes(Person person, Map< String, Id< VehicleType >> modeToVehicleType)
static void setFuelConsumption(VehicleType vehicleType, double literPerMeter)
Object putAttribute(final String attribute, final Object value)
final String getNetworkMode()
static VehicleType createDefaultVehicleType()
final VehicleType setPcuEquivalents(double pcuEquivalents)
static void setAccessTime(VehicleType vehicleType, double accessTime)
VehicleCapacity setWeightInTons(double weightInTons)
final CostInformation getCostInformation()
static final String DEFAULT_VEHICLE_TYPE_ID
static String getHbefaEmissionsConcept(EngineInformation ei)
static void setHbefaEmissionsConcept(EngineInformation engineInformation, String emissionsConcept)
final Attributes getAttributes()
static final String COST_PER_SECOND_WAITING
final VehicleType setMaximumVelocity(double meterPerSecond)
final Id< VehicleType > getId()
static Id< Vehicle > createVehicleId(Person person, String mode)
static final String ENERGYCONSUMPTION
Double getVolumeInCubicMeters()
static void setHbefaVehicleCategory(EngineInformation engineInformation, String hbefaVehicleCategory)
static final String INITIAL_LINK_ID
static final String FUELCONSUMPTION
Map< Id< Vehicle >, Vehicle > getVehicles()
static final String ACCESSTIME
static void writeVehicles(Vehicles vehicles, String filename)
static final String DOOR_OPERATION_MODE
static final String COST_PER_SECOND_INSERVICE
static VehicleType.DoorOperationMode getDoorOperationMode(VehicleType vehicleType)
static void setFuelConsumptionLitersPerMeter(EngineInformation engineInformation, double fuelConsumptionLitersPerMeter)
VehicleCapacity setSeats(Integer seats)
final VehicleType setFlowEfficiencyFactor(double flowEfficiencyFactor)
static String getHbefaVehicleCategory(EngineInformation ei)
static void insertVehicleIdsIntoAttributes(Person person, Map< String, Id< Vehicle >> modeToVehicle)
static void setEnergyCapacity(EngineInformation engineInformation, double energyCapacityInKWhOrLiters)
final VehicleType setNetworkMode(String networkMode)
static VehiclesFactory getFactory()
static VehicleType createVehicleType(Id< VehicleType > typeId, String networkMode)
static Vehicles createVehiclesContainer()
Id< Vehicle > getVehicle(String mode)