different simulation time steps in system and subsystem

2 次查看(过去 30 天)
Hello,
I have a very complicated model for a house connected to an air conditioner, due to the complexity of the ODEs I'm using ode15s. The air conditioner is a subsystem and is enabled when cooling is required.
I would like to have different time steps when solving the ODEs from each block. For example when the air conditioner if off the time step for solving the main system (the house) could be large (every 15 minutes for example) but when the air conditioner is activated, due to the complexity of the ODEs in this model the solver requires a time step of 1 sec.
Is this possible? I've tried to use the "auto" in the time step simulation options but it chooses a large time step and when the air conditioner is on I get an error message. On the other hand, when I use a 1 sec time step the whole simulation is super super slow, it takes like 12 hrs to run 10 days... and I need to simulate 365 days!!
help me please!! thanks!
Elsa
  1 个评论
Kaustubha Govind
Kaustubha Govind 2013-7-22
Have you configured sample-times for each set of blocks/subsystems appropriately? For example, when you turn on sample-time colors, do you see the various subsystems highlighted in the color?

请先登录,再进行评论。

采纳的回答

Jan
Jan 2013-7-22
编辑:Jan 2013-7-22
The size of the model equations is not a criterion to decide for a specific integrator. ODE15S is fine, when the problem is stiff, in other cases ODE45 might be faster. Both integrators cannot handle discontinuities in the model, see http://www.mathworks.com/matlabcentral/answers/59582#answer_72047. Therefore you need event functions to stop the integration and restart it with the new model parameters.
But how could you set the the step size externally to 15 min or 1 sec? ODE15S has an automatic step size control, such that the order of the method and the step size is adjusted until the local discretization error is below the given relative and absolute tolerances. So please explain, how you think that you define the step size exactly.
[EDITED] Now I get it: You use Simulink, while e.g. in Matlab there is neither an "auto" nor any other method to specify the step size.[/EDITED]
When you get an error message, it would be a great idea to post a copy of it here accompanied by the relevant part of the corresponding code. Otherwise we cannot guess, which problem the code has.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Subsystems 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by