diff --git a/simba/station_optimization.py b/simba/station_optimization.py index 88eba80..0d2f3cb 100644 --- a/simba/station_optimization.py +++ b/simba/station_optimization.py @@ -188,7 +188,12 @@ def run_optimization(conf, sched=None, scen=None, args=None): # remove none values from socs in the vehicle_socs so timeseries_calc can work optimizer.replace_socs_from_none_to_value() - vehicle_socs = optimizer.timeseries_calc() + # Restore the rotations and the scenario which where the goal of optimization. + optimizer.schedule.rotations = rotations_for_opt + optimizer.scenario = optimizer.base_scenario + + # Check if the rotations which were part of the optimization are not negative anymore + vehicle_socs = optimizer.timeseries_calc(optimizer.electrified_station_set) new_events = optimizer.get_low_soc_events(soc_data=vehicle_socs) diff --git a/tests/test_station_optimization.py b/tests/test_station_optimization.py index 658b663..27fe97f 100644 --- a/tests/test_station_optimization.py +++ b/tests/test_station_optimization.py @@ -169,7 +169,7 @@ def test_fast_calculations_and_events(self): sopt.create_charging_curves() # remove none values from socs in the vehicle_socs sopt.replace_socs_from_none_to_value() - vehicle_socs_fast = sopt.timeseries_calc(ele_station_set=["Station-1"]) + vehicle_socs_fast = sopt.timeseries_calc(set(sched.stations.keys())) for vehicle, socs in scen.vehicle_socs.items(): assert vehicle_socs_fast[vehicle][-1] == pytest.approx(socs[-1], 0.01, abs=0.01) events = sopt.get_low_soc_events(soc_data=vehicle_socs_fast, rel_soc=True)