필터 지우기
필터 지우기

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.

조회 수: 3 (최근 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
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.)
answers1.png
Raj
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 CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by