tests package

Submodules

tests.test_actors module

Unit tests for actor module.

Copyright 2018 G2Elab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License .

class tests.test_actors.TestActor(methodName='runTest')[source]

Bases: TestCase

Test of the actor class

setUp()[source]

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

test_add_actor_constraint_operator()[source]

Test the add_actor_constraint method associated to an actor operating energy unit

test_add_actor_constraint_regulator()[source]

Test the add_actor_constraint method associated to an actor non operating energy unit

test_add_actor_dynamic_constraint_operator()[source]

Test the add_actor_dynamic_constraint method associated to an actor operating energy unit

test_add_actor_dynamic_constraint_regulator()[source]

Test the add_actor_dynamic_constraint method associated to an actor non operating energy unit

test_add_objective_operator()[source]

Test the add_objective method associated to an actor operating energy unit

test_add_objective_regulator()[source]

Test the add_objective method associated to an actor non operating energy unit

test_init()[source]

Test the name and the description

tests.test_consumer_actors module

Unit tests for the module consumer_actors.py, defining constraints and objectives for consumer actor type.

Copyright 2018 G2Elab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_consumer_actors.TestConsumerActorConstraints(methodName='runTest')[source]

Bases: TestCase

Test of ConsumerActor constraints

setUp()[source]

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

test_energy_consumption_maximum()[source]

Test the energy_consumption_maximum constraint on two consumption units

test_energy_consumption_maximum_without_int_or_float()[source]

Test it raises an error if max_e_tot is a list

test_energy_consumption_minimum()[source]

Test the energy_consumption_minimum constraint on two consumption units

test_energy_consumption_minimum_without_int_or_float()[source]

Test it raises an error if min_e_tot is a list

test_power_consumption_by_unit_maximum()[source]

Test the power_consumption_by_unit_maximum constraint on two consumption units

test_power_consumption_by_unit_maximum_with_dic()[source]

Test it raises an error if max_p is a list with dictionary

test_power_consumption_by_unit_maximum_with_list()[source]

Test the power_consumption_by_unit_maximum constraint on two consumption units if max_p is a list

test_power_consumption_by_unit_maximum_with_wrong_list()[source]

Test it raises an error if max_p is a list with a wrong dimension considering the unit time

test_power_consumption_by_unit_minimum()[source]

Test the add_power_consumption_by_unit_minimum constraint on two consumption units

test_power_consumption_by_unit_minimum_with_dic()[source]

Test it raises an error if min_p is a dictionary

test_power_consumption_by_unit_minimum_with_list()[source]

Test the add_power_consumption_by_unit_minimum constraint on two consumption units if min_p is a list

test_power_consumption_by_unit_minimum_with_wrong_list()[source]

Test it raises an error if min_p is a list with a wrong dimension considering the unit time

test_power_consumption_total_maximum()[source]

Test the power_consumption_maximum constraint on two consumption units

test_power_consumption_total_maximum_with_dic()[source]

Test it raises an error if max_p is a list with dictionary

test_power_consumption_total_maximum_with_list()[source]

Test the power_consumption_maximum constraint on two consumption units if max_p is a list

test_power_consumption_total_maximum_with_wrong_list()[source]

Test it raises an error if max_p is a list with a wrong dimension considering the unit time

test_power_consumption_total_minimum()[source]

Test the add_power_consumption_minimum constraint on two consumption units

test_power_consumption_total_minimum_with_dic()[source]

Test it raises an error if min_p is a dictionary

test_power_consumption_total_minimum_with_list()[source]

Test the add_power_consumption_total_minimum constraint on two consumption units if min_p is a list

test_power_consumption_total_minimum_with_wrong_list()[source]

Test it raises an error if min_p is a list with a wrong dimension considering the unit time

class tests.test_consumer_actors.TestConsumerActorObjectives(methodName='runTest')[source]

Bases: TestCase

Test of ConsumerActor objectives

setUp()[source]

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

test_maximize_consumption()[source]

Test the maximize_consumption objective on two consumption units

test_minimize_co2_consumption()[source]

Test the minimize_co2_consumption objective on two consumption units

test_minimize_consumption()[source]

Test the minimize_consumption objective on two consumption units

test_minimize_consumption_cost()[source]

Test the minimize_consumption_cost objective on two consumption units

tests.test_consumer_producer_actors module

Unit tests for the module consumer_producer_actors.py, defining constraints and objectives for consumer_producer actor type.

Copyright 2018 G2Elab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_consumer_producer_actors.TestCheckOperatedList(methodName='runTest')[source]

Bases: TestCase

Test of _check_operated_list method dedicated to production or consumption

setUp()[source]

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

test_check_operated_consumption_list()[source]

Test _check_operated_consumption_list method

test_check_operated_production_list()[source]

Test _check_operated_production_list method

test_check_operated_storage_list()[source]

Test _check_operated_production_list method

class tests.test_consumer_producer_actors.TestMaximizeConsoProdMatch(methodName='runTest')[source]

Bases: TestCase

Test of maximize_conso_prod_match method

setUp()[source]

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

test_calc_conso_prod_match()[source]

Test the conso_prod_match DynamicConstraint

test_conso_prod_match()[source]

Test conso_prod_match is a Quantity

class tests.test_consumer_producer_actors.TestMaximizeSelfconsumptionRate(methodName='runTest')[source]

Bases: TestCase

Test of maximize_selfconsumption_rate method

setUp()[source]

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

test_calc_selfconsumption_rate()[source]

Test the calc_selfconsumption_rate DynamicConstraint

test_maximize_conso_prod_match()[source]

Test maximize_conso_prod_match is activated

test_selfconsumption_rate()[source]

Test selfconsumption_rate is Quantity

class tests.test_consumer_producer_actors.TestMaximizeSelfproductionRate(methodName='runTest')[source]

Bases: TestCase

Test of maximize_selfproduction_rate method

setUp()[source]

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

test_calc_selfproduction_rate()[source]

Test the calc_selproduction_rate DynamicConstraint

test_maximize_conso_prod_match()[source]

Test maximize_conso_prod_match is activated

test_selfproduction_rate()[source]

Test selfproduction_rate is Quantity

class tests.test_consumer_producer_actors.TestProsumerActor(methodName='runTest')[source]

Bases: TestCase

Test of ProsumerActor definition

setUp()[source]

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

test_unit_list()[source]

Test operator unit lists

tests.test_consumption_units module

Unit tests for consumption_units module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_consumption_units.TestDefConsumptionCostCalc(methodName='runTest')[source]

Bases: TestCase

Check the _def_consumption_cost_calc method

test_dict_consumption_cost_calc()[source]

check no cost calculation if consumption_cost is a dictionary

test_float_consumption_cost_calc()[source]

check the cost calculation if consumption_cost is a float

test_int_consumption_cost_calc()[source]

check the cost calculation if consumption_cost is an int

test_list_consumption_cost_calc()[source]

check the cost calculation if consumption_cost is a list First an incomplete list considering the time of the study Then a complete list

test_none_consumption_cost_calc()[source]

check if the consumption_cost is none

class tests.test_consumption_units.TestFixedConsumptionUnit(methodName='runTest')[source]

Bases: TestCase

Check the FixedConsumptionUnit class

test_variable_consumption_none_p()[source]

Check if it raises an error if no energy profile is done for a FixedConsumptionUnit

class tests.test_consumption_units.TestInitConsumptionUnit(methodName='runTest')[source]

Bases: TestCase

Check the initialisation of the ConsumptionUnit class

test_none_definition()[source]

Check if the external constraints are none at the initialisation

class tests.test_consumption_units.TestMaximizeConsumption(methodName='runTest')[source]

Bases: TestCase

Check the maximize_consumption method

setUp()[source]

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

test_minimize_consumption_expression()[source]

Check the expression of the max_consumption objective

test_minimize_consumption_name()[source]

Check the name of the max_consumption objective

class tests.test_consumption_units.TestMinimizeConsumption(methodName='runTest')[source]

Bases: TestCase

Check the minimize_consumption method

setUp()[source]

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

test_minimize_consumption_expression()[source]

Check the expression of the min_consumption objective

test_minimize_consumption_name()[source]

Check the name of the min_consumption objective

class tests.test_consumption_units.TestMinimizeConsumptionCost(methodName='runTest')[source]

Bases: TestCase

Check the minimize_consumption_cost method

setUp()[source]

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

test_minimize_consumption_expression()[source]

Check the expression of the min_consumption_cost objective

test_minimize_consumption_name()[source]

Check the name of the min_consumption_cost objective

class tests.test_consumption_units.TestShiftableConsumptionUnit(methodName='runTest')[source]

Bases: TestCase

check the ShiftableConsumptionUnit class

setUp()[source]

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

test_energy_bounds_mandatory_and_nonmandatory()[source]
test_no_overshoot_constraint()[source]

checking no overshoot constraint is properly set

test_power_values_cropping_and_epsilon()[source]
test_shiftable_constraint()[source]
test_shiftable_startup()[source]

checking add start up constraint is properly set

tests.test_conversion_units module

Unit tests for the module conversion_units.py, defining the conversion units attributes, constraints and functions.

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_conversion_units.TestCOPFloat(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_conversion_constraint()[source]

Checking the conversion constraint of the heat pump is properly set

test_power_flow_constraint()[source]

Checking the power flow constraint is properly set in the heat pump

test_wrong_cop_value()[source]

Asserting an error is raised when the COP value is below 1

class tests.test_conversion_units.TestCOPList(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_conversion_constraint()[source]

Checking the conversion constraint is properly set with a COP list

test_cop_inf()[source]

Asserting an error is raised when at least one value of the COP list is below 1

test_cop_inf_dict()[source]

Asserting an error is raised when at least one value of the COP dict is below 1

test_cop_too_long()[source]

Asserting an error is raised when the cop list is too long compared to the studied period

test_cop_wrong_type()[source]

Asserting an error is raised when the cop value is set to a string

class tests.test_conversion_units.TestConversionUnit(methodName='runTest')[source]

Bases: TestCase

test_conversion_unit()[source]
class tests.test_conversion_units.TestE2HRatioFloat(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_conversion_constraint()[source]

Checking the conversion constraint

test_e2hr_sup()[source]

Asserting an error is raised when the elec_to_therm ratio value is over 1

class tests.test_conversion_units.TestE2HRatioList(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_conversion_constraint()[source]

Checking the conversion constraint with a list elec_to_therm_ratio

test_e2hr_sup()[source]

Asserting an error is raised when at least one element of the elec_to_therm_ratio list is over 1

test_e2hr_sup_dict()[source]

Asserting an error is raised when at least one element of the elec_to_therm_ratio dict is over 1

test_e2hr_too_long()[source]

Asserting an error is raised when the elec_to_therm_ratio list is longer than the studied time period

test_e2hr_wrong_type()[source]

Asserting an error is raised when the elec_to_therm_ratio is a string

class tests.test_conversion_units.TestEffRatioList(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_conversion_constraint()[source]

Checking the conversion constraint with a list efficiency_ratio

test_eff_r_sup()[source]

Asserting an error is raised when at least one element of the efficiency_ratio list is over 1

test_eff_r_sup_dict()[source]

Asserting an error is raised when at least one element of the efficiency_ratio dict is over 1

test_eff_r_too_long()[source]

Asserting an error is raised when the efficiency_ratio list is longer than the studied time period

test_eff_r_wrong_type()[source]

Asserting an error is raised when the efficiency_ratio is a string

class tests.test_conversion_units.TestEfficiencyRatioFloat(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_conversion_constraint()[source]

Checking the conversion constraint

test_eff_ratio_sup()[source]

Asserting an error is raised when the efficiency ratio value is over 1

class tests.test_conversion_units.TestElec2ThermalConvUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_e_cons_unit()[source]

Checking the elec_consumption_unit is properly defined

test_h_prod_unit()[source]

Checking the thermal_production_unit is properly defined

class tests.test_conversion_units.TestHeatPump(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_e_cons_unit()[source]

Checking the elec_consumption_unit of the heat pump is properly set

test_h_cons_unit()[source]

Checking the thermal_consumption_unit of the heat pump is properly set

test_h_prod_unit()[source]

Checking the thermal_production_unit of the heat pump is properly set

test_hp_COP()[source]

Checking the heat pump COP Quantity is properly set

class tests.test_conversion_units.TestReversibleConversionUnitCreation(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_rev_units_down()[source]

Testing the reversible units downstream is created

test_rev_units_up()[source]

Testing the reversible units upstream is created

class tests.test_conversion_units.TestReversibleConversionUnitEff(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_down2up_eff_dict()[source]

Testing the down2up_eff for dicts

test_down2up_eff_float()[source]

Testing the down2up_eff for float

test_down2up_eff_list()[source]

Testing the down2up_eff for lists

test_up2down_eff_dict()[source]

Testing the up2down_eff for dicts

test_up2down_eff_float()[source]

Testing the up2down_eff for float

test_up2down_eff_list()[source]

Testing the up2down_eff for lists

test_wrong_eff_dict()[source]
test_wrong_eff_float()[source]
test_wrong_eff_list()[source]
class tests.test_conversion_units.TestSingleConvUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_cons_unit()[source]

Checking the consumption_unit is properly defined

test_prod_unit()[source]

Checking the production_unit is properly defined

tests.test_core module

Copyright 2018 G2Elab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_core.TestLists(methodName='runTest')[source]

Bases: TestCase

Test add_unit_attributes_in_lists and associated quantity, constraint and objective methods

setUp()[source]

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

test_add_and_get_constraints()[source]

Test if the constraint is added into the _model_constraints_list and that the list of constraints is available with get_constraints_name_list()

test_add_and_get_objectives()[source]

Test if the objective is added into the _model_objectives_list and that the list of objective is available with get_objectives_name_list()

test_add_and_get_quantities()[source]

Test if the quantity is added into the _model_quantities_list and that the list of quantities is available with get_quantities_name_list()

class tests.test_core.TestUnit(methodName='runTest')[source]

Bases: TestCase

Test the OptObject class

test_init()[source]

Test the initialisation with empty quantities, constraints and objectives

class tests.test_core.Testrepr(methodName='runTest')[source]

Bases: TestCase

Test the __repr__ method

test_return()[source]

Test the return for a unit with a name

test_return_empty_name()[source]

Test the return for a unit without name

class tests.test_core.Teststr(methodName='runTest')[source]

Bases: TestCase

Test the __str__ method

test_constant_quantity()[source]

Test the return considering a unit with a quantity which is constant

test_constraint()[source]

Test the return considering a unit with a constraint

test_dict_quantity()[source]

Test the return considering a unit with a quantity which is a dictionary

test_objective()[source]

Test the return considering a unit with an objective

test_optimised_quantity()[source]

Test the return considering a unit with a quantity which can be optimised

test_return()[source]

Test the return considering the name and the description

test_return_empty_name()[source]

Test the return considering a unit with empty name and description

tests.test_electrical_system_operation module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_electrical_system_operation.TestElectricalSystemOperation(methodName='runTest')[source]

Bases: TestCase

Unittests for the example electrical_system_operation.py

setUp()[source]

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

test_load_creation()[source]

Check the name for the load creation

test_operating_cost_calculation_variable_production()[source]

Check the operating cost calculated for the variable production unit

test_power_calculation_variable_production()[source]

Check the power calculated for the variable production unit

test_return_first_model()[source]

Check if the first value of return is an OptimisationModel

test_return_fourth_fifth_production()[source]

Check if the fourth and fifth values of return is a VariableProductionUnit type Check the result of the fourth and fifth values

test_return_second_time()[source]

Check if the second value of return is a TimeUnit

test_return_third_load()[source]

Check if the third value of return is a FixedConsumptionUnit Check the result of the third value

test_total_energy_calculation_variable_production()[source]

Check the operating cost calculated for the variable production unit

tests.test_electrical_vehicle module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_electrical_vehicle.TestElectricVehicle(methodName='runTest')[source]

Bases: TestCase

Unittests for the example electrical_system_operation.py

setUp()[source]

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

test_energy_calculation_storage()[source]

Check the energy calculated for the storage unit

test_load_profile_creation()[source]

Check if the load profile is taken into account for power values

test_operating_cost_calculation_variable_production()[source]

Check the operating cost calculated for the variable production unit

test_power_calculation_variable_production()[source]

Check the power calculated for the variable production unit

test_return_first_model()[source]

Check if the first value of return is an OptimisationModel

test_return_fith_load()[source]

Check if the fith value of return is a FixedConsumptionUnit Check the result of the fith value

test_return_fourth_fifth_production()[source]

Check if the fourth value of return is a VariableProductionUnit type

test_return_second_time()[source]

Check if the second value of return is a TimeUnit

test_return_sixth_storage()[source]

Check if the sixth value of return is a StorageUnit

test_return_third_load()[source]

Check if the third value of return is a FixedConsumptionUnit Check the result of the third value

test_seventh_node()[source]

Checking the 8th return is a node

test_total_energy_calculation_variable_production()[source]

Check the total energy produced calculated for the variable production unit

tests.test_elements module

Unit tests for the module elements.py, defining the quantity, constraint and objective classes

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_elements.TestActorConstraint(methodName='runTest')[source]

Bases: TestCase

Checking the attributes of ActorConstraint are properly set

test_deactivate_actor_cons()[source]
class tests.test_elements.TestConstraint(methodName='runTest')[source]

Bases: TestCase

Checking the attributes of Constraint are properly set

test_elements_constr()[source]
class tests.test_elements.TestDailyDynamicConstraint(methodName='runTest')[source]

Bases: TestCase

Testing Daily Dynamic Constraint

setUp()[source]

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

test_dd_cons_init_higher_than_final_time()[source]

Checking if the ValueError is raised if init_time higher than final_time

test_dd_cons_long_t_range()[source]

Checking t_range values when the studied period ends between the the specified init and final time

test_dd_cons_midnight_end()[source]

Checking t_range values when the studied period ends at midnight

test_dd_cons_t_range()[source]

Checking t_range values

test_dd_cons_wrong_final_time()[source]

Checking if the ValueError finak_h>24 is raised

class tests.test_elements.TestDynamicConstraint(methodName='runTest')[source]

Bases: TestCase

Checking the attributes of Dynamic Constraint are properly set

setUp()[source]

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

test_dconstr()[source]
class tests.test_elements.TestGetValue(methodName='runTest')[source]

Bases: TestCase

Checking the get_value() method

setUp()[source]

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

test_dict_get_correct_list()[source]

Checking if get_value() on an dict gives correct value

test_dict_get_list()[source]

Checking if get_value() on a dict gives a list

test_float_get_correct_float()[source]

Checking if get_value() on an float gives correct value

test_float_get_float()[source]

Checking if get_value() on a float gives a float

test_int_get_correct_int()[source]

Checking if get_value() on an int gives correct value

test_int_get_int()[source]

Checking if get_value() on an int gives an int

test_list_get_correct_list()[source]

Checking if get_value() on an list gives correct value

test_list_get_list()[source]

Checking if get_value() on a list gives a list

class tests.test_elements.TestGetValueWithDate(methodName='runTest')[source]

Bases: TestCase

Checking the get_value_with_date() method

setUp()[source]

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

test_dict_get_correct_dataframe()[source]

Checking if get_value_with_date() on a dict gives a correct dataframe

test_dict_get_dataframe()[source]

Checking if get_value_with_date() on a dict gives a dataframe

test_list_get_correct_dataframe()[source]

Checking if get_value_with_date() on a list gives a correct dataframe

test_list_get_dataframe()[source]

Checking if get_value_with_date() on a list gives a dataframe

class tests.test_elements.TestHourlyDynamicConstraint(methodName='runTest')[source]

Bases: TestCase

Testing Hourly Dynamic Constraint

setUp()[source]

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

test_hd_cons_final_24()[source]

Checking t_range if final_h=24

test_hd_cons_t_range()[source]

Checking t_range values

test_hd_cons_wrong_final_time()[source]

Checking if the ValueError finak_h>24 is raised

test_hd_cons_wrong_init_final_time()[source]

Checking if the ValueError final_h<init_h is raised

class tests.test_elements.TestObjective(methodName='runTest')[source]

Bases: TestCase

Checking the attributes of Objective are properly set

test_objective()[source]
class tests.test_elements.TestQuantityDictValue(methodName='runTest')[source]

Bases: TestCase

Testing Quantity when the value is a dict

setUp()[source]

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

test_elements_opt()[source]

Checking the opt is set to False if at least one dict value is specified

test_elements_opt_none()[source]

Checking the opt remains the same if at no dict value is specified

test_elements_value()[source]

Checking the dict values

test_elements_wrong_vlen()[source]

Checking if the error is raised when the vlen is wrong

class tests.test_elements.TestQuantityFloatValue(methodName='runTest')[source]

Bases: TestCase

Tests on the Quantity class when its value is a float

setUp()[source]

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

test_elements_opt()[source]

Checking the opt value

test_elements_value()[source]

Checking the quantity value

test_elements_vlen()[source]

Checking the vlen value

test_elements_vlen_error()[source]

Checking error is raised when vlen is wrong

class tests.test_elements.TestQuantityListValues(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_elements_opt()[source]

Checking the opt value

test_elements_value()[source]

Checking the quantity value

test_elements_vlen()[source]

Checking the vlen value

class tests.test_elements.TestQuantityNoneValue(methodName='runTest')[source]

Bases: TestCase

Tests when the quantity has no value

setUp()[source]

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

test_element_none_value_below_two()[source]

Checking the value is set to 0 when opt=True and vlen=1

test_elements_none_opt_vlen_above_two()[source]

Checking a dict of opt is created when opt=True and vlen is set>2

test_elements_none_value_false_opt()[source]

Checking an exception is raised when value = None AND opt=False

test_elements_none_value_vlen_above_two()[source]

Checking a dict of value is created when opt=True and vlen is set>2

class tests.test_elements.TestQuantityOtherOptObjects(methodName='runTest')[source]

Bases: TestCase

Checking an exception is raised if opt is a list or a dict

test_elements_other_opt_objects()[source]
class tests.test_elements.TestQuantitySpecialMethodFloat(methodName='runTest')[source]

Bases: TestCase

Checking the Str special method works properly with floats, and raises an error for lists and dicts

setUp()[source]

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

test_elements_str_dict()[source]
test_elements_str_float()[source]
test_elements_str_list()[source]
class tests.test_elements.TestQuantitySpecialMethodRepr(methodName='runTest')[source]

Bases: TestCase

Checking the Repr special method works properly with floats, lists and dicts

setUp()[source]

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

test_elements_repr_bool()[source]
test_elements_repr_dict()[source]
test_elements_repr_list()[source]
class tests.test_elements.TestQuantitySpecialMethodStr(methodName='runTest')[source]

Bases: TestCase

Checking the Str special method works properly with floats, lists and dicts

setUp()[source]

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

test_elements_str_dict()[source]
test_elements_str_float()[source]
test_elements_str_list()[source]
class tests.test_elements.TestQuantityWrongOptObjects(methodName='runTest')[source]

Bases: TestCase

Checking an error is raised if opt has a wrong type

test_elements_other_opt_objects()[source]
class tests.test_elements.TestQuantityWrongValue(methodName='runTest')[source]

Bases: TestCase

Checking an error is raised if value has a wrong value

test_elements_wrong_value()[source]
class tests.test_elements.TestTechnicalConstraint(methodName='runTest')[source]

Bases: TestCase

Checking the attributes of TechnicalConstraint are properly set

test_deactivate_tech_cons()[source]

tests.test_energy_nodes module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_energy_nodes.TestAddConnectedEnergyUnits(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_only_once_to_list()[source]

Test if the EnergyUnit is not added into the connected_energy_units list when already in it.

test_add_to_list()[source]

Test if the EnergyUnit is added to the connected_energy_units list.

test_no_energy_type_for_node()[source]

Test if the energy_type of the EnergyNode becomes the energy_type of the EnergyUnit connected to the node, when there is no energy_type for the EnergyNode.

test_no_energy_type_for_unit()[source]

Test if the energy_type of the EnergyUnit becomes the energy_type of the EnergyNode connected to the unit, when there is no energy_type for the EnergyUnit.

test_raise_energy_type_error()[source]

Test if a TypeError is raised when the energy_type of the node is not the same as the energy_type of the unit to be connected.

test_raise_type_error()[source]

Test if the proper TypeError is raised when the unit is not an EnergyUnit

test_raise_type_error_assembly()[source]

Test if the proper TypeError is raised when the unit is an AssemblyUnit

class tests.test_energy_nodes.TestAddPole(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_pole_only_once_to_list()[source]

Test if the pole is not added to the list of poles if it is already in it

test_add_pole_to_list()[source]

Test if the pole is added to the list of poles

test_raise_type_error()[source]

Test if a TypeError is raised when the pole is not an Epole

class tests.test_energy_nodes.TestCreateExport(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_to_export_list()[source]

Test if the energy_export is added to the export list

test_add_to_import_list()[source]

Test if the energy export is added to the import list of the other node

test_energy_export_to_node_is_added()[source]

Test if the Quantity energy_export is added as attribute to the node

test_is_exporting_to_node_is_added()[source]

Test if the Quantity is_exporting is added as attribute to the node

test_set_export_max_to_node_is_added()[source]

Test if the Constraint set_export_max is added as attribute to the node

test_set_export_min_to_node_is_added()[source]

Test if the Constraint set_export_min is added as attribute to the node

class tests.test_energy_nodes.TestExportToNode(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_raise_error_if_not_EnergyNode()[source]

Test if a TypeError is raised when the node is not an EnergyNode.

test_raise_error_if_wrong_energy_type()[source]

Test if an AttributeError is raised when the node to whom we export is not the same energy type as the node from whom we export.

class tests.test_energy_nodes.TestIsExport(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_is_export_False()[source]

Test if the method returns False when the quantity test is not in the export list.

test_is_export_True()[source]

Test if the method returns True when the quantity test is in the export list.

class tests.test_energy_nodes.TestIsImport(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_is_import_False()[source]

Test if the method returns False when the quantity test is not in the import list.

test_is_import_True()[source]

Test if the method returns True when the quantity test is in the import list.

class tests.test_energy_nodes.TestSetPowerBalance(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_if_power_balance_is_added()[source]

Test if the Constraint power_balance is added as attribute to the node

test_power_balance_expression()[source]

Test if the power_balance expression is the expected expression

test_raise_TypeError_if_not_FlowPole()[source]

Test if a TypeError is raised if there is an object that is not a FlowPole in the pole list

tests.test_energy_units module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_energy_units.TestAddConsUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_cons_unit()[source]

Checking the method add_cons_unit

class tests.test_energy_units.TestAddEnergyLimitsOnTimePeriod(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_e_min_0()[source]

Test if there is no min constraint added with e_min equals to 0

test_empty_end()[source]

Test if the period_index is time.I[start:] when no empty end

test_empty_start()[source]

Test if the period_index is time.I[0:end] when no empty start

test_no_e_max()[source]

Test if there is no max constraint added with e_max = None

class tests.test_energy_units.TestAddProdUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_prod_unit()[source]

Checking the method add_prod_unit

class tests.test_energy_units.TestAddRevProdConsUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_assembly_units_poles()[source]

Checking the poles of assembly unit

test_assembly_units_types()[source]

Checking the types of the unit in AssemblyUnit

class tests.test_energy_units.TestAddRevUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_rev_unit()[source]

Checking the method add_rev_unit

class tests.test_energy_units.TestAssemblyUnitAttributes(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_attributes()[source]

Checking the attributes of the Assembly unit are properly set : - operator, - prod_units - cons_units - poles

class tests.test_energy_units.TestEminEmax(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_e_max()[source]
test_e_min()[source]
test_no_emax()[source]
class tests.test_energy_units.TestEnergyMinMaxValues(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_e_tot_lb()[source]
test_e_tot_ub()[source]
class tests.test_energy_units.TestInitEnergyUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_p_lb_int_float()[source]

Test if the expected lower bound is created for p with an int or a float

test_p_lb_list()[source]

Test if the expected lower bound is created for p with a list

test_p_ub_int_float()[source]

Test if the expected upper bound is created for p with an int or a float

test_p_ub_list()[source]

Test if the expected upper bound is created for p with a list

class tests.test_energy_units.TestSetOperatingTimeRange(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_beg_time_range()[source]

Asserting the set_start_time_range is properly created for the 3 days

test_end_time_range()[source]

Asserting the set_end_time_range is properly created

test_mid_time_range()[source]

Asserting the set_time_range are properly created

class tests.test_energy_units.TestWrongAssemblyUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_no_defined_cons_units()[source]

Asserting an error is raised when no consumption unit is defined

test_no_defined_prod_units()[source]

Asserting an error is raised when no production unit is defined

test_no_list_cons_units()[source]

Asserting an error is raised when no list of consumption unit is defined

test_no_list_prod_units()[source]

Asserting an error is raised when no list of production unit is defined

test_no_list_rev_units()[source]

Asserting an error is raised when no list of reversible unit is defined

test_wrong_cons_units()[source]

Asserting an error is raised when the objects in the list of consumption units are not consumption units

test_wrong_prod_units()[source]

Asserting an error is raised when the objects in the list of production units are not production units

test_wrong_rev_units()[source]

Asserting an error is raised when the objects in the list of reversible units are not reversible units

tests.test_exergy module

Unit tests for exergy analysis module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_exergy.TestExergyAnalysis(methodName='runTest')[source]

Bases: TestCase

Test exergy analysis class

test_electrical_exergy_but_already_assessed()[source]

Asserting AttributeError whenever exergy analysis is attempted on a unit on which exergy analysis has already been applied

test_electrical_exergy_but_no_energy_unit()[source]

Asserting TypeError whenever electrical exergy analysis is attempted on an object that is not an EnergyUnit

test_electrical_exergy_but_non_electrical_unit()[source]

Asserting TypeError whenever electrical exergy analysis is attempted on a thermal unit

test_electrical_exergy_list_but_already_assessed()[source]

Asserting AttributeError whenever exergy analysis is attempted on a list containing at least one unit where exergy is already assessed

test_electrical_exergy_list_but_no_energy_unit()[source]

Asserting TypeError whenever electrical exergy analysis is attempted on a list of units that contains at least one object that is not an EnergyUnit

test_electrical_exergy_list_but_non_electrical_unit()[source]

Asserting TypeError whenever electrical exergy analysis is attempted on a list of units where at least one is not an electrical unit.

test_exergy_destruction_but_already_assessed()[source]
test_exergy_destruction_but_efficiency_is_zero()[source]
test_exergy_destruction_but_efficiency_is_zero_list()[source]
test_exergy_destruction_but_efficiency_list_different_length()[source]
test_exergy_destruction_but_efficiency_not_defined()[source]
test_exergy_destruction_but_efficiency_not_defined_list()[source]
test_exergy_destruction_but_efficiency_wrong_type()[source]
test_exergy_destruction_but_efficiency_wrong_type_list()[source]
test_exergy_destruction_but_exergy_not_assessed()[source]
test_thermal_exergy_but_already_assessed()[source]

Asserting AttributeError whenever exergy analysis is attempted on a unit on which exergy analysis has already been applied

test_thermal_exergy_but_no_temp()[source]

Asserting ValueError whenever thermal exergy analysis is attempted without providing a temperature

test_thermal_exergy_but_no_temp_within_a_list()[source]

Asserting TypeError whenever ThermalExergy is attempted with a list that contains at least one temperature in a wrong format

test_thermal_exergy_but_non_thermal_unit()[source]

Asserting TypeError whenever thermal exergy analysis is attempted on a unit whose energy type is not Thermal

test_thermal_exergy_but_not_an_energy_unit()[source]

Asserting TypeError whenever thermal exergy analysis is attempted on an object that is not an EnergyUnit

test_thermal_exergy_but_temp_list_different_length()[source]

Asserting IndexError whenever thermal exergy analysis is attempted on a unit that has a temperature vector with different length than the time vector

test_thermal_exergy_but_temp_list_wrong_format()[source]

Asserting TypeError whenever Thermal exergy assessment is attempted with at least one temperature in the wrong format

test_thermal_exergy_but_temp_wrong_format()[source]

Asserting TypeError when energy type is Thermal but the temperature is not an int, nor a float, nor a list

test_thermal_exergy_list_but_already_assessed()[source]

Asserting AttributeError whenever exergy analysis is attempted on a list of units containing at least one on which exergy analysis has already been applied

test_thermal_exergy_list_but_non_energy_unit()[source]

Asserting TypeError whenever thermal exergy analysis is attempted on a list of units which contains at least one object that is not an EnergyUnit

test_thermal_exergy_list_but_non_thermal_unit()[source]

Asserting TypeError whenever thermal exergy analysis is attempted on a unit whose energy type is not Thermal

test_thermal_exergy_multiple_but_temp_list_different_length()[source]

Asserting IndexError whenever thermal exergy analysis is attempted on a unit that has a temperature vector with different length than the time vector

tests.test_operator_actors module

Unit tests for the module operator_actors.py, defining an operator actor.

Copyright 2018 G2Elab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_operator_actors.TestCheckOperatedUnitList(methodName='runTest')[source]

Bases: TestCase

Test the _check_operated_unit_list method

setUp()[source]

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

test_error_if_not_list()[source]

Test obj_operated_unit_list raise an error if obj_operated_unit_list is not a list

test_obj_operated_unit_list_empty()[source]

Test if obj_operated_unit_list is empty

test_obj_operated_unit_list_none()[source]

Test if obj_operated_unit_list is none

test_obj_operated_unit_list_with_operated_unit()[source]

Test obj_operated_unit_list with operated unit

test_obj_operated_unit_list_without_operated_unit()[source]

Test obj_operated_unit_list with operated unit

class tests.test_operator_actors.TestCheckOperatedUnitType(methodName='runTest')[source]

Bases: TestCase

Test the _check_unit_type method

setUp()[source]

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

test_error_if_wrong_unit_type()[source]

Test _check_unit_type raise an error if the operator operates a unit from another type

class tests.test_operator_actors.TestOperatorActor(methodName='runTest')[source]

Bases: TestCase

Test OperatorActor class

setUp()[source]

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

test_name_description()[source]

Test the name and the description associated to an operator_actor object

test_operated_unit_list_none()[source]

Test the operated unit list associated to an operator_actor object if it is none

test_operated_unit_list_not_none()[source]

Test the operated unit list associated to an operator_actor object if it is not none

tests.test_optimisation_model module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_optimisation_model.TestAddConstraints(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_constraint()[source]

Check if the Constraint is added to the dictionary of constraints by looking at the key.

class tests.test_optimisation_model.TestAddNode(methodName='runTest')[source]

Bases: TestCase

Test add_nodes method

setUp()[source]

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

test_adding_unit_instead_of_node()[source]

Check that it raises an error if an energyunit is added instead of a node

test_node_with_different_model_time()[source]

Check that it raises an error if the time of a node is different of the model time

test_unit_with_different_model_time()[source]

Check that it raises an error if the time of a unit is different of the model time

class tests.test_optimisation_model.TestAddNodeAndActors(methodName='runTest')[source]

Bases: TestCase

Test add_nodes_and_actors method

setUp()[source]

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

test_adding_unit_instead_of_node()[source]

Check that it raises an error if an energyunit is added instead of a node

test_node_with_different_model_time()[source]

Check that it raises an error if the time of a node is different of the model time

test_unit_with_different_model_time()[source]

Check that it raises an error if the time of a unit is different of the model time

class tests.test_optimisation_model.TestAddObjectives(methodName='runTest')[source]

Bases: TestCase

Test add_objectives method

setUp()[source]

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

test_add_objective()[source]

Check that all objective are added to the model with their weights taken into account to create the optimisation expression

class tests.test_optimisation_model.TestAddQuantities(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_no_parent_for_quantity()[source]

Check that ValueError is raised when there is a try to add a quantity with parent=None to the _model_quantities_list through model._add_quantities()

class tests.test_optimisation_model.TestAddQuantity(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_dict_qval_with_opt()[source]

Check that the quantity is created and is a LpVariable when opt=True

test_dict_qval_without_opt()[source]

Check that the quantity is created and is equals the value of the dictionary when opt=False

test_int_float_qval_with_opt()[source]

Check that the quantity is created as LpVariable when opt=True

test_int_float_qval_without_opt()[source]

Check that the quantity is created and equals the q_val when opt=False

test_lb_list()[source]

Check that an dynamic constraint ‘set_lb’ is added to the parent

test_list_qval_with_opt()[source]

Check that the quantity is created and is a LpVariable when opt=True

test_list_qval_without_opt()[source]

Check that the quantity is created and is equals the value of the list when opt=False

test_ub_list()[source]

Check that an dynamic constraint ‘set_ub’ is added to the parent

test_wrong_type_qval()[source]

Check if TypeError is raised when q_val is not an int, a float, a list or a dictionary

class tests.test_optimisation_model.TestAddUnitAttributes(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_add_all_children()[source]

Check if all OptObject objects contained as attributes in a OptObject are added to the _model_units_list of the model

test_add_all_constraints()[source]

Check if all Constraint objects contained as attributes in a OptObject are added to the cosntraints_list of the model

test_add_all_objectives()[source]

Check if all Objective objects contained as attributes in a OptObject are added to the objective_list of the model

test_add_all_quantities()[source]

Check if all Quantity objects contained as attributes in a OptObject are added to the _model_quantities_list of the model

test_constraint_parent()[source]

Check if the parent of the Constraint object contained as attribute in a OptObject is this OptObject

test_objective_parent()[source]

Check if the parent of the Objective object contained as attribute in a OptObject is this OptObject

test_quantity_parent()[source]

Check if the parent of the Quantity object contained as attribute in a OptObject is this OptObject

class tests.test_optimisation_model.TestAddUnitParent(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_if_no_parent()[source]

Check if the list is still empty when the unit gets no parent

test_parent_not_added_if_not_unit()[source]

Check if the parent is not added to the _model_units_list when the parent is not a OptObject.

test_parent_unit_added()[source]

Check if the parent of the unit is added to the _model_units_list when the parent of the unit is a OptObject.

class tests.test_optimisation_model.TestCheckIfUnitCouldHaveParent(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_no_warning()[source]

Check if no Warning is raised when there is no suspicion that a OptObject with no parent as attribute is contained in an other OptObject

test_warning()[source]

Check if a Warning is raised when there is a suspicion that a OptObject with no parent as attribute is contained in an other OptObject

class tests.test_optimisation_model.TestGetAllUnits(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_all_units_in_list_no_parent()[source]

Check if all units are in self._model_units_list when the unit with no parent is added first when parent are not explicitly defined

test_all_units_in_list_with_parents()[source]

Check if all units are in self._model_units_list when the unit when the parents are correctly defined for each unit

class tests.test_optimisation_model.TestGetLists(methodName='runTest')[source]

Bases: TestCase

Test quantity, constraint and objective get methods

setUp()[source]

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

test_add_and_get_constraints()[source]

Test if the constraint is added into the model is available with get_constraints_name_list()

test_add_and_get_objectives()[source]

Test if the objective is added into the model is available with get_objectives_name_list()

test_add_and_get_quantities()[source]

Test if the quantity is added into the model is available with get_quantities_name_list()

tests.test_producer_actors module

Unit tests for the module producer_actors.py, defining constraints and objectives for producer actor type.

Copyright 2018 G2Elab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_producer_actors.TestProducerActorConstraints(methodName='runTest')[source]

Bases: TestCase

Test of ProducerActor constraints

setUp()[source]

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

test_energy_production_maximum()[source]

Test the energy_production_maximum constraint on two production units

test_energy_production_maximum_without_int_or_float()[source]

Test it raises an error if max_e_tot is a list

test_energy_production_minimum()[source]

Test the energy_production_minimum constraint on two production units

test_energy_production_minimum_without_int_or_float()[source]

Test it raises an error if min_e_tot is a list

test_power_producion_total_maximum_with_dic()[source]

Test it raises an error if max_p is a list with dictionary

test_power_production_by_unit_maximum()[source]

Test the power_production_by_unit_maximum constraint on two production units

test_power_production_by_unit_maximum_with_dic()[source]

Test it raises an error if max_p is a list with dictionary

test_power_production_by_unit_maximum_with_list()[source]

Test the power_production_by_unit_maximum constraint on two production units if max_p is a list

test_power_production_by_unit_maximum_with_wrong_list()[source]

Test it raises an error if max_p is a list with a wrong dimension considering the unit time

test_power_production_by_unit_minimum()[source]

Test the add_power_production_by_unit_minimum constraint on two production units

test_power_production_by_unit_minimum_with_dic()[source]

Test it raises an error if min_p is a dictionary

test_power_production_by_unit_minimum_with_list()[source]

Test the add_power_production_by_unit_minimum constraint on two production units if min_p is a list

test_power_production_by_unit_minimum_with_wrong_list()[source]

Test it raises an error if min_p is a list with a wrong dimension considering the unit time

test_power_production_total_maximum()[source]

Test the power_production_maximum constraint on two production units

test_power_production_total_maximum_with_list()[source]

Test the power_production_maximum constraint on two production units if max_p is a list

test_power_production_total_maximum_with_wrong_list()[source]

Test it raises an error if max_p is a list with a wrong dimension considering the unit time

test_power_production_total_minimum()[source]

Test the add_power_production_minimum constraint on two production units

test_power_production_total_minimum_with_dic()[source]

Test it raises an error if min_p is a dictionary

test_power_production_total_minimum_with_list()[source]

Test the add_power_production_total_minimum constraint on two production units if min_p is a list

test_power_production_total_minimum_with_wrong_list()[source]

Test it raises an error if min_p is a list with a wrong dimension considering the unit time

class tests.test_producer_actors.TestProducerActorObjectives(methodName='runTest')[source]

Bases: TestCase

Test of ProducerActor objectives

setUp()[source]

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

test_maximize_production()[source]

Test the maximize_production objective on two production units

test_minimize_co2_emissions()[source]

Test the minimize_co2_production objective on two production units

test_minimize_costs()[source]

Test the minimize_costs objective considering starting and operating costs on two production units

test_minimize_operating_costs()[source]

Test the minimize_operating_cost objective on two production units

test_minimize_production()[source]

Test the minimize_production objective on two production units

test_minimize_starting_costs()[source]

Test the minimize_starting_cost objective on two production units

test_minimize_time_of_use()[source]

Test the minimize_time_of_use objective on two production units

tests.test_production_units module

Unit tests for production_units module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_production_units.TestCalculationMethods(methodName='runTest')[source]

Bases: TestCase

Check the calculation methods of the ProductionUnit class

test_def_co2_emissions_calc_float()[source]

Test the _def_co2_emissions_calc method if co2_out is a float

test_def_co2_emissions_calc_int()[source]

Test the _def_co2_emissions_calc method if co2_out is an int

test_def_co2_emissions_calc_list()[source]

Test the _def_co2_emissions_calc method if co2_out is a incomplete and complete list

test_def_co2_emissions_calc_none()[source]

Test the _def_co2_emissions_calc method if co2_out is none

test_def_co2_emissions_calc_other()[source]

Test the _def_co2_emissions_calc method if co2_out is a dictionary

test_def_operating_cost_calc_float()[source]

Test the _def_operating_cost_calc method if operating_cost is a float

test_def_operating_cost_calc_int()[source]

Test the _def_operating_cost_calc method if operating_cost is an int

test_def_operating_cost_calc_list()[source]

Test the _def_operating_cost_calc method if operating_cost is a incomplete and complete list

test_def_operating_cost_calc_none()[source]

Test the _def_operating_cost_calc method if operating_cost is none

test_def_operating_cost_calc_other()[source]

Test the _def_operating_cost_calc method if operating_cost is a dictionary

test_def_starting_cost_calc_none()[source]

Test the _def_starting_cost_cal method if start_cost is none

test_def_starting_cost_calc_not_none()[source]

Test the _def_starting_cost_cal method if start_cost is not none

class tests.test_production_units.TestFixedProductionUnit(methodName='runTest')[source]

Bases: TestCase

Check the FixedProductionUnit class

test_variable_production_none_p()[source]

Check if it raises an error if no energy profile is done for a FixedProductionUnit

class tests.test_production_units.TestObjectives(methodName='runTest')[source]

Bases: TestCase

Test the objective methods

setUp()[source]

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

test_minimize_operating_cost()[source]

Check the min_operating_cost objective

test_minimize_production()[source]

Check min_production objective

test_minimize_starting_cost()[source]

Check min_start_cost objective

test_minimize_time_of_use()[source]

Check min_time_of_use objective

class tests.test_production_units.TestQuantitiesAndConstraints(methodName='runTest')[source]

Bases: TestCase

Check the initialisation of the ProductionUnit class

setUp()[source]

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

test_co2_emissions()[source]

Test the creation of the co2_emissions quantity

test_def_init_start_up()[source]

Test the creation of the def_init_start_up constraint

test_def_init_switch_off()[source]

Test the creation of the def_init_switch_off constraint

test_def_no_start_up()[source]

Test the creation of the def_start_up constraint

test_def_start_up()[source]

Test the creation of the def_start_up constraint

test_def_switch_off()[source]

Test the creation of the def_switch_off constraint

test_none_definition()[source]

Check if the objectives are none at the initialisation

test_operating_cost()[source]

Test the creation of the operating_cost quantity

test_start_up()[source]

Test the creation of the start_up quantity

test_starting_cost()[source]

Test the creation of the starting_cost quantity

test_switch_off()[source]

Test the creation of the switch_off quantity

class tests.test_production_units.TestSeveralProductionUnit(methodName='runTest')[source]

Bases: TestCase

Check the SeveralProductionUnit class

test_nb_unit_constraint()[source]

Test the creation of the calc_prod_with_nb_unit_cst constraint

test_nb_unit_quantity()[source]

Test the creation of the nb_unit quantity

test_production_curve_quantity()[source]

Test the creation of the production_curve quantity

class tests.test_production_units.TestShiftableProductionUnit(methodName='runTest')[source]

Bases: TestCase

Check the ShiftableProductionUnit class

setUp()[source]

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

set_energy_limits_on_time_period_mandatory_false()[source]

Test the quantity created by the set_energy_limits_on_time_period method, and the emin definition

set_energy_limits_on_time_period_mandatory_true()[source]

Test the quantity created by the set_energy_limits_on_time_period method, and the emin definition

test_mandatory_false()[source]

Test the duration constraint if mandatory is false

test_mandatory_true()[source]

Test the duration constraint if mandatory is true

test_power_values_quantity()[source]

Test the creation of the power_values quantity

class tests.test_production_units.TestSquareProductionUnit(methodName='runTest')[source]

Bases: TestCase

Check the SquareProductionUnit class

test_duration_error()[source]

Test if it raises an error if the duration is under 1

class tests.test_production_units.TestTheConstraintsMethods(methodName='runTest')[source]

Bases: TestCase

Check the constraint methods of the ProductionUnit class

setUp()[source]

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

test_def_availability_cst_none()[source]

Test the _def_availability_cst method if availability_hours is none

test_def_availability_cst_not_none()[source]

Test the _def_availability_cst method if availability_hours is not none

test_def_max_ramp_down_cst_none()[source]

Test the _def_max_ramp_down_cst method if set_max_ramp_down is none

test_def_max_ramp_down_cst_not_none()[source]

Test the _def_max_ramp_down_cst method if set_max_ramp_down is not none

test_def_max_ramp_up_cst_none()[source]

Test the _def_max_ramp_up_cst method if set_max_ramp_up is none

test_def_max_ramp_up_cst_not_none()[source]

Test the _def_max_ramp_up_cst method if set_max_ramp_up is not none

test_def_min_down_time_cst_none()[source]

Test the _def_min_down_time_cst method if set_min_down_time is none

test_def_min_down_time_cst_not_none()[source]

Test the _def_min_down_time_cst method if set_min_down_time is not none

test_def_min_up_time_cst_none()[source]

Test the _def_min_up_time_cst method if set_min_up_time is none

test_def_min_up_time_cst_not_none()[source]

Test the _def_min_up_time_cst method if set_min_up_time is not none

tests.test_regulator_actors module

Unit tests for the module regulator_actors.py, defining regulator actor classes and constraints for regulator actors.

Copyright 2018 G2Elab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_regulator_actors.TestRegulatorActor(methodName='runTest')[source]

Bases: TestCase

Test of RegulatorActor constraint

setUp()[source]

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

test_co2_emission_maximum()[source]

Test the co2_emission_maximum constraint on two production units

test_co2_emission_maximum_with_list()[source]

Test the co2_emission_maximum constraint on two production units if max_co2 is a list

test_power_production_maximum_with_dic()[source]

Test it raises an error if max_co2 is a list with dictionary

test_power_production_maximum_with_wrong_list()[source]

Test it raises an error if max_co2 is a list with a wrong dimension considering the unit time

tests.test_reversible_units module

Unit tests for the module reversible_units.py, defining the reversible units attributes, constraints and functions.

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_reversible_units.TestRevUnit(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_def_fixed_rev()[source]

Asserting the inputs checking is properly led with fixed units

test_def_rev_cons()[source]

Asserting the def_rev constraint (non-simultaneity constraint) is properly defined with fixed consumption unit

test_def_rev_prod()[source]

Asserting the def_rev constraint (non-simultaneity constraint) is properly defined with fixed production unit

test_def_rev_var()[source]

Asserting the def_rev constraint (non-simultaneity constraint) is properly defined with variable energy units

test_fixed_var_rev()[source]

Asserting fixed units are created when power values are given as parameters of the ReversibleUnit

tests.test_storage_design module

” Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_storage_design.TestStorageDesign(methodName='runTest')[source]

Bases: TestCase

Unittests for the example storage_design.py

setUp()[source]

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

test_capacity_result()[source]

Check if the capacity results with the defined parameters is the right solution

test_cycling()[source]

Check if the storage is cycling

test_load_profile_creation()[source]

Check if the load profile is taken into account for power values

test_p_max_prod()[source]

Check if the p_max constraint is respected for the production.

test_p_max_storage()[source]

Check if the p_max constraint is respected for the storage.

test_p_min_storage()[source]

Check if the p_max constraint is respected for the storage.

test_return_fifth_storage()[source]

Check if the fifth value of return is a StorageUnit

test_return_first_model()[source]

Check if the first value of return is an OptimisationModel

test_return_fourth_production()[source]

Check if the fourth value of return is a VariableProductionUnit

test_return_second_time()[source]

Check if the second value of return is a TimeUnit

test_return_sixth_node()[source]

Check if the sixth value of return is an EnergyNode

test_return_third_load()[source]

Check if the third value of return is a FixedConsumptionUnit

test_soc_max()[source]

Check if the maximal value of state of charge is respected

test_soc_min()[source]

Check if the minimal value of state of charge is respected

tests.test_storage_units module

Unit tests for the module storage_units.py, defining the storage units attributes, constraints and functions.

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_storage_units.TestCalcP(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_calc_p()[source]

Checking the power calculation is properly set

class tests.test_storage_units.TestCycles(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_cycles()[source]

Checking the cycles constraint is properly set

class tests.test_storage_units.TestCyclesNone(methodName='runTest')[source]

Bases: TestCase

test_cycles_none()[source]

Asserting an error is raised when set_cycles is used while cycles is not defined

class tests.test_storage_units.TestCyclesWrong(methodName='runTest')[source]

Bases: TestCase

Asserting an error is raised when cycles is not an int

test_cycles_wrong()[source]
class tests.test_storage_units.TestE0equalEf(methodName='runTest')[source]

Bases: TestCase

test_e0_eq_ef()[source]

Checking ef_is_e0 is properly set

test_e0_eq_ef_error()[source]

Asserting e0_is_e0 raises an error when e_0 and e_f are set to different values

class tests.test_storage_units.TestE0greatequalEf(methodName='runTest')[source]

Bases: TestCase

test_ef_geq_e0()[source]

Checking ef_geq_e0 is properly set

test_ef_geq_e0_error()[source]

Asserting e0_geq_ef raises an error when e_f are set to a constant value

class tests.test_storage_units.TestMinCapacity(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_def_capacity()[source]

Checking the def_capacity constraint is properly defined

test_float_pmax_ratio_error()[source]

Asserting an error is raised when pmax ratio is not a float

test_min_capacity()[source]

Checking the min_capacity objective is properly defined

test_pc_max_ratio()[source]

Checking the pc_max_ratio works properly

test_pd_max_ratio()[source]

Checking the pc_max_ratio works properly

class tests.test_storage_units.TestOnOffStor(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_on_off_stor()[source]

Checking the on_off_stor is properly set

class tests.test_storage_units.TestSOCStorageUnits(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_SOC_float()[source]

Checking the SOC is properly set when it is float

test_SOC_list()[source]

Checking the SOC is properly set when it is float

class tests.test_storage_units.TestSelfDisch(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_calc_e()[source]

Checking the energy calculation is properly set

test_wrong_self_disch_t_value()[source]

Asserting an error is raised when the self_disch_t value is over 1

test_wrong_self_disch_value()[source]

Asserting an error is raised when the self_disch value is over 1

class tests.test_storage_units.TestStorageUnitInit(methodName='runTest')[source]

Bases: TestCase

Checking the initialisation of the StorageUnit class

setUp()[source]

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

test_SOC_error()[source]

Asserting an error is raised when SOCmin > SOCmax

test_SOC_error_list()[source]

Asserting an error is raised when SOCmin > SOCmax for all time instants

test_SOC_error_list_length()[source]

Asserting an error is raised when the lengths of SOCmin and socmax != len(time.I) + 1

test_default_values_capacity()[source]

Checking the default values for the capacity Quantity

test_default_values_energy()[source]

Checking the default values for the energy Quantity

test_default_values_pc()[source]

Checking the default values for the pc Quantity

test_default_values_pd()[source]

Checking the default values for the pd Quantity

test_quantity_pc_max()[source]

Checking the quantity pc_max parameters

test_quantity_pd_max()[source]

Checking the quantity pc_max parameters

class tests.test_storage_units.TestThermoclineStorageSocMax(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_force_soc_max()[source]

Checking the force_soc_max constraint is properly defined

test_is_soc_max()[source]

Checking is_soc_max is properly defined

test_is_soc_max_inf()[source]

Checking is_soc_max_inf constraint is properly defined

test_is_soc_max_sup()[source]

Checking is_soc_max_sup constraint is properly defined

class tests.test_storage_units.Test_e_f(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_calc_e_f()[source]

Checking the calc_e_f is properly set

test_e_f_SOC_float()[source]

Checking e_f boundary constraints are properly set when floats and deactivate it when ef is not none

test_e_f_SOC_list()[source]

Checking boundary constraints are properly set when lists and deactivate it when ef is not none

test_no_e_f_SOC_float()[source]

Checking e_f boundary constraints are properly set when floats

test_no_e_f_SOC_list()[source]

Checking boundary constraints are properly set when lists

test_set_e_f()[source]

Checking the set_e_f is properly set

class tests.test_storage_units.Teste0eF(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_e0()[source]

Checking set_e_0 is properly set

test_e0_valid()[source]

Checking e_0 is within the defined valid soc range

test_ef()[source]

Checking set_e_f is properly set

test_ef_valid()[source]

Checking e_f is within the defined valid soc range

class tests.test_storage_units.Teste0eFNone(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_none_e0()[source]

Asserting an error is raised when the set_e_0 method is used while e_0 is set to None

test_none_eF()[source]

Asserting an error is raised when the set_e_f method is used while e_f is set to None

tests.test_time module

Unittests for the module time.py, defining the time units class of the models

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_time.TestConvertEuropeanFormat(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_convert_european_format_dt()[source]

Testing the function convert_european_format with a dateTime format date

test_convert_european_format_euro()[source]

Testing the function convert_european_format with an european format date

class tests.test_time.TestGetDateForIndex(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_get_date_for_index_dict()[source]

Checking the get_date_for index function raises an Error when asked a dict index

test_get_date_for_index_float()[source]

Checking the get_date_for index function raises an Error when asked a float index

test_get_date_for_index_int()[source]

Checking the get_date_for index function return the right date

test_get_date_for_index_list()[source]

Checking the get_date_for index function raises an Error when asked a list index

test_get_date_for_index_out_of_range()[source]

Checking the get_date_for index function raises an Error when asked an index out of range

test_get_date_for_index_string()[source]

Checking the get_date_for index function raises an Error when asked a string index

class tests.test_time.TestGetDays(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_get_days()[source]

Asserting the get_days function returns the days as expected

class tests.test_time.TestGetIndexForDate(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_get_index_for_date()[source]

Checking the right index is returned for a certain date

test_get_index_for_date_error()[source]

Checking an error is raised when asked for a timestamp more precise than the timestep

class tests.test_time.TestGetIndexForDateRange(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

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

test_get_index_for_date_range_end()[source]

Checking the right list of indexes is returned when using get_index_for_date_range with start and end

test_get_index_for_date_range_periods()[source]

Checking the right list of indexes is returned when using get_index_for_date_range with start and periods

class tests.test_time.TestTimeUnit(methodName='runTest')[source]

Bases: TestCase

Checking the attributes of TimeUnit are properly set for european and dateTime formats

setUp()[source]

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

test_time_unit_dates()[source]
test_time_unit_dt()[source]
test_time_unit_i()[source]
test_time_unit_len()[source]

tests.test_waste_heat_recovery module

Copyright 2018 G2ELab / MAGE

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class tests.test_waste_heat_recovery.TestWasteHeatRecoverySystem(methodName='runTest')[source]

Bases: TestCase

Unittests for the example waste_heat_recovery.py

setUp()[source]

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

test_eighth_sto()[source]

Checking the 8th return is a consumption unit

test_eleventh_node()[source]

Checking the 11th return is a node

test_fifth_hp()[source]

Checking the 5th return is a heat pump

test_file_cons()[source]

Checking the text file for the district heat load consumption is properly taken into account

test_file_indus()[source]

Checking the text file for the indus consumption is properly taken into account

test_first_model()[source]

Checking the first return is a model

test_fourth_cons()[source]

Checking the 4th return is a consumption unit

test_minimise_heat_prod()[source]

Checking the optimisation result

test_ninth_node()[source]

Checking the 9th return is a node

test_p_max_hp()[source]

Checking if the p_max constraint is respected for the heat pump.

test_p_max_storage()[source]

Checking if the p_max constraint is respected for the storage.

test_second_time()[source]

Checking the second return is a time unit

test_seventh_dissip()[source]

Checking the 7th return is a consumption unit

test_sixth_heat_prod()[source]

Checking the 6th return is a heat prod

test_tenth_node()[source]

Checking the 10th return is a node

test_third_convers()[source]

Checking the 3rd return is a conversion unit

Module contents