calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
299 stars 94 forks source link

Data duplication in the Calliope backend #617

Closed irm-codebase closed 4 months ago

irm-codebase commented 4 months ago

What happened?

This issue may be related to #616

Calliope is duplicating model._model_data in the backend, leading to sync issues and unexpected behavior!

id(model._model_data)
140507415076176
id(model.math_documentation.inputs)
140507415076176
id(model.backend.inputs)  # duplication!
140507414858960

We should avoid this by just passing the whole dataset directly, like model.math_documentation.inputs does. This also hints at a need for better functions to update stuff in the backend and ensure that it also does not fall out of sync with user updates to the data.

Which operating systems have you used?

Version

v0.7

Relevant log output

No response

irm-codebase commented 4 months ago

Ok, so turns out that this is only partially true. We only copy the configuration, and create a shallow copy of model_data. This has other issues, but it should be a separate issue.