Simulink model very slow when integrates

I have a Simulink model that does many integrations. If the data input is steady state, then the model is fairly quick. When the data input is very transient, the model slows down significantly, especially when I try to add it to a bigger model where my model is a sub-component. The model uses ODE15s already, and it is variable step. When I try to go to discrete mode, I get rate transition errors, but when I try to embedd rate transition blocks, the sw gives an error. Any suggestions?

Respuestas (2)

Ryan G
Ryan G el 17 de Oct. de 2012

0 votos

It sounds like the model is behaving as expected with a variable step ODE solver. Essentially it will take bigger (faster) steps when the data is steady.
When you transition to discrete solver, is it also fixed step? There are 2 potential issues:
1) if fixed step, you must make sure the rate transitions make sense
2) Discrete solvers require discrete blocks such as discrete integrator instead of 1/s
What is the first error you see?
Finally, sometimes your model may be optimized for speed as much as possible and given the complexity of the system it just runs slow. A couple things you can do is utilize parallel computing for multiple runs, use accelerator/rapid accelerator and model references to speed up simulink and finally you can potentially look for places in your model to simplify the system.

4 comentarios

Roxanna Moores
Roxanna Moores el 18 de Oct. de 2012
Hello,
when I transition to discrete solver, I have it at "fixed step", with the "ode3 (Bogacki-Shampine)" solver, and a fixed step-size of 0.1.
so when I simply turn on to fixed step without any other modification to the model and try to run, I get this error:
"Simulink detected an unspecified rate transition at output port 1 of block 'Myfile/Mdot'. However, Simulink cannot automatically insert a Rate Transition block because one of the following scenarios exists: - Fixing the unspecified rate transition requires rewiring of the blocks; - Simulink cannot choose an insertion location for the Rate Transition block because multiple possibilities exist; - The unspecified rate transition requires the insertion of a Rate Transition block on a virtual bus signal. Rewire the block diagram or manually insert a Rate Transition block to resolve the unspecified rate transition"
and my source block paramter for Mdot is highlighted.
So I manually inserted a rate transition block and got the following error:
"Simulink detected an unspecified rate transition at input port 1 of block 'Myfile/Rate Transition'. Simulink did not automatically insert a Rate Transition block because a rate transition block exists either upstream or downstream of the insertion location. Serial rate transition blocks represent an inefficient model pattern. Before manually inserting a Rate Transition block, ensure that the insertion is unavoidable."
I don't know if I can try parallel computing? I duplicate the integration block 20 times, and the 2nd block for example depends on the results from the first. The 3rd block for eacmple depends on the results from the 2nd...
I can run in accelerator mode for my model. But when I want to have my model added to the larger model, one of the subcomponents of the larger model has s-functions. So then the big model can't use acelerator mode.
Do I need to generate an executable? I would rather keep the model functions visible to the user...
Any suggestions you may have would be greatly appreciated
Roxanna Moores
Roxanna Moores el 18 de Oct. de 2012
Editada: Roxanna Moores el 18 de Oct. de 2012
also, I manually placed the rate transition block right after the source block parameter for the Mdot...
Ryan G
Ryan G el 18 de Oct. de 2012
Editada: Ryan G el 18 de Oct. de 2012
It sounds like there is some confusion between terms and what different things do. I want to clarify things as it will help you now and in the future when determining issues.
1) Fixed step and discrete are different. You have a fixed-step solver but the ODE solver is not discrete, it takes little steps between the specified fixed step.
2) Parallel computing acts on the ENTIRE model, not just portions. It does not sound like you would want that for this.
Based on what you wrote nothing sounds particularly complicated. It is important to note you want things working smoothly before doing accelerator or parallel computing.
Since your profile says you're at volvo, I would highly recommend creating a service request. The tech support team at mathworks is pretty quick and you can send your model along with the request and see what you're doing wrong.
I would specify what you do/don't understand about Simulink and your model and ask for help understanding this a bit better. As you work with Simulink and understand the terminology it becomes much easier to search for answers.
I would also suggest sending a link to this thread to show what has been recommended already.
Roxanna Moores
Roxanna Moores el 18 de Oct. de 2012
ok, thank you. I will go ahead and create the service request. While I have worked with Simulink somewhat, I am new to this optimization aspect of it. I am also working on the links also sent below. I am hoping between the links and the service request, that I can possibly find a solution.

Iniciar sesión para comentar.

K E
K E el 18 de Oct. de 2012

0 votos

I agree with Ryan on the cause and possible steps. In case it is helpful, here are some general links on speeding up model execution: a blog post, a Mathworks note, and a webinar.

Categorías

Más información sobre General Applications en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 17 de Oct. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by