フィルターのクリア

Which SLRT Functions Replace xPC Functions?

38 ビュー (過去 30 日間)
Engenuity
Engenuity 2024 年 8 月 7 日 16:30
コメント済み: Garmit Pant 2024 年 8 月 12 日 22:58
I need to update legacy r2010b MATLAB code that uses xPC functions to r2024a code that uses Simulink Real-Time functions. For example, I have replaced instances of xpctargetping with slrtpingtarget (https://www.mathworks.com/help/releases/R2020a/xpc/api/slrtpingtarget.html).
Are there modern SLRT replacement functions for legacy setxpcenv and xpctarget.fs/xpctarget.ftp functions? Maybe setslrtenv and slrt('target') or slrealtime.fs/ftp? (https://www.mathworks.com/help/slrealtime/api/slrealtime.target.html)
Are these functions only available once connected to target hardware?

採用された回答

Garmit Pant
Garmit Pant 2024 年 8 月 8 日 7:01
Hello Engenuity,
As of the latest release, R2024a, Simulink Real-Time (SLRT) provides alternative workflows to the legacy xPC functions.
Replacing "setxpcenv"
The "setxpcenv" function is used to set environment properties in xPC Target. In SLRT, the environment properties and parameters can be tuned using the "slrtExplorer" and the "Target" object.
To use the interactive SLRT Explorer, run the following command in the Command Window:
slrtExplorer
The SLRT Explorer provides a UI for viewing connection status and interacting with a real-time application. You can set environment settings like IP address, etc.
The following code snippet demonstrates how to initialize a "Target" object and use object functions:
tg = slrealtime('TargetPC1');
% Connect to the computer
connect(tg);
% Configure the target computer to run the selected real-time application on startup
setStartupApp(tg, 'slrt_ex_osc');
% Set the IP address and netmask on the target computer
setipaddr(tg, '192.168.7.5', '255.255.255.0');
Replacing "xpctarget.fs" and "xpctarget.ftp"
The "xpctarget.fs" function does not have a direct replacement. You cannot manage and manipulate the file system as extensively in SLRT compared to xPC. Instead, SLRT introduces File Logging. This can be achieved by using the "Enable File Log" block in the model. The import method can then be used to import file log data from the target computer.
import(tg.FileLog, 'app_name')
An FTP server connection can be established by using the ftp function. The FTP connection object can be used to upload and download files. You can also create, delete, and navigate to different folders on the server.
ftpobj = ftp("ftp.example.com")
You can further use the various object methods of the "ftp" object to access the files on the server.
For further understanding, kindly refer to the following MathWorks Documentation:
  • This MATLAB Answers post details different methods of Signal Logging using “File Log” and FTP connection for SLRT: MATLAB Answers
  • This resource details the process of configuring the Target Computer settings: Target Computer Settings
I hope you find the above explanation and suggestions useful!
  2 件のコメント
Engenuity
Engenuity 2024 年 8 月 12 日 22:43
Thank you...
Garmit Pant
Garmit Pant 2024 年 8 月 12 日 22:58
Glad I could be of help!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by