Simulink simulation slows down drastically after first run following reboot
22 views (last 30 days)
Hi! I am having an issue with a simulink simulation. The first time I run it after a windows reboot, the simulation rate is somewhere around 0.7 simulation seconds / real seconds. When I simulate again, the simulation rate drops to about 0.1 simulation seconds / real seconds. Subsequent runs slow down further and stabilize somewhere around estimated 0.02 simulation seconds / real seconds. For a simulation that needs to simulate 150 seconds to be meaningful, this is far too slow. Since I cannot publicly post this simulation, I will describe properties of the simulation, as well as observations I have made regarding this issue.
Description of simulation:
- Heavily using Simscape Power Systems -> Specialized Technology
- Discrete fixed-step solver (auto-select), no continuous states
- Rapid-accelerator mode (though this also seems to happen when using normal mode)
- most parameters are defined using a struct "par" in the base workspace. Simulink blocks are parameterized by accessing this struct (e.g. a constant value would be set by entering "par.someConstantValue").
- There is a use of masked and variant subsystems
- Windows 10 64-bit
- 32GB of ram (absolutely not limiting for the case I'm describing here)
- Core i7-8700K
- Geforce 1060
- This issue likely exists/has become severe since I ran this simulation overnight for a long time with lots of output data. It probably was too much data. The computer had crashed the next day I came back to it. This was using Matlab 2017b
- I thought I might as well update to Matlab 2018a afterwards. No difference for this issue, though.
- Another simulation shows the same slow-downs. It is based on the Simscape Power Systems example "Thyristor-Based HVDC Transmission System (Detailed Model)". As soon as I change the parameterization to the struct-model described above, simulation performance drops by a few orders, but remains stable. Therefore, I am not really sure if this is the core of the problem.
I do not know where to look and what else to try. I have sunk a lot of time into this already and need to become productive again. I am going to test this on another computer, as soon as I can. Does anyone have any help/clues/support?
Thank you very much! MP
Edit: please see second answer posted for further information.