Main Content

rtw.connectivity.Config

Define connectivity implementation that comprises builder, launcher, and communicator components

Description

Thertw.connectivity.Configclass specifies the actions required for running a processor-in-the-loop (PIL) simulation.

Creation

Description

example

rtw.connectivity.Config(componentArgs, builder, launcher, communicator)creates anrtw.connectivity.Configobject with these arguments:

  • componentArgsrtw.connectivity.ComponentArgsobject

  • builderrtw.connectivity.Builderobject, for example,rtw.connectivity.MakefileBuilderobject.

  • launcherrtw.connectivity.Launcherobject

  • communicatorrtw.connectivity.Communicator, for example,rtw.connectivity.RtIOStreamHostCommunicatorobject.

To define a connectivity implementation:

  1. Create a subclass ofrtw.connectivity.Configthat creates instances of your connectivity component classes:

    • rtw.connectivity.MakefileBuilder

    • rtw.connectivity.Launcher

    • rtw.connectivity.RtIOStreamHostCommunicator

  2. Define the constructor for your subclass:

    function this = myConfig(componentArgs)

    When the software creates an instance of your subclass ofrtw.connectivity.Config, it provides an instance of thertw.connectivity.ComponentArgsclass as the only constructor argument. If you want to test your subclass ofrtw.connectivity.Configmanually, you can create anrtw.connectivity.ComponentArgsobject to pass as a constructor argument.

  3. After instantiating the builder, launcher and communicator objects in your subclass, call the constructor of the superclassrtw.connectivity.Configto define your complete target connectivity configuration. For example:

    this@rtw.connectivity.Config(componentArgs,... builder, launcher, communicator);
  4. Optionally, for execution-time profiling, use thesetTimermethod to register your hardware timer. For example, if you specified thetimer in a code replacement table, insert the following line:

    this.setTimer('myCrlTable')
    myCrlTable代码替换表的名称,must be in a location on the MATLAB®search path.

    You can also estimate and remove instrumentation overheads from execution-time measurements. For example:

    this.activateOverheadFiltering(true); this.runOverheadBenchmark(true); this.setOverheadBenchmarkSteps(50);

  5. Optionally, for stack usage profiling, use thesetStackDrivermethod to specify a driver implementation that obtains stack usage data from the target hardware. For example, if you usecoder.profile.StackDriverto create the objectstackUsageDriver, insert the following line:

    this.setStackDriver(stackUsageDriver)

Register your subclass name, for example,myPIL.ConnectivityConfigby using the classrtw.connectivity.ConfigRegistry. The PIL infrastructure instantiates your subclass as required. ThertwTargetInfo.mfile (for MATLAB) orsl_customization.mmechanism (for Simulink®) specifies a suitable connectivity configuration for use with a particular PIL component (and its configuration set). The subclass can also perform additional validation on construction. For example, you can use the component path returned by thegetComponentPathmethod of thecomponentArgsconstructor argument to query and validate parameters associated with the PIL component under test.

Examples

Usingrtw.connectivity.Configin PIL Connectivity

为例,展示了如何使用这个对象n setting up PIL connectivity, see:

Version History

Introduced in R2008b