Main Content

autosar.slrealtime.migrateModel

Migrate AUTOSAR component models to Simulink Real-Time for rapid-prototyping and real-time simulation

Since R2024b

    Description

    slrtModelName = autosar.slrealtime.migrateModel(autosarModel,outputDirectory,Name=Value) create a Simulink® Real-Time™ copy of autosarModel deployed in a test harness, and saved in a specified location, outputDirectory.

    This function supports only AUTOSAR Blockset Classic platform component models.

    For more information regarding rapid-prototyping and simulation for AUTOSAR Adaptive models, see Configure AUTOSAR Adaptive Model for External Mode Simulation.

    example

    Examples

    collapse all

    To migrate an AUTOSAR Classic component model to Simulink Real-Time use the autosar.slrealtime.migrateModel function which creates a Simulink Real-Time model and test harness.

    Open the AUTOSAR example model autosar_swc_throttle_sensor.slx.

    modelName = 'autosar_swc_throttle_sensor';
    openExample(modelName);

    Create an AUTOSAR-compliant Simulink Real-Time copy of autosar_swc_throttle_sensor.slx and deploy it in a test harness.

    mySLRTModel = autosar.slrealtime.migrateModel(modelName,...
                  'SLRTOutputDir',HarnessModelName = "SLRTAUTOSAR",...
                   OpenFlag = true)
    Validating AUTOSAR model "autosar_swc_throttle_sensor" for migration to Simulink Real-Time.
    Copying model "autosar_swc_throttle_sensor" and preparing for Simulink Real-Time.
    Model "autosar_swc_throttle_sensor" successfully prepared for a Simulink Real-Time environment.
    Creating a new test harness for model "autosar_swc_throttle_sensor_slrt".
    
    mySLRTModel =
    
        'autosar_swc_throttle_sensor_slrt'

    The test harness of the model opens.

    Test harness for Simulink Real-Time compliant AUTOSAR model.

    The model and supporting files are saved in SLRTOutputDir, and can be used in Simulink Real-Time workflows. For more information regarding Simulink Real-Time, see Simulink Real-Time Workflows and Licensing (Simulink Real-Time).

    Input Arguments

    collapse all

    Name of AUTOSAR Classic platform component model, specified as a character vector or string scalar.

    Example: autosar.slrealtime.migrateModel("myAUTOSARModel","/SLRTOutput")

    File path of the directory to save the Simulink Real-Time model and test harness, specified as a string scalar or character vector.

    Example: 'C:/Work/SLRTOutputDirectory'

    Example: 'SLRTOutputDirectory'

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: openFlag = true opens the generated test harness upon completion of the migration process to Simulink Real-Time.

    Name of the generated test harness containing the Simulink Real-Time model, specified as a string scalar or character vector. If this name-value argument is not specified then the name of the test harness model defaults to the name of the original AUTOSAR model appending _harness. For example, if the name of the model represented by autosarModel is myAUTOSARModel then the name of the generated test harness defaults to myAUTOSARModel_harness.

    Example: autosar.slrealtime.migrateModel(modelName,'/Output',testHarnessName = "myHarness")

    Example: 'mySLRTAUTOSARHarness'

    Example: 'autosarSWC_harness'

    Data Types: character vector | string

    Option to open the Simulink test harness upon finishing the migration, specified as either true or false. The generated test harness model is loaded into memory regardless of the setting of OpenFlag.

    Example: autosar.slrealtime.migrateModel(myModel,"/OutputDirectory",myHarness,openHarnessModel = true)

    Data Types: logical

    Output Arguments

    collapse all

    Name of the generated AUTOSAR-compliant Simulink Real-Time copy of the original AUTOSAR model, specified as a character vector. The name of the generated model defaults to the name of the original AUTOSAR model appending _slrt.

    For example, if the name of autosarModel is myAUTOSARModel then the name of the generated Simulink Real-Time model defaults to myAUTOSARModel_slrt.

    This generated model uses a rate-based modeling style, regardless of the modeling style of the original AUTOSAR model. Algorithmically the models remain the same.

    Limitations

    • Export function AUTOSAR models with global Simulink functions are not supported.

    • Simulink does not support Data Store Memory blocks that are accessed by multiple functions that have different rates, which may impact some Basic Software workflows.

    • Models that have an AUTOSAR Adaptive platform are not supported.

    More About

    collapse all

    Workflow Considerations

    1. All original AUTOSAR models and supporting files, including Simulink data dictionaries, are copied and configured for Simulink Real-Time. Changes made to these generated files are not automatically applied to the original AUTOSAR models and supporting files. Changes to the Simulink Real-Time models as a result of parameter tuning and rapid-prototyping need to be monitored and applied to the original AUTOSAR models manually.

      The main changes to parameters of AUTOSAR models to support Simulink Real-Time are in the following table.

      Note

      This is not a complete list and may change based on your specific AUTOSAR configuration.

      ParameterInitial Parameter ValueParameter Value After Migration to Simulink Real-TimeImpacted Models
      System target file (Simulink Coder)autosar.tlc'slrealtime.tlc' | 'speedgoat.tlc'Applies to both generated test harness and referenced models
      Generate code only (Simulink Coder)'on' | 'off''off'Applies to both generated test harness and referenced models
      Multitask data transfer'warning' | 'error''error'Applies to both generated test harness and referenced models
      Allow tasks to execute concurrently on target'on' | 'off''on'Applies to both generated test harness and referenced models
      Maximum identifier length (Simulink Coder)'31' | integer between '30' and '256''127'Applies to both generated test harness and referenced models
      Use bitsets for storing state configuration (Simulink Coder)'on' | 'off''off'Applies to both generated test harness and referenced models
      Use bitsets for storing Boolean data (Simulink Coder)'on' | 'off''off'Applies to both generated test harness and referenced models
      Total number of instances allowed per top model'Multi' | 'Zero' | 'Single''Single'Only applies to the top model in a hierarchy.
      Automatically handle rate transition for data transfer'on' | 'off''off'Only applies to AUTOSAR models that use an export-function modeling style.
    2. Any base workspace parameters, configuration sets, and model workspace parameters that are referenced by the model are copied and moved into data dictionaries upon migration of the model to Simulink Real-Time.

      Note

      Enumerated data types that are referenced in opened models or by parameters present in the base workspace can not be migrated to data dictionaries. You can either remove the reference to the enumerated data types, or manually migrate all data referencing the enumerated data type to a data dictionary prior to beginning the migration process.

    3. All parameters in the created data dictionaries are treated as Architectural Data and can be configured in the Architectural Data section of the data dictionary files using the Architectural Data Editor.

    4. Any open models in the hierarchy will be closed during the migration.

    5. The migrator modifies export function AUTOSAR models to resemble a rate-based modeling style to accommodate Simulink Real-Time, but is algorithmically equivalent to the original export function model.

    Version History

    Introduced in R2024b