def test_check_feedin_tariff_vs_levelized_cost_of_generation_of_production_dispatchable_lower_dispatch_price( ): energy_vector = "Electricity" dict_values = { ENERGY_PROVIDERS: { "DSO": { FEEDIN_TARIFF: { UNIT: "currency/kWh", VALUE: 0.4 }, LABEL: "test DSO", ENERGY_VECTOR: energy_vector, } }, ENERGY_PRODUCTION: { "asset": { ENERGY_VECTOR: energy_vector, LABEL: "production asset", DISPATCH_PRICE: { VALUE: 0.3 }, DISPATCHABILITY: True, OPTIMIZE_CAP: { VALUE: True }, MAXIMUM_CAP: { VALUE: None }, } }, } with pytest.raises(ValueError): C1.check_feedin_tariff_vs_levelized_cost_of_generation_of_production( dict_values ), f"If feed-in tariff > dispatch price of an asset without maximumCap and with optimized capacity a ValueError should be risen."
def test_check_feedin_tariff_vs_levelized_cost_of_generation_of_production_non_dispatchable_greater_costs_dispatch_mode( caplog, ): energy_vector = "Electricity" dict_values = { ENERGY_PROVIDERS: { "DSO": { FEEDIN_TARIFF: { UNIT: "currency/kWh", VALUE: 0.4 }, LABEL: "test DSO", ENERGY_VECTOR: energy_vector, } }, ENERGY_PRODUCTION: { "asset": { ENERGY_VECTOR: energy_vector, LABEL: "production asset", SIMULATION_ANNUITY: { VALUE: 1 }, TIMESERIES_TOTAL: { VALUE: 10 }, DISPATCHABILITY: False, OPTIMIZE_CAP: { VALUE: False }, MAXIMUM_CAP: { VALUE: 1000 }, } }, } # logging.warning with caplog.at_level(logging.DEBUG): C1.check_feedin_tariff_vs_levelized_cost_of_generation_of_production( dict_values) assert ( "No error expected but strange dispatch behaviour might occur." in caplog.text ), f"If the capacity of a production asset is not optimized and the feed-in tariff is greater than the expected lcoe a debug msg should be logged."
def test_check_feedin_tariff_vs_levelized_cost_of_generation_of_production_non_dispatchable_greater_costs_with_maxcap( caplog, ): energy_vector = "Electricity" dict_values = { ENERGY_PROVIDERS: { "DSO": { FEEDIN_TARIFF: { UNIT: "currency/kWh", VALUE: 0.4 }, LABEL: "test DSO", ENERGY_VECTOR: energy_vector, } }, ENERGY_PRODUCTION: { "asset": { ENERGY_VECTOR: energy_vector, LABEL: "production asset", SIMULATION_ANNUITY: { VALUE: 1 }, TIMESERIES_TOTAL: { VALUE: 10 }, DISPATCHABILITY: False, OPTIMIZE_CAP: { VALUE: True }, MAXIMUM_CAP: { VALUE: 1000 }, } }, } # logging.warning with caplog.at_level(logging.WARNING): C1.check_feedin_tariff_vs_levelized_cost_of_generation_of_production( dict_values) assert ( "This will cause the optimization to result into the maximum capacity of this asset." in caplog.text ), f"If a production asset has a maximumCap and the feed-in tariff is greater than the expected lcoe a warning should be logged."
def test_check_feedin_tariff_vs_levelized_cost_of_generation_of_production_non_dispatchable_not_greater_costs( caplog, ): energy_vector = "Electricity" dict_values = { ENERGY_PROVIDERS: { "DSO": { FEEDIN_TARIFF: { UNIT: "currency/kWh", VALUE: 0.4 }, LABEL: "test DSO", ENERGY_VECTOR: energy_vector, } }, ENERGY_PRODUCTION: { "asset": { ENERGY_VECTOR: energy_vector, LABEL: "production asset", SIMULATION_ANNUITY: { VALUE: 10 }, TIMESERIES_TOTAL: { VALUE: 10 }, DISPATCHABILITY: False, OPTIMIZE_CAP: { VALUE: True }, MAXIMUM_CAP: { VALUE: None }, } }, } # no error no logging with caplog.at_level(logging.WARNING): C1.check_feedin_tariff_vs_levelized_cost_of_generation_of_production( dict_values) assert ( caplog.text == "" ), f"If feed-in tariff < dispatch price of an asset no error and no logging message should occur."