Skip to content

Save current machine state #255

Answered by kev-wes
kev-wes asked this question in Q&A
Mar 30, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

I solved this by myself, which, in hindsight, is quite trivial. The return values of simulate_to comprise a list of states. Setting these states as new model.parameters saves the current state of the model.

Example
Simulation for 100 time steps (assume that future_loading always returns a specific intensity for any t, e.g., 2):
(_, _, states, _, event_states) = batt.simulate_to(100, future_loading, **options)
Set states of battery to final values of last observation (i.e., after simulating 100 time steps with intensity 2):
batt.parameters['x0'] = states[-1]
Now any following simulation starts as if the battery was already run with intensity 2 for 100 time steps.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@teubert
Comment options

Answer selected by teubert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants