Simulink model takes lot of time to save

조회 수: 24 (최근 30일)
Bhargav Kinnal
Bhargav Kinnal 2019년 6월 24일
댓글: Jesús Zambrano 2020년 10월 12일
I have this relatively large simulink model. I make very tiny changes and when i try to save it takes unbelievably long time to finish saving.
I have tried Save_system and also saving via the button.
The model takes forever to save. The model is yet to save while i write this question (Thats about 45mins already!!!!)
Is there anything wrong in my settings? Do i need to clear some matlab or model related files and retry?
A quick help would be really helpful
  댓글 수: 2
Jonas
Jonas 2019년 6월 24일
Are you using a Simulink library? I have experienced issues myself when trying to save a Simulink model after I have opened and unlocked a library. It then actually saves the models, but it keeps on showing the 'Saving' waitbar and I have to kill Matlab and restart it to work again.
Bhargav Kinnal
Bhargav Kinnal 2019년 6월 24일
I thought so too and killed Matlab twice or thrice to see that it was infact not saved.
What worked for me is an Update diagram and then a save_system.
I still dont know the root cause for this though. And the Matlab help is badly documented for these kind of errors.

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

답변 (1개)

Jesús Zambrano
Jesús Zambrano 2019년 8월 25일
Hi Barghav,
Please find below some recommendations you can find in the MathWorks documentation:
Modifying and Simplifying Your Model
Most of the techniques described so far require few, if any, changes to the model itself. You can achieve additional performance improvements by applying techniques that involve modifications to the model.
Accelerating the Initialization Phase
Large images and complex graphics take a long time to load and render. As a result, masked blocks that contain images might make your model less responsive. To accelerate the initialization phase of a simulation, remove complex drawings and images. If you don't want to remove an image, you can still improve performance by replacing it with a smaller, low-resolution version. To do this, use the Mask Editor and edit the icon drawing commands to change the image that is loaded by the call to image().
When you update or open a model, Simulink runs the mask initialization code. If you have complicated mask initialization commands that contain many calls to set_param, consider consolidating consecutive calls to set_param()into a single call with multiple argument pairs. This can reduce the overhead associated with these calls.
Learn more about mask code execution.
If you use MATLAB scripts to load and initialize data, you can often improve performance by loading MAT-files instead. The drawback is that the data in a MAT-file is not in a human-readable form, and can therefore be more difficult to work with than a script. However, load typically initializes data much more quickly than the equivalent script.
Reducing Model Complexity
Simplifying your model without sacrificing fidelity is an effective way to improve simulation performance. Here are three ways to reduce model complexity.
Replace a subsystem with a lower-fidelity alternative. In many cases, you can simplify your model by replacing a complex subsystem model with one of the following:
  • A linear or nonlinear dynamic model created from measured input-output data using System Identification Toolbox
  • A high-fidelity, nonlinear statistical model created using Model-Based Calibration Toolbox
  • A linear model created using Simulink Control Design
  • A lookup table
You can maintain both representations of the subsystem in a library and use variant subsystems to manage them.
Reduce the number of blocks. When you reduce the number of blocks in your model, fewer blocks will need to be updated during simulations, leading to faster simulation runs. Vectorization is one way to reduce your block count. For example, if you have several parallel signals that undergo a similar set of computations, try combining them into a vector and performing a single computation. Another way is to simply enable the Block Reduction optimization in the Optimization > General section of the configuration parameters.
Use frame-based processing. In frame-based processing, samples are processed in batches instead of one at a time. If your model includes an analog-to-digital converter, for example, you can collect the output samples in a buffer and process the buffer with a single operation, such as a fast Fourier transform. Processing data in chunks in this way reduces the number of times that blocks in your model must be invoked. In general, scheduling overhead decreases as frame size increases. However, larger frames consume more memory, and memory limitations can adversely affect the performance of complex models. Experiment with different frame sizes to find one that maximizes the performance benefit of frame-based processing without causing memory issues.
Hope these tips can help you!
Best,
Jesús
  댓글 수: 2
francois chaunut
francois chaunut 2020년 10월 12일
Hello
I have the same problem than Bhargav : on my model when I try to save it most of the time it take around 15 min and some time just 1 or 2 sec.
I red what you wrote but there is nothing that solve my problem.
Have you any other suggestions ?
thanks
François
Jesús Zambrano
Jesús Zambrano 2020년 10월 12일
Have you tried using model references? It might help you to reduce the save time, since you will organize model hierarchically. Then, you can go downstream and modify each child model. When all parts are defined and tested, you can call them from the parent model.
Here I give you a link to the documentation where you can read more about it:

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

카테고리

Help CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by