Main Content

crossReleaseImport

Import generated model code from a previous release as SIL or PIL blocks

Description

example

blockHandle = crossReleaseImport(buildFolder,configSetOrModel,'SimulationMode',mode) imports previously generated model component code into the current release. The function imports the code as a cross-release block and returns the numeric handle of the block. The function displays the block in a new model window.

In an existing model, you can replace the model component with the cross-release block.

If you set 'SimulationMode' to, for example, 'SIL' or 'PIL', the function imports the code as a software-in-the-loop (SIL) or processor-in-the-loop (PIL) block. When you run a simulation or build the model, the model component uses generated code from the previous release.

To build a SIL or PIL block, the function by default uses the following parameters of the Simulink® model specified by configSetOrModel:

  • SystemTargetFile

  • Toolchain or TemplateMakefile

  • ExistingSharedCode

  • PortableWordSizes

  • TargetLang

  • TargetLangStandard

  • TargetLibSuffix

  • ModelReferenceNumInstancesAllowed

  • Hardware Implementation pane parameters

If you set 'SimulationMode' to 'none', the function creates a Cross-Release Code Integration block, which:

  • Supports generation of code that calls the imported code.

  • Does not support normal, accelerator, or rapid accelerator mode simulations.

  • Does not compile the imported code.

You can use the Cross-Release Code Integration block, for example, in workflows where compilation occurs on a different computer.

blockHandle = crossReleaseImport(buildFolder,configSetOrModel,'SimulationMode',mode,'ConfigParams',additionalParameterList) uses additional configuration parameters for building the SIL or PIL block.

blockHandle = crossReleaseImport(buildFolder,configSetOrModel,'SimulationMode',mode,'DataDictionary',dictionaryFile) imports generated code that uses data types specified by a data dictionary. If configSetOrModel is a model associated with a data dictionary, you do not have to specify the name-value pair. By default, the function identifies and uses the data dictionary when it imports the generated code. If you specify a name-value pair, the data dictionary that you specify takes precedence over the default data dictionary.

blockHandle = crossReleaseImport(buildFolder,configSetOrModel,'SimulationMode',mode,'OriginalPaths',originalPaths,'ReplacementPaths',replacementPaths) imports generated model code with relocated custom code or modified include paths. The paths specified by replacementPaths override the original custom code or include paths specified by originalPaths in a one-to-one manner. You cannot use replacementPaths to specify additional custom code or include paths.

blockHandle = crossReleaseImport(buildFolder,configSetOrModel,'SimulationMode',mode,'SFunctionName',sFunctionName) names the generated SIL or PIL block sFunctionName_sil or sFunctionName_pil. Use the sFunctionName argument if the default block name produces associated MATLAB® identifiers that are longer than 63 characters.

Examples

collapse all

This example shows how to import generated model code from a previous release.

Specify the location of the build folder.

buildFolder = fullfile(pwd,'R2015bWork', 'folderPathForP1_ert_rtw');

Import code for the integration model Controller.

crossReleaseImport(buildFolder,'Controller','SimulationMode','SIL');

The function displays a SIL block in a new Simulink editor window.

Input Arguments

collapse all

Build folder that contains generated model component code from a previous release.

A configuration set or Simulink model on the MATLAB path.

Simulation mode for block with imported code:

  • 'SIL' — Create SIL block.

  • 'PIL' — Create PIL block.

  • {'SIL','PIL'} — Create SIL and PIL blocks.

  • 'none' — Create Cross-Release Code Integration block.

Additional parameters for building the SIL or PIL block.

Data dictionary that specifies data types used by the generated code.

Folder or include paths for original custom code. Must have a one-to-one correspondence with replacementPaths.

Folder or include paths for relocated custom code. Must have a one-to-one correspondence with originalPaths.

Specify name for SIL or PIL block that contains generated code from previous release. If the default block name produces associated MATLAB identifiers that are longer than 63 characters, use this argument to specify a shorter block name.

Output Arguments

collapse all

Numeric handle of a block. Returned as a double if mode is 'SIL' or 'PIL'. Returned as an array of doubles if mode is {'SIL','PIL'}.

Introduced in R2016b