matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 179 forks source link

Adding constant access time and egress time for car #491

Open pburla91 opened 3 years ago

pburla91 commented 3 years ago

Hi Everyone,

I have been trying to add a constant access/egress time for car but i see that the method available in the Vehicle implementation is deprecated. If anyone has already worked on it or has an alternate way to do it, can you please suggest how?

Thanking you in advance.

tschlenther commented 3 years ago

Do you want to set access / egress time or do you want to add additional time to the car leg?

For the first case, consider to setPlansCalcRouteConfigGroup.AccessEgressType to walkConstantTimeToLink or to accessEgressModeToLinkPlusTimeConstant if you want to define a different mode for access and/or egress. This can also be done by config.

But if you rather want to add a constant time to the car leg (e.g. to model parking search time) you need to do something different. You can probably use VehicleHandler, or you can wait a bit because we plan on coming up with something for that ourselves :)

Cheers,

Tilmann

pburla91 commented 3 years ago

Hey Tilmann,

Thank you for the quick reply. You got it right, I would like to add a constant (to look for a parking space) to the car leg travel time. I will see if I can add it to PersonLeavesVehicle event somehow, that would be a quick but dirty solution.

cheers, Pradeep

tschlenther commented 3 years ago

Please rather try to implement a corresponding VehicleHander. That would not really be dirty all. Let us know how it goes

pburla91 commented 3 years ago

Yes sure, I will post my progress here :).

ikaddoura commented 3 years ago

see here for an example where the additional amount of time is taken from the link attributes: https://github.com/matsim-scenarios/matsim-hamburg/blob/master/src/main/java/org/matsim/parking/VehicleHandlerForParking.java

pburla91 commented 3 years ago

Thank you Ihab. Based on your input, adding a constant time was pretty straight forward. Now I will go ahead and work on region specific links and their parking times. Thank you for the help Ihab and Tilamnn :)

pburlaisb commented 3 years ago

Hello (again) everyone :)

The solution with modifying VehicleHandler works but gave me incosistent results. If the egress time is defined as 300.0 seconds, it shot up to 10-15 minutes in some cases. I realized that as we do not let the Vehicle leave the link, it is creating a congestion, which is not what I want in my case. Instead of delaying VehicleLeave event by 5 minutes, I would like to delay the PersonLeavesVehicle event by 5 minutes to avoid congestion effects. Is there a way to tweak the AbstractQLink class's "letVehicleArrive" function without changing the source code?

Thank you in advance :)