how to speed up the simulation time ?

2 views (last 30 days)
Kutaiba sabah
Kutaiba sabah on 6 Jul 2017
Edited: Stephen on 6 Jul 2017
I am designing microgrid network that has a diesel generator, wind turbine, PV, tidal generator and battery plus a dynamic load that depends on the load profile of my case study. the issues now I am facing: First, how can I speed up the simulation time as the simulation takes days to finish the run. Second, the power of diesel generators goes to negative values as well as the power of load profile.
I will appreciate any answer or suggestion to my questions.
Thanks

Answers (1)

Stephen
Stephen on 6 Jul 2017
Edited: Stephen on 6 Jul 2017
The amount of speedup you can expect depends on the algorithms you're using. If you are doing a simulation that can be parallelized (like a Monte Carlo) with many independent iterations, you can use the parallel computing toolbox to run these iteration in parallel rather than one after the other. A VERY simple solution to code that runs slowly due to loops can be solved by changing "for" to "parfor". This works in some cases depending on what variables are referenced inside of the loop.
If it is not parallelizable, I would suggest running your code with the profiler tool. This will give you a detailed report showing what portions of your code are using the most time and resources, then you can focus on optimizing the code used in those lines/functions for speed.
Also, it is possible to run certain functions in Matlab on the GPU relatively easily, and perform other custom operations as well with a little more effort. If this applies to your situation, I would investigate that avenue as well. There is good documentation from mathworks for this.
Besides the above, if you have a computer lab or cluster and the distributed computing toolbox, it may be possible to create a makeshift "supercomputer". This depends on the level to which your code can be run in parallel and the level of resources you have
It will be relatively impossible for anyone to help you diagnose the second error without knowing more.

Categories

Find more on Wind Power 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!