calliope-project / calliope

A multi-scale energy systems modelling framework

Home Page:https://www.callio.pe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using "file=" for "storage_cap" yields Xarray merge issues in postprocessing

fvandebeek opened this issue · comments

Hi all,

Please advice.

I'm trying to model an EV car park as a mega battery with variable storage capacity in Calliope. I manually adjusted a fork of the V0.6.8 Calliope dist to allow for using "file=" to set the storage_cap values of the battery over time. I did so by adding "storage_cap" to the list of "file_allowed" in the calliope/config/default.py and then assign a file to the storage_cap variable of the technology in the model definition (tech.yaml). The model runs and solves succesfully, but an error arises during postprocessing.

I can trace back the error to line 279 in calliope/core/model.py:

    self._model_data = xr.merge(
        [results, self._model_data], compat="override", combine_attrs="no_conflicts"
    )

With traceback;
..raise MergeError(
xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'is_result': 1} with {'is_result': 0}

It trips over the fact that the value of an attribute called "is_result" was already set to 0, while the new value is 1. I suspect this has something to do with the fact that storage_cap normally is an output, and now was set as an input.

I do not know how to solve this though. Ideally I can call xr.merge without "no_conflicts", but I cannot oversee the effects downstream. Alternatively I could overwrite "is_result", but I cannot find this attribute in the results or self._model_data sets.

Any ideas?

Thanks!

Hi all,

I made a mistake with the original request: as "storage_cap" is a time independent variable, it is not possible to set its value at each time step, and in turn setting "file_allowed" for this variable also does not make much sense.

The variable "storage" on the other hand is. I managed to solve my issue by limiting this variable at each time step using a manual constraint, see Calliope Read The Docs on how to implement manual constraints.

I will close this issue for now.