Simulink/SimscapeMultibody, using UDP in parallel, without blocking a simulation?
2 ビュー (過去 30 日間)
古いコメントを表示
Dear fellow Matlab users
I am creating a model in Simscape Multibody trying to simulte close to realtime. For communicating with a c++ application I am using a udp receive and send block.
The problem is that the udp blocks tend to slow down the simulation drastically. The good thing is they are not necessary for the simulation to function, they are only needed to transfer the data. So from the architecture side is absolutely possible to provide the data with the simscape simulation and transfer them in a separate thread with udp.
The question is now, how do I implement a parallel udp communication in Matlab Simulink? is it possible to deploy some data in a global space and transfer them with a separate udp communication block? can I run both in parallel in one simulation ?
I am asking because it is really hard to find some usefull information on this and I have to say I am a bit frustrated on the general topic of parallelism in Matlab. But maybe it is just that I did not fully get it yet, so I would be glad of any help on the topic.
Thank you for you time
kind regards
0 件のコメント
回答 (1 件)
Vasco Lenzi
2020 年 11 月 11 日
I'm not sure you can because of the nature of the UDB block, but you can try follow this workflow:
if you have good knowledge with C++ you can implement a shared memory block in C++ that writes directly to the C++ application, there is a similar example here:
hope this helps
Vasco
2 件のコメント
Vasco Lenzi
2020 年 11 月 11 日
Yes the project is in C# unfortunately, but I thought it could serves as an inspiration.
You can write and/or embed native C++ in Simulink:
You could create a custom way of communicating through some shared memory.
参考
カテゴリ
Help Center および File Exchange で Model Preparation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!