Verify "Objective Function" with numerical output data

Hey there,

my interest is into reconstructing and understanding the value of the objective function after optimization when using the Investment.Storage module.
Since I got kind problems in understanding the API at the according topic I tried to reconstruct the output value


by using the output data from a csv-file after optimization. The according syntax to get the csv-file I used is: results.bus_balance_to_csv

The programmed storage-model is very simple:

    inputs={O_net: solph.Flow()},
    outputs={O_net: solph.Flow()},  

I already got the value of ep_costs(n) and it is coherent to my expectations. But what I can’t figure out is the summed value of invest(n) see in the following equation documented in the API:

How can I reconstruct this value with numerical data after optimization from the csv-file?

The storage capacity value of my timeseries (1 Day) multiplied with the value of ep_costs is not coherent with om.InvestmentStorage.investment_costs()

I would be very grateful to get an idea. I am using the OEMOF version 0.1.4.

cheers, Bastian

Thank you for your question and welcome to the forum.

Do you have more than one Investment object, because it is the sum over all (n) objects?
Does it only happens with the csv reader or also with pure Python like in oemof’s storage_invest example?

'Running this example I get exactly the expected results:

epc * invest = investment_costs
80.2426 * 10805267 ~= 867042579

Thank you a lot for the answer.

Yes I got more than one Investment object:
2 x InvestmentFlow
1 x InvestmentStorage

epc * invest get multiplied. The result is exactly the value of om.InvestmentFlow.investment_costs() which means the value after optimization. As “invest” I took the maximum flow of my timeseries from the csv-file.

InvestmentStorage object
epc * invest get multiplied. In this result there is always a small gap between the result of om.InvestmentStorage.investment_costs(). As “invest” I took the maximum storage capacity of my timeseries from the csv-file.

What are the “missing investment costs” ? The answer leads me to the objective funktion of the InvestmentStorage.

greets, Bastian

It is easier to analyse your problem if you add more information e.g. the parameters of your storage. Therefore I can only guess. You may have defined the “nominal_input_capacity_ratio” (c-rate) or “nominal_output_capacity_ratio” for your storage. This restricts the maximum input/output flow. In this case the solver might increase the capacity to increase the maximum out/in flow even though the additional capacity is not needed. This additional capacity is never used, so the maximum used capacity is lower. You could analyse your maximum in-/out-flow to verify this but it might be easier to read out the value of the invest variable.

According to the storage_investment example you can use the results dictionary to get the value of the invest variable (function: get_result_dict()):

my_storage = energysystem.groups['storage_label']

We are working on the output API to make things easier but still haven’t finished.

Thank you, with the use of the results dictionary I could figure out the gap between the invest of numerical output data from the csv-file and the calculated invest from solver. The discrepancy came from a factor which multiplies the input data of the energy model with a self defined factor in a subroutine. So as a result the maximum storage capacity changed and could not be verified.
Deleting the self defined factor, the objective function acts like it has been expected.

greets, Bastian

Text and images licensed under CC BY 4.0Data licensed under CC0 1.0Code licensed under MITSite terms of serviceOpenmod mailing list.