Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to save network state to json string #603

Open
TristanM-TD opened this issue Feb 4, 2025 · 2 comments · May be fixed by #605
Open

Option to save network state to json string #603

TristanM-TD opened this issue Feb 4, 2025 · 2 comments · May be fixed by #605

Comments

@TristanM-TD
Copy link

It is already possible to save the network state (e.g. using network.save(path) or network.export(path)), however it would also be useful to "just" get the json string representation as opposed to the files, which in turn can be stored in a variable or written to a database.

Ideally, one would then also be able to use the same string representation to reload the state of the network or initialise the solver.

@fwitte
Copy link
Member

fwitte commented Feb 7, 2025

Hi @TristanM-TD,

I think the separation of reading/writing from the collection of the data is a good idea. I am thinking about a large dictionary with the keys representing the different classes, and not multiple variables. Would that be fine for you?

{
    "Connection": {...},
    "Components": {
        "HeatExchanger": {...},
        "Turbine": {...},
    },
    "Bus": {...},
    "Network": {...},
}

@fwitte
Copy link
Member

fwitte commented Feb 7, 2025

Thinking more about it, it could actually be kind of beneficial to have just one large .json file for network states or exports... Same for loading it. Then people do not need to deal with multiple files, if they want to deal with the contents separately. On the downside, the contents would then become less humanly readable. Any opinion on this?

@fwitte fwitte linked a pull request Feb 8, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants