Deltares / ra2ce

RA2CE helps to quantify resilience of critical infrastructure networks, prioritize interventions and adaptation measures and select the most appropriate action perspective to increase resilience considering future conditions.
https://deltares.github.io/ra2ce/
Other
9 stars 2 forks source link

Changing the 'weighing' parameter of the single_link redundancy to 'time' instead of distance does not work #439

Closed LiekeMeijer closed 1 month ago

LiekeMeijer commented 2 months ago

Ra2ce version checks

Reproducible example

I tested some functionality and tried to perform a single link redundancy with 'time' as the weighing parameter of the single link redundancy function. While RA2CE does not crash, the output is exactly the same as when using 'distance' as the weighing parameter. I am not sure if 'time' is still a functionality that we want to support, but probably? I have a Jupyter notebook and an analysis ini to reproduce upon request. I also do not see the 'time' option worked out in the code. If we do not support this anymore, we should update the documentation.

From @Carsopre: I can confirm this is a bug. It can be reproduced using the example in tests/test_data/simple_inputs:

_case_dir = Path("tests", "test_data", "simple_inputs")
_network_config_data = NetworkConfigDataReader().read_file(_case_dir.joinpath("network.ini"))
_analyses_config_data = AnalysisConfigDataReader().read_file(_case_dir.joinpath("analysis.ini"))

# Modify the Analysis config data to weigh by `time`
_analyses_config_data[0].weighing = WeighingEnum.TIME

# Run analysis
Ra2ceHandler.run_with_config_data(_network_config_data, _analyses_config_data)

Current behaviour

Setting the weighing parameter to 'time' does not provide any other output than specifying 'distance' in the analysis ini for single link redundancy.

Desired behaviour

Using time as weight.

Additional context

No response

Carsopre commented 2 months ago

I can confirm this is a bug. It can be reproduced using the example in tests/test_data/simple_inputs:

_case_dir = Path("tests", "test_data", "simple_inputs")
_network_config_data = NetworkConfigDataReader().read_file(_case_dir.joinpath("network.ini"))
_analyses_config_data = AnalysisConfigDataReader().read_file(_case_dir.joinpath("analysis.ini"))

# Modify the Analysis config data to weigh by `time`
_analyses_config_data[0].weighing = WeighingEnum.TIME

# Run analysis
Ra2ceHandler.run_with_config_data(_network_config_data, _analyses_config_data)
ArdtK commented 1 month ago

@LiekeMeijer it seems the notebook analysis crashes once time is chosen as weighing as some edges lack the attribute time. This will lead to a crash of the analysis in single_link_redundancy on line 83. Should we investigate this further?

LiekeMeijer commented 1 month ago

@mjevanmarle Is the time function still something that we want to support? I think we have not used this a lot over the past time but this may also be the explanation as to why it is not working at the moment.

ArdtK commented 1 month ago

Discussed: both time and distance should work. In case time is missing avg_speed should be used to calculate time based on distance. @sahand-asgarpour could you plan a meeting for this?

ArdtK commented 1 month ago

This is a duplicate of #433 and can be closed if that issue is closed. Linking it to the same PR for that reason.