I was running a simulation and it stopped due to a memory issue. How can I deal with this and is there any way to get the simulation data that was calculated before the simulation stopped?
Unfortunately there is no way to get the simulation data out of any scopes prior to the simulation stopping. While PLECS can allow for large models and long simulation times, the main memory sink is the use of multiple scopes in a model. The best way to avoid this error is to reduce the number of scopes.
As far as PLECS is concerned the following measures may also help to reduce the memory consumption:
- Use a 64-bit version of Matlab and PLECS. The 32 bit version of PLECS is limited to 3 GB of virtual memory by the operating system, while a 64-bit machine can allocate several terabytes of virtual address space.
- Decrease the cache size limit in the PLECS preferences.
- Check that the solver is not forced to use unnecessary small steps, e.g. try to use a stiff solver when solving a stiff system or that the maximum step size is set smaller than it needs to be.
- Limit the maximum number of samples stored per scope in the scope's preferences to the last N samples. You cannot decimate the samples in the scope that are stored (i.e. store only 1 of N samples).