MATLAB Answers

0

sldiagnostics counts subsystems which are not visible

Asked by Philipp Wälchli on 16 May 2019
Latest activity Commented on by Philipp Wälchli on 3 Jun 2019
Hi there
I am modelling a PV system with 3 cells in series and 2 cells in parallel. I am interested in analysing the performance of my model, as I intend to go on large-scale for the purpose of my studies (i.e. 50x40). As such, I used "sldiagnostics" to see where my model spends most of its time. I have two particular question regarding the diagnostics of my model (can be downloaded from my dropbox here; I am sorry for the messy model, I have removed the subsystems in order to understand the diagnostics better, see question 2 below).
  • What is the compile process "Cstat 33 = Pre-compile post-eval notifies" doing? It seems that this is the bottleneck of the computation time of my model.
  • I can see there are are 51 Subsystems counted, but there are no subsystems added by me to the model. What kind of subsystems are those? Where can I find them?
Thank you all for your contribution and help!

  3 Comments

Anybody has even the slightest hint? I searched the whole community but didn't find anything helpful...
Philipp, I don't have 2018b hence, I'm not able to open your model.
The subsytems could be the built-in library blocks that you're using in your model, many of them are modelled as subystems with masks on top. I'm not sure about the compile process, that would be question for the Mathworks support team.
Have you tried using the performance advisor tool in simulink to improve your models performance?
Hi Arvind - thank you for sharing your thoughts. Actually, I have used the performance advisor tool quite intensively and was able to reduce the compilation time already. But still, it is not in an acceptable range, that's why I posted my question.

Sign in to comment.

1 Answer

Answer by Fangjun Jiang on 29 May 2019

When Simulink compiles or updates the model, it went through many steps. I have a guess on what "Pre-compile post-eval notifies" means but there is no document for it. I would think it is related to "Cstat2: Pre_Compile" and "Cstat26: Evaluate block parameters and model args".
Run the following command to find all the subsystem blocks
find_system(ModelName,'FollowLinks','On','LookUnderMasks','all','blocktype','SubSystem')

  3 Comments

Hi Fangjun; that's a great idea. I run the command you suggested and it gave me quite some insights... Most of the subsystems originate from the PS-Simulink and Simulink-PS converters, which I need to export the data from the physical system to mat files. Are there better ways I am not aware of to do that without the need for these converters?
Another question: May you know how the evaluation of the block parameters can be reduced in time? I can imagine it takes quite some compilation time if the block parameters are just strings refering to a variable in the workspace; that's why I put numbers in all block parameters. Do you have any other ideas?
If you are using Simulink blocks which contain many masked subsystems, don't worry about it. The number of subsystem blocks is unlikely be the factor of slow down.
The a few seconds compilation time would not be a big factor if you run simulation for 50x40 cells for a period time. I would suggest you run a simulation and then use profiler to improve somewhere else.
The only thing I can think of that is related to compilation time for your case that you might consider is Model Reference. Search in document for Model Reference and pay attention to its benefit regarding compilation time.
That's great to know, thank you for pointing this out. I did already use Model Reference but was only able to create a model reference for the whole model as physical connections are not allowed to cross reference's borders. After I did so and run the simulation again, the compilation time took even longer (don't ask me why...). That's why I rejected the idea again - or did I miss an important aspect here?

Sign in to comment.