Simulink file run in hours

4 views (last 30 days)
Dr. Siva Malla
Dr. Siva Malla on 15 Nov 2012
Commented: Khadim Ullah Jan on 24 Jul 2020
Dear Sir,
I implemented a model in simulink, and it is in discrete (Ts= 20e-6). My model is running very slowly, I kept run time as 5, I think this is in sec. and its normal. but this is taking more than 30 minuts to complete to run. Now I want to run my model in Hours (for 24 Hours =86400 sec). Because in my model PV system is there, so I have to test this system for 24 hours base, because my input is solar irradiance. but if I kept my run time as 86400, then may be it will take couple of months to complete simulation. So please give me a suggestion or any alternate method to run my system in hours. Or please tell me is any alternate option available to run model in basis of hours?

Accepted Answer

Jan
Jan on 15 Nov 2012
Edited: Jan on 15 Nov 2012
Please read your question again and imagine, that you do not have any further information. Then it gets obvious, that any answer must be based opn guessing what you are doing.
Here are some of these guesses:
  • Run the model in steps of 20e-5 will reduce the runtime by a factor of 10.
  • Can parts of the model be vectorized or parallelized?
  • Are you running Matlab/Simulink on an old Pentium4 which is low on memory? Then buy a modern i7 with Gig's of RAM and try it again.
  • Does your program write logfiles to disk and 3 installed virus scanner collide with eachother such that the disk access is the bottleneck? Then uninstall two of the scanners.
  • The bottleneck of the simulation could be much faster if you replace the most used code sections by faster C-Mex functions. When you show us the code, perhaps we find improvements.
  • When I understand correctly, you simulate 5 seconds of realtime with a fixed stepsize of 20e-6. Do you really need a fixed stepsize? An automatic stepsize control will lead to a more accurate result in most likely less processing time. Currently you accumulate the rounding errors of 1e8 steps!
I suggest to post the most time consuming part of the model and ask for accelerations (guessed speedup: factor 1 to 100). In addition try to run the code on a faster computer (guessed speedup: factor 1 to 4).
  3 Comments
Jan
Jan on 16 Nov 2012
Any solution to what? We have only a rough description of you you have programmed. Therefore a specific suggestion is impossible. And there are no magic, general, but secret switches for Matalb and Simulink, which let them run with quadrupel speed.
Khadim Ullah Jan
Khadim Ullah Jan on 24 Jul 2020
I didn't understand the replies. The question is so clear though.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!