Changes in VehicleType

The following is currently in the newest matsim snapshot. It is not yet in the newest contribs snapshots, but will be there once they are no longer failing on jenkins. (They are passing on travis.)

We have changed the "VehicleType" data structure. This has been discussed in depth at various places. We think that we are still reading the old file format but into the new data structure. If you have not used ScenarioLoader but have been reading the vehicles yourself, then

new VehicleReaderV1(...)

needs to be replaced by

new MatsimVehicleReader(...)

This change was unavoidable since otherwise your code will not automatically switch between file formats.

---

If you programmed the vehicle type in code, there are unfortunately more changes. The most important ones seem to be

* The line

VehicleCapacity cap = vehicleFactory.createVehicleCapacity() ;

needs to be replaced by

VehicleCapacity cap = vehicleType.getCapacity() ; // (*)

* The line

type.setVehicleCapacity(cap) ;

is no longer needed (and no longer possible), since the reference is there from the beginning (and obtained by (*)).

The same is the case with vehicleType.getEngineInformation() and with vehicleType.getCostInformation(), but those seem to be used less often.

* The expression

new VehicleTypeImpl(...)

becomes

new VehicleType(...)

I am really sorry about these changes. In this case it was triggered by the desire to have the consistent vehicle types for analysis, e.g. for the calculation of emissions. However, the existing vehicle type was geared very much towards public transit, and rather problematic for freight. In consequence, the freight contrib had designed its own vehicle type, which, however, was then not consistent with emissions.

Please write to matsim.org/faq if you have problems with the conversion.