pycity_scheduling.testing.unit_tests package

Submodules

pycity_scheduling.testing.unit_tests.test_algorithms module

The pycity_scheduling framework

Copyright (C) 2025, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class pycity_scheduling.testing.unit_tests.test_algorithms.TestAlgorithms(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_central_algorithm

test_dual_decomposition

test_exchange_admm

test_exchange_admm_beta

test_exchange_miqp_admm

test_local_algorithm

test_stand_alone_algorithm

setUp()

Hook method for setting up the test fixture before exercising it.

test_central_algorithm()
test_dual_decomposition()
test_exchange_admm()
test_exchange_admm_beta()
test_exchange_miqp_admm()
test_local_algorithm()
test_stand_alone_algorithm()

pycity_scheduling.testing.unit_tests.test_all_classes module

The pycity_scheduling framework

Copyright (C) 2025, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class pycity_scheduling.testing.unit_tests.test_all_classes.TestAllClasses(methodName='runTest')

Bases: TestCase

Methods

test_all_classes

test_all_classes()

pycity_scheduling.testing.unit_tests.test_classes module

The pycity_scheduling framework

Copyright (C) 2025, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class pycity_scheduling.testing.unit_tests.test_classes.TestBattery(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2

test_e_ini

test_get_objective

test_no_discharge

test_populate_model

test_update_model

test_update_schedule

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2()
test_e_ini()
test_get_objective()
test_no_discharge()
test_populate_model()
test_update_model()
test_update_schedule()
class pycity_scheduling.testing.unit_tests.test_classes.TestBoiler(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2

test_lower_activation

test_objective

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2()
test_lower_activation()
test_objective()
class pycity_scheduling.testing.unit_tests.test_classes.TestBuilding(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

testReset

test_calculate_co2

test_get_objective

test_robustness

setUp()

Hook method for setting up the test fixture before exercising it.

testReset()
test_calculate_co2()
test_get_objective()
test_robustness()
class pycity_scheduling.testing.unit_tests.test_classes.TestChiller(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation

test_update_model

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation()
test_update_model()
class pycity_scheduling.testing.unit_tests.test_classes.TestCityDistrict(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_autarky

test_calculate_adj_costs

test_calculate_co2

test_calculate_costs

test_get_objective

test_self_consumption

setUp()

Hook method for setting up the test fixture before exercising it.

test_autarky()
test_calculate_adj_costs()
test_calculate_co2()
test_calculate_costs()
test_get_objective()
test_self_consumption()
class pycity_scheduling.testing.unit_tests.test_classes.TestCombinedHeatPower(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2

test_lower_activation

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2()
test_lower_activation()
class pycity_scheduling.testing.unit_tests.test_classes.TestCurtailableLoad(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_integer_first

test_populate_model

test_populate_model_integer

test_populate_model_on_off

test_small_horizon

test_small_horizon_low_full

test_small_horizon_low_full_integer

test_update_model

test_update_model_integer

test_update_model_on_off

combinations = [(4, 1), (3, 1), (2, 1), (1, 1), (1, 3), (1, 4), (2, 2), (2, 3), (0, 1), (0, 2), (0, 3), (0, 4)]
horizon = 5
setUp()

Hook method for setting up the test fixture before exercising it.

test_integer_first()
test_populate_model()
test_populate_model_integer()
test_populate_model_on_off()
test_small_horizon()
test_small_horizon_low_full()
test_small_horizon_low_full_integer()
test_update_model()
test_update_model_integer()
test_update_model_on_off()
class pycity_scheduling.testing.unit_tests.test_classes.TestDeferrableLoad(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_infeasible_consumption

test_infeasible_integer

test_large_runtime

test_objective

test_small_horizon

test_small_runtime

test_update_integer

test_update_model

test_update_model_integer

test_zero_runtime

setUp()

Hook method for setting up the test fixture before exercising it.

test_infeasible_consumption()
test_infeasible_integer()
test_large_runtime()
test_objective()
test_small_horizon()
test_small_runtime()
test_update_integer()
test_update_model()
test_update_model_integer()
test_zero_runtime()
class pycity_scheduling.testing.unit_tests.test_classes.TestElectricHeater(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation

test_update_schedule

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation()
test_update_schedule()
class pycity_scheduling.testing.unit_tests.test_classes.TestElectricVehicle(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_bad_charging_times

test_get_objective

test_no_charge_time

test_no_discharge

test_populate_model

test_update_model

setUp()

Hook method for setting up the test fixture before exercising it.

test_bad_charging_times()
test_get_objective()
test_no_charge_time()
test_no_discharge()
test_populate_model()
test_update_model()
class pycity_scheduling.testing.unit_tests.test_classes.TestElectricalEntity(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_autarky

test_calculate_adj_costs

test_calculate_adj_energy

test_calculate_adj_power

test_calculate_costs

test_metric_delta_g

test_new_objective

test_objective

test_peak_reduction_ratio

test_peak_to_average_ratio

test_self_consumption

test_update_schedule

setUp()

Hook method for setting up the test fixture before exercising it.

test_autarky()
test_calculate_adj_costs()
test_calculate_adj_energy()
test_calculate_adj_power()
test_calculate_costs()
test_metric_delta_g()
test_new_objective()
test_objective()
test_peak_reduction_ratio()
test_peak_to_average_ratio()
test_self_consumption()
test_update_schedule()
class pycity_scheduling.testing.unit_tests.test_classes.TestFixedLoad(methodName='runTest')

Bases: TestCase

Methods

test_populate_model

test_unit_conversion

test_populate_model()
test_unit_conversion()
class pycity_scheduling.testing.unit_tests.test_classes.TestHeatPump(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation

test_update_model

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation()
test_update_model()
class pycity_scheduling.testing.unit_tests.test_classes.TestModule(methodName='runTest')

Bases: TestCase

Methods

test_filter_entities

test_filter_entities()
class pycity_scheduling.testing.unit_tests.test_classes.TestPhotovoltaic(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2

test_objective

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2()
test_objective()
class pycity_scheduling.testing.unit_tests.test_classes.TestPrices(methodName='runTest')

Bases: TestCase

Methods

test_cache

test_unavailable_year

test_cache()
test_unavailable_year()
class pycity_scheduling.testing.unit_tests.test_classes.TestSpaceCooling(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_model

setUp()

Hook method for setting up the test fixture before exercising it.

test_model()
class pycity_scheduling.testing.unit_tests.test_classes.TestSpaceHeating(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_model

setUp()

Hook method for setting up the test fixture before exercising it.

test_model()
class pycity_scheduling.testing.unit_tests.test_classes.TestThermalCoolingStorage(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule()
class pycity_scheduling.testing.unit_tests.test_classes.TestThermalEntityCooling(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule()
class pycity_scheduling.testing.unit_tests.test_classes.TestThermalEntityHeating(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule()
class pycity_scheduling.testing.unit_tests.test_classes.TestThermalHeatingStorage(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_schedule()
class pycity_scheduling.testing.unit_tests.test_classes.TestTimer(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_more_than_one_year

test_time_in_day

test_time_in_week

test_time_in_year

setUp()

Hook method for setting up the test fixture before exercising it.

test_more_than_one_year()
test_time_in_day()
test_time_in_week()
test_time_in_year()
class pycity_scheduling.testing.unit_tests.test_classes.TestWindEnergyConverter(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2

test_objective

setUp()

Hook method for setting up the test fixture before exercising it.

test_calculate_co2()
test_objective()
pycity_scheduling.testing.unit_tests.test_classes.assert_equal_array(a: ndarray, expected)
pycity_scheduling.testing.unit_tests.test_classes.get_env(op_horizon, mpc_horizon=None, mpc_step_width=1)
pycity_scheduling.testing.unit_tests.test_classes.solve_model(model)

pycity_scheduling.testing.unit_tests.test_examples module

The pycity_scheduling framework

Copyright (C) 2025, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class pycity_scheduling.testing.unit_tests.test_examples.TestExamples(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_all_examples

setUp()

Hook method for setting up the test fixture before exercising it.

test_all_examples()

pycity_scheduling.testing.unit_tests.test_util module

The pycity_scheduling framework

Copyright (C) 2025, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class pycity_scheduling.testing.unit_tests.test_util.TestConstraints(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation_limit

setUp()

Hook method for setting up the test fixture before exercising it.

test_lower_activation_limit()
class pycity_scheduling.testing.unit_tests.test_util.TestFactory(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_distribution

setUp()

Hook method for setting up the test fixture before exercising it.

test_distribution()
class pycity_scheduling.testing.unit_tests.test_util.TestPlotSchedules(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_plot_into_dir

setUp()

Hook method for setting up the test fixture before exercising it.

test_plot_into_dir()
class pycity_scheduling.testing.unit_tests.test_util.TestSubpackage(methodName='runTest')

Bases: TestCase

Methods

test_compute_profile

test_value_extraction

test_compute_profile()
test_value_extraction()
class pycity_scheduling.testing.unit_tests.test_util.TestWriteSchedules(methodName='runTest')

Bases: TestCase

Methods

setUp()

Hook method for setting up the test fixture before exercising it.

test_schedule_to_csv

test_schedule_to_json

test_to_dict_1

test_to_dict_2

test_to_dict_3

setUp()

Hook method for setting up the test fixture before exercising it.

test_schedule_to_csv()
test_schedule_to_json()
test_to_dict_1()
test_to_dict_2()
test_to_dict_3()
class pycity_scheduling.testing.unit_tests.test_util.TimerStub

Bases: object

Methods

time_in_day

time_in_week

static time_in_day(from_init)
static time_in_week(from_init)
pycity_scheduling.testing.unit_tests.test_util.solve_model(model)

Module contents

The pycity_scheduling framework

Copyright (C) 2025, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.