How can I connect two seperate Simulink models?
이전 댓글 표시
I have two Simulink models (Matlab 7.11 and Matlab 6.5) and I want them co-simulate. There is no way in merging them in one Matlab version (given boundary condition). A brief desription of the situation I want to create: model one gets an initialization vector, does some calculations, give the results to model 2 and waits. The latter model waits until it gets the data from model 1, does some calculation as well, gives the solutions back to model one and so on. This should be repeated for every time step. Both Matlab applications will run on the same machine. I have no idea how to realize this. I tried something with UDP, but I found out there are no UDP toolboxes in Matlab 6.5. I don't know how to make the models wait for each other. I hope someone will have some inspiring ideas for me :)
Thank you in advance! :)
답변 (2개)
Kaustubha Govind
2012년 10월 25일
0 개 추천
Why not use the Model block to reference each model? You can connect them in a third top-level model.
댓글 수: 3
Stefan
2012년 10월 26일
Kaustubha Govind
2012년 10월 26일
No, but can you not load the model from 6.5 in 7.1?
Stefan
2012년 10월 26일
Azzi Abdelmalek
2012년 10월 26일
편집: Azzi Abdelmalek
2012년 10월 26일
Use two scripts in each session of matlab. for example script1
x=load('comunicat')
if x.test==1
sim('model1')
test=0
save cmunicat test
end
while test==0
pause(10)
x=load('comunicat')
test=x.test
end
%
sim('model1') %
...
use the same with script2. The mat file comunicat contain one logical variable. It says which model will run
댓글 수: 12
Stefan
2012년 10월 26일
Azzi Abdelmalek
2012년 10월 26일
편집: Azzi Abdelmalek
2012년 10월 26일
- suppose ts is your sample time, set time simulation to ts
- lunch your two m files in your 2 sessions
- in file1
test=0
for k=1:1000
while test==0
pause(10)
x=load('comunicat')
%file 1 waits until test=1(when file2 finishs simulation)
test=x.test
end
sim('model1') % use data from model 2, load file or...
test=0
save comunicat test % will trigger model 2
end
Stefan
2012년 10월 26일
Azzi Abdelmalek
2012년 10월 26일
pause(10)
% will wait 10 secondes before checking a mat file
Azzi Abdelmalek
2012년 10월 26일
편집: Azzi Abdelmalek
2012년 10월 26일
But the question is, why make it dificcult when you can work with one model using 2 triggered subsystems
Azzi Abdelmalek
2012년 10월 26일
you can convert your model(matlab 6.5) to (matlab 7.11), have you tried to do it?
Stefan
2012년 10월 26일
Azzi Abdelmalek
2012년 10월 26일
Just open it under matlab 7.11, If you've tried to do it, is there error messages
Stefan
2012년 10월 26일
Stefan
2012년 10월 26일
카테고리
도움말 센터 및 File Exchange에서 Naming Conventions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!