TCP/IP MATLAB and Python

3 ビュー (過去 30 日間)
Soumil Chugh
Soumil Chugh 2019 年 3 月 5 日
回答済み: Vijaya Lakshmi Chagi 2019 年 3 月 13 日
I am trying to run a simulation model in MATLAB which takes input via TCP/IP from python code and sends back some data to the python code. I am unable to sync both the times. My TCP/IP is sending data with a different time interval(0.02) while my simulation model runs with a different interval(0.08). I tried to fix the step size in simulation model configuration but nothing helps. Can anybody explain the same?

回答 (1 件)

Vijaya Lakshmi Chagi
Vijaya Lakshmi Chagi 2019 年 3 月 13 日
Hi Soumil,
I assume you are sending data from Python to MATALB via TCP/IP connection. The TCP/IP receive block used in the simulink model has a parameter called 'Block Sample Time'. You can specify the block sample time which is the rate at which block is executed during the simulation.
The other thing I could think of is about the Blocking Mode property of the block. This is enabled by default. If it is enabled, it will block the simulation until data is received.
To receive the data continuously without blocking the simulation, disable the blocking mode.
Hope the above information helps you.

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by