Simulink - TCP/IP Send / Receive Variable Size

1 回表示 (過去 30 日間)
johnnynoc4sh
johnnynoc4sh 2020 年 7 月 7 日
コメント済み: johnnynoc4sh 2020 年 7 月 14 日
Dear all,
I want to implement a Modbus TCP communication between MATLAB Simulink and a measurement device by using the Instrument Control Toolbox. For the Modbus protocol different function codes are defined, e.g. 0x04 for reading registers and 0x16 for writing registers. Depending on the function code the message to send/receive by the TCP/IP block differs in size. For both blocks (TCP/IP Send and Receive) you need to predefine how many bytes the message will be. You are also restricted to only use one block for the same target (IP/Port) in one model. Therefore it is impossible to do Modbus TCP/IP read and writing operations within the same model. I think this is quite a big limitation. Anybody has an idea how to overcome this challenge?
Regards
Jonathan

採用された回答

Govind KP
Govind KP 2020 年 7 月 14 日
Hi Jonathan,
One possible way I can see is to create and use an m-func block in Simulink to call the modbus function.
You can find more details at this link
  1 件のコメント
johnnynoc4sh
johnnynoc4sh 2020 年 7 月 14 日
Exactly the way how I implemented it. Thanks for the valuable hint!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelopment Computer Setup についてさらに検索

製品


リリース

R2020a

Translated by