GenericStorage .results() Non-Invest Error 'label' Bus-Tuple "NoneType"

Hello World,
as I am new to oemof I wanted to ask a question regarding the results generation with outputlib.processing.results module. I recently found a problem with the GenericStorage component I was adding to my energy system.
In the beginning I always used the invest method and the results-creation worked fine. While trying the “normal” method for curiosity reasons I recieved an error message of processing.py.
My own first investigation showed, that the bus tuple definition of the storage was “bus_electric” to “None”. Why does the results()-module raise an error in one case but not in the other? Is there anybody out there who can help me with this issue and solve this problem?
Following I’ll post a part of the source code and the error message.
Thx a lot in advance and good day to all of you!

— source code —

            kwargs = {}
            input_args = {}
            inflow_args = {}
            output_args = {}
            outflow_args = {}
            inflow_args.update({'nominal_value': stel['capacity_inflow'],
                                'variable_costs': stel['variable_input_costs']})
            input_args.update({self.SubWW[scen]['buses'][stel['bus']]: solph.Flow(**inflow_args)})

            outflow_args.update({'nominal_value': stel['capacity_outflow'],
                                'variable_costs': stel['variable_output_costs']})
            output_args.update({self.SubWW[scen]['buses'][stel['bus']]: solph.Flow(**outflow_args)})

            kwargs.update({'label': stel['label'],
                           'nominal_storage_capacity': stel['nominal_capacity'],
                           'min_storage_level': stel['min_level'],
                           'max_storage_level': stel['max_level'],
                           'loss_rate': stel['capacity_loss'],
                           'initial_storage_level': stel['initial_stor_level'],
                           # 'nominal_input_capacity': 1000,
                           'inflow_conversion_factor': stel['efficiency_inflow'],
                           # 'nominal_output_capacity': 1000,
                           'outflow_conversion_factor': stel['efficiency_outflow'],
                           'balanced': stel['balanced']
                           })

part for investment-method if set == 1 in source dict read from excel file

            if stel['invest']:
                kwargs.update({'nominal_storage_capacity': None,
                                    'investment': solph.Investment(
                                       ep_costs=stel['ep_costs'],
                                       minimum=0,
                                       maximum=stel['maximum_inv'],
                                       existing=stel['existing']),
                                    'invest_relation_input_capacity': None,
                                    'invest_relation_output_capacity': None
                                    })
            
            kwargs.update({'inputs': input_args})
            kwargs.update({'outputs': output_args})
            stor_el = solph.components.GenericStorage(**kwargs)

— error message using “non-invest”-mode —

Traceback (most recent call last):
File “…python3.7/site-packages/oemof/outputlib/processing.py”, line 125, in results
df_dict[k].index = om.es.timeindex
File “…python3.7/site-packages/pandas/core/generic.py”, line 5193, in setattr
return object.setattr(self, name, value)
File “pandas/_libs/properties.pyx”, line 67, in pandas._libs.properties.AxisProperty.set
File “…python3.7/site-packages/pandas/core/generic.py”, line 691, in _set_axis
self._data.set_axis(axis, labels)
File “…python3.7/site-packages/pandas/core/internals/managers.py”, line 183, in set_axis
“values have {new} elements”.format(old=old_len, new=new_len)
ValueError: Length mismatch: Expected axis has 1 elements, new values have 24 elements

During handling of the above exception, another exception occurred:

[…]

File “…python3.7/site-packages/oemof/outputlib/processing.py”, line 129, in results
raise type(e)(str(e) + msg.format(k[0].label, k[1].label)
AttributeError: ‘NoneType’ object has no attribute ‘label’

Hello PyMoF, welcome to the oemof community.

It is difficult to analyse the system from the information you gave. It is always good to reduce the system to only a few components (e.g. Source, Sink, Bus, Storage) and to use just a few time steps. Furthermore, you should write the data into the componets because I do not know anything about stel['capacity_inflow']. You should also remove all parameter that are not necessary to reproduce the error message.

This is the important part of the error message. I guess that your time index has a range of 24 but the results array does have a range of 1.

The last part of the error message is our fault but I already fixed it and it will be part of the next release. This message should show which object causes the problem :flushed: But as you know that it is the storage you do not need it. If you need it, you have to patch commit 72d4eaf .

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