Generate MatSim Solution from City #1

Closed
opened 2024-01-24 01:18:12 -05:00 by r_sanchez · 1 comment

#Overview
The idea behind this feature is to allow the users to continue using a similar API to the hub's API while being able to generate MatSim solutions. It would probably look something like:

MatSimEngine(city, tmp_folder)

This requires building a minimum of the following files:

  • facilities.xml
  • network.xml
  • population.xml
  • config.xml

Facilities

This would be done easily using the already existing buildings. It would probably something like this:

    for building in city.buildings():
      facility = {
        '@id': building.building_id,
        '@x': str(building.centroid[0]),
        '@y': str(building.centroid[1]),
        'activity': {
          '@type': building.function,
          'capacity': {
            '@value': '4.0'
          },
          'opentime': {
            '@day': 'wkday',
            '@start_time': '00:00:00',
            '@end_time': '30:00:00'
          }
        }
      }
      facilities_dict['facilities']['facility'].append(facility)

Things like the function should be mapped. Currently the examples have "home", "work", "secondary" but we can do any we want.

Network

This is TBD but in the documentation we are provided with ways of getting the network of a city using OpenStreetMaps. Might be worth getting Montreal as a whole once and then just querying the nodes/edges we need depending on the facilities.

Population

This one I wouldn't be able to generate properly but we can randomize it.

Config

I have left this for last because there are a ton of parameters that can change. The biggest thing is that it must point to the files we generated but it might have values that we want to let users change.

#Overview The idea behind this feature is to allow the users to continue using a similar API to the hub's API while being able to generate MatSim solutions. It would probably look something like: ```py MatSimEngine(city, tmp_folder) ``` This requires building a minimum of the following files: - [x] facilities.xml - [x] network.xml - [x] population.xml - [x] config.xml # Facilities This would be done easily using the already existing buildings. It would probably something like this: ```py for building in city.buildings(): facility = { '@id': building.building_id, '@x': str(building.centroid[0]), '@y': str(building.centroid[1]), 'activity': { '@type': building.function, 'capacity': { '@value': '4.0' }, 'opentime': { '@day': 'wkday', '@start_time': '00:00:00', '@end_time': '30:00:00' } } } facilities_dict['facilities']['facility'].append(facility) ``` Things like the function should be mapped. Currently the examples have "home", "work", "secondary" but we can do any we want. # Network This is TBD but in the documentation we are provided with ways of getting the network of a city using OpenStreetMaps. Might be worth getting Montreal as a whole once and then just querying the nodes/edges we need depending on the facilities. # Population This one I wouldn't be able to generate properly but we can randomize it. # Config I have left this for last because there are a ton of parameters that can change. The biggest thing is that it must point to the files we generated but it might have values that we want to let users change.
r_sanchez added the
enhancement
label 2024-01-24 01:18:12 -05:00
r_sanchez self-assigned this 2024-01-24 01:18:12 -05:00
Author

7c15ee4399 closes this issue.

7c15ee439943b232da9ad729884dfdd71a93494f closes this issue.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: CERC/matsim-proto#1
No description provided.