Remove stored system state

Hi,

I stored system state for initialization. And I assume that is the reason why the file size increased from 800kb to 80Mb. How to remove the stored state to get the file size small again?

I can’t find a button to do this…

There is not a button to remove the system state.

The size of the file increasing to 80 MB seems out of the norm. In my tests with demo models in the PLECS library the size only increases by a few KB, even for a 700 KB model file.

Could you share an example such that we can reproduce the issue?

Two suggestions:

  • You can try manually removing the SystemState field in the text file and the character string afterwards.
  • You can also do a text diff between the two model files to see what is causing the model bloat. It may not just be the system state.

Hi,

I can not share this simulation, sorry. But I removed the section manually. This works and the file size is also decreased from 81.4MiB to 1.2MiB.

Thank you for the update Stefan.

If you do want to continue to use stored states - one idea would be to store the state using a separate *.mat file. This way the model file stays the same but you have access to the desired system state. You can do this via a script.

Also note that the stored state is visible as plain text - you can see what states are being stored that lead to such high memory usage.

For example to save the state to file using an inbuilt PLECS Octave Script:

plecs('simulate')
StoredSystemState = plecs('get','.','SystemState')
save("SystemStates.mat", "StoredSystemState");

And to restore a saved state:

load("SystemStates.mat"); 
opts=struct();
opts.SolverOpts.InitialSystemState = StoredSystemState;
plecs('simulate',opts)

You can achieve something similar with the RPC interface via Python.

Hi,

that is an interesting idea. Thanks for the suggestion.