run the system for 24 hours in short period
5 views (last 30 days)
Show older comments
hello,
so i have model in simulink, it runs for Total time=2 seconds, and sampling time for microgrid=1e-6, sampling time for model predictive controller=0.1; the thing is when i run the simulation, it takes about 3 to 4 minutes to finish because of the sampling time, when in fact the Total time is 2 seconds, and i want the axe "X" to show results for 24 hours, so what can i do?
obiously i cannot run it for 24 hours, it will take few days to finish,
thanks in advance
2 Comments
Umar
on 1 Jul 2024
Hi Mounira,
My suggestion would be increase the simulation step size while maintaining accuracy by changing the solver settings in Simulink. Also, consider reducing the data logging frequency or using virtual scopes to visualize results without storing all data points. By strategically selecting what data to log and visualize, you can reduce the computational load and speed up the simulation process significantly.
Hope these suggestions will help resolve your issues.
Accepted Answer
Umar
on 1 Jul 2024
Hi Mounira,
Sorry to hear that. After looking at your comments into consideration, here are my suggestions.
Firstly, the discrepancy between the total simulation time of 2 seconds and the actual runtime of 3 to 4 minutes can be attributed to the sampling times you have specified. The sampling time for the microgrid (1e-6) and model predictive controller (0.1) directly affect how frequently data points are collected and processed during simulation. In your case, these small sampling times may be causing a significant computational load, leading to longer simulation times.
While increasing the sampling time (Ts) might seem like a solution to reduce computation load, it's crucial to note that changing this parameter can affect the accuracy of your results. Higher sampling times can lead to loss of detail in your model dynamics and potentially incorrect outcomes. Therefore, if changing the sampling time is not an option, you may need to optimize other aspects of your model for better performance.
Regarding the number of scopes in your model, having multiple scopes can indeed impact simulation speed. Each scope adds overhead in terms of data logging and visualization, which can contribute to longer runtimes. To improve simulation performance, consider reducing the number of scopes or optimizing their usage by only displaying essential signals.
In addition to adjusting sampling times and scopes, you can also explore other optimization techniques such as reducing the complexity of your model, utilizing parallel computing capabilities, or leveraging Simulink features like signal logging configurations to streamline data collection.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!