How to make 2 different models running in parallel to be executed at the same speed from the beginning to the end of the simulation.
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have 2 Simulink models.
Both models run with Automatic solver selction and a solver of the Fixed step type and a Fixed-step size set to Auto.
Both models have the same simulation stop time equal to: 1050s.
The sample time used by Simulink with the 1st model when it is run separately is: 0.001s (so this model is executed very slowly).
The sample time used by Simulink with the 2nd model when it is run separately is: 21s (so this model is executed very quickly).
I managed to use Data Store Memory and MATLAB Function blocks to run the two models at the same time (in parallel) in order to exchange some variables calculated betweeen the two models.
The problem is that after starting both models at the same time the model with sample time equal to 21s executes very quickly and stops but the other model with sample time equal to 0.001s continues running.
I know that all this is normal given the different sample times of the two models but I am wondering whether there is a way to make the two models have the same length of the execution time (fast or slow) so that the data exchanged betweeen the two models is correct during the whole simulation time.
Note:
The 1st model can not run successfully when its sample time is set to 21s.
The 2nd model can not run successfully when its sample time is set to 0.001s.
Every little tip is welcome.
Many thanks to all the contributors of MATLAB Central.
8 个评论
Archit Dhanani
2019-7-25
Hi Kamal,
The issue seems to be else where. Here is a similar model below. Const1 is set to sample time = 0.001 and Const2 = 21. You can check the legend to see the rates for all the blocks. I used the same solver settings. The model works fine. (The atomic subsystems just adds the two numbers.)
Raj
2019-7-26
@ kamal kiki "all the values of the variables of the model reached very high values" - Since the model is running, it means the rate transition block is doing its job. Model becoming unstable maybe a sign of design issues. Individual systems can run perfectly without any issues but combining them creates a totally new system with its own characteristics.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!