Target Object 属性
slrealtime 用于配置和状态的对象属性
利用这些属性,您可以配置 Target 对象并监控目标计算机的状态。
配置
TargetOptions 属性包含一个 TargetOptions 结构,该结构包含 restApiServerPort、supportHttps、sslCertificateFilePath、sslPrivateKeyFilePath 和 useNetrc 这几个字段。要查看 TargetOptions,在 MATLAB 命令行窗口中输入:
tg.TargetOptions
ans =
TargetOptions with properties:
restApiServerPort: 8080
supportHttps: 0
sslCertificateFilePath: ''
sslPrivateKeyFilePath: ''
useNetrc: 1有关如何使用 restApiServerPort、supportHttps、sslCertificateFilePath 和 sslPrivateKeyFilePath 的信息,请参阅 setupTLSCertificate。useNetrc 的值用于指定是否启用 (true) 或禁用 (false) 使用 .netrc 文件进行身份验证。禁用后,目标计算机上的 .netrc 文件将被删除。启用此功能后,系统将在下次连接目标计算机或对目标计算机进行更新时创建或更新 .netrc 文件。
Instruments 属性包含一个 Instruments 结构体,该结构体包含 ForSDI、ForMATLAB 和 ForFileLog 这三个字段。要查看 Instruments,在 MATLAB 命令行窗口中输入:
tg.Instruments
Instruments added to target computer 'TargetPC1':
ForSDI
<EMPTY>
ForMATLAB
<EMPTY>
ForFileLog
<EMPTY>您可以使用 Instrument Viewer App 查看、创建或删除目标计算机上的仪表。创建仪表时,您可以向该仪表添加信号。使用命令 view(tg.Instruments) 打开该 App,其中 tg 是目标计算机的名称。使用 App 中的按钮或上下文菜单来查看、创建或删除仪表。

TargetSettings 属性包含一个 TargetSettings 结构体,该结构体包含 name、address、sshPort、xcpPort、username、userPassword 和 rootPassword 这些字段。要查看 TargetSettings,在 MATLAB 命令行窗口中输入:
tg.TargetSettings
ans =
TargetSettings with properties:
name: 'TargetPC1'
address: '192.168.7.5'
sshPort: 22
xcpPort: 5555
username: 'slrt'
userPassword: 'slrt'
rootPassword: 'root'SDIRunId 属性存储了当前仿真运行的“仿真数据检查器”运行标识符。要查看 SDIRunId,在 MATLAB 命令行窗口中输入:
tg.SDIRunId
ans = int32 22110
ptpd 属性包含一个 PTPControl 结构体,该结构体包含 Command 和 AutoStart 两个字段。有关详细信息,请参阅 Target.ptpd 对象。要查看 TargetSettings,在 MATLAB 命令行窗口中输入:
tg.ptpd
ans =
PTPControl with properties:
Command: 'ptpd -L -K -g'
AutoStart: 1Stimulation 属性可用于访问 Target.Stimulation 对象。要查看 Stimulation,在 MATLAB 命令行窗口中输入:
tg.Stimulation
ans = StimulationControl with no properties.
状态
ProfilerStatus 属性保存了执行探查器的状态。要查看 ProfilerStatus,在 MATLAB 命令行窗口中输入:
tg.ProfilerStatus
ans =
'Ready'TracerStatus 属性保存了执行跟踪器的状态。要查看 TracerStatus,在 MATLAB 命令行窗口中输入:
tg.TracerStatus
ans =
'Ready'FileLog 属性包含一个 FileLogger 结构,该结构包含 Importing、LoggingService 和 DataAvailable 这三个字段。有关详细信息,请参阅 Target.FileLog 对象。要查看 TargetSettings,在 MATLAB 命令行窗口中输入:
tg.FileLog
ans =
FileLogger with properties:
Importing: 0
ImportProgress: 100
LoggingService: STOPPED
DataAvailable: 0TargetStatus 属性可用于访问目标计算机的状态信息。状态值是枚举类型。要查看 TargetStatus,在 MATLAB 命令行窗口中输入:
tg.TargetStatus
ans =
struct with fields:
State: BUSY
Error: ''ModelStatus 属性可用于访问有关已加载的实时应用程序及相关模型的信息。状态值是枚举类型。要查看 ModelStatus,在 MATLAB 命令行窗口中输入:
tg.ModelStatus
ans =
struct with fields:
State: LOADED
Application: 'slrt_ex_osc_outport'
ModelName: 'slrt_ex_osc_outport'
Error: ''
LogLevel: "info"
PollingThreshold: 1.0000e-04
FileLogMaxRuns: 1
OverrideBaseRatePeriod: 0
StopTime: 10
ExecTime: 0
TETInfo: [1×1 struct]版本历史记录
在 R2020b 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)