Skip to content

Commit

Permalink
move _add_ccost_to_scenario to prepare transit network step
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishKuls committed Apr 22, 2024
1 parent d91d040 commit 9ac45ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 0 additions & 20 deletions tm2py/components/network/transit/transit_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,6 @@ def run(self):
)
# TODO: run skim
# TODO: trim_demand
# create ccost attribute for skimming
scenario = self.transit_emmebank.scenario(time_period)
self._add_ccost_to_scenario(scenario)
# congested_transit_assignment = self.config.congested_transit_assignment
# # apply peaking factor
# if self.config.congested.use_peaking_factor:
Expand Down Expand Up @@ -1353,23 +1350,6 @@ def _add_ccr_vars_to_scenario(self, emme_scenario: "EmmeScenario") -> None:
scenario=emme_scenario,
)

def _add_ccost_to_scenario(self, emme_scenario: "EmmeScenario") -> None:
"""Add Extra Added Wait Time and Capacity Penalty to emme scenario.
Args:
emme_scenario : EmmeScenario
"""
create_extra = self.controller.emme_manager.tool(
"inro.emme.data.extra_attribute.create_extra_attribute"
)
create_extra(
"TRANSIT_SEGMENT",
"@ccost",
"congested cost",
overwrite=True,
scenario=emme_scenario,
)

def _get_network_with_ccr_scenario_attributes(self, emme_scenario):

self._add_ccr_vars_to_scenario(emme_scenario)
Expand Down
20 changes: 20 additions & 0 deletions tm2py/components/network/transit/transit_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def run(self):
# self.apply_station_attributes(input_dir, network)
scenario.publish_network(network)

# create ccost attribute for skimming
self._add_ccost_to_scenario(scenario)

for time_period in self.time_period_names:
# self.update_auto_times(time_period) # run in transit_assign component
self._update_pnr_penalty(time_period)
Expand Down Expand Up @@ -155,6 +158,23 @@ def egress_connector_df(self):
)
return self._egress_connector_df

def _add_ccost_to_scenario(self, emme_scenario: "EmmeScenario") -> None:
"""Add Extra Added Wait Time and Capacity Penalty to emme scenario.
Args:
emme_scenario : EmmeScenario
"""
create_extra = self.controller.emme_manager.tool(
"inro.emme.data.extra_attribute.create_extra_attribute"
)
create_extra(
"TRANSIT_SEGMENT",
"@ccost",
"congested cost",
overwrite=True,
scenario=emme_scenario,
)

def update_auto_times(self, time_period: str):
"""Update the auto travel times from the last auto assignment to the transit scenario.
Expand Down

0 comments on commit 9ac45ea

Please sign in to comment.