Simulink simulation slows down drastically after first run following reboot

33 次查看(过去 30 天)
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
Computer info:
  • Windows 10 64-bit
  • 32GB of ram (absolutely not limiting for the case I'm describing here)
  • Core i7-8700K
  • Geforce 1060
Observations:
  • 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.

回答(3 个)

MP
MP 2018-3-31
I did some systematic testing with lots of windows/matlab/simulation restarting tonight (18 test runs). Observations are as follows:
  1. The slprj and mexw64 do not seem to be connected to this issue
  2. I get one fast (0.7) run after a windows reboot. The next run will be slower (0.1, usually stabilizes somewhere around there for consecutive runs without any restarts)
  3. If I alter my parameter struct (par), the simulation speed will drop to super-slow (the 0.02 mentioned above). This can ONLY be reset by a windows restart. Even restarting matlab does not change this
  4. I saw that a new nvidia graphics driver was released 3 days ago (version 391.35). So I updated from the previous version (391.24). After that, the simulation slowing was a little less (maybe settling between 0.03-0.05 instead of 0.02). However, everything else is still unchanged, especially the way it slows down.

MP
MP 2018-4-2
I cannot reproduce this problem on a different computer (unfortunately much slower), hence it must be related to some OS, driver or configuration thing on this computer.
Nevertheless, I switched to the 'Accelerator' mode and don't seem to be having this issue. I will continue using this mode from now on.

Ilham Hardy
Ilham Hardy 2018-3-30
Since you run the model in Rapid Accelerator mode, have you tried deleting the slprj and yourmodelname.mexw64?
  1 个评论
MP
MP 2018-3-31
Hi Illham, thank you for your reply. I did try this and it has no effect on the situation. I will post a more elaborate answer below in a few moments.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Choose and Parameterize Blocks 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by