Simulink Real-Time C API with python, TCP/IP ERROR

4 ビュー (過去 30 日間)
xy
xy 2024 年 11 月 7 日
コメント済み: xy 2024 年 11 月 18 日
I call Simulink Real-Time(speedGoat) C API with python
The error message:
MathWorks.xPCTarget.FrameWork.xPCException:TCP/IP Write ERRIR
在 MathWorks.xPCInvokePI.xPCErroe.handlError(xPCTargetPC tgpc)
在 MathWorks.xPCTarget.FrameWork.xPCSignals.get_NumSignals()
.......
sys.path.append(xpcDLLFolderPath)
clr.AddReference('xPCFrameWork')
import MathWorks.xPCTarget.FrameWork as xpc
tgpc = xpc.xPCTargetPC()
tgpc.DLMFileName = 'xxxx' # xxxx respent a path
tgpc.TcpIpTargetAddress = '192.168.7.2'
tgpc.TcpIpTargetPort = '22222'
tgpc.Connect()
tgSignals = tgpc.Application.Signals
for i in range(tgSignals.NumSignals):
tgSignal = tgSignals.get_Item(i)
......

回答 (1 件)

Harsh
Harsh 2024 年 11 月 11 日
Hi,
The error you are encountering indicates an issue with writing data over TCP/IP. This could be due to several factors such as incorrect IP address or port or incorrect setup of the Simulink Real-Time environment. 
Go through the following steps to debug your error -
  • Please make sure that the “xpcDLLFolderPath” is correctly set to the folder containing the necessary DLLs for the xPCFramework.
  • Additionally, double check the values for “TcpIPtargetAddress” and “TcpIpTargetPort to make sure they match the configuration on your Speedgoat target machine.
  • Finally make sure the target computer settings are set properly to match the capabilities of target computer.
You can refer to the following documentation to understand how to configure the target settings - https://www.mathworks.com/help/releases/R2020b/slrealtime/gs/target-computer-settings.html
  1 件のコメント
xy
xy 2024 年 11 月 18 日
Thank you for your reply. I found that speedgoat could not be operated through the API when it was connected. Just disconnect speedgoat,it will be ok

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

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by