This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Code Regeneration in Accelerated Models

Changing the structure of your model causes the Rapid Accelerator mode to regenerate the standalone executable, and for the Accelerator mode to regenerate the target code and update (overwrite) the existing MEX-file. Changing the value of a tunable parameter does not trigger a rebuild.

Determine If the Simulation Will Rebuild

The Accelerator and Rapid Accelerator modes use a checksum to determine if the model has changed, indicating that the code should be regenerated. The checksum is an array of four integers computed using an MD5 checksum algorithm based on attributes of the model and the blocks it contains.

  1. Use the Simulink.BlockDiagram.getChecksum command to obtain the checksum for your model. For example:

    cs1 = Simulink.BlockDiagram.getChecksum('myModel');

  2. Obtain a second checksum after you have altered your model. The code regenerates if the new checksum does not match the previous checksum.

  3. Use the information in the checksum to determine why the simulation target rebuilt.

For a detailed explanation of this procedure, see the example model slAccelDemoWhyRebuild.

Parameter Tuning in Rapid Accelerator Mode

In model rebuilds, Rapid Accelerator Mode handles block diagram and runtime parameters differently from other parameters.

Tuning Block Diagram Parameters

You can change some block diagram parameters during simulation without causing a rebuild. Tune these parameters using the set_param command or using the Model Configuration Parameters dialog box. These block diagram parameters include:

Tuning Runtime Parameters

To tune runtime parameters for maximum acceleration in Rapid Accelerator mode, follow this procedure which yields better results than using set_param for the same purpose:

  1. Collect the runtime parameters in a runtime parameter structure while building a rapid accelerator target executable using the Simulink.BlockDiagram.buildRapidAcceleratorTarget function.

  2. To change the parameters, use the Simulink.BlockDiagram.modifyTunableParameters function.

  3. To specify the modified parameters to the sim command, use the RapidAcceleratorParameterSets and RapidAcceleratorUpToDateCheck parameters.

All other parameter changes can necessitate a rebuild of the model.

Parameter Changes:Passed Directly to sim commandPassed Graphically via Block Diagram or via set_param command
RuntimeDoes not require rebuild Can require rebuild
Block diagram (logging parameters)Does not require rebuild Does not require rebuild

Related Examples

More About

Was this topic helpful?