Hussein-Mahfouz / matsim-drt

0 stars 0 forks source link

VehicleID error when qsim::vehiclesSource = fromVehiclesData #12

Open Hussein-Mahfouz opened 5 days ago

Hussein-Mahfouz commented 5 days ago

It seems eqasim expects a vehicles files - see here. I updated the config to

howevever, I still get the following error

java.lang.RuntimeException: Could not retrieve vehicle id from person: 1003 for mode: car.

If you are not using config.qsim().getVehicleSource() with 'defaultVehicle' or 'modeVehicleTypesFromVehiclesData' you have to provide 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.

VehicleUtils.insertVehicleIdIntoAttributes does this for you.

I need to use VehicleUtils.insertVehicleIdIntoAttributes somehow

Related questions

Hussein-Mahfouz commented 5 days ago

I found an issue that mentions this problem https://github.com/eqasim-org/eqasim-java/issues/191. From this comment https://github.com/eqasim-org/eqasim-java/issues/191#issuecomment-1946893271, it seems that VehicleUtils.insertVehicleIdIntoAttributes is being used in eqasim/core/scenario/routing/RunPopulationRouting.java, see also this commit https://github.com/eqasim-org/eqasim-java/commit/a8a73b53dbfc085e6eabddcd8ba43fd72013b063

If this is handled by eqasim, why am I getting the error?

Hussein-Mahfouz commented 5 days ago

It seems that this piece of code is no longer there in the latest commit .

It is now in RunInsertVehicles.java. Should I use RunInsertVehicles in my RunDMCSimulation class, or somewhere else in the code? Or should it be used by default?

Hussein-Mahfouz commented 4 days ago

This is resolved after commit 3ea4sd5 above. However, Milos says it is better for RunInsertVehicles to be implemented in a separate script, and be part of a scenario generation process. In https://github.com/Hussein-Mahfouz/matsim-drt/commit/309d1b326dad8ea8b4835d0f91c80499e47221e6 I: