Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transit mode coding error during assignment #28

Open
xyzjayne opened this issue Dec 6, 2022 · 8 comments
Open

Transit mode coding error during assignment #28

xyzjayne opened this issue Dec 6, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@xyzjayne
Copy link

xyzjayne commented Dec 6, 2022

After creating time period scenarios and preparing the transit network, we ran into this issue during transit assignment.

It was triggered at the following location:
tm2py\components\network\transit\transit.py in run_assignment(self, scenario, period, network, mode_types, use_fares, use_ccr, congested_transit_assignment)

Error: transit_assignment_spec[0].journey_levels[0].transition_rules[2].mode: Mode does not exist or is not a transit mode: f

Prior to the error, there were printouts showing that:

mode_type = {'TRN': ['p', 'b', 'x', 'f', 'l', 'h', 'r'], 'WALK': ['w', 'a', 'e'], 'PNR_ACCESS': ['D', 'w', 'e'], 'PNR_EGRESS': ['D', 'w', 'a'], 'KNR_ACCESS': ['D', 'k', 'w', 'e'], 'KNR_EGRESS': ['D', 'k', 'w', 'a']}
all_modes = ['b', 'j', 'd', 'q', 'p', 'g', 't'] # note that 'f' is missing

This seems to be the line causing all_modes to neglect ferry:
all_modes = get_fare_modes(mode_types["TRN"])

The function called in the line above references a dictionary called fare_modes, which maps the ferry mode to 'd'. Below is the full value of the dictionary:

defaultdict(<function TransitAssignment.run_assignment.<locals>.<lambda> at 0x000001DE6B2641F8>, {'o': {'r'}, 'j': {'i'}, 'l': {'j'}, 'v': {'o'}, 'u': {'x'}, 'i': {'h'}, 'n': {'y'}, 'y': {'z'}, 'z': {'A'}, 'm': {'n'}, 'x': {'q'}, 'h': {'g'}, 'g': {'f'}, 'f': {'d'}, 's': {'u'}, 't': {'v'}, 'q': {'s'}, 'r': {'t'}, 'A': {'l'}, 'B': {'m'}, 'b': {'b'}, 'p': {'p'}})````
@xyzjayne xyzjayne added the bug Something isn't working label Dec 6, 2022
@xyzjayne
Copy link
Author

xyzjayne commented Dec 6, 2022

@yueshuaing
Copy link
Collaborator

After creating time period scenarios and preparing the transit network, we ran into this issue during transit assignment.

It was triggered at the following location: tm2py\components\network\transit\transit.py in run_assignment(self, scenario, period, network, mode_types, use_fares, use_ccr, congested_transit_assignment)

Error: transit_assignment_spec[0].journey_levels[0].transition_rules[2].mode: Mode does not exist or is not a transit mode: f

Prior to the error, there were printouts showing that:

mode_type = {'TRN': ['p', 'b', 'x', 'f', 'l', 'h', 'r'], 'WALK': ['w', 'a', 'e'], 'PNR_ACCESS': ['D', 'w', 'e'], 'PNR_EGRESS': ['D', 'w', 'a'], 'KNR_ACCESS': ['D', 'k', 'w', 'e'], 'KNR_EGRESS': ['D', 'k', 'w', 'a']}
all_modes = ['b', 'j', 'd', 'q', 'p', 'g', 't'] # note that 'f' is missing

This seems to be the line causing all_modes to neglect ferry: all_modes = get_fare_modes(mode_types["TRN"])

The function called in the line above references a dictionary called fare_modes, which maps the ferry mode to 'd'. Below is the full value of the dictionary:

defaultdict(<function TransitAssignment.run_assignment.<locals>.<lambda> at 0x000001DE6B2641F8>, {'o': {'r'}, 'j': {'i'}, 'l': {'j'}, 'v': {'o'}, 'u': {'x'}, 'i': {'h'}, 'n': {'y'}, 'y': {'z'}, 'z': {'A'}, 'm': {'n'}, 'x': {'q'}, 'h': {'g'}, 'g': {'f'}, 'f': {'d'}, 's': {'u'}, 't': {'v'}, 'q': {'s'}, 'r': {'t'}, 'A': {'l'}, 'B': {'m'}, 'b': {'b'}, 'p': {'p'}})````

Could you share the sceanrio_config.toml and \emme_project\Database_transit\apply_fares_report_ea_{timestamp}.txt. Seems that the prepare transit network did not work properly.

@xyzjayne
Copy link
Author

xyzjayne commented Dec 7, 2022

We are still getting a similar error after re-downloading the network from v9.1, switching our code over to the develop_bart branch, and running 'prepare_network_transit' exactly once. Attached FYI:

07-Dec-2022 (08:35:10): Start period ea
{'TRN': ['p', 'b', 'x', 'f', 'l', 'h', 'r'], 'WALK': ['w', 'a', 'e'], 'PNR_ACCESS': ['D', 'w', 'e'], 'PNR_EGRESS': ['D', 'w', 'a'], 'KNR_ACCESS': ['D', 'k', 'w', 'e'], 'KNR_EGRESS': ['D', 'k', 'w', 'a']}
['m', 'p', 'o', 'x', 'h', 'u', 'j', 'v', 't', 'l', 's', 'b', 'g', 'f', 'y', 'q', 'z', 'i', 'r', 'n']
run congested transit assignment
[...]
Error: Mode does not exist or is not a transit mode: e

Full error message

apply_fares_report_ea_20221207-075037.txt

model_config.toml

scenario_config.toml

@yueshuaing
Copy link
Collaborator

Mode does not exist or is not a transit mode: e

please try the latest Emme version (4.6.2)

@xyzjayne
Copy link
Author

xyzjayne commented Dec 8, 2022

We switched to Emme 4.6.2 per your instructions and got a different error this time around:
ArgumentError: transit_assignment_spec[0].demand: inter-zonal demand "mf476" is <=0 (total: 0.0)

I took the demand matrices that you shared in the v9.1 folder, but just to be sure, here's a summary on each matrix. If you could confirm that your version is indeed the same that would be great.
transit_demand_summary.xlsx

Full error message

Emme's matrix calculation report

image

@yueshuaing
Copy link
Collaborator

We switched to Emme 4.6.2 per your instructions and got a different error this time around: ArgumentError: transit_assignment_spec[0].demand: inter-zonal demand "mf476" is <=0 (total: 0.0)

I took the demand matrices that you shared in the v9.1 folder, but just to be sure, here's a summary on each matrix. If you could confirm that your version is indeed the same that would be great. transit_demand_summary.xlsx

Full error message

Emme's matrix calculation report

image

The demand matrices(v9.1) you use are correct.
The issue is that the transit assignment running in iteration 0 uses zero demands. But congested transit assignment method couldn't run with zero demands. We fixed this issue in b88c466.
Please pull the changes and try rerun the model, let me know if you have any issues.

@xyzjayne
Copy link
Author

xyzjayne commented Dec 9, 2022

Thanks for updating the code.

Just to be sure, if we wanted to replicate the skims that you shared previously, would we want to start with iteration 1, or is it fine to run in iteration 0 with this code update?

@yueshuaing
Copy link
Collaborator

yueshuaing commented Dec 9, 2022

For testing and running transit assignment v9.1, we started with iteration 1, and used this version of assigned highway database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants