Speeding up Simulink simulations with event charts and random events

조회 수: 1 (최근 30일)
Altug Emiroglu
Altug Emiroglu 2022년 3월 22일
댓글: Altug Emiroglu 2022년 4월 1일
I have a simulink model which consists of about more than 300 blocks that contain basically 5 different custom library blocks. Each block contains 1-2 Discrete Event Charts. The blocks communicate with each other in a hierarchical manner using messages. The communication between the blocks are not one directional meaning the blocks at any level on the hierarchy can be communicating with other blocks in the upper and lower levels. Immediate connections to lower levels are established with duplicated messages and to higher levels are established by making use of the entity multicast blocks.
Events in the discrete event charts take place at some randomly generated times from a matlab function that is defined in the base workspace.
I need to get this simulation as fast as possible such that I can run +10K Monte-Carlo iterations in a reasonable time. I recently read that model referencing is more favourable to get the simulation speed up. Are there any other significant changes that I can make to increase the simulation speed? For instance the profiler in "Normal" mode tells me that a huge amount of time is spent in the initialization phase. It is also the case when I start the simulation with "Step Forward". After that when I click it again, the complete simulation runs in the fraction of a second.
Trying to run the simulation in an automated way via a Matlab Script for Monte Carlo simulations also take a huge amount of time regardless of choosing "FastRestart" option or not due to the initialization.
I would appreaciate any comments and suggestions for improvement.

답변 (1개)

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2022년 3월 29일
편집: Abdolkarim Mohammadi 2022년 3월 29일
You should try parsim() with fast restart enabled. Read my answer here for further details about this methodology.
  댓글 수: 1
Altug Emiroglu
Altug Emiroglu 2022년 4월 1일
Hi, and thank you for your answer. My problem is that, when I do profiling, my whole simulation without compile time is around 100 seconds out of which the compilation 95, initialization 3 and simulation/termination time is 2 seconds. When I run the simulation programatically as you mention with FastRestart turned on, it takes about 200 seconds which is nowhere near what the profiling tells me. I am essentially using only one fixed time step for the whole simulation, since I have only discrete events in my system and the events are automatically handled at precise times even if the model does not sample at those specific times.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by