arup-group / elara

Command line utility for processing MATSim events output files.
MIT License
14 stars 4 forks source link

Toll event handler #161

Closed andkay closed 2 years ago

andkay commented 2 years ago

As discussed in demo, the prior plan handler essentially is a lookup between the road pricing config file and routes from agents' plans.

Included in this PR:

  1. There is new event handler called AgentTollsDaily. Please note, it cannot accept mode filtering and it produces.
  2. Tests for the above, including ones that touch the pandas ops
  3. I have renamed the AgentTollsPaid handler from the PlanHandlers to AgentTollsFromRPConfig. I intend on burying this slightly -- but as @mfitz points out, it does produce a useful record of the tolls that agents "should" have paid, if not for a toll factor being applied.

To do still before merging:

andkay commented 2 years ago

Thanks for the review @mfitz -- regarding your validations numbers above

1,036,987 toll paid events:

arup@workbox-michael:~$ zcat > /mnt/efs/Ireland/deliverable01/2016scenarios/test3_diff_distance_based/500/output_events.xml.gz | grep personMoney | wc -l

1036987

Are we 100% sure that there aren't other personMoney events outside of tolls?

andkay commented 2 years ago

@mfitz and @fredshone -- this handler is now finished along with pretty thorough tests, and ready for final review/approval.

It is now renamed AgentTollsLog and will produce a pure log of tolls along with the timestamp for the charge, along with a 24-hour summary for each agent (what they were charged, how many times).

Please note -- by default, nothing stops MATSim from charging PT Drivers tolls. I've added logic to exclude agents whose id begins with "pt" from the results. However, I keep track of their agent ids and emit a logger warning ala the below.

11679 PT vehicles incurred tolls. These are excluded from logs

I tested the outputs over the simulation referenced above.

I counted 1,025,308 tolling events -- along with the ~11k PT drivers incurring tolls, yields 1,036,987 which aligns with the grep tests.

mfitz commented 2 years ago

Please note -- by default, nothing stops MATSim from charging PT Drivers tolls. I've added logic to exclude agents whose id begins with "pt" from the results. However, I keep track of their agent ids and emit a logger warning ala the below.

11679 PT vehicles incurred tolls. These are excluded from logs

We should probably introduce some logic such that PT vehicles don't pay tolls at all, hence no event fires when they cross a toll boundary. We could choose to do that in the toll factor class. At the moment, toll factoring is based only on caps, but it will be expanded to include differential pricing, and this broadly falls under the heading of differential pricing based on agent/vehicle attributes - it's arguably both in this case. It seems like cutting out these tolls in the first place is better than filtering them downstream in Elara.

I tested the outputs over the simulation referenced above.

I counted 1,025,308 tolling events -- along with the ~11k PT drivers incurring tolls, yields 1,036,987 which aligns with the grep tests.

Cool, cool. Just out of interest - that simulation included quite a lot of tolling. Was that part of the analysis delivered to TII from that model? If so, how?

andkay commented 2 years ago

We should probably introduce some logic such that PT vehicles don't pay tolls at all, hence no event fires when they cross a toll boundary.

Probably we should! But it doesn't make too much a difference in the short for fixed-route transit because the drivers (a) aren't scored and (b) aren't allowed route choice.

that simulation included quite a lot of tolling

Indeed -- it was a distance-based tolling test. I don't recall the precise config, but I believe a large portion of the motorway network was tolled on a per-km basis. I'm actually slightly concerned that the number may be a bit a lower than expected.