arup-group / elara

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

adds road pricing input #84

Closed fredshone closed 3 years ago

fredshone commented 3 years ago

@sarah-e-hayes WIP.

I've added a road pricing input. So you can now add road pricing as a requirement to a handler. eg: requirements = ["road_pricing"]

The road pricing is as follows, note that this is an awkward combination of dicts and list (the cost start times are not necessarily in order). In simulation agents should enter a single toll zone in the morning (links 2-3 and 3-4). In the afternoon agents should enter two toll zones (4-3 and the 2-1).

    self.resources['road_pricing'].links == {
        '2-3': [
            {'start_time': '00:00', 'end_time': '06:00', 'amount': '0.0'},
            {'start_time': '06:01', 'end_time': '10:00', 'amount': '10.0'},
            {'start_time': '10:01', 'end_time': '16:00', 'amount': '3.0'},
            {'start_time': '16:01', 'end_time': '19:00', 'amount': '10.0'},
            {'start_time': '19:01', 'end_time': '23:59', 'amount': '3.0'}
        ],
        '3-4': [
            {'start_time': '00:00', 'end_time': '06:00', 'amount': '0.0'},
            {'start_time': '06:01', 'end_time': '10:00', 'amount': '10.0'},
            {'start_time': '10:01', 'end_time': '16:00', 'amount': '3.0'},
            {'start_time': '16:01', 'end_time': '19:00', 'amount': '10.0'},
            {'start_time': '19:01', 'end_time': '23:59', 'amount': '3.0'}
        ],
        '4-3': [
            {'start_time': '00:00', 'end_time': '06:00', 'amount': '0.0'},
            {'start_time': '06:01', 'end_time': '10:00', 'amount': '10.0'},
            {'start_time': '10:01', 'end_time': '16:00', 'amount': '3.0'},
            {'start_time': '16:01', 'end_time': '19:00', 'amount': '10.0'},
            {'start_time': '19:01', 'end_time': '23:59', 'amount': '3.0'}
        ],
        '2-1': [
            {'start_time': '00:00', 'end_time': '06:00', 'amount': '0.0'},
            {'start_time': '06:01', 'end_time': '10:00', 'amount': '10.0'},
            {'start_time': '10:01', 'end_time': '16:00', 'amount': '3.0'},
            {'start_time': '16:01', 'end_time': '19:00', 'amount': '10.0'},
            {'start_time': '19:01', 'end_time': '23:59', 'amount': '3.0'}
        ]
    }
fredshone commented 3 years ago

times are now guaranteed to be ordered

sarah-e-hayes commented 3 years ago

Hi @KasiaKoz - would you be able to review some changes Fred and I have made to Elara? The idea is to process the plans output in conjunction with the road pricing input file to work out which agents have paid tolls, how much and on which links.

The logic is essentially:

Fred's added in a sample roadpricing.xml file and made the changes needed to the elara underbelly (inputs.py and config.py) and I've added in a new plan handler and some corresponding unit tests.

Thank you!