Main Content

sschdl.updateRuntimeParameters

Generate updated tunable parameter data file for Simscape model

Since R2024a

    Description

    sschdl.updateRuntimeParameters(modelName,SSPPath,TPPath,dataFileName) generates an updated tunable run-time parameter data file for the specified model modelName. This allows you to update the parameter values in the generated HDL implementation model or SLRT model with a new set of parameters without rerunning the synthesis. Use this function after generating the HDL implementation model and associated data files through the Simscape HDL Workflow Advisor.

    The function generates a data file based on the parameter values set in the model modelName. Update parameter values in the model to the desired configuration before executing the function. The newly created data file in the working directory is saved as dataFileName.mat.

    You can then load the new data file dataFileName.mat in place of the original data file tunableParameters.mat from the generated sschdl folder to update your Simulink or SLRT model parameter values. Make sure that the desired file in the Simulink or SLRT model is updated. Open the Simulink or SLRT model. Then, on the Modeling tab, select Model Settings > Model Properties. On the Callbacks tab, in the Model callback pane, select InitFcn and replace the tunableParameter.mat file with the newly generated dataFileName.mat file.

    example

    Examples

    collapse all

    1. Open the two-phase DC-DC converter model at the MATLAB® command prompt.

    ModelName = 'sschdlexTwoPhaseDCDCConverterExample';
    open_system(ModelName)
    

    2. Open the Simscape HDL Workflow Advisor for the model and generate HDL implementation model.

    sschdladvisor(ModelName)
    

    To generate the HDL implementation model, right-click the Implementation model generation > Generate implementation model task, and then select Run to Selected Task from the context menu.

    After the task passes, you see a link to the HDL implementation model gmStateSpaceHDL_sschdlexTwoPhaseDCDCConvert.

    3. Reopen the original Simscape™ model and update the run-time parameter values to the desired configuration.

    4. In the MATLAB Command Window, run the sschdl.updateRuntimeParameters function:

    sschdl.updateRuntimeParameters('sschdlexTwoPhaseDCDCConverterExample',...
    'sschdl\sschdlexTwoPhaseDCDCConverterExample\stateSpaceParameters',...
    'sschdl\sschdlexTwoPhaseDCDCConverterExample\tunableParameters', 'myTunableParams');
    

    This function generates a new data file in the working directory with the filename myTunableParams.mat.

    Input Arguments

    collapse all

    Simscape model name, specified as a character vector or string scalar. In this model, you set the parameter values to the desired values to extract updated parameter data.

    Example: 'sschdlexTwoPhaseDCDCConverterExample'

    Data Types: char | string

    State-space parameter data file path, specified as a character vector or string scalar. This file is created in the sschdl folder while generating the HDL implementation model.

    Example: 'C:\Users\username\TuneParam\sschdl\sschdlexTwoPhaseDCDCConverterExample\stateSpaceParameters'

    Data Types: char | string

    Tunable parameter data file path, specified as a character vector or string scalar. This file is created in the sschdl folder while generating the HDL implementation model.

    Example: 'C:\Users\username\TuneParam\sschdl\sschdlexTwoPhaseDCDCConverterExample\tunableParameters'

    Data Types: char | string

    Name of new data file, specified as a character vector or string scalar. The new parameter data file is saved in the working directory with the specified filename.

    Example: 'myTunableParameter.mat'

    Data Types: char | string

    Limitations

    • This function supports parameter tuning of Simscape™ run-time parameter values or Simulink.Parameter objects. Functional changes to the model are not supported. If there is any functional change to the original Simscape model, MATLAB® encounters error and displays an error message.

    Version History

    Introduced in R2024a